Re: another question on skbuff.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 03 June 2004 11:16, bunty  wrote:
> i want to know what is stored in unsigned char *raw and why it
> included in each union? also what is the purpose of these unions in
> skbuff.h for each protocol layer? IS they represent state at that
> layer or no. of protocol headers added at that layer?

The pointers in the h, nh, and raw unions are used to point to the 
relevant headers within the skbuff's data.  The 'raw' members are
usefull to avoid casts when doing certain pointer arithmitic or for use 
when you don't care what type of header it is refering to.

e.g.

skb->h.raw = skb->nh.raw + skb->nh.iph->ihl * 4;
if (skb->nh.iph->protocol == IPPROTO_TCP)
	do_something_with_tcp(skb->h.th);



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux