diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/_private.h | 4 | ||||
-rw-r--r-- | include/asterisk/http.h | 30 |
2 files changed, 22 insertions, 12 deletions
diff --git a/include/asterisk/_private.h b/include/asterisk/_private.h index b477d0e93..52b7e227f 100644 --- a/include/asterisk/_private.h +++ b/include/asterisk/_private.h @@ -33,7 +33,9 @@ int ast_device_state_engine_init(void); /*!< Provided by devicestate.c */ int astobj2_init(void); /*!< Provided by astobj2.c */ int ast_file_init(void); /*!< Provided by file.c */ int ast_features_init(void); /*!< Provided by features.c */ -void ast_autoservice_init(void); /*!< Provided by autoservice.c */ +void ast_autoservice_init(void); /*!< Provided by autoservice.c */ +int ast_http_init(void); /*!< Provided by http.c */ +int ast_http_reload(void); /*!< Provided by http.c */ /*! * \brief Reload asterisk modules. 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 */ |