This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <event2/http.h>
|
||||
|
||||
#include <qlibc/qlibc.h>
|
||||
|
||||
/*------------------------------- TYPEDEFS ----------------------------------*/
|
||||
@@ -37,7 +39,12 @@
|
||||
typedef struct restd_server_s restd_server_t;
|
||||
typedef struct restd_hook_s restd_hook_t;
|
||||
|
||||
typedef int (*restd_callback)(short event, void *conn, void *userdata);
|
||||
/**
|
||||
* User callback(hook) prototype.
|
||||
*/
|
||||
typedef int (*restd_call_hook_cb)(short event, void *conn);
|
||||
typedef int (*restd_callback)(struct evhttp_request *req, void *arg);
|
||||
typedef void (*restd_userdata_free_cb)(void *conn, void *userdata);
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
@@ -47,9 +54,12 @@ extern int restd_server_start(restd_server_t *server);
|
||||
extern int restd_server_attach_event_loop(restd_server_t *server, struct event_base *ev_base);
|
||||
|
||||
extern void restd_server_set_option(restd_server_t *server, const char *key, const char *value);
|
||||
extern void restd_server_register_hook_on_path(restd_server_t *server, const char *method, const char *path,
|
||||
extern void restd_server_register_hook_on_path(restd_server_t *server, enum evhttp_cmd_type method, const char *path,
|
||||
restd_callback cb, void *userdata);
|
||||
|
||||
extern void restd_http_response(struct evhttp_request *req, int code, const char *contenttype, const char *data);
|
||||
|
||||
|
||||
/*------------------------------- DEFINES ------------------------------------*/
|
||||
|
||||
/*
|
||||
@@ -65,16 +75,16 @@ enum restd_log_e
|
||||
RESTD_LOG_DEBUG2,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define RESTD_OK (0) /*!< I'm done with this request. Escalate to other hooks. */
|
||||
#define RESTD_FAILED (1) /*!< I'm done with this request. But the Process failed. */
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| USER-CALLBACK |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* User callback(hook) prototype.
|
||||
*/
|
||||
typedef int (*restd_call_hook_cb)(short event, void *conn);
|
||||
typedef int (*restd_callback)(short event, void *conn, void *userdata);
|
||||
typedef void (*restd_userdata_free_cb)(void *conn, void *userdata);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| DATA STRUCTURES |
|
||||
@@ -107,7 +117,7 @@ struct restd_server_s
|
||||
*/
|
||||
struct restd_hook_s
|
||||
{
|
||||
char *method;
|
||||
enum evhttp_cmd_type method;
|
||||
char *path;
|
||||
restd_callback cb;
|
||||
void *userdata;
|
||||
|
||||
Reference in New Issue
Block a user