Neale Ranns | cbe25aa | 2019-09-30 10:53:31 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 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. |
| 14 | */ |
| 15 | |
Neale Ranns | f7040f0 | 2022-02-15 09:02:27 +0000 | [diff] [blame] | 16 | #include <vnet/vnet.h> |
Neale Ranns | cbe25aa | 2019-09-30 10:53:31 +0000 | [diff] [blame] | 17 | #include <vnet/ip6-nd/rd_cp.h> |
| 18 | |
| 19 | #include <vlibapi/api.h> |
| 20 | #include <vlibmemory/api.h> |
| 21 | |
| 22 | /* define message IDs */ |
| 23 | #include <vnet/format_fns.h> |
| 24 | #include <vnet/ip6-nd/rd_cp.api_enum.h> |
| 25 | #include <vnet/ip6-nd/rd_cp.api_types.h> |
| 26 | |
| 27 | /** |
| 28 | * Base message ID fot the plugin |
| 29 | */ |
| 30 | static u32 rd_cp_base_msg_id; |
| 31 | #define REPLY_MSG_ID_BASE rd_cp_base_msg_id |
| 32 | |
| 33 | #include <vlibapi/api_helper_macros.h> |
| 34 | |
| 35 | |
| 36 | static void |
| 37 | vl_api_ip6_nd_address_autoconfig_t_handler (vl_api_ip6_nd_address_autoconfig_t |
| 38 | * mp) |
| 39 | { |
| 40 | vl_api_ip6_nd_address_autoconfig_reply_t *rmp; |
| 41 | u32 sw_if_index; |
| 42 | int rv = 0; |
| 43 | |
| 44 | VALIDATE_SW_IF_INDEX (mp); |
| 45 | |
| 46 | sw_if_index = ntohl (mp->sw_if_index); |
| 47 | |
| 48 | rv = rd_cp_set_address_autoconfig (sw_if_index, |
| 49 | mp->enable, mp->install_default_routes); |
| 50 | |
| 51 | BAD_SW_IF_INDEX_LABEL; |
| 52 | |
| 53 | REPLY_MACRO (VL_API_IP6_ND_ADDRESS_AUTOCONFIG_REPLY); |
| 54 | } |
| 55 | |
| 56 | #include <vnet/ip6-nd/rd_cp.api.c> |
| 57 | |
| 58 | static clib_error_t * |
| 59 | rd_cp_api_init (vlib_main_t * vm) |
| 60 | { |
| 61 | rd_cp_base_msg_id = setup_message_id_table (); |
| 62 | |
| 63 | return (NULL); |
| 64 | } |
| 65 | |
| 66 | VLIB_INIT_FUNCTION (rd_cp_api_init); |
| 67 | |
| 68 | /* |
| 69 | * fd.io coding-style-patch-verification: ON |
| 70 | * |
| 71 | * Local Variables: |
| 72 | * eval: (c-set-style "gnu") |
| 73 | * End: |
| 74 | */ |