pool_put (app_pool, app);
}
+static void
+application_verify_cb_fns (application_type_t type, session_cb_vft_t * cb_fns)
+{
+ if (type == APP_SERVER && cb_fns->session_accept_callback == 0)
+ clib_warning ("No accept callback function provided");
+ if (type == APP_CLIENT && cb_fns->session_connected_callback == 0)
+ clib_warning ("No session connected callback function provided");
+ if (cb_fns->session_disconnect_callback == 0)
+ clib_warning ("No session disconnect callback function provided");
+ if (cb_fns->session_reset_callback == 0)
+ clib_warning ("No session reset callback function provided");
+}
+
application_t *
application_new (application_type_t type, session_type_t sst,
u32 api_client_index, u32 flags, session_cb_vft_t * cb_fns)
app->flags = flags;
app->cb_fns = *cb_fns;
+ /* Check that the obvious things are properly set up */
+ application_verify_cb_fns (type, cb_fns);
+
/* Add app to lookup by api_client_index table */
application_table_add (app);
return pool_elt_at_index (app_pool, index);
}
+application_t *
+application_get_if_valid (u32 index)
+{
+ if (pool_is_free_index (app_pool, index))
+ return 0;
+
+ return pool_elt_at_index (app_pool, index);
+}
+
u32
application_get_index (application_t * app)
{
regp = vl_api_client_index_to_registration (srv->api_client_index);
if (!regp)
- server_name = format (0, "%s%c", regp->name, 0);
+ server_name = format (0, "builtin-%d%c", srv->index, 0);
else
server_name = regp->name;
show_app_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
+ session_manager_main_t *smm = &session_manager_main;
application_t *app;
int do_server = 0;
int do_client = 0;
int verbose = 0;
+ if (!smm->is_enabled)
+ {
+ clib_error_return (0, "session layer is not enabled");
+ }
+
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "server"))
/* *INDENT-ON* */
}
else
- vlib_cli_output (vm, "No active server bindings");
+ vlib_cli_output (vm, "No active client bindings");
}
return 0;
}
+/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_app_command, static) =
{
-.path = "show app",.short_help =
- "show app [server|client] [verbose]",.function = show_app_command_fn,};
+ .path = "show app",
+ .short_help = "show app [server|client] [verbose]",
+ .function = show_app_command_fn,
+};
+/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON