19#ifndef _ASTERISK_HTTP_H
20#define _ASTERISK_HTTP_H
203 int status_code,
const char *status_title,
struct ast_str *http_header,
204 struct ast_str *
out,
int fd,
unsigned int static_content);
226 const char *status_title,
struct ast_str *http_header_data,
const char *
text);
336 const char *
value,
const char *expected_value);
353 const char *
value,
const char *expected_value);
static char version[AST_MAX_EXTENSION]
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_http_prefix(char *buf, int len)
Return the current prefix.
void ast_http_send(struct ast_tcptls_session_instance *ser, enum ast_http_method method, int status_code, const char *status_title, struct ast_str *http_header, struct ast_str *out, int fd, unsigned int static_content)
Generic function for sending HTTP/1.1 response.
struct ast_variable * ast_http_get_post_vars(struct ast_tcptls_session_instance *ser, struct ast_variable *headers)
Get post variables from client Request Entity-Body, if content type is application/x-www-form-urlenco...
struct ast_json * ast_http_get_json(struct ast_tcptls_session_instance *ser, struct ast_variable *headers)
Get JSON from client Request Entity-Body, if content type is application/json.
ast_http_method
HTTP Request methods known by Asterisk.
int ast_http_header_parse(char *buf, char **name, char **value)
Parse a header into the given name/value strings.
struct ast_variable * ast_http_get_cookies(struct ast_variable *headers)
Get cookie from Request headers.
int ast_http_header_match_in(const char *name, const char *expected_name, const char *value, const char *expected_value)
Check if the header name matches the expected header name. If so, then check to see if the value can ...
const char * ast_http_ftype2mtype(const char *ftype) attribute_pure
Return mime type based on extension.
void ast_http_uri_unlink(struct ast_http_uri *urihandler)
Unregister a URI handler.
int ast_http_body_discard(struct ast_tcptls_session_instance *ser)
Read and discard any unread HTTP request body.
int(* ast_http_callback)(struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers)
HTTP Callbacks.
struct ast_http_auth * ast_http_get_auth(struct ast_variable *headers)
Get HTTP authentication information from headers.
int ast_http_header_match(const char *name, const char *expected_name, const char *value, const char *expected_value)
Check if the header and value match (case insensitive) their associated expected values.
uint32_t ast_http_manid_from_vars(struct ast_variable *headers) attribute_pure
Return manager id, if exist, from request headers.
int ast_http_response_status_line(const char *buf, const char *version, int code)
Parse the http response status line.
const char * ast_get_http_method(enum ast_http_method method) attribute_pure
Return http method name string.
void ast_http_auth(struct ast_tcptls_session_instance *ser, const char *realm, const unsigned long nonce, const unsigned long opaque, int stale, const char *text)
Send http "401 Unauthorized" response and close socket.
void ast_http_request_close_on_completion(struct ast_tcptls_session_instance *ser)
Request the HTTP connection be closed after this HTTP request.
void ast_http_error(struct ast_tcptls_session_instance *ser, int status, const char *title, const char *text)
Send HTTP error message and close socket.
int ast_http_uri_link(struct ast_http_uri *urihandler)
Register a URI handler.
void ast_http_create_response(struct ast_tcptls_session_instance *ser, int status_code, const char *status_title, struct ast_str *http_header_data, const char *text)
Creates and sends a formatted http response message.
void ast_http_uri_unlink_all_with_key(const char *key)
Unregister all handlers with matching key.
void ast_http_body_read_status(struct ast_tcptls_session_instance *ser, int read_success)
Update the body read success status.
Configuration File Parser.
A set of macros to manage forward-linked lists.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
HTTP authentication information.
Definition of a URI handler.
unsigned int no_decode_uri
ast_http_callback callback
struct ast_http_uri::@228 entry
Abstract JSON element (object, array, string, int, ...).
Support for dynamic strings.
describes a server instance
Structure for variables, used for configurations and for channel variables.
Generic support for tcp/tls servers in Asterisk.