Hybrid ICN (hICN) plugin
v21.06-rc0-4-g18fa668
hicn-plugin
src
hicn
protocol
ipv6.h
1
/*
2
* Copyright (c) 2017-2019 Cisco and/or its affiliates.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
#ifndef HICN_PROTOCOL_IPV6_H
17
#define HICN_PROTOCOL_IPV6_H
18
19
#include "../common.h"
20
21
/*
22
* The length of the IPV6 header struct must be 40 bytes.
23
*/
24
#define EXPECTED_IPV6_HDRLEN 40
25
26
typedef
struct
27
{
28
union
29
{
30
struct
31
{
32
u32 version_class_flow;
/* version, traffic class and 20 bits of flow-ID */
33
u16 len;
/* payload length */
34
u8 nxt;
/* next header */
35
u8 hlim;
/* hop limit */
36
};
37
u8 vfc;
/* 4 bits version, top 4 bits class */
38
};
39
ip6_address_t
saddr;
/* source address */
40
ip6_address_t
daddr;
/* destination address */
41
}
_ipv6_header_t
;
42
43
#define IPV6_HDRLEN sizeof(_ipv6_header_t)
44
static_assert (EXPECTED_IPV6_HDRLEN == IPV6_HDRLEN,
45
"Size of IPV6 struct does not match its expected size."
);
46
47
/*
48
* The length of the IPV6 pseudo header struct must be 40 bytes.
49
*/
50
#define EXPECTED_IPV6_PSHDRLEN 40
51
52
typedef
struct
53
{
54
ip6_address_t
ip_src;
55
ip6_address_t
ip_dst;
56
u32 size;
57
u16 zeros;
58
u8 zero;
59
u8 protocol;
60
}
ipv6_pseudo_header_t
;
61
62
#define IPV6_PSHDRLEN sizeof(ipv6_pseudo_header_t)
63
static_assert (EXPECTED_IPV6_PSHDRLEN == IPV6_PSHDRLEN,
64
"Size of IPV6_PSHDR struct does not match its expected size."
);
65
66
/* Default field values */
67
#define IPV6_DEFAULT_VERSION 6
68
#define IPV6_DEFAULT_TRAFFIC_CLASS 0
69
#define IPV6_DEFAULT_FLOW_LABEL 0
70
#define IPV6_DEFAULT_PAYLOAD_LENGTH 0
71
72
#endif
73
74
/*
75
* fd.io coding-style-patch-verification: ON
76
*
77
* Local Variables:
78
* eval: (c-set-style "gnu")
79
* End:
80
*/
ip6_address_t
Definition:
common.h:173
ipv6_pseudo_header_t
Definition:
ipv6.h:52
_ipv6_header_t
Definition:
ipv6.h:26
Generated by
1.8.17