[asterisk-commits] mmichelson: branch group/asterisk-cpp r168452 - in /team/group/asterisk-cpp: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jan 11 18:27:13 CST 2009


Author: mmichelson
Date: Sun Jan 11 18:27:13 2009
New Revision: 168452

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168452
Log:
http.c compiles


Modified:
    team/group/asterisk-cpp/README-cpp
    team/group/asterisk-cpp/include/asterisk/http.h
    team/group/asterisk-cpp/main/http.c

Modified: team/group/asterisk-cpp/README-cpp
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/README-cpp?view=diff&rev=168452&r1=168451&r2=168452
==============================================================================
--- team/group/asterisk-cpp/README-cpp (original)
+++ team/group/asterisk-cpp/README-cpp Sun Jan 11 18:27:13 2009
@@ -4,7 +4,7 @@
 
 Objects left in main: channel.o pbx.o rtp.o manager.o srv.o http.o features.o
 
-mmichelson: manager.c (need to get line 992 to compile), http.c
+mmichelson: done!
 russell: pbx.c, app.c (fix ast_app_option parsing functions)
 seanbright: srv.c, channel.c
 

Modified: team/group/asterisk-cpp/include/asterisk/http.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/http.h?view=diff&rev=168452&r1=168451&r2=168452
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/http.h (original)
+++ team/group/asterisk-cpp/include/asterisk/http.h Sun Jan 11 18:27:13 2009
@@ -77,8 +77,8 @@
 /*! \brief Definition of a URI handler */
 struct ast_http_uri {
 	ast_http_uri(const char *description, const char *uri, ast_http_callback callback, unsigned int supports_get,
-			void *data, const char *key) :
-		description(description), uri(uri), callback(callback), supports_get(supports_get), data(data), key(key) {}
+			void *data, const char *key, unsigned int static_content = 0, unsigned int has_subtree = 0) :
+		description(description), uri(uri), callback(callback), has_subtree(has_subtree), static_content(static_content), supports_get(supports_get), data(data), key(key){}
 	AST_LIST_ENTRY(ast_http_uri) entry;
 	const char *description;
 	const char *uri;

Modified: team/group/asterisk-cpp/main/http.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/http.c?view=diff&rev=168452&r1=168451&r2=168452
==============================================================================
--- team/group/asterisk-cpp/main/http.c (original)
+++ team/group/asterisk-cpp/main/http.c Sun Jan 11 18:27:13 2009
@@ -66,25 +66,9 @@
 /*!
  * we have up to two accepting threads, one for http, one for https
  */
-static struct ast_tcptls_session_args http_desc = {
-	.accept_fd = -1,
-	.master = AST_PTHREADT_NULL,
-	.tls_cfg = NULL,
-	.poll_timeout = -1,
-	.name = "http server",
-	.accept_fn = ast_tcptls_server_root,
-	.worker_fn = httpd_helper_thread,
-};
-
-static struct ast_tcptls_session_args https_desc = {
-	.accept_fd = -1,
-	.master = AST_PTHREADT_NULL,
-	.tls_cfg = &http_tls_cfg,
-	.poll_timeout = -1,
-	.name = "https server",
-	.accept_fn = ast_tcptls_server_root,
-	.worker_fn = httpd_helper_thread,
-};
+static struct ast_tcptls_session_args http_desc("http server", ast_tcptls_server_root, httpd_helper_thread);
+
+static struct ast_tcptls_session_args https_desc("https server", ast_tcptls_server_root, httpd_helper_thread, -1, AST_PTHREADT_NULL, -1, NULL, &http_tls_cfg);
 
 static AST_RWLIST_HEAD_STATIC(uris, ast_http_uri);	/*!< list of supported handlers */
 
@@ -117,7 +101,7 @@
 
 static const char *ftype2mtype(const char *ftype, char *wkspace, int wkspacelen)
 {
-	int x;
+	size_t x;
 
 	if (ftype) {
 		for (x = 0; x < ARRAY_LEN(mimetypes); x++) {
@@ -190,7 +174,7 @@
 		goto out403;
 	}
 		
-	path = alloca(len);
+	path = (char *) alloca(len);
 	sprintf(path, "%s/static-http/%s", ast_config_AST_DATA_DIR, uri);
 	if (stat(path, &st)) {
 		goto out404;
@@ -219,7 +203,7 @@
 		ast_get_version(), buf, (int) st.st_size, mtype);
 
 	while ((len = read(fd, buf, sizeof(buf))) > 0) {
-		if (fwrite(buf, 1, len, ser->f) != len) {
+		if ((int) fwrite(buf, 1, len, ser->f) != len) {
 			ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
 		}
 	}
@@ -286,25 +270,25 @@
 	return out;
 }
 
-static struct ast_http_uri statusuri = {
-	.callback = httpstatus_callback,
-	.description = "Asterisk HTTP General Status",
-	.uri = "httpstatus",
-	.supports_get = 1,
-	.data = NULL,
-	.key = __FILE__,
-};
+static struct ast_http_uri statusuri(
+	"Asterisk HTTP General Status",
+	"httpstatus",
+	httpstatus_callback,
+	1,
+	NULL,
+	__FILE__
+);
 	
-static struct ast_http_uri staticuri = {
-	.callback = static_callback,
-	.description = "Asterisk HTTP Static Delivery",
-	.uri = "static",
-	.has_subtree = 1,
-	.static_content = 1,
-	.supports_get = 1,
-	.data = NULL,
-	.key= __FILE__,
-};
+static struct ast_http_uri staticuri(
+	"Asterisk HTTP Static Delivery",
+	"static",
+	static_callback,
+	1,
+	NULL,
+	__FILE__,
+	1,
+	1
+);
 	
 struct ast_str *ast_http_error(int status, const char *title, const char *extra_header, const char *text)
 {
@@ -344,7 +328,7 @@
 int ast_http_uri_link(struct ast_http_uri *urih)
 {
 	struct ast_http_uri *uri;
-	int len = strlen(urih->uri);
+	size_t len = strlen(urih->uri);
 
 	if (!(urih->supports_get || urih->supports_post)) {
 		ast_log(LOG_WARNING, "URI handler does not provide either GET or POST method: %s (%s)\n", urih->uri, urih->description);
@@ -450,7 +434,7 @@
 				if (val) {
 					http_decode(val);
 				} else {
-					val = "";
+					val = (char *) "";
 				}
 				http_decode(var);
 				if ((v = ast_variable_new(var, val, ""))) {
@@ -660,7 +644,7 @@
 {
 	char buf[4096];
 	char cookie[4096];
-	struct ast_tcptls_session_instance *ser = data;
+	struct ast_tcptls_session_instance *ser = (struct ast_tcptls_session_instance *) data;
 	struct ast_variable *vars=NULL, *headers = NULL;
 	char *uri, *title=NULL;
 	int status = 200, contentlength = 0;
@@ -762,10 +746,10 @@
 			if (tmp) {
 				fprintf(ser->f, "Content-length: %d\r\n", contentlength);
 				/* first write the header, then the body */
-				if (fwrite(ast_str_buffer(out), 1, (tmp + 4 - ast_str_buffer(out)), ser->f) != tmp + 4 - ast_str_buffer(out)) {
+				if ((int) fwrite(ast_str_buffer(out), 1, (tmp + 4 - ast_str_buffer(out)), ser->f) != tmp + 4 - ast_str_buffer(out)) {
 					ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
 				}
-				if (fwrite(tmp + 4, 1, contentlength, ser->f) != contentlength ) {
+				if ((int) fwrite(tmp + 4, 1, contentlength, ser->f) != contentlength ) {
 					ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
 				}
 			}
@@ -811,7 +795,7 @@
 	target_len = strlen(target) + 1;
 	total_len = sizeof(*redirect) + target_len + strlen(dest) + 1;
 
-	if (!(redirect = ast_calloc(1, total_len))) {
+	if (!(redirect = (struct http_uri_redirect *)ast_calloc(1, total_len))) {
 		return;
 	}
 




More information about the asterisk-commits mailing list