blob: 96b36a579af202b9d8419bcb99e6c9fe22b3d195 [file] [log] [blame]
Stephen Hemmingerf8942e02010-09-08 14:46:36 -07001#ifndef _IPV6_PROTOCOL_DEFINES_
2#define _IPV6_PROTOCOL_DEFINES_
3
Stephen Hemmingerf8942e02010-09-08 14:46:36 -07004#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 McKinneyd83beb82012-12-10 21:54:54 -050012#define TCP_HEADER_TYPE 0x6
13#define UDP_HEADER_TYPE 0x11
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070014#define IPV6_ICMP_HDR_TYPE 0x2
15#define IPV6_FLOWLABEL_BITOFFSET 9
16
17#define IPV6_MAX_CHAINEDHDR_BUFFBYTES 0x64
18/*
Kevin McKinney5cc3dea2012-12-10 21:54:55 -050019 * Size of Dest Options field of Destinations Options Header
20 * in bytes.
21 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070022#define IPV6_DESTOPTS_HDR_OPTIONSIZE 0x8
23
Kevin McKinney9d4cf712012-12-10 21:55:10 -050024struct bcm_ipv6_hdr {
Kevin McKinney67b587c2012-12-10 21:54:59 -050025 unsigned char ucVersionPrio;
26 unsigned char aucFlowLabel[3];
Kevin McKinney5ef43c32012-12-10 21:54:57 -050027 unsigned short usPayloadLength;
Kevin McKinney67b587c2012-12-10 21:54:59 -050028 unsigned char ucNextHeader;
29 unsigned char ucHopLimit;
Kevin McKinney828c1dd2012-12-10 21:54:58 -050030 unsigned long ulSrcIpAddress[4];
31 unsigned long ulDestIpAddress[4];
Kevin McKinney9d4cf712012-12-10 21:55:10 -050032};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070033
Kevin McKinney8f0652c2012-12-10 21:55:09 -050034struct bcm_ipv6_routing_hdr {
Kevin McKinney67b587c2012-12-10 21:54:59 -050035 unsigned char ucNextHeader;
36 unsigned char ucRoutingType;
37 unsigned char ucNumAddresses;
38 unsigned char ucNextAddress;
Kevin McKinney828c1dd2012-12-10 21:54:58 -050039 unsigned long ulReserved;
Kevin McKinney8f0652c2012-12-10 21:55:09 -050040};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070041
Kevin McKinney17d7fd22012-12-10 21:55:08 -050042struct bcm_ipv6_fragment_hdr {
Kevin McKinney67b587c2012-12-10 21:54:59 -050043 unsigned char ucNextHeader;
44 unsigned char ucReserved;
Kevin McKinney5ef43c32012-12-10 21:54:57 -050045 unsigned short usFragmentOffset;
Kevin McKinney828c1dd2012-12-10 21:54:58 -050046 unsigned long ulIdentification;
Kevin McKinney17d7fd22012-12-10 21:55:08 -050047};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070048
Kevin McKinneyd69438d2012-12-10 21:55:07 -050049struct bcm_ipv6_dest_options_hdr {
Kevin McKinney67b587c2012-12-10 21:54:59 -050050 unsigned char ucNextHeader;
51 unsigned char ucHdrExtLen;
52 unsigned char ucDestOptions[6];
Kevin McKinneyd69438d2012-12-10 21:55:07 -050053};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070054
Kevin McKinneybc25b752012-12-10 21:55:06 -050055struct bcm_ipv6_options_hdr {
Kevin McKinney67b587c2012-12-10 21:54:59 -050056 unsigned char ucNextHeader;
57 unsigned char ucMisc[3];
Kevin McKinney828c1dd2012-12-10 21:54:58 -050058 unsigned long ulJumboPayloadLen;
Kevin McKinneybc25b752012-12-10 21:55:06 -050059};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070060
Kevin McKinney5601bb92012-12-10 21:55:05 -050061struct bcm_ipv6_authentication_hdr {
Kevin McKinney67b587c2012-12-10 21:54:59 -050062 unsigned char ucNextHeader;
63 unsigned char ucLength;
Kevin McKinney5ef43c32012-12-10 21:54:57 -050064 unsigned short usReserved;
Kevin McKinney828c1dd2012-12-10 21:54:58 -050065 unsigned long ulSecurityParametersIndex;
Kevin McKinney5601bb92012-12-10 21:55:05 -050066};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070067
Kevin McKinneydbadab22012-12-10 21:55:03 -050068enum bcm_ipaddr_context {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070069 eSrcIpAddress,
70 eDestIpAddress
Kevin McKinneydbadab22012-12-10 21:55:03 -050071};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070072
Kevin McKinney5cc3dea2012-12-10 21:54:55 -050073/* Function Prototypes */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070074
Kevin McKinney5ef43c32012-12-10 21:54:57 -050075unsigned short IpVersion6(struct bcm_mini_adapter *Adapter, /* < Pointer to the driver control structure */
Kevin McKinney3ee5afd2012-12-10 21:55:00 -050076 void *pcIpHeader, /* <Pointer to the IP Hdr of the packet */
Kevin McKinneyd83beb82012-12-10 21:54:54 -050077 struct bcm_classifier_rule *pstClassifierRule);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070078
Kevin McKinneyb66cf162012-12-10 21:55:01 -050079void DumpIpv6Address(unsigned long *puIpv6Address);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070080
Kevin McKinney16806302012-12-10 21:55:02 -050081extern bool MatchSrcPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort);
82extern bool MatchDestPort(struct bcm_classifier_rule *pstClassifierRule, unsigned short ushSrcPort);
83extern bool MatchProtocol(struct bcm_classifier_rule *pstClassifierRule, unsigned char ucProtocol);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070084
85#endif