hi
i downloaded a sniffer from the net. i could not understand the foll lines.
   ip=(struct iphdr *)(((unsigned long)&ep.ip)-2);<== (doubt)
   tcp=(struct tcphdr *)(((unsigned long)&ep.tcp)-2);
ep is a variable to the structure of this type
struct ethpkt {

     struct ethdhr eth;
     struct iphdr ip;
     struct tcphdr tcp;
};
the structure is read from the socket like this
x=read(s, (struct etherpacket *)&ep, sizeof(ep));

iam not able to understand why is that subtraction (-2)
i've built a code, using this as the base (without knowing, why this-2 
itself). i dont want to change the code. So please explain to me this. it 
would be of great help
thanks in advance
bye
rajesh balan


NOTE :
1 -  the code i've written over this is working well.
2 -  iam sending the code as an attachment(sniffer.c)

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to