FD.io VPP  v19.08.3-2-gbabecb413
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>
21 #include <vnet/dhcp/dhcp6_packet.h>
22 #include <vnet/vnet_msg_enum.h>
23 #include <vlibapi/api_common.h>
24 #include <vlibmemory/api.h>
25 
26 #define vl_typedefs /* define message structures */
27 #include <vnet/vnet_all_api_h.h>
28 #undef vl_typedefs
29 
30 #define vl_endianfun /* define message structures */
31 #include <vnet/vnet_all_api_h.h>
32 #undef vl_endianfun
33 
34 /* instantiate all the print functions we know about */
35 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
36 #define vl_printfun
37 #include <vnet/vnet_all_api_h.h>
38 #undef vl_printfun
39 
41 
42 typedef struct
43 {
53 
54 typedef struct
55 {
56  u8 *data;
58 } server_id_t;
59 
60 typedef struct
61 {
64 
66 
67 typedef union
68 {
69  CLIB_PACKED (struct
70  {
71  u16 duid_type;
72  u16 hardware_type;
73  u8 lla[6];
74  });
75  char bin_string[10];
77 
79 #define CLIENT_DUID_LENGTH sizeof (client_duid)
80 #define DHCPV6_CLIENT_IAID 1
81 
82 void dhcp6_clients_enable_disable (u8 enable);
84 
85 #define vl_typedefs /* define message structures */
86 #include <vnet/vnet_all_api_h.h>
87 #undef vl_typedefs
88 
90 
93 {
94  static u32 seed = 0;
95  static u8 seed_set = 0;
96  if (!seed_set)
97  {
98  seed = random_default_seed ();
99  seed_set = 1;
100  }
101  return random_f64 (&seed) * (to - from) + from;
102 }
103 
104 static const ip6_address_t all_dhcp6_relay_agents_and_servers = {
105  .as_u8 = {
106  0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02}
108 };
109 
110 #endif /* included_vnet_dhcp6_client_common_dp_h */
111 
112 /*
113  * fd.io coding-style-patch-verification: ON
114  *
115  * Local Variables:
116  * eval: (c-set-style "gnu")
117  * End:
118  */
Set DHCPv6 DUID-LL.
Definition: dhcp.api:208
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
Definition: random.h:91
u8 as_u8[16]
Definition: ip6_packet.h:48
u8 data[128]
Definition: ipsec.api:251
unsigned char u8
Definition: types.h:56
double f64
Definition: types.h:142
void vl_api_dhcp6_duid_ll_set_t_handler(vl_api_dhcp6_duid_ll_set_t *mp)
#define static_always_inline
Definition: clib.h:100
dhcpv6_duid_ll_string_t client_duid
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
dhcp6_client_common_main_t dhcp6_client_common_main
u8 len
Definition: ip_types.api:90
void dhcp6_clients_enable_disable(u8 enable)
u32 server_index_get_or_create(u8 *data, u16 len)
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
Definition: random.h:145
#define CLIB_PACKED(x)
Definition: clib.h:82
static_always_inline f64 random_f64_from_to(f64 from, f64 to)