[Winpcap-users] question regarding retrieving ip_len

Vasily Borovyak vbor at isd.dp.ua
Wed Jul 5 14:14:22 GMT 2006


Because the length represents not amount if bytes (octets)
but amount of WORDs (32bit or 4 bytes).

That's why we should multiply by 4 to get actual amount of bytes.

Read rfc791 to get full information about ip header.


ahsan askari wrote:
> Could anybody please tell me what this piece of code will do
>
> ip_len = (ih->ver_ihl & 0xf) * 4;
>
> I know that we are "anding" ver_ihl to make all the bits equal to 1 
> but why are we multiplying it by 4.
>
> Thank you
> ------------------------------------------------------------------------
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>   

-- 
Best regards. Vasily Borovyak <vbor at isd.dp.ua>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20060705/647c5158/attachment.htm


More information about the Winpcap-users mailing list