1 /************************************
3 *************************************/
14 unsigned char ar_sha
[ETH_ALEN
]; /* sender hardware address */
15 unsigned char ar_sip
[4]; /* sender IP address */
16 unsigned char ar_tha
[ETH_ALEN
]; /* target hardware address */
17 unsigned char ar_tip
[4]; /* target IP address */
18 }/*__attribute__((packed))*/;
21 struct TransportHeaderT
28 } __attribute__((packed
));
29 typedef struct TransportHeaderT xporthdr
;
32 typedef enum _E_NWPKT_IPFRAME_TYPE
37 }E_NWPKT_IPFRAME_TYPE
;
39 typedef enum _E_NWPKT_ETHFRAME_TYPE
46 } E_NWPKT_ETHFRAME_TYPE
;
48 typedef struct _S_ETHCS_PKT_INFO
50 E_NWPKT_IPFRAME_TYPE eNwpktIPFrameType
;
51 E_NWPKT_ETHFRAME_TYPE eNwpktEthFrameType
;
54 }S_ETHCS_PKT_INFO
,*PS_ETHCS_PKT_INFO
;
56 typedef struct _ETH_CS_802_Q_FRAME
58 ETH_HEADER_STRUC EThHdr
;
59 USHORT UserPriority
:3;
63 } __attribute__((packed
)) ETH_CS_802_Q_FRAME
;
65 typedef struct _ETH_CS_802_LLC_FRAME
67 ETH_HEADER_STRUC EThHdr
;
70 unsigned char Control
;
71 }__attribute__((packed
)) ETH_CS_802_LLC_FRAME
;
73 typedef struct _ETH_CS_802_LLC_SNAP_FRAME
75 ETH_HEADER_STRUC EThHdr
;
78 unsigned char Control
;
80 unsigned short usEtherType
;
81 } __attribute__((packed
)) ETH_CS_802_LLC_SNAP_FRAME
;
83 typedef struct _ETH_CS_ETH2_FRAME
85 ETH_HEADER_STRUC EThHdr
;
86 } __attribute__((packed
)) ETH_CS_ETH2_FRAME
;
88 #define ETHERNET_FRAMETYPE_IPV4 ntohs(0x0800)
89 #define ETHERNET_FRAMETYPE_IPV6 ntohs(0x86dd)
90 #define ETHERNET_FRAMETYPE_802QVLAN ntohs(0x8100)
92 //Per SF CS Specification Encodings
93 typedef enum _E_SERVICEFLOW_CS_SPEC_
95 eCSSpecUnspecified
=0,
98 eCS802_3PacketEthernet
,
100 eCSPacketIPV4Over802_3Ethernet
,
101 eCSPacketIPV6Over802_3Ethernet
,
102 eCSPacketIPV4Over802_1QVLAN
,
103 eCSPacketIPV6Over802_1QVLAN
,
105 }E_SERVICEFLOW_CS_SPEC
;
108 #define IP6_HEADER_LEN 40
110 #define IP_VERSION(byte) (((byte&0xF0)>>4))
114 #define MAC_ADDRESS_SIZE 6
115 #define ETH_AND_IP_HEADER_LEN 14 + 20
116 #define L4_SRC_PORT_LEN 2
117 #define L4_DEST_PORT_LEN 2
121 #define CTRL_PKT_LEN 8 + ETH_AND_IP_HEADER_LEN
123 #define ETH_ARP_FRAME 0x806
124 #define ETH_IPV4_FRAME 0x800
125 #define ETH_IPV6_FRAME 0x86DD
129 #define ARP_OP_REQUEST 0x01
130 #define ARP_OP_REPLY 0x02
131 #define ARP_PKT_SIZE 60
133 // This is the format for the TCP packet header
134 typedef struct _TCP_HEADER
142 USHORT usWindowsSize
;
145 } TCP_HEADER
,*PTCP_HEADER
;
146 #define TCP_HEADER_LEN sizeof(TCP_HEADER)
147 #define TCP_ACK 0x10 //Bit 4 in tcpflags field.
148 #define GET_TCP_HEADER_LEN(byte) ((byte&0xF0)>>4)
151 #endif //__PROTOCOL_H__