1 #ifndef _IPV6_PROTOCOL_DEFINES_
2 #define _IPV6_PROTOCOL_DEFINES_
3 
4 
5 #define IPV6HDR_TYPE_HOPBYHOP 0x0
6 #define IPV6HDR_TYPE_ROUTING 0x2B
7 #define IPV6HDR_TYPE_FRAGMENTATION 0x2C
8 #define IPV6HDR_TYPE_DESTOPTS 0x3c
9 #define IPV6HDR_TYPE_AUTHENTICATION 0x33
10 #define IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD 0x34
11 #define MASK_IPV6_CS_SPEC 0x2
12 
13 
14 #define TCP_HEADER_TYPE 0x6
15 #define UDP_HEADER_TYPE 0x11
16 #define IPV6_ICMP_HDR_TYPE 0x2
17 #define IPV6_FLOWLABEL_BITOFFSET 9
18 
19 #define IPV6_MAX_CHAINEDHDR_BUFFBYTES 0x64
20 /*
21 // Size of Dest Options field of Destinations Options Header
22 // in bytes.
23 */
24 #define IPV6_DESTOPTS_HDR_OPTIONSIZE 0x8
25 
26 //typedef  unsigned char UCHAR;
27 //typedef  unsigned short USHORT;
28 //typedef  unsigned long int ULONG;
29 
30 typedef struct IPV6HeaderFormatTag
31 {
32 	UCHAR  ucVersionPrio;
33 	UCHAR  aucFlowLabel[3];
34 	USHORT usPayloadLength;
35 	UCHAR  ucNextHeader;
36 	UCHAR  ucHopLimit;
37 	ULONG  ulSrcIpAddress[4];
38 	ULONG  ulDestIpAddress[4];
39 }IPV6Header;
40 
41 typedef struct IPV6RoutingHeaderFormatTag
42 {
43 	UCHAR ucNextHeader;
44 	UCHAR ucRoutingType;
45 	UCHAR ucNumAddresses;
46 	UCHAR ucNextAddress;
47 	ULONG ulReserved;
48 	//UCHAR aucAddressList[0];
49 
50 }IPV6RoutingHeader;
51 
52 typedef struct IPV6FragmentHeaderFormatTag
53 {
54 	UCHAR ucNextHeader;
55 	UCHAR ucReserved;
56 	USHORT usFragmentOffset;
57 	ULONG  ulIdentification;
58 }IPV6FragmentHeader;
59 
60 typedef struct IPV6DestOptionsHeaderFormatTag
61 {
62 	UCHAR ucNextHeader;
63 	UCHAR ucHdrExtLen;
64 	UCHAR ucDestOptions[6];
65 	//UCHAR udExtDestOptions[0];
66 }IPV6DestOptionsHeader;
67 
68 typedef struct IPV6HopByHopOptionsHeaderFormatTag
69 {
70 	UCHAR ucNextHeader;
71 	UCHAR ucMisc[3];
72 	ULONG ulJumboPayloadLen;
73 }IPV6HopByHopOptionsHeader;
74 
75 typedef struct IPV6AuthenticationHeaderFormatTag
76 {
77 	UCHAR ucNextHeader;
78 	UCHAR ucLength;
79 	USHORT usReserved;
80 	ULONG  ulSecurityParametersIndex;
81 	//UCHAR  ucAuthenticationData[0];
82 
83 }IPV6AuthenticationHeader;
84 
85 typedef struct IPV6IcmpHeaderFormatTag
86 {
87 	UCHAR ucType;
88 	UCHAR ucCode;
89 	USHORT usChecksum;
90 	//UCHAR  ucIcmpMsg[0];
91 
92 }IPV6IcmpHeader;
93 
94 typedef enum _E_IPADDR_CONTEXT
95 {
96 	eSrcIpAddress,
97 	eDestIpAddress
98 
99 }E_IPADDR_CONTEXT;
100 
101 
102 
103 //Function Prototypes
104 
105 USHORT	IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control structure */
106 					PVOID pcIpHeader, /**<Pointer to the IP Hdr of the packet*/
107 					S_CLASSIFIER_RULE *pstClassifierRule );
108 
109 VOID DumpIpv6Address(ULONG *puIpv6Address);
110 
111 extern BOOLEAN MatchSrcPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushSrcPort);
112 extern BOOLEAN MatchDestPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushSrcPort);
113 extern BOOLEAN MatchProtocol(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucProtocol);
114 
115 
116 #endif
117