2 *------------------------------------------------------------------
3 * sctp_api.c - sctp-layer API
5 * Copyright (c) 2018 SUSE LLC.
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:
10 * http://www.apache.org/licenses/LICENSE-2.0
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 *------------------------------------------------------------------
20 #include <vlib/vlib.h>
21 #include <vlibapi/api.h>
22 #include <vlibmemory/api.h>
24 #include <sctp/sctp.h>
26 #include <sctp/sctp.api_enum.h>
27 #include <sctp/sctp.api_types.h>
29 #define REPLY_MSG_ID_BASE sctp_main.msg_id_base
30 #include <vlibapi/api_helper_macros.h>
33 vl_api_sctp_add_src_dst_connection_t_handler
34 (vl_api_sctp_add_src_dst_connection_t * mp)
36 vlib_main_t *vm = vlib_get_main ();
37 vl_api_sctp_add_src_dst_connection_reply_t *rmp;
41 rv = sctp_sub_connection_add_ip6
43 (ip6_address_t *) mp->src_address, (ip6_address_t *) mp->dst_address);
45 rv = sctp_sub_connection_add_ip4
47 (ip4_address_t *) mp->src_address, (ip4_address_t *) mp->dst_address);
49 REPLY_MACRO (VL_API_SCTP_ADD_SRC_DST_CONNECTION_REPLY);
53 vl_api_sctp_del_src_dst_connection_t_handler
54 (vl_api_sctp_del_src_dst_connection_t * mp)
56 vl_api_sctp_del_src_dst_connection_reply_t *rmp;
60 rv = sctp_sub_connection_del_ip6
61 ((ip6_address_t *) mp->src_address, (ip6_address_t *) mp->dst_address);
63 rv = sctp_sub_connection_del_ip4
64 ((ip4_address_t *) mp->src_address, (ip4_address_t *) mp->dst_address);
66 REPLY_MACRO (VL_API_SCTP_ADD_SRC_DST_CONNECTION_REPLY);
70 vl_api_sctp_config_t_handler (vl_api_sctp_config_t * mp)
72 sctp_user_configuration_t config;
73 vl_api_sctp_config_reply_t *rmp;
76 config.never_delay_sack = mp->never_delay_sack;
77 config.never_bundle = mp->never_bundle;
78 rv = sctp_configure (config);
80 REPLY_MACRO (VL_API_SCTP_CONFIG_REPLY);
83 #include <sctp/sctp.api.c>
85 sctp_plugin_api_hookup (vlib_main_t * vm)
87 /* Ask for a correctly-sized block of API message decode slots */
88 sctp_main.msg_id_base = setup_message_id_table ();
94 * fd.io coding-style-patch-verification: ON
97 * eval: (c-set-style "gnu")