23 #include <vpp/app/version.h> 40 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 46 #define vl_api_version(n,v) static u32 api_version=(v); 52 #define IKEV2_PLUGIN_VERSION_MAJOR 1 53 #define IKEV2_PLUGIN_VERSION_MINOR 0 54 #define REPLY_MSG_ID_BASE ikev2_main.msg_id_base 57 #define foreach_ikev2_api_msg \ 58 _(IKEV2_PLUGIN_GET_VERSION, ikev2_plugin_get_version) \ 59 _(IKEV2_PROFILE_ADD_DEL, ikev2_profile_add_del) \ 60 _(IKEV2_PROFILE_SET_AUTH, ikev2_profile_set_auth) \ 61 _(IKEV2_PROFILE_SET_ID, ikev2_profile_set_id) \ 62 _(IKEV2_PROFILE_SET_TS, ikev2_profile_set_ts) \ 63 _(IKEV2_SET_LOCAL_KEY, ikev2_set_local_key) \ 64 _(IKEV2_SET_RESPONDER, ikev2_set_responder) \ 65 _(IKEV2_SET_IKE_TRANSFORMS, ikev2_set_ike_transforms) \ 66 _(IKEV2_SET_ESP_TRANSFORMS, ikev2_set_esp_transforms) \ 67 _(IKEV2_SET_SA_LIFETIME, ikev2_set_sa_lifetime) \ 68 _(IKEV2_INITIATE_SA_INIT, ikev2_initiate_sa_init) \ 69 _(IKEV2_INITIATE_DEL_IKE_SA, ikev2_initiate_del_ike_sa) \ 70 _(IKEV2_INITIATE_DEL_CHILD_SA, ikev2_initiate_del_child_sa) \ 71 _(IKEV2_INITIATE_REKEY_CHILD_SA, ikev2_initiate_rekey_child_sa) 79 int msg_size =
sizeof (*rmp);
89 ntohs (VL_API_IKEV2_PLUGIN_GET_VERSION_REPLY + im->
msg_id_base);
100 vl_api_ikev2_profile_add_del_reply_t *rmp;
110 rv = VNET_API_ERROR_UNSPECIFIED;
112 rv = VNET_API_ERROR_UNIMPLEMENTED;
122 vl_api_ikev2_profile_set_auth_reply_t *rmp;
128 int data_len = ntohl (mp->
data_len);
136 rv = VNET_API_ERROR_UNSPECIFIED;
138 rv = VNET_API_ERROR_UNIMPLEMENTED;
147 vl_api_ikev2_profile_add_del_reply_t *rmp;
154 int data_len = ntohl (mp->
data_len);
161 rv = VNET_API_ERROR_UNSPECIFIED;
163 rv = VNET_API_ERROR_UNIMPLEMENTED;
172 vl_api_ikev2_profile_set_ts_reply_t *rmp;
184 rv = VNET_API_ERROR_UNSPECIFIED;
186 rv = VNET_API_ERROR_UNIMPLEMENTED;
195 vl_api_ikev2_profile_set_ts_reply_t *rmp;
204 rv = VNET_API_ERROR_UNSPECIFIED;
206 rv = VNET_API_ERROR_UNIMPLEMENTED;
215 vl_api_ikev2_set_responder_reply_t *rmp;
229 rv = VNET_API_ERROR_UNSPECIFIED;
231 rv = VNET_API_ERROR_UNIMPLEMENTED;
241 vl_api_ikev2_set_ike_transforms_reply_t *rmp;
255 rv = VNET_API_ERROR_UNSPECIFIED;
257 rv = VNET_API_ERROR_UNIMPLEMENTED;
260 REPLY_MACRO (VL_API_IKEV2_SET_IKE_TRANSFORMS_REPLY);
267 vl_api_ikev2_set_esp_transforms_reply_t *rmp;
281 rv = VNET_API_ERROR_UNSPECIFIED;
283 rv = VNET_API_ERROR_UNIMPLEMENTED;
286 REPLY_MACRO (VL_API_IKEV2_SET_ESP_TRANSFORMS_REPLY);
292 vl_api_ikev2_set_sa_lifetime_reply_t *rmp;
306 rv = VNET_API_ERROR_UNSPECIFIED;
308 rv = VNET_API_ERROR_UNIMPLEMENTED;
317 vl_api_ikev2_initiate_sa_init_reply_t *rmp;
329 rv = VNET_API_ERROR_UNSPECIFIED;
331 rv = VNET_API_ERROR_UNIMPLEMENTED;
341 vl_api_ikev2_initiate_del_ike_sa_reply_t *rmp;
350 rv = VNET_API_ERROR_UNSPECIFIED;
352 rv = VNET_API_ERROR_UNIMPLEMENTED;
355 REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_IKE_SA_REPLY);
362 vl_api_ikev2_initiate_del_child_sa_reply_t *rmp;
371 rv = VNET_API_ERROR_UNSPECIFIED;
373 rv = VNET_API_ERROR_UNIMPLEMENTED;
376 REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_CHILD_SA_REPLY);
383 vl_api_ikev2_initiate_rekey_child_sa_reply_t *rmp;
392 rv = VNET_API_ERROR_UNSPECIFIED;
394 rv = VNET_API_ERROR_UNIMPLEMENTED;
397 REPLY_MACRO (VL_API_IKEV2_INITIATE_REKEY_CHILD_SA_REPLY);
407 #define vl_msg_name_crc_list 409 #undef vl_msg_name_crc_list 414 #define _(id,n,crc) \ 415 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + im->msg_id_base); 416 foreach_vl_msg_name_crc_ikev2;
425 vl_msg_api_set_handlers(VL_API_##N + im->msg_id_base, #n, \ 426 vl_api_##n##_t_handler, \ 428 vl_api_##n##_t_endian, \ 429 vl_api_##n##_t_print, \ 430 sizeof(vl_api_##n##_t), 1); 444 name =
format (0,
"ikev2_%08x%c", api_version, 0);
clib_error_t * ikev2_set_profile_responder(vlib_main_t *vm, u8 *name, u32 sw_if_index, ip4_address_t ip4)
static void vl_api_ikev2_initiate_rekey_child_sa_t_handler(vl_api_ikev2_initiate_rekey_child_sa_t *mp)
IKEv2: Set Child SA lifetime, limited by time and/or data.
clib_error_t * ikev2_add_del_profile(vlib_main_t *vm, u8 *name, int is_add)
IKEv2: Add/delete profile.
clib_error_t * ikev2_initiate_delete_ike_sa(vlib_main_t *vm, u64 ispi)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
clib_error_t * ikev2_set_profile_sa_lifetime(vlib_main_t *vm, u8 *name, u64 lifetime, u32 jitter, u32 handover, u64 maxdata)
static void vl_api_ikev2_initiate_sa_init_t_handler(vl_api_ikev2_initiate_sa_init_t *mp)
static void vl_api_ikev2_set_sa_lifetime_t_handler(vl_api_ikev2_set_sa_lifetime_t *mp)
void * vl_msg_api_alloc(int nbytes)
static void vl_api_ikev2_initiate_del_ike_sa_t_handler(vl_api_ikev2_initiate_del_ike_sa_t *mp)
#define clib_memcpy(d, s, n)
static void vl_api_ikev2_plugin_get_version_t_handler(vl_api_ikev2_plugin_get_version_t *mp)
static void vl_api_ikev2_set_local_key_t_handler(vl_api_ikev2_set_local_key_t *mp)
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * ikev2_plugin_api_hookup(vlib_main_t *vm)
clib_error_t * ikev2_initiate_sa_init(vlib_main_t *vm, u8 *name)
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
#define foreach_ikev2_api_msg
clib_error_t * ikev2_set_profile_auth(vlib_main_t *vm, u8 *name, u8 auth_method, u8 *auth_data, u8 data_hex_format)
IKEv2: Initiate the delete Child SA exchange.
clib_error_t * ikev2_set_profile_esp_transforms(vlib_main_t *vm, u8 *name, ikev2_transform_encr_type_t crypto_alg, ikev2_transform_integ_type_t integ_alg, ikev2_transform_dh_type_t dh_type, u32 crypto_key_size)
IKEv2: Set IKEv2 profile local/remote identification.
static void vl_api_ikev2_profile_set_ts_t_handler(vl_api_ikev2_profile_set_ts_t *mp)
IKEv2: Set IKEv2 profile traffic selector parameters.
static void vl_api_ikev2_set_ike_transforms_t_handler(vl_api_ikev2_set_ike_transforms_t *mp)
clib_error_t * ikev2_set_profile_id(vlib_main_t *vm, u8 *name, u8 id_type, u8 *data, int is_local)
IKEv2: Initiate the rekey Child SA exchange.
clib_error_t * ikev2_initiate_delete_child_sa(vlib_main_t *vm, u32 ispi)
static void vl_api_ikev2_set_responder_t_handler(vl_api_ikev2_set_responder_t *mp)
clib_error_t * ikev2_set_local_key(vlib_main_t *vm, u8 *file)
clib_error_t * ikev2_set_profile_ts(vlib_main_t *vm, u8 *name, u8 protocol_id, u16 start_port, u16 end_port, ip4_address_t start_addr, ip4_address_t end_addr, int is_local)
API main structure, used by both vpp and binary API clients.
An API client registration, only in vpp/vlib.
clib_error_t * ikev2_initiate_rekey_child_sa(vlib_main_t *vm, u32 ispi)
static void vl_api_ikev2_initiate_del_child_sa_t_handler(vl_api_ikev2_initiate_del_child_sa_t *mp)
#define vec_free(V)
Free vector's memory (no header).
IKEv2: Initiate the SA_INIT exchange.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
IKEv2: Set IKEv2 responder interface and IP address.
IKEv2: Initiate the delete IKE SA exchange.
IKEv2: Set IKEv2 profile authentication method.
static void vl_api_ikev2_profile_set_auth_t_handler(vl_api_ikev2_profile_set_auth_t *mp)
static vlib_main_t * vlib_get_main(void)
#define IKEV2_PLUGIN_VERSION_MINOR
#define IKEV2_PLUGIN_VERSION_MAJOR
IKEv2: Set IKEv2 local RSA private key.
static void vl_api_ikev2_profile_set_id_t_handler(vl_api_ikev2_profile_set_id_t *mp)
clib_error_t * ikev2_set_profile_ike_transforms(vlib_main_t *vm, u8 *name, ikev2_transform_encr_type_t crypto_alg, ikev2_transform_integ_type_t integ_alg, ikev2_transform_dh_type_t dh_type, u32 crypto_key_size)
static void vl_api_ikev2_set_esp_transforms_t_handler(vl_api_ikev2_set_esp_transforms_t *mp)
static void setup_message_id_table(ikev2_main_t *im, api_main_t *am)
static void vl_api_ikev2_profile_add_del_t_handler(vl_api_ikev2_profile_add_del_t *mp)
Reply to get the plugin version.
static clib_error_t * ikev2_api_init(vlib_main_t *vm)
u16 vl_msg_api_get_msg_ids(const char *name, int n)