GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / include / Common / Protocol.h
blobf41a28326fa5e68ad41d8533baf7492aef5d6186
1 /*
2 * Protocol.h
4 *Copyright (C) 2010 Beceem Communications, Inc.
6 *This program is free software: you can redistribute it and/or modify
7 *it under the terms of the GNU General Public License version 2 as
8 *published by the Free Software Foundation.
10 *This program is distributed in the hope that it will be useful,but
11 *WITHOUT ANY WARRANTY; without even the implied warranty of
12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *See the GNU General Public License for more details.
15 *You should have received a copy of the GNU General Public License
16 *along with this program. If not, write to the Free Software Foundation, Inc.,
17 *51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef __PROTOCOL_H__
23 #define __PROTOCOL_H__
26 #define IPV4 4
27 #define IPV6 6
30 struct ArpHeader {
31 struct arphdr arp;
32 unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
33 unsigned char ar_sip[4]; /* sender IP address */
34 unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
35 unsigned char ar_tip[4]; /* target IP address */
36 }/*__attribute__((packed))*/;
39 struct TransportHeaderT
41 union
43 struct udphdr uhdr;
44 struct tcphdr thdr;
46 } __attribute__((packed));
47 typedef struct TransportHeaderT xporthdr;
50 typedef enum _E_NWPKT_IPFRAME_TYPE
52 eNonIPPacket,
53 eIPv4Packet,
54 eIPv6Packet
55 }E_NWPKT_IPFRAME_TYPE;
57 typedef enum _E_NWPKT_ETHFRAME_TYPE
59 eEthUnsupportedFrame,
60 eEth802LLCFrame,
61 eEth802LLCSNAPFrame,
62 eEth802QVLANFrame,
63 eEthOtherFrame
64 } E_NWPKT_ETHFRAME_TYPE;
66 typedef struct _S_ETHCS_PKT_INFO
68 E_NWPKT_IPFRAME_TYPE eNwpktIPFrameType;
69 E_NWPKT_ETHFRAME_TYPE eNwpktEthFrameType;
70 USHORT usEtherType;
71 UCHAR ucDSAP;
72 }S_ETHCS_PKT_INFO,*PS_ETHCS_PKT_INFO;
74 typedef struct _ETH_CS_802_Q_FRAME
76 ETH_HEADER_STRUC EThHdr;
77 USHORT UserPriority:3;
78 USHORT CFI:1;
79 USHORT VLANID:12;
80 USHORT EthType;
81 } __attribute__((packed)) ETH_CS_802_Q_FRAME;
83 typedef struct _ETH_CS_802_LLC_FRAME
85 ETH_HEADER_STRUC EThHdr;
86 unsigned char DSAP;
87 unsigned char SSAP;
88 unsigned char Control;
89 }__attribute__((packed)) ETH_CS_802_LLC_FRAME;
91 typedef struct _ETH_CS_802_LLC_SNAP_FRAME
93 ETH_HEADER_STRUC EThHdr;
94 unsigned char DSAP;
95 unsigned char SSAP;
96 unsigned char Control;
97 unsigned char OUI[3];
98 unsigned short usEtherType;
99 } __attribute__((packed)) ETH_CS_802_LLC_SNAP_FRAME;
101 typedef struct _ETH_CS_ETH2_FRAME
103 ETH_HEADER_STRUC EThHdr;
104 } __attribute__((packed)) ETH_CS_ETH2_FRAME;
107 #define ETHERNET_FRAMETYPE_IPV4 ntohs(0x0800)
108 #define ETHERNET_FRAMETYPE_IPV6 ntohs(0x86dd)
109 #define ETHERNET_FRAMETYPE_802QVLAN 0x8100
110 //Per SF CS Specification Encodings
111 typedef enum _E_SERVICEFLOW_CS_SPEC_
113 eCSSpecUnspecified =0,
114 eCSPacketIPV4,
115 eCSPacketIPV6,
116 eCS802_3PacketEthernet,
117 eCS802_1QPacketVLAN,
118 eCSPacketIPV4Over802_3Ethernet,
119 eCSPacketIPV6Over802_3Ethernet,
120 eCSPacketIPV4Over802_1QVLAN,
121 eCSPacketIPV6Over802_1QVLAN,
122 eCSPacketUnsupported
123 }E_SERVICEFLOW_CS_SPEC;
126 #define IP6_HEADER_LEN 40
128 #define IP_VERSION(byte) (((byte&0xF0)>>4))
132 #define MAC_ADDRESS_SIZE 6
133 #define ETH_AND_IP_HEADER_LEN 14 + 20
134 #define L4_SRC_PORT_LEN 2
135 #define L4_DEST_PORT_LEN 2
139 #define CTRL_PKT_LEN 8 + ETH_AND_IP_HEADER_LEN
141 #define ETH_ARP_FRAME 0x806
142 #define ETH_IPV4_FRAME 0x800
143 #define ETH_IPV6_FRAME 0x86DD
144 #define UDP 0x11
145 #define TCP 0x06
147 #define ARP_OP_REQUEST 0x01
148 #define ARP_OP_REPLY 0x02
149 #define ARP_PKT_SIZE 60
151 // This is the format for the TCP packet header
152 typedef struct _TCP_HEADER
154 USHORT usSrcPort;
155 USHORT usDestPort;
156 ULONG ulSeqNumber;
157 ULONG ulAckNumber;
158 UCHAR HeaderLength;
159 UCHAR ucFlags;
160 USHORT usWindowsSize;
161 USHORT usChkSum;
162 USHORT usUrgetPtr;
163 } TCP_HEADER,*PTCP_HEADER;
164 #define TCP_HEADER_LEN sizeof(TCP_HEADER)
165 #define TCP_ACK 0x10 //Bit 4 in tcpflags field.
166 #define GET_TCP_HEADER_LEN(byte) ((byte&0xF0)>>4)
169 #endif //__PROTOCOL_H__