i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / staging / bcm / Protocol.h
blobb8a4009bdf0cb74568ce20321cdc92db078b4a27
1 /************************************
2 * Protocol.h
3 *************************************/
4 #ifndef __PROTOCOL_H__
5 #define __PROTOCOL_H__
8 #define IPV4 4
9 #define IPV6 6
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))*/;
21 struct TransportHeaderT
23 union
25 struct udphdr uhdr;
26 struct tcphdr thdr;
28 } __attribute__((packed));
29 typedef struct TransportHeaderT xporthdr;
32 typedef enum _E_NWPKT_IPFRAME_TYPE
34 eNonIPPacket,
35 eIPv4Packet,
36 eIPv6Packet
37 }E_NWPKT_IPFRAME_TYPE;
39 typedef enum _E_NWPKT_ETHFRAME_TYPE
41 eEthUnsupportedFrame,
42 eEth802LLCFrame,
43 eEth802LLCSNAPFrame,
44 eEth802QVLANFrame,
45 eEthOtherFrame
46 } E_NWPKT_ETHFRAME_TYPE;
48 typedef struct _S_ETHCS_PKT_INFO
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;
56 typedef struct _ETH_CS_802_Q_FRAME
58 ETH_HEADER_STRUC EThHdr;
59 USHORT UserPriority:3;
60 USHORT CFI:1;
61 USHORT VLANID:12;
62 USHORT EthType;
63 } __attribute__((packed)) ETH_CS_802_Q_FRAME;
65 typedef struct _ETH_CS_802_LLC_FRAME
67 ETH_HEADER_STRUC EThHdr;
68 unsigned char DSAP;
69 unsigned char SSAP;
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;
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;
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,
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;
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
126 #define UDP 0x11
127 #define TCP 0x06
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
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)
151 #endif //__PROTOCOL_H__