C and C++ web framework.
http://rapida.vilor.one/docs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.0 KiB
54 lines
1.0 KiB
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
|
/* Copyright 2022 Ivan Polyakov */ |
|
|
|
/*! |
|
* \file route.h |
|
* \brief Route handler. |
|
*/ |
|
#ifndef RAPIDA_ROUTE_H_ENTRY |
|
#define RAPIDA_ROUTE_H_ENTRY |
|
|
|
#include "request.h" |
|
#include "response.h" |
|
#include "url.h" |
|
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
/*! |
|
* \brief Request handling callback type. |
|
* |
|
* \param req Resquest. |
|
* \param res Response. |
|
* \param userdata User data. |
|
*/ |
|
typedef void (*rpd_route_cb)(rpd_req *req, rpd_res *res, void *userdata); |
|
|
|
/*! |
|
* \brief Route struct. |
|
*/ |
|
typedef struct { |
|
rpd_url path; /**< Route path. */ |
|
rpd_route_cb cb; /**< Callback. */ |
|
void *userdata; /**< User data */ |
|
} rpd_route; |
|
|
|
/*! |
|
* \brief Fills route instance. |
|
* |
|
* \param dest Route instance. |
|
* \param path Route path. |
|
* \param cb Handling callback. |
|
* \param userdata Additional callback data. |
|
* |
|
* \return Status. 0 is success. |
|
*/ |
|
int rpd_route_init(rpd_route *dest, const char *path, rpd_route_cb cb, |
|
void *userdata); |
|
|
|
#ifdef __cplusplus |
|
} |
|
#endif |
|
|
|
#endif /* RAPIDA_ROUTE_H_ENTRY */
|
|
|