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));
143 send_stn_rules_details (r, reg, mp->context);
150 #define foreach_stn_plugin_api_msg \ 151 _(STN_ADD_DEL_RULE, stn_add_del_rule) \ 152 _(STN_RULES_DUMP, stn_rules_dump) 164 vl_msg_api_set_handlers((VL_API_##N + stn->msg_id_base), \ 166 vl_api_##n##_t_handler, \ 168 vl_api_##n##_t_endian, \ 169 vl_api_##n##_t_print, \ 170 sizeof(vl_api_##n##_t), 1); 177 #define vl_msg_name_crc_list 178 #include <stn/stn.api.h> 179 #undef vl_msg_name_crc_list 184 #define _(id,n,crc) \ 185 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + stn->msg_id_base); 186 foreach_vl_msg_name_crc_stn;
193 #define _(n,f) api_main.msg_print_handlers \ 194 [VL_API_##n + stn->msg_id_base] \ 195 = (void *) vl_api_##f##_t_print; 206 name =
format (0,
"stn_%08x%c", api_version, 0);
static void setup_message_id_table(stn_main_t *stn, api_main_t *am)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
u32 sw_if_index
TX interface to send packets to.
int stn_rule_add_del(stn_rule_add_del_args_t *args)
Add or delete an stn rule.
void * vl_msg_api_alloc(int nbytes)
ip46_address_t address
Destination address of intercepted packets.
memset(h->entries, 0, sizeof(h->entries[0])*entries)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
u8 del
Whether to delete the rule.
static void vl_api_stn_add_del_rule_t_handler(vl_api_stn_add_del_rule_t *mp)
STN response to rules request.
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)
An API client registration, only in vpp/vlib.
#define vec_free(V)
Free vector's memory (no header).
#define clib_memcpy(a, b, c)
static vl_api_registration_t * vl_api_client_index_to_registration(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.
#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
static void send_stn_rules_details(stn_rule_t *r, vl_api_registration_t *reg, u32 context)
u16 vl_msg_api_get_msg_ids(const char *name, int n)