Example #1
0
void vlog_init(struct agent_core_t *core)
{
	struct agent_plugin_t *plug;
	struct vlog_priv_t *priv = malloc(sizeof(struct vlog_priv_t));
	plug = plugin_find(core,"vlog");
	assert(plug);
	plug->data = priv;

	httpd_register_url(core, "/log", M_GET, vlog_reply, core);
}
Example #2
0
File: html.c Project: rrana/vagent2
void
html_init(struct agent_core_t *core)
{
	struct agent_plugin_t *plug;
	struct html_priv_t *priv = malloc(sizeof(struct html_priv_t));
	plug = plugin_find(core,"html");
	
	priv->logger = ipc_register(core,"logger");
	plug->data = (void *)priv;
	plug->start = NULL;
	httpd_register_url(core, "/html/", M_GET, html_reply, core);
}
Example #3
0
void echo_init(struct agent_core_t *core)
{
	/*
	 * Allocate the private data structure we'll keep using.
	 */
	struct echo_priv_t *priv = malloc(sizeof(struct echo_priv_t));

	/*
	 * Find our pre-allocated data structure. This is only used to
	 * define start-functions (which we don't have), module-specific
	 * private data and an IPC for the module (which we don't use).
	 */
	struct agent_plugin_t *plug;
	plug = plugin_find(core,"echo");
	assert(plug);

	/*
	 * Register with the logger.
	 */	
	priv->logger = ipc_register(core,"logger");
	
	/*
	 * Store our private data somewhere we can reach it, and set our
	 * start function to NULL since echo is only triggered by HTTP
	 * requests.
	 */
	plug->data = (void *)priv;
	plug->start = NULL;

	/*
	 * Register the url /echo for the methods POST, PUT and GET. When a
	 * request like that is encountered, the echo_reply function will
	 * be called with "priv" as the last argument.
	 */
	httpd_register_url(core, "/echo", M_POST | M_PUT | M_GET, echo_reply, priv);
}