// SPDX-License-Identifier: Apache-2.0 // Copyright(c) 2023 Cisco Systems, Inc. #include #include #include #include #include #include #include #include #include npt66_main_t npt66_main; /* * This file contains the API handlers for the pnat.api */ #define REPLY_MSG_ID_BASE npt66_main.msg_id_base #include static void vl_api_npt66_binding_add_del_t_handler (vl_api_npt66_binding_add_del_t *mp) { vl_api_npt66_binding_add_del_reply_t *rmp; int rv; clib_warning ("Interface index: %d", mp->sw_if_index); VALIDATE_SW_IF_INDEX_END (mp); rv = npt66_binding_add_del ( mp->sw_if_index, (ip6_address_t *) &mp->internal.address, mp->internal.len, (ip6_address_t *) &mp->external.address, mp->external.len, mp->is_add); bad_sw_if_index: REPLY_MACRO_END (VL_API_NPT66_BINDING_ADD_DEL_REPLY); } /* API definitions */ #include #include /* Set up the API message handling tables */ clib_error_t * npt66_plugin_api_hookup (vlib_main_t *vm) { npt66_main_t *nm = &npt66_main; nm->msg_id_base = setup_message_id_table (); return 0; } /* * Register the plugin and hook up the API */ #include VLIB_PLUGIN_REGISTER () = { .version = VPP_BUILD_VER, .description = "NPTv6", .default_disabled = 1, }; clib_error_t * npt66_init (vlib_main_t *vm) { npt66_main_t *nm = &npt66_main; memset (nm, 0, sizeof (*nm)); return npt66_plugin_api_hookup (vm); } VLIB_INIT_FUNCTION (npt66_init);