router.c 777 Bytes
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <string.h>
#include "router.h"

typedef struct route {
    char *path;
    route_handler_t handler;
} route_t;

struct router {
    route_handler_t fallback;
    size_t max_routes;
    size_t num_routes;
    route_t routes[];
};

router_t *router_init(size_t max_routes, route_handler_t fallback) {
    (void) max_routes;
    (void) fallback;
    return NULL;
}

void router_register(router_t *router, const char *path, route_handler_t handler) {
    (void) router;
    (void) path;
    (void) handler;
}

bytes_t *router_dispatch(router_t *router, request_t *request) {
    (void) router;
    (void) request;
    return NULL;
}

void router_free(router_t *router) {
    (void) router;
}