Simple example showing the path entry-point feature.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static void r1_route_cb(
void *cls,
struct sg_route *route) {
fprintf(stdout,
"%s: %s\n",
sg_route_path(route), (
const char *) cls);
fflush(stdout);
}
static void r2_route_cb(
void *cls,
struct sg_route *route) {
fprintf(stdout,
"%s: %s\n",
sg_route_path(route), (
const char *) cls);
fflush(stdout);
}
int main(void) {
struct sg_route *rts1 = NULL, *rts2 = NULL;
return EXIT_SUCCESS;
}
int sg_router_dispatch(struct sg_router *router, const char *path, void *user_data)
int sg_entrypoints_add(struct sg_entrypoints *entrypoints, const char *path, void *user_data)
int sg_routes_cleanup(struct sg_route **routes)
int sg_entrypoints_find(struct sg_entrypoints *entrypoints, struct sg_entrypoint **entrypoint, const char *path)
const char * sg_route_path(struct sg_route *route)
void * sg_entrypoint_user_data(struct sg_entrypoint *entrypoint)
struct sg_router * sg_router_new(struct sg_route *routes) __attribute__((malloc))
bool sg_routes_add(struct sg_route **routes, const char *pattern, sg_route_cb cb, void *cls)
void sg_router_free(struct sg_router *router)
void sg_entrypoints_free(struct sg_entrypoints *entrypoints)
struct sg_entrypoints * sg_entrypoints_new(void) __attribute__((malloc))