Sat Aug 6 00:39:29 2011

Asterisk developer's documentation


http.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2006, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 #ifndef _ASTERISK_HTTP_H
00020 #define _ASTERISK_HTTP_H
00021 
00022 #include "asterisk/config.h"
00023 
00024 /*!
00025   \file http.h
00026   \brief Support for Private Asterisk HTTP Servers.
00027   \note Note: The Asterisk HTTP servers are extremely simple and minimal and
00028         only support the "GET" method.
00029   \author Mark Spencer <markster@digium.com>
00030 */
00031 
00032 /*! \brief HTTP Callbacks take the socket, the method and the path as arguments and should
00033    return the content, allocated with malloc().  Status should be changed to reflect
00034    the status of the request if it isn't 200 and title may be set to a malloc()'d string
00035    to an appropriate title for non-200 responses.  Content length may also be specified. 
00036    The return value may include additional headers at the front and MUST include a blank 
00037    line with \r\n to provide separation between user headers and content (even if no
00038    content is specified) */
00039 typedef char *(*ast_http_callback)(struct sockaddr_in *requestor, const char *uri, struct ast_variable *params, int *status, char **title, int *contentlength);
00040 
00041 struct ast_http_uri {
00042    struct ast_http_uri *next;
00043    const char *description;
00044    const char *uri;
00045    unsigned int has_subtree:1;
00046    /*! This URI mapping serves static content */
00047    unsigned int static_content:1;
00048    ast_http_callback callback;
00049 };
00050 
00051 /*! \brief Link into the Asterisk HTTP server */
00052 int ast_http_uri_link(struct ast_http_uri *urihandler);
00053 
00054 /*! \brief Return a malloc()'d string containing an HTTP error message */
00055 char *ast_http_error(int status, const char *title, const char *extra_header, const char *text);
00056 
00057 /*! \brief Destroy an HTTP server */
00058 void ast_http_uri_unlink(struct ast_http_uri *urihandler);
00059 
00060 char *ast_http_setcookie(const char *var, const char *val, int expires, char *buf, size_t buflen);
00061 
00062 int ast_http_init(void);
00063 int ast_http_reload(void);
00064 
00065 #endif /* _ASTERISK_SRV_H */

Generated on Sat Aug 6 00:39:29 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7