[asterisk-commits] dlee: branch dlee/ASTERISK-22296 r397698 - in /team/dlee/ASTERISK-22296: incl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 26 21:09:17 CDT 2013


Author: dlee
Date: Mon Aug 26 21:09:15 2013
New Revision: 397698

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397698
Log:
Making all websocket API's optional, so that the module will unload

Modified:
    team/dlee/ASTERISK-22296/include/asterisk/http_websocket.h
    team/dlee/ASTERISK-22296/res/res_http_websocket.c

Modified: team/dlee/ASTERISK-22296/include/asterisk/http_websocket.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22296/include/asterisk/http_websocket.h?view=diff&rev=397698&r1=397697&r2=397698
==============================================================================
--- team/dlee/ASTERISK-22296/include/asterisk/http_websocket.h (original)
+++ team/dlee/ASTERISK-22296/include/asterisk/http_websocket.h Mon Aug 26 21:09:15 2013
@@ -73,7 +73,7 @@
  * \retval \c NULL on error
  * \since 12
  */
-struct ast_websocket_server *ast_websocket_server_create(void);
+AST_OPTIONAL_API(struct ast_websocket_server *, ast_websocket_server_create, (void), { return NULL; });
 
 /*!
  * \brief Callback suitable for use with a \ref ast_http_uri.
@@ -81,7 +81,7 @@
  * Set the data field of the ast_http_uri to \ref ast_websocket_server.
  * \since 12
  */
-int ast_websocket_uri_cb(struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_vars, struct ast_variable *headers);
+AST_OPTIONAL_API(int, ast_websocket_uri_cb, (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_vars, struct ast_variable *headers), { return -1; });
 
 /*!
  * \brief Add a sub-protocol handler to the default /ws server

Modified: team/dlee/ASTERISK-22296/res/res_http_websocket.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22296/res/res_http_websocket.c?view=diff&rev=397698&r1=397697&r2=397698
==============================================================================
--- team/dlee/ASTERISK-22296/res/res_http_websocket.c (original)
+++ team/dlee/ASTERISK-22296/res/res_http_websocket.c Mon Aug 26 21:09:15 2013
@@ -143,7 +143,7 @@
 	return websocket_server_create_impl(websocket_server_internal_dtor);
 }
 
-struct ast_websocket_server *ast_websocket_server_create(void)
+struct ast_websocket_server *AST_OPTIONAL_API_NAME(ast_websocket_server_create)(void)
 {
 	ast_module_ref(ast_module_info->self);
 	return websocket_server_create_impl(websocket_server_dtor);
@@ -529,7 +529,7 @@
 	return ao2_callback(server->protocols, OBJ_NOLOCK, NULL, NULL);
 }
 
-int ast_websocket_uri_cb(struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_vars, struct ast_variable *headers)
+int AST_OPTIONAL_API_NAME(ast_websocket_uri_cb)(struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_vars, struct ast_variable *headers)
 {
 	struct ast_variable *v;
 	char *upgrade = NULL, *key = NULL, *key1 = NULL, *key2 = NULL, *protos = NULL, *requested_protocols = NULL, *protocol = NULL;
@@ -693,7 +693,7 @@
 }
 
 static struct ast_http_uri websocketuri = {
-	.callback = ast_websocket_uri_cb,
+	.callback = AST_OPTIONAL_API_NAME(ast_websocket_uri_cb),
 	.description = "Asterisk HTTP WebSocket",
 	.uri = "ws",
 	.has_subtree = 0,




More information about the asterisk-commits mailing list