Mon Apr 30 07:36:34 2007

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    int has_subtree;
00046    ast_http_callback callback;
00047 };
00048 
00049 /*! \brief Link into the Asterisk HTTP server */
00050 int ast_http_uri_link(struct ast_http_uri *urihandler);
00051 
00052 /*! \brief Return a malloc()'d string containing an HTTP error message */
00053 char *ast_http_error(int status, const char *title, const char *extra_header, const char *text);
00054 
00055 /*! \brief Destroy an HTTP server */
00056 void ast_http_uri_unlink(struct ast_http_uri *urihandler);
00057 
00058 char *ast_http_setcookie(const char *var, const char *val, int expires, char *buf, size_t buflen);
00059 
00060 int ast_http_init(void);
00061 int ast_http_reload(void);
00062 
00063 #endif /* _ASTERISK_SRV_H */

Generated on Mon Apr 30 07:36:34 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1