API refactoring : dhcp 61/4861/5
authorPavel Kotucek <pkotucek@cisco.com>
Wed, 25 Jan 2017 06:25:32 +0000 (07:25 +0100)
committerDamjan Marion <dmarion.lists@gmail.com>
Thu, 26 Jan 2017 08:23:47 +0000 (08:23 +0000)
Change-Id: I3829835ed2126e51e96690c907deac623dc77151
Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
src/vnet.am
src/vnet/dhcp/dhcp.api [new file with mode: 0644]
src/vnet/dhcp/dhcp_api.c [new file with mode: 0644]
src/vnet/vnet_all_api_h.h
src/vpp/api/api.c
src/vpp/api/vpe.api

index 669ea1f..c692249 100644 (file)
@@ -657,10 +657,14 @@ endif
 ########################################
 libvnet_la_SOURCES +=                          \
  vnet/dhcp/client.c                            \
- vnet/dhcp/client.h
+ vnet/dhcp/client.h                            \
+ vnet/dhcp/dhcp_api.c
 
 nobase_include_HEADERS +=                      \
- vnet/dhcp/client.h
+ vnet/dhcp/client.h                                    \
+ vnet/dhcp/dhcp.api.h
+
+API_FILES += vnet/dhcp/dhcp.api
 
 ########################################
 # DHCP proxy
diff --git a/src/vnet/dhcp/dhcp.api b/src/vnet/dhcp/dhcp.api
new file mode 100644 (file)
index 0000000..c228cd0
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2015-2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** \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 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 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 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 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];
+};
+
+/*
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
\ No newline at end of file
diff --git a/src/vnet/dhcp/dhcp_api.c b/src/vnet/dhcp/dhcp_api.c
new file mode 100644 (file)
index 0000000..88b32b2
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ *------------------------------------------------------------------
+ * dhcp_api.c - dhcp api
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <vnet/vnet.h>
+#include <vlibmemory/api.h>
+
+#include <vnet/interface.h>
+#include <vnet/api_errno.h>
+#include <vnet/dhcp/proxy.h>
+#include <vnet/dhcp/client.h>
+#include <vnet/dhcpv6/proxy.h>
+
+#include <vnet/vnet_msg_enum.h>
+
+#define vl_typedefs            /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_typedefs
+
+#define vl_endianfun           /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_endianfun
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define vl_printfun
+#include <vnet/vnet_all_api_h.h>
+#undef vl_printfun
+
+#include <vlibapi/api_helper_macros.h>
+
+#define foreach_vpe_api_msg                       \
+_(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)
+
+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);
+}
+
+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_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);
+}
+
+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);
+}
+
+/*
+ * dhcp_api_hookup
+ * Add vpe's API message handlers to the table.
+ * vlib has alread mapped shared memory and
+ * added the client registration handlers.
+ * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
+ */
+#define vl_msg_name_crc_list
+#include <vnet/vnet_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (api_main_t * am)
+{
+#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
+  foreach_vl_msg_name_crc_dhcp;
+#undef _
+}
+
+static clib_error_t *
+dhcp_api_hookup (vlib_main_t * vm)
+{
+  api_main_t *am = &api_main;
+
+#define _(N,n)                                                  \
+    vl_msg_api_set_handlers(VL_API_##N, #n,                     \
+                           vl_api_##n##_t_handler,              \
+                           vl_noop_handler,                     \
+                           vl_api_##n##_t_endian,               \
+                           vl_api_##n##_t_print,                \
+                           sizeof(vl_api_##n##_t), 1);
+  foreach_vpe_api_msg;
+#undef _
+
+  /*
+   * Set up the (msg_name, crc, message-id) table
+   */
+  setup_message_id_table (am);
+
+  return 0;
+}
+
+VLIB_API_INIT_FUNCTION (dhcp_api_hookup);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
index d76eee5..4ba3a0e 100644 (file)
@@ -54,6 +54,7 @@
 #include <vnet/sr/sr.api.h>
 #include <vnet/classify/classify.api.h>
 #include <vnet/flow/flow.api.h>
+#include <vnet/dhcp/dhcp.api.h>
 
 /*
  * fd.io coding-style-patch-verification: ON
index 9f6f260..6317f55 100644 (file)
 #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)
 {
index a00033c..3a35a54 100644 (file)
@@ -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