Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1 | #ifndef _IPV6_PROTOCOL_DEFINES_ |
| 2 | #define _IPV6_PROTOCOL_DEFINES_ |
| 3 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 4 | #define IPV6HDR_TYPE_HOPBYHOP 0x0 |
| 5 | #define IPV6HDR_TYPE_ROUTING 0x2B |
| 6 | #define IPV6HDR_TYPE_FRAGMENTATION 0x2C |
| 7 | #define IPV6HDR_TYPE_DESTOPTS 0x3c |
| 8 | #define IPV6HDR_TYPE_AUTHENTICATION 0x33 |
| 9 | #define IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD 0x34 |
| 10 | #define MASK_IPV6_CS_SPEC 0x2 |
| 11 | |
Kevin McKinney | d83beb8 | 2012-12-10 21:54:54 -0500 | [diff] [blame] | 12 | #define TCP_HEADER_TYPE 0x6 |
| 13 | #define UDP_HEADER_TYPE 0x11 |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 14 | #define IPV6_ICMP_HDR_TYPE 0x2 |
| 15 | #define IPV6_FLOWLABEL_BITOFFSET 9 |
| 16 | |
| 17 | #define IPV6_MAX_CHAINEDHDR_BUFFBYTES 0x64 |
| 18 | /* |
Kevin McKinney | 5cc3dea | 2012-12-10 21:54:55 -0500 | [diff] [blame] | 19 | * Size of Dest Options field of Destinations Options Header |
| 20 | * in bytes. |
| 21 | */ |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 22 | #define IPV6_DESTOPTS_HDR_OPTIONSIZE 0x8 |
| 23 | |
Kevin McKinney | 9d4cf71 | 2012-12-10 21:55:10 -0500 | [diff] [blame] | 24 | struct bcm_ipv6_hdr { |
Kevin McKinney | 67b587c | 2012-12-10 21:54:59 -0500 | [diff] [blame] | 25 | unsigned char ucVersionPrio; |
| 26 | unsigned char aucFlowLabel[3]; |
Kevin McKinney | 5ef43c3 | 2012-12-10 21:54:57 -0500 | [diff] [blame] | 27 | unsigned short usPayloadLength; |
Kevin McKinney | 67b587c | 2012-12-10 21:54:59 -0500 | [diff] [blame] | 28 | unsigned char ucNextHeader; |
| 29 | unsigned char ucHopLimit; |
Kevin McKinney | 828c1dd | 2012-12-10 21:54:58 -0500 | [diff] [blame] | 30 | unsigned long ulSrcIpAddress[4]; |
| 31 | unsigned long ulDestIpAddress[4]; |
Kevin McKinney | 9d4cf71 | 2012-12-10 21:55:10 -0500 | [diff] [blame] | 32 | }; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 33 | |
Kevin McKinney | 8f0652c | 2012-12-10 21:55:09 -0500 | [diff] [blame] | 34 | struct bcm_ipv6_routing_hdr { |
Kevin McKinney | 67b587c | 2012-12-10 21:54:59 -0500 | [diff] [blame] | 35 | unsigned char ucNextHeader; |
| 36 | unsigned char ucRoutingType; |
| 37 | unsigned char ucNumAddresses; |
| 38 | unsigned char ucNextAddress; |
Kevin McKinney | 828c1dd | 2012-12-10 21:54:58 -0500 | [diff] [blame] | 39 | unsigned long ulReserved; |
Kevin McKinney | 8f0652c | 2012-12-10 21:55:09 -0500 | [diff] [blame] | 40 | }; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 41 | |
Kevin McKinney | 17d7fd2 | 2012-12-10 21:55:08 -0500 | [diff] [blame] | 42 | struct bcm_ipv6_fragment_hdr { |
Kevin McKinney | 67b587c | 2012-12-10 21:54:59 -0500 | [diff] [blame] | 43 | unsigned char ucNextHeader; |
| 44 | unsigned char ucReserved; |
Kevin McKinney | 5ef43c3 | 2012-12-10 21:54:57 -0500 | [diff] [blame] | 45 | unsigned short usFragmentOffset; |
Kevin McKinney | 828c1dd | 2012-12-10 21:54:58 -0500 | [diff] [blame] | 46 | unsigned long ulIdentification; |
Kevin McKinney | 17d7fd2 | 2012-12-10 21:55:08 -0500 | [diff] [blame] | 47 | }; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 48 | |
Kevin McKinney | d69438d | 2012-12-10 21:55:07 -0500 | [diff] [blame] | 49 | struct bcm_ipv6_dest_options_hdr { |
Kevin McKinney | 67b587c | 2012-12-10 21:54:59 -0500 | [diff] [blame] | 50 | unsigned char ucNextHeader; |
| 51 | unsigned char ucHdrExtLen; |
| 52 | unsigned char ucDestOptions[6]; |
Kevin McKinney | d69438d | 2012-12-10 21:55:07 -0500 | [diff] [blame] | 53 | }; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 54 | |
Kevin McKinney | bc25b75 | 2012-12-10 21:55:06 -0500 | [diff] [blame] | 55 | struct bcm_ipv6_options_hdr { |
Kevin McKinney | 67b587c | 2012-12-10 21:54:59 -0500 | [diff] [blame] | 56 | unsigned char ucNextHeader; |
| 57 | unsigned char ucMisc[3]; |
Kevin McKinney | 828c1dd | 2012-12-10 21:54:58 -0500 | [diff] [blame] | 58 | unsigned long ulJumboPayloadLen; |
Kevin McKinney | bc25b75 | 2012-12-10 21:55:06 -0500 | [diff] [blame] | 59 | }; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 60 | |
Kevin McKinney | 5601bb9 | 2012-12-10 21:55:05 -0500 | [diff] [blame] | 61 | struct bcm_ipv6_authentication_hdr { |
Kevin McKinney | 67b587c | 2012-12-10 21:54:59 -0500 | [diff] [blame] | 62 | unsigned char ucNextHeader; |
| 63 | unsigned char ucLength; |
Kevin McKinney | 5ef43c3 | 2012-12-10 21:54:57 -0500 | [diff] [blame] | 64 | unsigned short usReserved; |
Kevin McKinney | 828c1dd | 2012-12-10 21:54:58 -0500 | [diff] [blame] | 65 | unsigned long ulSecurityParametersIndex; |
Kevin McKinney | 5601bb9 | 2012-12-10 21:55:05 -0500 | [diff] [blame] | 66 | }; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 67 | |
Kevin McKinney | dbadab2 | 2012-12-10 21:55:03 -0500 | [diff] [blame] | 68 | enum bcm_ipaddr_context { |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 69 | eSrcIpAddress, |
| 70 | eDestIpAddress |
Kevin McKinney | dbadab2 | 2012-12-10 21:55:03 -0500 | [diff] [blame] | 71 | }; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 72 | |
Kevin McKinney | 5cc3dea | 2012-12-10 21:54:55 -0500 | [diff] [blame] | 73 | /* Function Prototypes */ |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 74 | |
Kevin McKinney | 5ef43c3 | 2012-12-10 21:54:57 -0500 | [diff] [blame] | 75 | unsigned short IpVersion6(struct bcm_mini_adapter *Adapter, /* < Pointer to the driver control structure */ |
Kevin McKinney | 3ee5afd | 2012-12-10 21:55:00 -0500 | [diff] [blame] | 76 | void *pcIpHeader, /* <Pointer to the IP Hdr of the packet */ |
Kevin McKinney | d83beb8 | 2012-12-10 21:54:54 -0500 | [diff] [blame] | 77 | struct bcm_classifier_rule *pstClassifierRule); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 78 | |
Kevin McKinney | b66cf16 | 2012-12-10 21:55:01 -0500 | [diff] [blame] | 79 | void DumpIpv6Address(unsigned long *puIpv6Address); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 80 | |
Kevin McKinney | 1680630 | 2012-12-10 21:55:02 -0500 | [diff] [blame] | 81 | extern bool MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort); |
| 82 | extern bool MatchDestPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort); |
| 83 | extern bool MatchProtocol(struct bcm_classifier_rule *pstClassifierRule, unsigned char ucProtocol); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 84 | |
| 85 | #endif |