1/*
2 *------------------------------------------------------------------
3 * dhcp_api.c - dhcp api
4 *
5 * Copyright (c) 2016 Cisco and/or its affiliates.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *------------------------------------------------------------------
18 */
19
20#include <vnet/vnet.h>
21#include <vlibmemory/api.h>
22
23#include <dhcp/dhcp6_ia_na_client_dp.h>
24
25/* define message IDs */
26#include <vnet/format_fns.h>
27#include <dhcp/dhcp6_ia_na_client_cp.api_enum.h>
28#include <dhcp/dhcp6_ia_na_client_cp.api_types.h>
29
30/**
31 * Base message ID fot the plugin
32 */
33static u32 dhcp_base_msg_id;
34#define REPLY_MSG_ID_BASE dhcp_base_msg_id
35
36#include <vlibapi/api_helper_macros.h>
37
38static void
39  vl_api_dhcp6_client_enable_disable_t_handler
40  (vl_api_dhcp6_client_enable_disable_t * mp)
41{
42  vl_api_dhcp6_client_enable_disable_reply_t *rmp;
43  u32 sw_if_index;
44  int rv = 0;
45
46  VALIDATE_SW_IF_INDEX (mp);
47
48  sw_if_index = ntohl (mp->sw_if_index);
49
50  rv = dhcp6_client_enable_disable (sw_if_index, mp->enable);
51
52  BAD_SW_IF_INDEX_LABEL;
53
54  REPLY_MACRO (VL_API_DHCP6_CLIENT_ENABLE_DISABLE_REPLY);
55}
56
57#define vl_msg_name_crc_list
58#include <dhcp/dhcp6_ia_na_client_cp.api.c>
59#undef vl_msg_name_crc_list
60
61static clib_error_t *
62dhcp_ia_na_client_cp_api_init (vlib_main_t * vm)
63{
64  /*
65   * Set up the (msg_name, crc, message-id) table
66   */
67  dhcp_base_msg_id = setup_message_id_table ();
68
69  return 0;
70}
71
72VLIB_INIT_FUNCTION (dhcp_ia_na_client_cp_api_init);
73
74/*
75 * fd.io coding-style-patch-verification: ON
76 *
77 * Local Variables:
78 * eval: (c-set-style "gnu")
79 * End:
80 */
81