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 \
33 foreach_dhcp_client_state
35 } dhcp_client_state_t;
39 dhcp_client_state_t state;
41 /* the interface in question */
44 /* State machine retry counter */
47 /* Send next pkt at this time */
51 /* DHCP transaction ID, a random number */
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 */
62 /* Requested data (option 55) */
67 /* hostname and software client identifiers */
69 u8 *client_identifier; /* software version, e.g. vpe 1.0 */
71 /* Information used for event callback */
79 /* DHCP client pool */
80 dhcp_client_t *clients;
81 uword *client_by_sw_if_index;
85 vlib_main_t *vlib_main;
86 vnet_main_t *vnet_main;
94 /* vectors, consumed by dhcp client code */
96 u8 *client_identifier;
98 /* Bytes containing requested option numbers */
101 /* Information used for event callback */
104 void *event_callback;
105 } dhcp_client_add_del_args_t;
107 extern dhcp_client_main_t dhcp_client_main;
109 #define EVENT_DHCP_CLIENT_WAKEUP 1
111 int dhcp_client_for_us (u32 bi0,
114 udp_header_t * u0, dhcp_header_t * dh0);
116 int dhcp_client_config (vlib_main_t * vm,
121 u32 client_index, void *event_callback, u32 pid);
123 #endif /* included_dhcp_client_h */
126 * fd.io coding-style-patch-verification: ON
129 * eval: (c-set-style "gnu")