summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2006-03-25 23:50:09 +0000
committerMark Spencer <markster@digium.com>2006-03-25 23:50:09 +0000
commit9164eac21a1cce9c9f205e7a5a939346de55bf5f (patch)
treead20048993b3cb7000c2f24edc0e013205b48924 /include
parentb0ac62573a6282a0114d2b23e5a6f04e472fb051 (diff)
Add micro-http server and abstract manager interface, make snmp not die
on reload. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@14953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/http.h64
-rw-r--r--include/asterisk/manager.h39
2 files changed, 69 insertions, 34 deletions
diff --git a/include/asterisk/http.h b/include/asterisk/http.h
new file mode 100644
index 000000000..ea580c3ca
--- /dev/null
+++ b/include/asterisk/http.h
@@ -0,0 +1,64 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2006, Digium, Inc.
+ *
+ * Mark Spencer <markster@digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*
+ * DNS SRV record support
+ */
+
+#ifndef _ASTERISK_HTTP_H
+#define _ASTERISK_HTTP_H
+
+#include "asterisk/config.h"
+
+/*!
+ \file http.h
+ \brief Support for Private Asterisk HTTP Servers.
+ \note Note: The Asterisk HTTP servers are extremely simple and minimal and
+ only support the "GET" method.
+*/
+
+/* HTTP Callbacks take the socket, the method and the path as arguments and should
+ return the content, allocated with malloc(). Status should be changed to reflect
+ the status of the request if it isn't 200 and title may be set to a malloc()'d string
+ to an appropriate title for non-200 responses. Content length may also be specified.
+ The return value may include additional headers at the front and MUST include a blank
+ line with \r\n to provide separation between user headers and content (even if no
+ content is specified) */
+typedef char *(*ast_http_callback)(struct sockaddr_in *requestor, const char *uri, struct ast_variable *params, int *status, char **title, int *contentlength);
+
+struct ast_http_uri {
+ struct ast_http_uri *next;
+ const char *description;
+ const char *uri;
+ int has_subtree;
+ ast_http_callback callback;
+};
+
+/* Link into the Asterisk HTTP server */
+int ast_http_uri_link(struct ast_http_uri *urihandler);
+
+/* Return a malloc()'d string containing an HTTP error message */
+char *ast_http_error(int status, const char *title, const char *extra_header, const char *text);
+
+/* Destroy an HTTP server */
+void ast_http_uri_unlink(struct ast_http_uri *urihandler);
+
+int ast_http_init(void);
+int ast_http_reload(void);
+
+#endif /* _ASTERISK_SRV_H */
diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h
index 523ccfaae..53f82f467 100644
--- a/include/asterisk/manager.h
+++ b/include/asterisk/manager.h
@@ -64,40 +64,7 @@ struct eventqent {
char eventdata[1];
};
-struct mansession {
- /*! Execution thread */
- pthread_t t;
- /*! Thread lock -- don't use in action callbacks, it's already taken care of */
- ast_mutex_t __lock;
- /*! socket address */
- struct sockaddr_in sin;
- /*! TCP socket */
- int fd;
- /*! Whether or not we're busy doing an action */
- int busy;
- /*! Whether or not we're "dead" */
- int dead;
- /*! Logged in username */
- char username[80];
- /*! Authentication challenge */
- char challenge[10];
- /*! Authentication status */
- int authenticated;
- /*! Authorization for reading */
- int readperm;
- /*! Authorization for writing */
- int writeperm;
- /*! Buffer */
- char inbuf[AST_MAX_MANHEADER_LEN];
- int inlen;
- int send_events;
- /* Queued events that we've not had the ability to send yet */
- struct eventqent *eventq;
- /* Timeout for ast_carefulwrite() */
- int writetimeout;
- struct mansession *next;
-};
-
+struct mansession;
struct message {
int hdrcount;
@@ -164,6 +131,10 @@ extern void astman_send_error(struct mansession *s, struct message *m, char *err
extern void astman_send_response(struct mansession *s, struct message *m, char *resp, char *msg);
extern void astman_send_ack(struct mansession *s, struct message *m, char *msg);
+extern void astman_append(struct mansession *s, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+
+
/*! Called by Asterisk initialization */
extern int init_manager(void);
/*! Called by Asterisk initialization */