Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
struct sk_buff **skb,<br />
const struct net_device *in,<br />
const struct net_device *out,<br />
int (*okfn)(struct sk_buff *));<br />
Vamos por partes como diria Jack estripador, agora acredito que vc tenha<br />
pensado o que é este tal de skb??<br />
Ele é um ponteiro para uma estrutura que representa nada mais nada<br />
menos do que um pacote no níel do kernel, o driver da nossa placa de<br />
rede nos entrega estes pacotes neste formato podemos encontrar sua<br />
declaração e seus membros em ~/linux/sk_buff.h, ele é um nó dentro de<br />
uma lista encadeada, digo para os programadores ruins como eu: "muita<br />
calma nesta hora", não tenham medo, não vamos manipular esta lista<br />
encadeada, pelo menos não neste artigo hehehehe.<br />
Vamos dar uma olhada num pedaço deste bicho de 7 cabeças:<br />
struct sk_buff {<br />
/* These two members must be first. */<br />
struct sk_buff * next; /* Next buffer in list<br />
*/<br />
struct sk_buff * prev; /* Previous buffer in<br />
list */<br />
struct sk_buff_head * list; /* List we are on<br />
*/<br />
struct sock *sk; /* Socket we are owned by<br />
*/<br />
struct timeval stamp; /* Time we arrived<br />
*/<br />
struct net_device *dev; /* Device we arrived on/are leaving<br />
by */<br />
struct net_device *real_dev; /* For support of point to point<br />
protocols<br />
(e.g. 802.3ad) over bonding, we<br />
must save the<br />
physical device that got the<br />
packet before<br />
replacing skb->dev with the<br />
virtual device. */<br />
112<br />
/* Transport layer header */<br />
union<br />
{<br />
struct tcphdr *th;<br />
struct udphdr *uh;<br />
struct icmphdr *icmph;<br />
struct igmphdr *igmph;<br />
struct iphdr *ipiph;<br />
struct spxhdr *spxh;<br />
unsigned char *raw;<br />
} h;