diff options
Diffstat (limited to 'include/asterisk/http.h')
-rw-r--r-- | include/asterisk/http.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/include/asterisk/http.h b/include/asterisk/http.h index 10e75d93e..8dd122e3f 100644 --- a/include/asterisk/http.h +++ b/include/asterisk/http.h @@ -65,29 +65,37 @@ content is specified) \endverbatim */ -typedef struct ast_str *(*ast_http_callback)(struct ast_tcptls_session_instance *ser, const char *uri, struct ast_variable *params, int *status, char **title, int *contentlength); -/*! \brief Definition of a URI reachable in the embedded HTTP server */ +enum ast_http_method { + AST_HTTP_GET = 0, + AST_HTTP_POST, +}; + +typedef struct ast_str *(*ast_http_callback)(struct ast_tcptls_session_instance *ser, const char *uri, enum ast_http_method method, + struct ast_variable *params, int *status, char **title, int *contentlength); + +/*! \brief Definition of a URI handler */ struct ast_http_uri { AST_LIST_ENTRY(ast_http_uri) entry; const char *description; const char *uri; + ast_http_callback callback; unsigned int has_subtree:1; - /*! This URI mapping serves static content */ + /*! This handler serves static content */ unsigned int static_content:1; - ast_http_callback callback; + /*! This handler accepts GET requests */ + unsigned int supports_get:1; + /*! This handler accepts POST requests */ + unsigned int supports_post:1; }; -/*! \brief Link into the Asterisk HTTP server */ +/*! \brief Register a URI handler */ int ast_http_uri_link(struct ast_http_uri *urihandler); -/*! \brief Return an ast_str malloc()'d string containing an HTTP error message */ -struct ast_str *ast_http_error(int status, const char *title, const char *extra_header, const char *text); - -/*! \brief Destroy an HTTP server */ +/*! \brief Unregister a URI handler */ void ast_http_uri_unlink(struct ast_http_uri *urihandler); -int ast_http_init(void); -int ast_http_reload(void); +/*! \brief Return an ast_str malloc()'d string containing an HTTP error message */ +struct ast_str *ast_http_error(int status, const char *title, const char *extra_header, const char *text); #endif /* _ASTERISK_SRV_H */ |