假设我有一些复杂的结构
struct icmphdr
{
u_int8_t type;
u_int8_t code;
u_int16_t checksum;
/* Parts of the packet below don’t have to appear */
union
{
struct
{
u_int16_t id;
u_int16_t sequence;
// Type of ICMP message
// Packet code
// Datagram checksum
} echo;
u_int32_t gateway;
struct
{
u_int16_t __unused;
u_int16_t mtu;
} frag;
} un;
};
和一个
char buf[SIZE];//for some integer SIZE
这个演员表的意义和兴趣是什么?
ip=(struct icmphdr*)buf; //ip was formerly defined as some struct iphdr *ip;