FD.io VPP
v18.04-17-g3a0d853
Vector Packet Processing
Main Page
Related Pages
Modules
Namespaces
Data Structures
Source
Files
Symbols
client.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 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
* client.h: dhcp client
17
*/
18
19
#ifndef included_dhcp_client_h
20
#define included_dhcp_client_h
21
22
#include <
vnet/ip/ip.h
>
23
#include <
vnet/dhcp/dhcp4_packet.h
>
24
25
#define foreach_dhcp_client_state \
26
_(DHCP_DISCOVER) \
27
_(DHCP_REQUEST) \
28
_(DHCP_BOUND)
29
30
typedef
enum
31
{
32
#define _(a) a,
33
foreach_dhcp_client_state
34
#undef _
35
}
dhcp_client_state_t
;
36
37
typedef
struct
38
{
39
dhcp_client_state_t
state
;
40
41
/* the interface in question */
42
u32
sw_if_index
;
43
44
/* State machine retry counter */
45
u32
retry_count
;
46
47
/* Send next pkt at this time */
48
f64
next_transmit
;
49
f64
lease_expires
;
50
51
/* DHCP transaction ID, a random number */
52
u32
transaction_id
;
53
54
/* leased address, other learned info DHCP */
55
ip4_address_t
leased_address
;
/* from your_ip_address field */
56
ip4_address_t
dhcp_server
;
57
u32
subnet_mask_width
;
/* option 1 */
58
ip4_address_t
router_address
;
/* option 3 */
59
u32
lease_renewal_interval
;
/* option 51 */
60
u32
lease_lifetime
;
/* option 59 */
61
62
/* Requested data (option 55) */
63
u8
*
option_55_data
;
64
65
u8
*
l2_rewrite
;
66
67
/* hostname and software client identifiers */
68
u8
*
hostname
;
69
u8
*
client_identifier
;
/* software version, e.g. vpe 1.0 */
70
71
/* Information used for event callback */
72
u32
client_index
;
73
u32
pid
;
74
75
/* Set the broadcast Flag in the Discover/Request messages */
76
u8
set_broadcast_flag
;
77
/* Interface MAC address, so we can do an rx-packet-for-us check */
78
u8
client_hardware_address[6];
79
u8
pad1
;
80
81
void
*
event_callback
;
82
}
dhcp_client_t
;
83
84
typedef
struct
85
{
86
/* DHCP client pool */
87
dhcp_client_t
*
clients
;
88
uword
*
client_by_sw_if_index
;
89
u32
seed
;
90
91
/* convenience */
92
vlib_main_t
*
vlib_main
;
93
vnet_main_t
*
vnet_main
;
94
}
dhcp_client_main_t
;
95
96
typedef
struct
97
{
98
int
is_add
;
99
u32
sw_if_index
;
100
u8
set_broadcast_flag
;
101
102
/* vectors, consumed by dhcp client code */
103
u8
*
hostname
;
104
u8
*
client_identifier
;
105
106
/* Bytes containing requested option numbers */
107
u8
*
option_55_data
;
108
109
/* Information used for event callback */
110
u32
client_index
;
111
u32
pid
;
112
void
*
event_callback
;
113
}
dhcp_client_add_del_args_t
;
114
115
extern
dhcp_client_main_t
dhcp_client_main
;
116
117
#define EVENT_DHCP_CLIENT_WAKEUP 1
118
119
int
dhcp_client_for_us
(
u32
bi0,
120
vlib_buffer_t
* b0,
121
ip4_header_t
* ip0,
122
udp_header_t
* u0,
dhcp_header_t
* dh0);
123
124
int
dhcp_client_config
(
vlib_main_t
*
vm
,
125
u32
sw_if_index,
126
u8
* hostname,
127
u8
* client_id,
128
u32
is_add,
129
u32
client_index,
130
void
*event_callback,
u8
set_broadcast_flag,
u32
pid);
131
132
#endif
/* included_dhcp_client_h */
133
134
/*
135
* fd.io coding-style-patch-verification: ON
136
*
137
* Local Variables:
138
* eval: (c-set-style "gnu")
139
* End:
140
*/
dhcp_client_add_del_args_t::client_identifier
u8 * client_identifier
Definition:
client.h:104
dhcp_client_main_t
Definition:
client.h:84
dhcp_client_main
dhcp_client_main_t dhcp_client_main
Definition:
client.c:20
dhcp_client_t::retry_count
u32 retry_count
Definition:
client.h:45
dhcp_client_add_del_args_t::is_add
int is_add
Definition:
client.h:98
dhcp_client_add_del_args_t::hostname
u8 * hostname
Definition:
client.h:103
dhcp_client_t::next_transmit
f64 next_transmit
Definition:
client.h:48
dhcp_client_t::pad1
u8 pad1
Definition:
client.h:79
dhcp_client_add_del_args_t::pid
u32 pid
Definition:
client.h:111
dhcp_client_add_del_args_t::sw_if_index
u32 sw_if_index
Definition:
client.h:99
dhcp_client_t::transaction_id
u32 transaction_id
Definition:
client.h:52
dhcp_client_t::hostname
u8 * hostname
Definition:
client.h:68
dhcp_header_t
Definition:
dhcp4_packet.h:22
dhcp4_packet.h
dhcp_client_main_t::clients
dhcp_client_t * clients
Definition:
client.h:87
dhcp_client_add_del_args_t::client_index
u32 client_index
Definition:
client.h:110
ip.h
udp_header_t
Definition:
udp_packet.h:43
dhcp_client_add_del_args_t::event_callback
void * event_callback
Definition:
client.h:112
dhcp_client_t::lease_lifetime
u32 lease_lifetime
Definition:
client.h:60
dhcp_client_t::l2_rewrite
u8 * l2_rewrite
Definition:
client.h:65
dhcp_client_add_del_args_t::option_55_data
u8 * option_55_data
Definition:
client.h:107
foreach_dhcp_client_state
#define foreach_dhcp_client_state
Definition:
client.h:25
dhcp_client_t::client_index
u32 client_index
Definition:
client.h:72
dhcp_client_t::set_broadcast_flag
u8 set_broadcast_flag
Definition:
client.h:76
ip4_address_t
Definition:
ip4_packet.h:49
dhcp_client_config
int dhcp_client_config(vlib_main_t *vm, u32 sw_if_index, u8 *hostname, u8 *client_id, u32 is_add, u32 client_index, void *event_callback, u8 set_broadcast_flag, u32 pid)
Definition:
client.c:964
dhcp_client_state_t
dhcp_client_state_t
Definition:
client.h:30
dhcp_client_main_t::seed
u32 seed
Definition:
client.h:89
dhcp_client_main_t::vlib_main
vlib_main_t * vlib_main
Definition:
client.h:92
dhcp_client_add_del_args_t
Definition:
client.h:96
dhcp_client_for_us
int dhcp_client_for_us(u32 bi0, vlib_buffer_t *b0, ip4_header_t *ip0, udp_header_t *u0, dhcp_header_t *dh0)
Definition:
client.c:165
dhcp_client_t::subnet_mask_width
u32 subnet_mask_width
Definition:
client.h:57
dhcp_client_t
Definition:
client.h:37
vm
vlib_main_t * vm
Definition:
buffer.c:294
vlib_buffer_t
Definition:
buffer.h:98
dhcp_client_t::state
dhcp_client_state_t state
Definition:
client.h:39
dhcp_client_t::option_55_data
u8 * option_55_data
Definition:
client.h:63
vnet_main_t
Definition:
vnet.h:51
u32
unsigned int u32
Definition:
types.h:88
dhcp_client_t::lease_renewal_interval
u32 lease_renewal_interval
Definition:
client.h:59
dhcp_client_t::sw_if_index
u32 sw_if_index
Definition:
client.h:42
uword
u64 uword
Definition:
types.h:112
dhcp_client_t::lease_expires
f64 lease_expires
Definition:
client.h:49
dhcp_client_add_del_args_t::set_broadcast_flag
u8 set_broadcast_flag
Definition:
client.h:100
f64
double f64
Definition:
types.h:142
u8
unsigned char u8
Definition:
types.h:56
dhcp_client_t::pid
u32 pid
Definition:
client.h:73
dhcp_client_t::dhcp_server
ip4_address_t dhcp_server
Definition:
client.h:56
vlib_main_t
Definition:
main.h:59
dhcp_client_main_t::client_by_sw_if_index
uword * client_by_sw_if_index
Definition:
client.h:88
dhcp_client_t::event_callback
void * event_callback
Definition:
client.h:81
dhcp_client_t::router_address
ip4_address_t router_address
Definition:
client.h:58
dhcp_client_main_t::vnet_main
vnet_main_t * vnet_main
Definition:
client.h:93
ip4_header_t
Definition:
ip4_packet.h:126
dhcp_client_t::leased_address
ip4_address_t leased_address
Definition:
client.h:55
dhcp_client_t::client_identifier
u8 * client_identifier
Definition:
client.h:69
src
vnet
dhcp
client.h
Generated on Mon Oct 1 2018 08:02:36 for FD.io VPP by
1.8.11