X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fdhcp%2Fclient.h;h=5191fcf0fa825d2a4c8de7c3877f3648ff666167;hb=038e1dfbd;hp=d9c7e25d0b216fb3bbc3201557c477a19a89c46a;hpb=34719e37bf820e8398ca9159725f7f4c42764aeb;p=vpp.git diff --git a/src/vnet/dhcp/client.h b/src/vnet/dhcp/client.h index d9c7e25d0b2..5191fcf0fa8 100644 --- a/src/vnet/dhcp/client.h +++ b/src/vnet/dhcp/client.h @@ -34,7 +34,15 @@ typedef enum #undef _ } dhcp_client_state_t; -typedef struct +struct dhcp_client_t_; + +/** + * Callback function for DHCP complete events + */ +typedef void (*dhcp_event_cb_t) (u32 client_index, + const struct dhcp_client_t_ * client); + +typedef struct dhcp_client_t_ { dhcp_client_state_t state; @@ -56,14 +64,13 @@ typedef struct ip4_address_t dhcp_server; u32 subnet_mask_width; /* option 1 */ ip4_address_t router_address; /* option 3 */ + ip4_address_t *domain_server_address; /* option 6 */ u32 lease_renewal_interval; /* option 51 */ u32 lease_lifetime; /* option 59 */ /* Requested data (option 55) */ u8 *option_55_data; - u8 *l2_rewrite; - /* hostname and software client identifiers */ u8 *hostname; u8 *client_identifier; /* software version, e.g. vpe 1.0 */ @@ -71,7 +78,21 @@ typedef struct /* Information used for event callback */ u32 client_index; u32 pid; - void *event_callback; + + /* Set the broadcast Flag in the Discover/Request messages */ + u8 set_broadcast_flag; + /* Interface MAC address, so we can do an rx-packet-for-us check */ + u8 client_hardware_address[6]; + u8 client_detect_feature_enabled; + + /* the unicast adjacency for the DHCP server */ + adj_index_t ai_ucast; + /* the broadcast adjacency on the link */ + adj_index_t ai_bcast; + /* IP DSCP to set in sent packets */ + ip_dscp_t dscp; + + dhcp_event_cb_t event_callback; } dhcp_client_t; typedef struct @@ -90,6 +111,7 @@ typedef struct { int is_add; u32 sw_if_index; + u8 set_broadcast_flag; /* vectors, consumed by dhcp client code */ u8 *hostname; @@ -101,7 +123,8 @@ typedef struct /* Information used for event callback */ u32 client_index; u32 pid; - void *event_callback; + ip_dscp_t dscp; + dhcp_event_cb_t event_callback; } dhcp_client_add_del_args_t; extern dhcp_client_main_t dhcp_client_main; @@ -113,12 +136,37 @@ int dhcp_client_for_us (u32 bi0, ip4_header_t * ip0, udp_header_t * u0, dhcp_header_t * dh0); -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, u32 pid); +/** + * Add/Delete DHCP clients + */ +extern int dhcp_client_config (u32 is_add, + u32 client_index, + vlib_main_t * vm, + u32 sw_if_index, + u8 * hostname, + u8 * client_id, + dhcp_event_cb_t event_callback, + u8 set_broadcast_flag, + ip_dscp_t dscp, u32 pid); + +/** + * callback function for clients walking the DHCP client configurations + * + * @param client The client being visitsed + * @param data The data passed during the call to 'walk' + * @return !0 to continue walking 0 to stop. + */ +typedef int (*dhcp_client_walk_cb_t) (const dhcp_client_t * client, + void *data); + +/** + * Walk (visit each) DHCP client configuration + * + * @param cb The callback function invoked as each client is visited + * @param ctx Context data passed back to the client in the invocation of + * the callback. + */ +extern void dhcp_client_walk (dhcp_client_walk_cb_t cb, void *ctx); #endif /* included_dhcp_client_h */