FD.io VPP
v17.01-9-ge7dcee4
Vector Packet Processing
Main Page
Related Pages
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
#define foreach_dhcp_client_state \
23
_(DHCP_DISCOVER) \
24
_(DHCP_REQUEST) \
25
_(DHCP_BOUND)
26
27
typedef
enum
{
28
#define _(a) a,
29
foreach_dhcp_client_state
30
#undef _
31
}
dhcp_client_state_t
;
32
33
typedef
struct
{
34
dhcp_client_state_t
state
;
35
36
/* the interface in question */
37
u32
sw_if_index
;
38
39
/* State machine retry counter */
40
u32
retry_count
;
41
42
/* Send next pkt at this time */
43
f64
next_transmit
;
44
f64
lease_expires
;
45
46
/* DHCP transaction ID, a random number */
47
u32
transaction_id
;
48
49
/* leased address, other learned info DHCP */
50
ip4_address_t
leased_address
;
/* from your_ip_address field */
51
ip4_address_t
dhcp_server
;
52
u32
subnet_mask_width
;
/* option 1 */
53
ip4_address_t
router_address
;
/* option 3 */
54
u32
lease_renewal_interval
;
/* option 51 */
55
u32
lease_lifetime
;
/* option 59 */
56
57
/* Requested data (option 55) */
58
u8
*
option_55_data
;
59
60
u8
*
l2_rewrite
;
61
62
/* hostname and software client identifiers */
63
u8
*
hostname
;
64
u8
*
client_identifier
;
/* software version, e.g. vpe 1.0*/
65
66
/* Information used for event callback */
67
u32
client_index
;
68
u32
pid
;
69
void
*
event_callback
;
70
}
dhcp_client_t
;
71
72
typedef
struct
{
73
/* DHCP client pool */
74
dhcp_client_t
*
clients
;
75
uword
*
client_by_sw_if_index
;
76
u32
seed
;
77
78
/* convenience */
79
vlib_main_t
*
vlib_main
;
80
vnet_main_t
*
vnet_main
;
81
}
dhcp_client_main_t
;
82
83
typedef
struct
{
84
int
is_add
;
85
u32
sw_if_index
;
86
87
/* vectors, consumed by dhcp client code */
88
u8
*
hostname
;
89
u8
*
client_identifier
;
90
91
/* Bytes containing requested option numbers */
92
u8
*
option_55_data
;
93
94
/* Information used for event callback */
95
u32
client_index
;
96
u32
pid
;
97
void
*
event_callback
;
98
}
dhcp_client_add_del_args_t
;
99
100
dhcp_client_main_t
dhcp_client_main
;
101
102
#define EVENT_DHCP_CLIENT_WAKEUP 1
103
104
int
dhcp_client_for_us
(
u32
bi0,
105
vlib_buffer_t
* b0,
106
ip4_header_t
* ip0,
107
udp_header_t
* u0,
108
dhcp_header_t
* dh0);
109
110
int
dhcp_client_config
(
vlib_main_t
* vm,
111
u32
sw_if_index,
112
u8
* hostname,
113
u32
is_add,
114
u32
client_index,
115
void
*event_callback,
116
u32
pid);
117
118
#endif
/* included_dhcp_client_h */
dhcp_client_add_del_args_t::client_identifier
u8 * client_identifier
Definition:
client.h:89
dhcp_client_main_t
Definition:
client.h:72
dhcp_client_main
dhcp_client_main_t dhcp_client_main
Definition:
client.h:100
dhcp_client_t::retry_count
u32 retry_count
Definition:
client.h:40
dhcp_client_add_del_args_t::is_add
int is_add
Definition:
client.h:84
dhcp_client_add_del_args_t::hostname
u8 * hostname
Definition:
client.h:88
dhcp_client_t::next_transmit
f64 next_transmit
Definition:
client.h:43
dhcp_client_add_del_args_t::pid
u32 pid
Definition:
client.h:96
dhcp_client_add_del_args_t::sw_if_index
u32 sw_if_index
Definition:
client.h:85
dhcp_client_t::transaction_id
u32 transaction_id
Definition:
client.h:47
dhcp_client_t::hostname
u8 * hostname
Definition:
client.h:63
dhcp_header_t
Definition:
packet.h:22
dhcp_client_main_t::clients
dhcp_client_t * clients
Definition:
client.h:74
dhcp_client_add_del_args_t::client_index
u32 client_index
Definition:
client.h:95
udp_header_t
Definition:
udp_packet.h:43
dhcp_client_add_del_args_t::event_callback
void * event_callback
Definition:
client.h:97
dhcp_client_t::lease_lifetime
u32 lease_lifetime
Definition:
client.h:55
dhcp_client_t::l2_rewrite
u8 * l2_rewrite
Definition:
client.h:60
dhcp_client_add_del_args_t::option_55_data
u8 * option_55_data
Definition:
client.h:92
foreach_dhcp_client_state
#define foreach_dhcp_client_state
Definition:
client.h:22
dhcp_client_t::client_index
u32 client_index
Definition:
client.h:67
ip4_address_t
Definition:
ip4_packet.h:49
dhcp_client_state_t
dhcp_client_state_t
Definition:
client.h:27
dhcp_client_main_t::seed
u32 seed
Definition:
client.h:76
dhcp_client_main_t::vlib_main
vlib_main_t * vlib_main
Definition:
client.h:79
dhcp_client_add_del_args_t
Definition:
client.h:83
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:65
dhcp_client_t::subnet_mask_width
u32 subnet_mask_width
Definition:
client.h:52
dhcp_client_t
Definition:
client.h:33
vlib_buffer_t
Definition:
buffer.h:73
dhcp_client_t::state
dhcp_client_state_t state
Definition:
client.h:34
dhcp_client_t::option_55_data
u8 * option_55_data
Definition:
client.h:58
vnet_main_t
Definition:
vnet.h:52
u32
unsigned int u32
Definition:
types.h:88
dhcp_client_t::lease_renewal_interval
u32 lease_renewal_interval
Definition:
client.h:54
dhcp_client_t::sw_if_index
u32 sw_if_index
Definition:
client.h:37
dhcp_client_config
int dhcp_client_config(vlib_main_t *vm, u32 sw_if_index, u8 *hostname, u32 is_add, u32 client_index, void *event_callback, u32 pid)
Definition:
client.c:836
uword
u64 uword
Definition:
types.h:112
dhcp_client_t::lease_expires
f64 lease_expires
Definition:
client.h:44
f64
double f64
Definition:
types.h:142
u8
unsigned char u8
Definition:
types.h:56
dhcp_client_t::pid
u32 pid
Definition:
client.h:68
dhcp_client_t::dhcp_server
ip4_address_t dhcp_server
Definition:
client.h:51
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:75
dhcp_client_t::event_callback
void * event_callback
Definition:
client.h:69
dhcp_client_t::router_address
ip4_address_t router_address
Definition:
client.h:53
dhcp_client_main_t::vnet_main
vnet_main_t * vnet_main
Definition:
client.h:80
ip4_header_t
Definition:
ip4_packet.h:125
dhcp_client_t::leased_address
ip4_address_t leased_address
Definition:
client.h:50
dhcp_client_t::client_identifier
u8 * client_identifier
Definition:
client.h:64
vnet
vnet
dhcp
client.h
Generated on Thu Mar 2 2017 19:44:47 for FD.io VPP by
1.8.11