aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp/api
diff options
context:
space:
mode:
authorPavel Kotucek <pkotucek@cisco.com>2017-01-25 07:25:32 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-01-26 08:23:47 +0000
commitc8d8770a3e09c300eeff461a11ef3723b8e029cb (patch)
tree772a259683c670b1bc7b708b723aeb49d5a4b6f3 /src/vpp/api
parentba888e46f799a1ae209c51fffdd6159d75b20cdd (diff)
API refactoring : dhcp
Change-Id: I3829835ed2126e51e96690c907deac623dc77151 Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
Diffstat (limited to 'src/vpp/api')
-rw-r--r--src/vpp/api/api.c158
-rw-r--r--src/vpp/api/vpe.api147
2 files changed, 1 insertions, 304 deletions
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index 9f6f260b..6317f557 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -52,12 +52,9 @@
#include <vnet/ip/ip.h>
#include <vnet/ip/ip6.h>
#include <vnet/ip/ip6_neighbor.h>
-#include <vnet/dhcp/proxy.h>
-#include <vnet/dhcp/client.h>
#if WITH_LIBSSL > 0
#include <vnet/sr/sr.h>
#endif
-#include <vnet/dhcpv6/proxy.h>
#include <vlib/vlib.h>
#include <vlib/unix/unix.h>
#include <vlibapi/api.h>
@@ -124,10 +121,6 @@ _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
_(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
_(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats) \
_(RESET_FIB, reset_fib) \
-_(DHCP_PROXY_CONFIG,dhcp_proxy_config) \
-_(DHCP_PROXY_CONFIG_2,dhcp_proxy_config_2) \
-_(DHCP_PROXY_SET_VSS,dhcp_proxy_set_vss) \
-_(DHCP_CLIENT_CONFIG, dhcp_client_config) \
_(CREATE_LOOPBACK, create_loopback) \
_(CONTROL_PING, control_ping) \
_(CLI_REQUEST, cli_request) \
@@ -1064,157 +1057,6 @@ vl_api_reset_fib_t_handler (vl_api_reset_fib_t * mp)
REPLY_MACRO (VL_API_RESET_FIB_REPLY);
}
-
-static void
-dhcpv4_proxy_config (vl_api_dhcp_proxy_config_t * mp)
-{
- vl_api_dhcp_proxy_config_reply_t *rmp;
- int rv;
-
- rv = dhcp_proxy_set_server ((ip4_address_t *) (&mp->dhcp_server),
- (ip4_address_t *) (&mp->dhcp_src_address),
- (u32) ntohl (mp->vrf_id),
- (int) mp->insert_circuit_id,
- (int) (mp->is_add == 0));
-
- REPLY_MACRO (VL_API_DHCP_PROXY_CONFIG_REPLY);
-}
-
-
-static void
-dhcpv6_proxy_config (vl_api_dhcp_proxy_config_t * mp)
-{
- vl_api_dhcp_proxy_config_reply_t *rmp;
- int rv = -1;
-
- rv = dhcpv6_proxy_set_server ((ip6_address_t *) (&mp->dhcp_server),
- (ip6_address_t *) (&mp->dhcp_src_address),
- (u32) ntohl (mp->vrf_id),
- (int) mp->insert_circuit_id,
- (int) (mp->is_add == 0));
-
- REPLY_MACRO (VL_API_DHCP_PROXY_CONFIG_REPLY);
-}
-
-static void
-dhcpv4_proxy_config_2 (vl_api_dhcp_proxy_config_2_t * mp)
-{
- vl_api_dhcp_proxy_config_reply_t *rmp;
- int rv;
-
- rv = dhcp_proxy_set_server_2 ((ip4_address_t *) (&mp->dhcp_server),
- (ip4_address_t *) (&mp->dhcp_src_address),
- (u32) ntohl (mp->rx_vrf_id),
- (u32) ntohl (mp->server_vrf_id),
- (int) mp->insert_circuit_id,
- (int) (mp->is_add == 0));
-
- REPLY_MACRO (VL_API_DHCP_PROXY_CONFIG_2_REPLY);
-}
-
-
-static void
-dhcpv6_proxy_config_2 (vl_api_dhcp_proxy_config_2_t * mp)
-{
- vl_api_dhcp_proxy_config_reply_t *rmp;
- int rv = -1;
-
- rv = dhcpv6_proxy_set_server_2 ((ip6_address_t *) (&mp->dhcp_server),
- (ip6_address_t *) (&mp->dhcp_src_address),
- (u32) ntohl (mp->rx_vrf_id),
- (u32) ntohl (mp->server_vrf_id),
- (int) mp->insert_circuit_id,
- (int) (mp->is_add == 0));
-
- REPLY_MACRO (VL_API_DHCP_PROXY_CONFIG_2_REPLY);
-}
-
-
-static void
-vl_api_dhcp_proxy_set_vss_t_handler (vl_api_dhcp_proxy_set_vss_t * mp)
-{
- vl_api_dhcp_proxy_set_vss_reply_t *rmp;
- int rv;
- if (!mp->is_ipv6)
- rv = dhcp_proxy_set_option82_vss (ntohl (mp->tbl_id),
- ntohl (mp->oui),
- ntohl (mp->fib_id),
- (int) mp->is_add == 0);
- else
- rv = dhcpv6_proxy_set_vss (ntohl (mp->tbl_id),
- ntohl (mp->oui),
- ntohl (mp->fib_id), (int) mp->is_add == 0);
-
- REPLY_MACRO (VL_API_DHCP_PROXY_SET_VSS_REPLY);
-}
-
-
-static void vl_api_dhcp_proxy_config_t_handler
- (vl_api_dhcp_proxy_config_t * mp)
-{
- if (mp->is_ipv6 == 0)
- dhcpv4_proxy_config (mp);
- else
- dhcpv6_proxy_config (mp);
-}
-
-static void vl_api_dhcp_proxy_config_2_t_handler
- (vl_api_dhcp_proxy_config_2_t * mp)
-{
- if (mp->is_ipv6 == 0)
- dhcpv4_proxy_config_2 (mp);
- else
- dhcpv6_proxy_config_2 (mp);
-}
-
-void
-dhcp_compl_event_callback (u32 client_index, u32 pid, u8 * hostname,
- u8 is_ipv6, u8 * host_address, u8 * router_address,
- u8 * host_mac)
-{
- unix_shared_memory_queue_t *q;
- vl_api_dhcp_compl_event_t *mp;
-
- q = vl_api_client_index_to_input_queue (client_index);
- if (!q)
- return;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- mp->client_index = client_index;
- mp->pid = pid;
- mp->is_ipv6 = is_ipv6;
- clib_memcpy (&mp->hostname, hostname, vec_len (hostname));
- mp->hostname[vec_len (hostname) + 1] = '\n';
- clib_memcpy (&mp->host_address[0], host_address, 16);
- clib_memcpy (&mp->router_address[0], router_address, 16);
-
- if (NULL != host_mac)
- clib_memcpy (&mp->host_mac[0], host_mac, 6);
-
- mp->_vl_msg_id = ntohs (VL_API_DHCP_COMPL_EVENT);
-
- vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void vl_api_dhcp_client_config_t_handler
- (vl_api_dhcp_client_config_t * mp)
-{
- vlib_main_t *vm = vlib_get_main ();
- vl_api_dhcp_client_config_reply_t *rmp;
- int rv = 0;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- rv = dhcp_client_config (vm, ntohl (mp->sw_if_index),
- mp->hostname, mp->is_add, mp->client_index,
- mp->want_dhcp_event ? dhcp_compl_event_callback :
- NULL, mp->pid);
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_DHCP_CLIENT_CONFIG_REPLY);
-}
-
static void
vl_api_create_loopback_t_handler (vl_api_create_loopback_t * mp)
{
diff --git a/src/vpp/api/vpe.api b/src/vpp/api/vpe.api
index a00033c5..3a35a54a 100644
--- a/src/vpp/api/vpe.api
+++ b/src/vpp/api/vpe.api
@@ -43,6 +43,7 @@
* DPDK APIs: see ... /src/vnet/devices/dpdk/{dpdk.api, dpdk_api.c}
* CLASSIFY APIs: see ... /src/vnet/classify/{classify.api, classify_api.c}
* FLOW APIs: see ... /src/vnet/flow/{flow.api, flow_api.c}
+ * DHCP APIs: see ... /src/vnet/dhcp/{dhcpk.api, dhcp_api.c}
*/
/** \brief Create a new subinterface with the given vlan id
@@ -398,68 +399,6 @@ define reset_fib_reply
i32 retval;
};
-/** \brief DHCP Proxy config add / del request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param vrf_id - vrf id
- @param if_ipv6 - ipv6 if non-zero, else ipv4
- @param is_add - add the config if non-zero, else delete
- @param insert_circuit_id - option82 suboption 1 fib number
- @param dhcp_server[] - server address
- @param dhcp_src_address[] - <fix this, need details>
-*/
-define dhcp_proxy_config
-{
- u32 client_index;
- u32 context;
- u32 vrf_id;
- u8 is_ipv6;
- u8 is_add;
- u8 insert_circuit_id;
- u8 dhcp_server[16];
- u8 dhcp_src_address[16];
-};
-
-/** \brief DHCP Proxy config response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
-*/
-define dhcp_proxy_config_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief DHCP Proxy set / unset vss request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param tbl_id - table id
- @param oui - first part of vpn id
- @param fib_id - second part of vpn id
- @param is_ipv6 - ip6 if non-zero, else ip4
- @param is_add - set vss if non-zero, else delete
-*/
-define dhcp_proxy_set_vss
-{
- u32 client_index;
- u32 context;
- u32 tbl_id;
- u32 oui;
- u32 fib_id;
- u8 is_ipv6;
- u8 is_add;
-};
-
-/** \brief DHCP proxy set / unset vss response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
-*/
-define dhcp_proxy_set_vss_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief Create loopback interface request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -834,40 +773,6 @@ define add_node_next_reply
u32 next_index;
};
-/** \brief DHCP Proxy config 2 add / del request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param rx_vrf_id - receive vrf id
- @param server_vrf_id - server vrf id
- @param if_ipv6 - ipv6 if non-zero, else ipv4
- @param is_add - add the config if non-zero, else delete
- @param insert_circuit_id - option82 suboption 1 fib number
- @param dhcp_server[] - server address
- @param dhcp_src_address[] - <fix this, need details>
-*/
-define dhcp_proxy_config_2
-{
- u32 client_index;
- u32 context;
- u32 rx_vrf_id;
- u32 server_vrf_id;
- u8 is_ipv6;
- u8 is_add;
- u8 insert_circuit_id;
- u8 dhcp_server[16];
- u8 dhcp_src_address[16];
-};
-
-/** \brief DHCP Proxy config 2 add / del response
- @param context - sender context, to match reply w/ request
- @param retval - return code for request
-*/
-define dhcp_proxy_config_2_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief L2 interface ethernet flow point filtering enable/disable request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -1083,37 +988,6 @@ define ip6_nd_event
u8 mac_ip;
};
-/** \brief DHCP Client config add / del request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param sw_if_index - index of the interface for DHCP client
- @param hostname - hostname
- @param is_add - add the config if non-zero, else delete
- @param want_dhcp_event - DHCP event sent to the sender
- via dhcp_compl_event API message if non-zero
- @param pid - sender's pid
-*/
-define dhcp_client_config
-{
- u32 client_index;
- u32 context;
- u32 sw_if_index;
- u8 hostname[64];
- u8 is_add;
- u8 want_dhcp_event;
- u32 pid;
-};
-
-/** \brief DHCP Client config response
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
-*/
-define dhcp_client_config_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief Set/unset input ACL interface
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -1146,25 +1020,6 @@ define input_acl_set_interface_reply
i32 retval;
};
-/** \brief Tell client about a DHCP completion event
- @param client_index - opaque cookie to identify the sender
- @param pid - client pid registered to receive notification
- @param is_ipv6 - if non-zero the address is ipv6, else ipv4
- @param host_address - Host IP address
- @param router_address - Router IP address
- @param host_mac - Host MAC address
-*/
-define dhcp_compl_event
-{
- u32 client_index;
- u32 pid;
- u8 hostname[64];
- u8 is_ipv6;
- u8 host_address[16];
- u8 router_address[16];
- u8 host_mac[6];
-};
-
/** \brief cop: enable/disable junk filtration features on an interface
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request