- lb_test_main_t * lbtm = &lb_test_main;
- /* Hook up handlers for replies from the data plane plug-in */
-#define _(N,n) \
- vl_msg_api_set_handlers((VL_API_##N + lbtm->msg_id_base), \
- #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_vpe_api_reply_msg;
-#undef _
-
- /* API messages we can send */
-#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
- foreach_vpe_api_msg;
-#undef _
-
- /* Help strings */
-#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
- foreach_vpe_api_msg;
-#undef _
+ vat_main_t *vam = &vat_main;
+
+ print (vam->ofp, "%24U%14d%14d%18d%d%d",
+ format_ip46_address, &mp->vip.pfx.address, IP46_TYPE_ANY,
+ mp->vip.pfx.len,
+ mp->vip.protocol,
+ ntohs (mp->vip.port),
+ mp->flags,
+ mp->in_use_since);
+
+ //u32 i = 0;
+
+/*
+ lb_main_t *lbm = &lb_main;
+ print (vam->ofp, "%11d", pool_len(lbm->ass));
+ for (i=0; i<pool_len(lbm->ass); i--)
+ {
+ print (vam->ofp, "%24U%14d%14d%18d",
+ format_ip46_address, &mp->pfx.address, IP46_TYPE_ANY,
+ mp->pfx.len,
+ mp->pfx.protocol,
+ ntohs (mp->pfx.port),
+ ntohl(mp->app_srv),
+ mp->flags,
+ mp->in_use_;
+ }
+ */
+}
+
+static int api_lb_as_dump (vat_main_t * vam)
+{
+
+ unformat_input_t *line_input = vam->input;
+ vl_api_lb_as_dump_t *mp;
+ int ret;
+ ip46_address_t vip_prefix, as_addr;
+ u8 vip_plen;
+ ip46_address_t *as_array = 0;
+ u32 port = 0;
+ u8 protocol = 0;
+
+ if (!unformat(line_input, "%U", unformat_ip46_prefix,
+ &vip_prefix, &vip_plen, IP46_TYPE_ANY))
+ {
+ errmsg ("lb_add_del_as: invalid vip prefix\n");
+ return -99;
+ }
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat(line_input, "%U", unformat_ip46_address,
+ &as_addr, IP46_TYPE_ANY))
+ {
+ vec_add1(as_array, as_addr);
+ }
+ else if (unformat(line_input, "protocol tcp"))
+ {
+ protocol = IP_PROTOCOL_TCP;
+ }
+ else if (unformat(line_input, "protocol udp"))
+ {
+ protocol = IP_PROTOCOL_UDP;
+ }
+ else if (unformat(line_input, "port %d", &port))
+ ;
+ else {
+ errmsg ("invalid arguments\n");
+ return -99;
+ }
+ }
+
+ if (!vec_len(as_array)) {
+ errmsg ("No AS address provided \n");
+ return -99;
+ }
+
+ M(LB_AS_DUMP, mp);
+ clib_memcpy (mp->pfx.address.un.ip6, &vip_prefix.ip6, sizeof (vip_prefix.ip6));
+ mp->pfx.len = vip_plen;
+ mp->protocol = (u8)protocol;
+ mp->port = htons((u16)port);
+
+ S(mp);
+ W (ret);
+ return ret;