21,597
社区成员
发帖
与我相关
我的任务
分享
typedef union
{
Uint8 Bytes[6];
Uint16 Words[3];
}MacAddr;
// Ethernet Header
#define ETHHDR_SIZE 14
typedef struct{
MacAddr DstMac;
MacAddr SrcMac;
Uint16 Type;
} EthHdr, *PEthHdr;
// IP HEADER
#define IPHDR_SIZE 20
typedef struct{
Uint8 VerLen; /*version and head length*/
Uint8 TypeOfService; /*Type of Service*/
Uint16 PacketLen; /*Packet Length*/
Uint16 Sequence; /*Sequence number*/
Uint16 MarkFragPoi; /*FlagOff*/
Uint8 TTL; /*Time Life*/
Uint8 ProtocolType; /*byProtocolype*/
Uint16 HeadCheckSum; /*Check Sum*/
IPAddr IPSrc; /*Source IP*/
IPAddr IPDes; /*Destinate IP*/
Uint8 Options[1];
}IPHdr, *PIPHdr;
// UDP HEADER
#define UDPHDR_SIZE 8
typedef struct {
Uint16 SrcPort;
Uint16 DstPort;
Uint16 Length;
Uint16 UDPChecksum;
} UDPHdr;