38 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 44 #define vl_api_version(n,v) static u32 api_version=(v); 48 #define REPLY_MSG_ID_BASE stn_main.msg_id_base 54 vl_print (handle, (char *)s); \ 69 s =
format (0,
"SCRIPT: stn_add_del_rule ");
83 vl_api_stn_add_del_rule_reply_t *rmp;
110 memset (rmp, 0,
sizeof (*rmp));
145 send_stn_rule (r, q, mp->context);
152 #define foreach_stn_plugin_api_msg \ 153 _(STN_ADD_DEL_RULE, stn_add_del_rule) \ 154 _(STN_RULES_DUMP, stn_rules_dump) 166 vl_msg_api_set_handlers((VL_API_##N + stn->msg_id_base), \ 168 vl_api_##n##_t_handler, \ 170 vl_api_##n##_t_endian, \ 171 vl_api_##n##_t_print, \ 172 sizeof(vl_api_##n##_t), 1); 179 #define vl_msg_name_crc_list 180 #include <stn/stn.api.h> 181 #undef vl_msg_name_crc_list 186 #define _(id,n,crc) \ 187 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + stn->msg_id_base); 188 foreach_vl_msg_name_crc_stn;
195 #define _(n,f) api_main.msg_print_handlers \ 196 [VL_API_##n + stn->msg_id_base] \ 197 = (void *) vl_api_##f##_t_print; 208 name =
format (0,
"stn_%08x%c", api_version, 0);
u16 vl_msg_api_get_msg_ids(const char *name, int n)
static void setup_message_id_table(stn_main_t *stn, api_main_t *am)
u32 sw_if_index
TX interface to send packets to.
STN response to rules request.
int stn_rule_add_del(stn_rule_add_del_args_t *args)
Add or delete an stn rule.
ip46_address_t address
Destination address of intercepted packets.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
u8 del
Whether to delete the rule.
void * vl_msg_api_alloc(int nbytes)
static void vl_api_stn_add_del_rule_t_handler(vl_api_stn_add_del_rule_t *mp)
static void vl_api_stn_rules_dump_t_handler(vl_api_stn_rules_dump_t *mp)
static void plugin_custom_dump_configure(stn_main_t *stn)
API main structure, used by both vpp and binary API clients.
#define ip46_address_is_ip4(ip46)
static void send_stn_rule(stn_rule_t *r, unix_shared_memory_queue_t *q, u32 context)
#define vec_free(V)
Free vector's memory (no header).
#define clib_memcpy(a, b, c)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void * vl_api_stn_add_del_rule_t_print(vl_api_stn_add_del_rule_t *mp, void *handle)
API message custom-dump function.
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
#define ip46_address_set_ip4(ip46, ip)
static clib_error_t * stn_plugin_api_hookup(vlib_main_t *vm)
Set up the API message handling tables.
clib_error_t * stn_api_init(vlib_main_t *vm, stn_main_t *sm)
#define foreach_stn_plugin_api_msg
struct _unix_shared_memory_queue unix_shared_memory_queue_t