diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-18 22:32:26 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-18 22:32:26 +0000 |
commit | 93531c68a25e6424e8f8b93f4bf3c944fdc53440 (patch) | |
tree | 359e80b11b9aeec274ca5fe62c4b6a075d487417 /include | |
parent | 28ef6ff72905b4d9229de9edf95682f958ba2fa5 (diff) |
start the process of changing HTTP request dispatching to do it based on *both* URI and method, so that POST support can move into a module; move http.c's private function prototypes into _private.h
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@109762 f38db490-d61c-443f-a65b-d21fe96a405b
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 */ |