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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 * client.h: dhcp client
19 #ifndef included_dhcp_client_h
20 #define included_dhcp_client_h
22 #include <vnet/ip/ip.h>
23 #include <vnet/dhcp/dhcp4_packet.h>
25 #define foreach_dhcp_client_state \
32 foreach_dhcp_client_state
34 } dhcp_client_state_t;
37 dhcp_client_state_t state;
39 /* the interface in question */
42 /* State machine retry counter */
45 /* Send next pkt at this time */
49 /* DHCP transaction ID, a random number */
52 /* leased address, other learned info DHCP */
53 ip4_address_t leased_address; /* from your_ip_address field */
54 ip4_address_t dhcp_server;
55 u32 subnet_mask_width; /* option 1 */
56 ip4_address_t router_address; /* option 3 */
57 u32 lease_renewal_interval; /* option 51 */
58 u32 lease_lifetime; /* option 59 */
60 /* Requested data (option 55) */
65 /* hostname and software client identifiers */
67 u8 * client_identifier; /* software version, e.g. vpe 1.0*/
69 /* Information used for event callback */
72 void * event_callback;
76 /* DHCP client pool */
77 dhcp_client_t * clients;
78 uword * client_by_sw_if_index;
82 vlib_main_t * vlib_main;
83 vnet_main_t * vnet_main;
90 /* vectors, consumed by dhcp client code */
92 u8 * client_identifier;
94 /* Bytes containing requested option numbers */
97 /* Information used for event callback */
100 void * event_callback;
101 } dhcp_client_add_del_args_t;
103 extern dhcp_client_main_t dhcp_client_main;
105 #define EVENT_DHCP_CLIENT_WAKEUP 1
107 int dhcp_client_for_us (u32 bi0,
111 dhcp_header_t * dh0);
113 int dhcp_client_config (vlib_main_t * vm,
119 void *event_callback,
122 #endif /* included_dhcp_client_h */