FD.io VPP  v19.01.2-3-gf61a1a8
Vector Packet Processing
sctp_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * sctp_api.c - vnet sctp-layer API
4  *
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:
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 <vnet/sctp/sctp.h>
24 
25 #include <vnet/vnet_msg_enum.h>
26 
27 #define vl_typedefs /* define message structures */
28 #include <vnet/vnet_all_api_h.h>
29 #undef vl_typedefs
30 
31 #define vl_endianfun /* define message structures */
32 #include <vnet/vnet_all_api_h.h>
33 #undef vl_endianfun
34 
35 /* instantiate all the print functions we know about */
36 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
37 #define vl_printfun
38 #include <vnet/vnet_all_api_h.h>
39 #undef vl_printfun
40 
42 
43 #define foreach_sctp_api_msg \
44 _(SCTP_ADD_SRC_DST_CONNECTION, sctp_add_src_dst_connection) \
45 _(SCTP_DEL_SRC_DST_CONNECTION, sctp_del_src_dst_connection) \
46 _(SCTP_CONFIG, sctp_config)
47 
48 static void
51 {
53  vl_api_sctp_add_src_dst_connection_reply_t *rmp;
54  int rv;
55 
56  if (mp->is_ipv6)
58  (vm,
60  else
62  (vm,
64 
65  REPLY_MACRO (VL_API_SCTP_ADD_SRC_DST_CONNECTION_REPLY);
66 }
67 
68 static void
71 {
72  vl_api_sctp_del_src_dst_connection_reply_t *rmp;
73  int rv;
74 
75  if (mp->is_ipv6)
78  else
81 
82  REPLY_MACRO (VL_API_SCTP_ADD_SRC_DST_CONNECTION_REPLY);
83 }
84 
85 static void
87 {
89  vl_api_sctp_config_reply_t *rmp;
90  int rv;
91 
92  config.never_delay_sack = mp->never_delay_sack;
93  config.never_bundle = mp->never_bundle;
94  rv = sctp_configure (config);
95 
96  REPLY_MACRO (VL_API_SCTP_CONFIG_REPLY);
97 }
98 
99 #define vl_msg_name_crc_list
100 #include <vnet/sctp/sctp.api.h>
101 #undef vl_msg_name_crc_list
102 
103 static void
105 {
106 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
107  foreach_vl_msg_name_crc_sctp;
108 #undef _
109 }
110 
111 static clib_error_t *
113 {
114  api_main_t *am = &api_main;
115 
116 #define _(N,n) \
117  vl_msg_api_set_handlers(VL_API_##N, #n, \
118  vl_api_##n##_t_handler, \
119  vl_noop_handler, \
120  vl_api_##n##_t_endian, \
121  vl_api_##n##_t_print, \
122  sizeof(vl_api_##n##_t), 1);
124 #undef _
125 
126  /*
127  * Set up the (msg_name, crc, message-id) table
128  */
130 
131  return 0;
132 }
133 
135 
136 void
138 {
139 }
140 
141 /*
142  * fd.io coding-style-patch-verification: ON
143  *
144  * Local Variables:
145  * eval: (c-set-style "gnu")
146  * End:
147  */
static void vl_api_sctp_add_src_dst_connection_t_handler(vl_api_sctp_add_src_dst_connection_t *mp)
Definition: sctp_api.c:50
static void setup_message_id_table(api_main_t *am)
Definition: sctp_api.c:104
#define foreach_sctp_api_msg
Definition: sctp_api.c:43
struct _sctp_user_configuration sctp_user_configuration_t
u8 sctp_configure(sctp_user_configuration_t config)
Definition: sctp.c:411
VLIB_API_INIT_FUNCTION(sctp_api_hookup)
u8 sctp_sub_connection_add_ip4(vlib_main_t *vm, ip4_address_t *lcl_addr, ip4_address_t *rmt_addr)
Definition: sctp.c:295
#define REPLY_MACRO(t)
void sctp_api_reference(void)
Definition: sctp_api.c:137
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:202
u8 sctp_sub_connection_del_ip4(ip4_address_t *lcl_addr, ip4_address_t *rmt_addr)
Definition: sctp.c:318
vlib_main_t * vm
Definition: buffer.c:301
static void vl_api_sctp_config_t_handler(vl_api_sctp_config_t *mp)
Definition: sctp_api.c:86
static void vl_api_sctp_del_src_dst_connection_t_handler(vl_api_sctp_del_src_dst_connection_t *mp)
Definition: sctp_api.c:70
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
static clib_error_t * sctp_api_hookup(vlib_main_t *vm)
Definition: sctp_api.c:112
u8 sctp_sub_connection_del_ip6(ip6_address_t *lcl_addr, ip6_address_t *rmt_addr)
Definition: sctp.c:375
u8 sctp_sub_connection_add_ip6(vlib_main_t *vm, ip6_address_t *lcl_addr, ip6_address_t *rmt_addr)
Definition: sctp.c:352
api_main_t api_main
Definition: api_shared.c:35
Configure SCTP source addresses, for active-open SCTP sessions.
Definition: sctp.api:28