FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
dhcp6_client_common_dp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 included_vnet_dhcp6_client_common_dp_h
17 #define included_vnet_dhcp6_client_common_dp_h
18 
19 #include <vlib/vlib.h>
20 #include <dhcp/dhcp6_packet.h>
21 
22 typedef struct
23 {
33 
34 typedef struct
35 {
36  u8 *data;
38 } server_id_t;
39 
40 typedef struct
41 {
44 
46 
47 typedef union
48 {
49  CLIB_PACKED (struct
50  {
51  u16 duid_type;
52  u16 hardware_type;
53  u8 lla[6];
54  });
55  char bin_string[10];
57 
59 #define CLIENT_DUID_LENGTH sizeof (client_duid)
60 #define DHCPV6_CLIENT_IAID 1
61 
62 void dhcp6_clients_enable_disable (u8 enable);
64 
66 
69 {
70  static u32 seed = 0;
71  static u8 seed_set = 0;
72  if (!seed_set)
73  {
74  seed = random_default_seed ();
75  seed_set = 1;
76  }
77  return random_f64 (&seed) * (to - from) + from;
78 }
79 
80 static const ip6_address_t all_dhcp6_relay_agents_and_servers = {
81  .as_u8 = {
82  0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02}
84 };
85 
86 #endif /* included_vnet_dhcp6_client_common_dp_h */
87 
88 /*
89  * fd.io coding-style-patch-verification: ON
90  *
91  * Local Variables:
92  * eval: (c-set-style "gnu")
93  * End:
94  */
vlib.h
to
u32 * to
Definition: interface_output.c:1078
dhcp6_report_common_t::T1
u32 T1
Definition: dhcp6_client_common_dp.h:27
dhcp6_report_common_t::status_code
u16 status_code
Definition: dhcp6_client_common_dp.h:30
u16
unsigned short u16
Definition: types.h:57
dhcp6_report_common_t::server_index
u32 server_index
Definition: dhcp6_client_common_dp.h:25
server_id_t
Definition: dhcp6_client_common_dp.h:34
random_f64
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
Definition: random.h:145
dhcp6_report_common_t::T2
u32 T2
Definition: dhcp6_client_common_dp.h:28
len
u8 len
Definition: ip_types.api:103
dhcp6_report_common_t::inner_status_code
u16 inner_status_code
Definition: dhcp6_client_common_dp.h:29
server_index_get_or_create
u32 server_index_get_or_create(u8 *data, u16 len)
Definition: dhcp6_client_common_dp.c:29
server_id_t::data
u8 * data
Definition: dhcp6_client_common_dp.h:36
static_always_inline
#define static_always_inline
Definition: clib.h:112
dhcp6_clients_enable_disable
void dhcp6_clients_enable_disable(u8 enable)
Definition: dhcp6_client_common_dp.c:448
f64
double f64
Definition: types.h:142
server_id_t::len
u16 len
Definition: dhcp6_client_common_dp.h:37
client_duid
dhcpv6_duid_ll_string_t client_duid
Definition: dhcp6_client_common_dp.h:65
dhcp6_report_common_t
Definition: dhcp6_client_common_dp.h:22
data
u8 data[128]
Definition: ipsec_types.api:92
dhcp6_client_common_main_t::server_ids
server_id_t * server_ids
Definition: dhcp6_client_common_dp.h:42
dhcp6_report_common_t::preference
u8 preference
Definition: dhcp6_client_common_dp.h:31
all_dhcp6_relay_agents_and_servers
static const ip6_address_t all_dhcp6_relay_agents_and_servers
Definition: dhcp6_client_common_dp.h:80
dhcp6_client_common_main
dhcp6_client_common_main_t dhcp6_client_common_main
Definition: dhcp6_client_common_dp.c:25
u32
unsigned int u32
Definition: types.h:88
u8
unsigned char u8
Definition: types.h:56
dhcp6_report_common_t::sw_if_index
u32 sw_if_index
Definition: dhcp6_client_common_dp.h:24
CLIB_PACKED
#define CLIB_PACKED(x)
Definition: clib.h:89
dhcp6_packet.h
random_f64_from_to
static_always_inline f64 random_f64_from_to(f64 from, f64 to)
Definition: dhcp6_client_common_dp.h:68
dhcp6_report_common_t::msg_type
u8 msg_type
Definition: dhcp6_client_common_dp.h:26
dhcpv6_duid_ll_string_t
Definition: dhcp6_client_common_dp.h:47
from
from
Definition: nat44_ei_hairpinning.c:415
dhcp6_client_common_main_t
Definition: dhcp6_client_common_dp.h:40
random_default_seed
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
Definition: random.h:91