Lan Qing wrote:
hello, I read the fllowing words in the c header file <netinet/in.h>
I.e., the header that came with your OS, not the header that comes with tcpdump?
/* Internet address. */ typedef uint32_t in_addr_t; struct in_addr { in_addr_t s_addr; };" the struct in_addr have only one variable in it, is there any necessary to define a struct like that? why not use "typedef in_addr_t in_addr;" directly?
In BSD, it was originally a union that also included arrays of bytes so that code could look at the bytes, for dealing with class A, B, and C Internet addresses - as the comment in OS X, and other BSDs, says, it's "a structure for historical reasons", because code depended on there being an "s_addr" member (which was one of the members of the union).
- This is the tcpdump-workers list. Visit https://lists.sandelman.ca/ to unsubscribe.