Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
bcm
Protocol.h
Go to the documentation of this file.
1
/************************************
2
* Protocol.h
3
*************************************/
4
#ifndef __PROTOCOL_H__
5
#define __PROTOCOL_H__
6
7
8
#define IPV4 4
9
#define IPV6 6
10
11
12
struct
ArpHeader
{
13
struct
arphdr
arp
;
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))*/
;
19
20
21
struct
TransportHeaderT
22
{
23
union
24
{
25
struct
udphdr
uhdr
;
26
struct
tcphdr
thdr
;
27
};
28
}
__attribute__
((packed));
29
typedef
struct
TransportHeaderT
xporthdr
;
30
31
32
typedef
enum
_E_NWPKT_IPFRAME_TYPE
33
{
34
eNonIPPacket
,
35
eIPv4Packet
,
36
eIPv6Packet
37
}
E_NWPKT_IPFRAME_TYPE
;
38
39
typedef
enum
_E_NWPKT_ETHFRAME_TYPE
40
{
41
eEthUnsupportedFrame
,
42
eEth802LLCFrame
,
43
eEth802LLCSNAPFrame
,
44
eEth802QVLANFrame
,
45
eEthOtherFrame
46
}
E_NWPKT_ETHFRAME_TYPE
;
47
48
typedef
struct
_S_ETHCS_PKT_INFO
49
{
50
E_NWPKT_IPFRAME_TYPE
eNwpktIPFrameType
;
51
E_NWPKT_ETHFRAME_TYPE
eNwpktEthFrameType
;
52
USHORT
usEtherType
;
53
UCHAR
ucDSAP
;
54
}
S_ETHCS_PKT_INFO
,*
PS_ETHCS_PKT_INFO
;
55
56
typedef
struct
_ETH_CS_802_Q_FRAME
57
{
58
struct
bcm_eth_header
EThHdr
;
59
USHORT
UserPriority
:3;
60
USHORT
CFI
:1;
61
USHORT
VLANID
:12;
62
USHORT
EthType
;
63
}
__attribute__
((packed)) ETH_CS_802_Q_FRAME;
64
65
typedef
struct
_ETH_CS_802_LLC_FRAME
66
{
67
struct
bcm_eth_header
EThHdr
;
68
unsigned
char
DSAP
;
69
unsigned
char
SSAP
;
70
unsigned
char
Control
;
71
}
__attribute__
((packed)) ETH_CS_802_LLC_FRAME;
72
73
typedef
struct
_ETH_CS_802_LLC_SNAP_FRAME
74
{
75
struct
bcm_eth_header
EThHdr
;
76
unsigned
char
DSAP
;
77
unsigned
char
SSAP
;
78
unsigned
char
Control
;
79
unsigned
char
OUI
[3];
80
unsigned
short
usEtherType
;
81
}
__attribute__
((packed)) ETH_CS_802_LLC_SNAP_FRAME;
82
83
typedef
struct
_ETH_CS_ETH2_FRAME
84
{
85
struct
bcm_eth_header
EThHdr
;
86
}
__attribute__
((packed)) ETH_CS_ETH2_FRAME;
87
88
#define ETHERNET_FRAMETYPE_IPV4 ntohs(0x0800)
89
#define ETHERNET_FRAMETYPE_IPV6 ntohs(0x86dd)
90
#define ETHERNET_FRAMETYPE_802QVLAN ntohs(0x8100)
91
92
//Per SF CS Specification Encodings
93
typedef
enum
_E_SERVICEFLOW_CS_SPEC_
94
{
95
eCSSpecUnspecified
=0,
96
eCSPacketIPV4
,
97
eCSPacketIPV6
,
98
eCS802_3PacketEthernet
,
99
eCS802_1QPacketVLAN
,
100
eCSPacketIPV4Over802_3Ethernet
,
101
eCSPacketIPV6Over802_3Ethernet
,
102
eCSPacketIPV4Over802_1QVLAN
,
103
eCSPacketIPV6Over802_1QVLAN
,
104
eCSPacketUnsupported
105
}
E_SERVICEFLOW_CS_SPEC
;
106
107
108
#define IP6_HEADER_LEN 40
109
110
#define IP_VERSION(byte) (((byte&0xF0)>>4))
111
112
113
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
118
119
120
121
#define CTRL_PKT_LEN 8 + ETH_AND_IP_HEADER_LEN
122
123
#define ETH_ARP_FRAME 0x806
124
#define ETH_IPV4_FRAME 0x800
125
#define ETH_IPV6_FRAME 0x86DD
126
#define UDP 0x11
127
#define TCP 0x06
128
129
#define ARP_OP_REQUEST 0x01
130
#define ARP_OP_REPLY 0x02
131
#define ARP_PKT_SIZE 60
132
133
// This is the format for the TCP packet header
134
typedef
struct
_TCP_HEADER
135
{
136
USHORT
usSrcPort
;
137
USHORT
usDestPort
;
138
ULONG
ulSeqNumber
;
139
ULONG
ulAckNumber
;
140
UCHAR
HeaderLength
;
141
UCHAR
ucFlags
;
142
USHORT
usWindowsSize
;
143
USHORT
usChkSum
;
144
USHORT
usUrgetPtr
;
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)
149
150
151
#endif //__PROTOCOL_H__
Generated on Thu Jan 10 2013 14:26:00 for Linux Kernel by
1.8.2