IPv6ProtocolHdr.h 2.5 KB

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