[asterisk-commits] kmoore: branch kmoore/stasis_http_rename r395528 - in /team/kmoore/stasis_htt...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 26 12:56:31 CDT 2013
Author: kmoore
Date: Fri Jul 26 12:56:30 2013
New Revision: 395528
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395528
Log:
Do some initial renaming and swapping around of things in templates
Added:
team/kmoore/stasis_http_rename/res/ari/
- copied from r395511, team/kmoore/stasis_http_rename/res/stasis_http/
team/kmoore/stasis_http_rename/res/ari.make
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/stasis_http.make
team/kmoore/stasis_http_rename/res/res_ari.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http.c
team/kmoore/stasis_http_rename/res/res_ari.exports.in
- copied, changed from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http.exports.in
team/kmoore/stasis_http_rename/res/res_ari_asterisk.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_asterisk.c
team/kmoore/stasis_http_rename/res/res_ari_bridges.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_bridges.c
team/kmoore/stasis_http_rename/res/res_ari_channels.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_channels.c
team/kmoore/stasis_http_rename/res/res_ari_endpoints.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_endpoints.c
team/kmoore/stasis_http_rename/res/res_ari_events.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_events.c
team/kmoore/stasis_http_rename/res/res_ari_playback.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_playback.c
team/kmoore/stasis_http_rename/res/res_ari_recordings.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_recordings.c
team/kmoore/stasis_http_rename/res/res_ari_sounds.c
- copied unchanged from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http_sounds.c
Removed:
team/kmoore/stasis_http_rename/res/res_stasis_http.c
team/kmoore/stasis_http_rename/res/res_stasis_http.exports.in
team/kmoore/stasis_http_rename/res/res_stasis_http_asterisk.c
team/kmoore/stasis_http_rename/res/res_stasis_http_bridges.c
team/kmoore/stasis_http_rename/res/res_stasis_http_channels.c
team/kmoore/stasis_http_rename/res/res_stasis_http_endpoints.c
team/kmoore/stasis_http_rename/res/res_stasis_http_events.c
team/kmoore/stasis_http_rename/res/res_stasis_http_playback.c
team/kmoore/stasis_http_rename/res/res_stasis_http_recordings.c
team/kmoore/stasis_http_rename/res/res_stasis_http_sounds.c
team/kmoore/stasis_http_rename/res/stasis_http/
team/kmoore/stasis_http_rename/res/stasis_http.make
Modified:
team/kmoore/stasis_http_rename/include/asterisk/stasis_http.h
team/kmoore/stasis_http_rename/rest-api-templates/make_ari_stubs.py
team/kmoore/stasis_http_rename/rest-api-templates/res_stasis_http_resource.c.mustache
team/kmoore/stasis_http_rename/rest-api-templates/rest_handler.mustache
team/kmoore/stasis_http_rename/rest-api-templates/stasis_http.make.mustache
team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.c.mustache
team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.h.mustache
team/kmoore/stasis_http_rename/tests/test_ari_model.c
team/kmoore/stasis_http_rename/tests/test_stasis_http.c
Modified: team/kmoore/stasis_http_rename/include/asterisk/stasis_http.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/include/asterisk/stasis_http.h?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/include/asterisk/stasis_http.h (original)
+++ team/kmoore/stasis_http_rename/include/asterisk/stasis_http.h Fri Jul 26 12:56:30 2013
@@ -16,15 +16,15 @@
* at the top of the source tree.
*/
-#ifndef _ASTERISK_STASIS_HTTP_H
-#define _ASTERISK_STASIS_HTTP_H
+#ifndef _ASTERISK_ARI_H
+#define _ASTERISK_ARI_H
/*! \file
*
* \brief Stasis RESTful API hooks.
*
* This header file is used mostly as glue code between generated declarations
- * and res_stasis_http.c.
+ * and res_ari.c.
*
* \author David M. Lee, II <dlee at digium.com>
*/
@@ -37,9 +37,9 @@
* \brief Configured encoding format for JSON output.
* \return JSON output encoding (compact, pretty, etc.)
*/
-enum ast_json_encoding_format stasis_http_json_format(void);
-
-struct stasis_http_response;
+enum ast_json_encoding_format ari_json_format(void);
+
+struct ari_response;
/*!
* \brief Callback type for RESTful method handlers.
@@ -51,7 +51,7 @@
typedef void (*stasis_rest_callback)(struct ast_variable *get_params,
struct ast_variable *path_vars,
struct ast_variable *headers,
- struct stasis_http_response *response);
+ struct ari_response *response);
/*!
* \brief Handler for a single RESTful path segment.
@@ -79,7 +79,7 @@
/*!
* Response type for RESTful requests
*/
-struct stasis_http_response {
+struct ari_response {
/*! Response message */
struct ast_json *message;
/*! \r\n seperated response headers */
@@ -99,7 +99,7 @@
* \return 0 on success.
* \return non-zero on failure.
*/
-int stasis_http_add_handler(struct stasis_rest_handlers *handler);
+int ari_add_handler(struct stasis_rest_handlers *handler);
/*!
* Remove a resource for REST handling.
@@ -107,13 +107,13 @@
* \return 0 on success.
* \return non-zero on failure.
*/
-int stasis_http_remove_handler(struct stasis_rest_handlers *handler);
+int ari_remove_handler(struct stasis_rest_handlers *handler);
/*!
* \internal
* \brief Stasis RESTful invocation handler.
*
- * Only call from res_stasis_http and test_stasis_http. Only public to allow
+ * Only call from res_ari and test_ari. Only public to allow
* for unit testing.
*
* \param ser TCP/TLS connection.
@@ -123,23 +123,23 @@
* \param headers HTTP headers.
* \param[out] response RESTful HTTP response.
*/
-void stasis_http_invoke(struct ast_tcptls_session_instance *ser,
+void ari_invoke(struct ast_tcptls_session_instance *ser,
const char *uri, enum ast_http_method method,
struct ast_variable *get_params, struct ast_variable *headers,
- struct stasis_http_response *response);
+ struct ari_response *response);
/*!
* \internal
* \brief Service function for API declarations.
*
- * Only call from res_stasis_http and test_stasis_http. Only public to allow
+ * Only call from res_ari and test_ari. Only public to allow
* for unit testing.
*
* \param uri Requested URI, relative to the docs path.
* \param headers HTTP headers.
* \param[out] response RESTful HTTP response.
*/
-void stasis_http_get_docs(const char *uri, struct ast_variable *headers, struct stasis_http_response *response);
+void ari_get_docs(const char *uri, struct ast_variable *headers, struct ari_response *response);
/*! \brief Abstraction for reading/writing JSON to a WebSocket */
struct ari_websocket_session;
@@ -190,42 +190,42 @@
struct ast_json *ari_oom_json(void);
/*!
- * \brief Fill in an error \a stasis_http_response.
+ * \brief Fill in an error \a ari_response.
* \param response Response to fill in.
* \param response_code HTTP response code.
* \param response_text Text corresponding to the HTTP response code.
* \param message_fmt Error message format string.
*/
-void stasis_http_response_error(struct stasis_http_response *response,
+void ari_response_error(struct ari_response *response,
int response_code,
const char *response_text,
const char *message_fmt, ...)
__attribute__((format(printf, 4, 5)));
/*!
- * \brief Fill in an \c OK (200) \a stasis_http_response.
+ * \brief Fill in an \c OK (200) \a ari_response.
* \param response Response to fill in.
* \param message JSON response. This reference is stolen, so just \ref
* ast_json_incref if you need to keep a reference to it.
*/
-void stasis_http_response_ok(struct stasis_http_response *response,
+void ari_response_ok(struct ari_response *response,
struct ast_json *message);
/*!
- * \brief Fill in a <tt>No Content</tt> (204) \a stasis_http_response.
- */
-void stasis_http_response_no_content(struct stasis_http_response *response);
-
-/*!
- * \brief Fill in a <tt>Created</tt> (201) \a stasis_http_response.
- */
-void stasis_http_response_created(struct stasis_http_response *response,
+ * \brief Fill in a <tt>No Content</tt> (204) \a ari_response.
+ */
+void ari_response_no_content(struct ari_response *response);
+
+/*!
+ * \brief Fill in a <tt>Created</tt> (201) \a ari_response.
+ */
+void ari_response_created(struct ari_response *response,
const char *url, struct ast_json *message);
/*!
* \brief Fill in \a response with a 500 message for allocation failures.
* \param response Response to fill in.
*/
-void stasis_http_response_alloc_failed(struct stasis_http_response *response);
-
-#endif /* _ASTERISK_STASIS_HTTP_H */
+void ari_response_alloc_failed(struct ari_response *response);
+
+#endif /* _ASTERISK_ARI_H */
Copied: team/kmoore/stasis_http_rename/res/res_ari.exports.in (from r395511, team/kmoore/stasis_http_rename/res/res_stasis_http.exports.in)
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/res/res_ari.exports.in?view=diff&rev=395528&p1=team/kmoore/stasis_http_rename/res/res_stasis_http.exports.in&r1=395511&p2=team/kmoore/stasis_http_rename/res/res_ari.exports.in&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/res/res_stasis_http.exports.in (original)
+++ team/kmoore/stasis_http_rename/res/res_ari.exports.in Fri Jul 26 12:56:30 2013
@@ -1,6 +1,5 @@
{
global:
- LINKER_SYMBOL_PREFIXstasis_http_*;
LINKER_SYMBOL_PREFIXari_*;
local:
*;
Modified: team/kmoore/stasis_http_rename/rest-api-templates/make_ari_stubs.py
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/rest-api-templates/make_ari_stubs.py?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/rest-api-templates/make_ari_stubs.py (original)
+++ team/kmoore/stasis_http_rename/rest-api-templates/make_ari_stubs.py Fri Jul 26 12:56:30 2013
@@ -44,22 +44,22 @@
API_TRANSFORMS = [
Transform(rel('api.wiki.mustache'),
'doc/rest-api/%s {{name_title}} REST API.wiki' % WIKI_PREFIX),
- Transform(rel('res_stasis_http_resource.c.mustache'),
- 'res/res_stasis_http_{{name}}.c'),
- Transform(rel('stasis_http_resource.h.mustache'),
- 'res/stasis_http/resource_{{name}}.h'),
- Transform(rel('stasis_http_resource.c.mustache'),
- 'res/stasis_http/resource_{{name}}.c', overwrite=False),
+ Transform(rel('res_ari_resource.c.mustache'),
+ 'res/res_ari_{{name}}.c'),
+ Transform(rel('ari_resource.h.mustache'),
+ 'res/ari/resource_{{name}}.h'),
+ Transform(rel('ari_resource.c.mustache'),
+ 'res/ari/resource_{{name}}.c', overwrite=False),
]
RESOURCES_TRANSFORMS = [
Transform(rel('models.wiki.mustache'),
'doc/rest-api/%s REST Data Models.wiki' % WIKI_PREFIX),
- Transform(rel('stasis_http.make.mustache'), 'res/stasis_http.make'),
+ Transform(rel('ari.make.mustache'), 'res/ari.make'),
Transform(rel('ari_model_validators.h.mustache'),
- 'res/stasis_http/ari_model_validators.h'),
+ 'res/ari/ari_model_validators.h'),
Transform(rel('ari_model_validators.c.mustache'),
- 'res/stasis_http/ari_model_validators.c'),
+ 'res/ari/ari_model_validators.c'),
]
Modified: team/kmoore/stasis_http_rename/rest-api-templates/res_stasis_http_resource.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/rest-api-templates/res_stasis_http_resource.c.mustache?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/rest-api-templates/res_stasis_http_resource.c.mustache (original)
+++ team/kmoore/stasis_http_rename/rest-api-templates/res_stasis_http_resource.c.mustache Fri Jul 26 12:56:30 2013
@@ -26,7 +26,7 @@
/*
{{> do-not-edit}}
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/res_stasis_http_resource.c.mustache
+ * template in rest-api-templates/res_ari_resource.c.mustache
*/
/*! \file
@@ -37,7 +37,7 @@
*/
/*** MODULEINFO
- <depend type="module">res_stasis_http</depend>
+ <depend type="module">res_ari</depend>
<depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
@@ -48,9 +48,9 @@
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
-#include "stasis_http/resource_{{name}}.h"
+#include "ari/resource_{{name}}.h"
#if defined(AST_DEVMODE)
-#include "stasis_http/ari_model_validators.h"
+#include "ari/ari_model_validators.h"
#endif
{{#apis}}
@@ -63,9 +63,9 @@
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
-static void stasis_http_{{c_nickname}}_cb(
+static void ari_{{c_nickname}}_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct stasis_http_response *response)
+ struct ast_variable *headers, struct ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
@@ -73,7 +73,7 @@
#endif /* AST_DEVMODE */
{{> param_parsing}}
- stasis_http_{{c_nickname}}(headers, &args, response);
+ ari_{{c_nickname}}(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -108,14 +108,14 @@
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for {{path}}\n");
- stasis_http_response_error(response, 500,
+ ari_response_error(response, 500,
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
}
{{/is_req}}
{{#is_websocket}}
-static void stasis_http_{{c_nickname}}_ws_cb(struct ast_websocket *ws_session,
+static void ari_{{c_nickname}}_ws_cb(struct ast_websocket *ws_session,
struct ast_variable *get_params, struct ast_variable *headers)
{
RAII_VAR(struct ast_websocket *, s, ws_session, ast_websocket_unref);
@@ -161,18 +161,18 @@
{{#operations}}
{{#is_websocket}}
res |= ast_websocket_server_add_protocol({{full_name}}.ws_server,
- "{{websocket_protocol}}", stasis_http_{{c_nickname}}_ws_cb);
+ "{{websocket_protocol}}", ari_{{c_nickname}}_ws_cb);
{{/is_websocket}}
{{/operations}}
{{/apis}}
stasis_app_ref();
- res |= stasis_http_add_handler(&{{root_full_name}});
+ res |= ari_add_handler(&{{root_full_name}});
return res;
}
static int unload_module(void)
{
- stasis_http_remove_handler(&{{root_full_name}});
+ ari_remove_handler(&{{root_full_name}});
{{#apis}}
{{#has_websocket}}
ao2_cleanup({{full_name}}.ws_server);
@@ -186,6 +186,6 @@
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - {{{description}}}",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http,res_stasis",
+ .nonoptreq = "res_ari,res_stasis",
);
{{/api_declaration}}
Modified: team/kmoore/stasis_http_rename/rest-api-templates/rest_handler.mustache
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/rest-api-templates/rest_handler.mustache?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/rest-api-templates/rest_handler.mustache (original)
+++ team/kmoore/stasis_http_rename/rest-api-templates/rest_handler.mustache Fri Jul 26 12:56:30 2013
@@ -17,7 +17,7 @@
}}
{{!
* Recursive partial template to render a rest_handler. Used in
- * res_stasis_http_resource.c.mustache.
+ * res_ari_resource.c.mustache.
}}
{{#children}}
{{> rest_handler}}
@@ -31,7 +31,7 @@
.callbacks = {
{{#operations}}
{{#is_req}}
- [{{c_http_method}}] = stasis_http_{{c_nickname}}_cb,
+ [{{c_http_method}}] = ari_{{c_nickname}}_cb,
{{/is_req}}
{{/operations}}
},
Modified: team/kmoore/stasis_http_rename/rest-api-templates/stasis_http.make.mustache
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/rest-api-templates/stasis_http.make.mustache?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/rest-api-templates/stasis_http.make.mustache (original)
+++ team/kmoore/stasis_http_rename/rest-api-templates/stasis_http.make.mustache Fri Jul 26 12:56:30 2013
@@ -2,7 +2,7 @@
#
# Asterisk -- A telephony toolkit for Linux.
#
-# Generated Makefile for res_stasis_http dependencies.
+# Generated Makefile for res_ari dependencies.
#
# Copyright (C) 2013, Digium, Inc.
#
@@ -15,12 +15,12 @@
# !!!!! DO NOT EDIT !!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# This file is generated by a template. Please see the original template at
-# rest-api-templates/stasis_http.make.mustache
+# rest-api-templates/ari.make.mustache
#
{{#apis}}
-res_stasis_http_{{name}}.so: stasis_http/resource_{{name}}.o
+res_ari_{{name}}.so: ari/resource_{{name}}.o
-stasis_http/resource_{{name}}.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_http_{{name}})
+ari/resource_{{name}}.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_{{name}})
{{/apis}}
Modified: team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.c.mustache?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.c.mustache (original)
+++ team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.c.mustache Fri Jul 26 12:56:30 2013
@@ -33,11 +33,11 @@
{{#apis}}
{{#operations}}
{{#is_req}}
-void stasis_http_{{c_nickname}}(struct ast_variable *headers,
+void ari_{{c_nickname}}(struct ast_variable *headers,
struct ast_{{c_nickname}}_args *args,
- struct stasis_http_response *response)
+ struct ari_response *response)
{
- ast_log(LOG_ERROR, "TODO: stasis_http_{{c_nickname}}\n");
+ ast_log(LOG_ERROR, "TODO: ari_{{c_nickname}}\n");
}
{{/is_req}}
{{#is_websocket}}
Modified: team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.h.mustache
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.h.mustache?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.h.mustache (original)
+++ team/kmoore/stasis_http_rename/rest-api-templates/stasis_http_resource.h.mustache Fri Jul 26 12:56:30 2013
@@ -20,7 +20,7 @@
/*! \file
*
* \brief Generated file - declares stubs to be implemented in
- * res/stasis_http/resource_{{name}}.c
+ * res/ari/resource_{{name}}.c
*
* {{{description}}}
*
@@ -30,17 +30,17 @@
/*
{{> do-not-edit}}
* This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/stasis_http_resource.h.mustache
+ * template in rest-api-templates/ari_resource.h.mustache
*/
#ifndef _ASTERISK_RESOURCE_{{name_caps}}_H
#define _ASTERISK_RESOURCE_{{name_caps}}_H
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
{{#apis}}
{{#operations}}
-/*! \brief Argument struct for stasis_http_{{c_nickname}}() */
+/*! \brief Argument struct for ari_{{c_nickname}}() */
struct ast_{{c_nickname}}_args {
{{#parameters}}
{{#description}}
@@ -61,7 +61,7 @@
* \param args Swagger parameters
* \param[out] response HTTP response
*/
-void stasis_http_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nickname}}_args *args, struct stasis_http_response *response);
+void ari_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nickname}}_args *args, struct ari_response *response);
{{/is_req}}
{{#is_websocket}}
/*!
Modified: team/kmoore/stasis_http_rename/tests/test_ari_model.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/tests/test_ari_model.c?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/tests/test_ari_model.c (original)
+++ team/kmoore/stasis_http_rename/tests/test_ari_model.c Fri Jul 26 12:56:30 2013
@@ -36,7 +36,7 @@
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/test.h"
-#include "../res/stasis_http/ari_model_validators.h"
+#include "../res/ari/ari_model_validators.h"
AST_TEST_DEFINE(validate_byte)
{
Modified: team/kmoore/stasis_http_rename/tests/test_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis_http_rename/tests/test_stasis_http.c?view=diff&rev=395528&r1=395527&r2=395528
==============================================================================
--- team/kmoore/stasis_http_rename/tests/test_stasis_http.c (original)
+++ team/kmoore/stasis_http_rename/tests/test_stasis_http.c Fri Jul 26 12:56:30 2013
@@ -25,7 +25,7 @@
/*** MODULEINFO
<depend>TEST_FRAMEWORK</depend>
- <depend>res_stasis_http</depend>
+ <depend>res_ari</depend>
<support_level>core</support_level>
***/
@@ -35,7 +35,7 @@
#include "asterisk/module.h"
#include "asterisk/test.h"
-#include "asterisk/stasis_http.h"
+#include "asterisk/ari.h"
/*!@{*/
@@ -62,7 +62,7 @@
struct ast_variable *get_params,
struct ast_variable *path_vars,
struct ast_variable *headers,
- struct stasis_http_response *response)
+ struct ari_response *response)
{
struct ast_json *message = ast_json_pack("{s: s, s: {}, s: {}, s: {}}",
"name", name,
@@ -98,7 +98,7 @@
static void name(struct ast_variable *get_params, \
struct ast_variable *path_vars, \
struct ast_variable *headers, \
- struct stasis_http_response *response) \
+ struct ari_response *response) \
{ \
handler(#name, response_code, get_params, path_vars, headers, response); \
}
@@ -149,20 +149,20 @@
/*!
* \internal
- * \c stasis_http_response constructor.
- */
-static struct stasis_http_response *response_alloc(void)
-{
- struct stasis_http_response *resp = ast_calloc(1, sizeof(struct stasis_http_response));
+ * \c ari_response constructor.
+ */
+static struct ari_response *response_alloc(void)
+{
+ struct ari_response *resp = ast_calloc(1, sizeof(struct ari_response));
resp->headers = ast_str_create(24);
return resp;
}
/*!
* \internal
- * \c stasis_http_response destructor.
- */
-static void response_free(struct stasis_http_response *resp)
+ * \c ari_response destructor.
+ */
+static void response_free(struct ari_response *resp)
{
if (!resp) {
return;
@@ -179,7 +179,7 @@
static void *setup_invocation_test(void) {
int r;
invocation_count = 0;
- r = stasis_http_add_handler(&test_root);
+ r = ari_add_handler(&test_root);
ast_assert(r == 0);
return &invocation_count;
}
@@ -192,13 +192,13 @@
if (!ignore) {
return;
}
- stasis_http_remove_handler(&test_root);
+ ari_remove_handler(&test_root);
}
AST_TEST_DEFINE(get_docs)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_variable *, headers, NULL, ast_variables_destroy);
struct ast_json *basePathJson;
const char *basePath;
@@ -216,7 +216,7 @@
response = response_alloc();
headers = ast_variable_new("Host", "stasis.asterisk.org", __FILE__);
- stasis_http_get_docs("resources.json", headers, response);
+ ari_get_docs("resources.json", headers, response);
ast_test_validate(test, 200 == response->response_code);
/* basePath should be relative to the Host header */
@@ -230,7 +230,7 @@
AST_TEST_DEFINE(get_docs_nohost)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
struct ast_variable *headers = NULL;
struct ast_json *basePathJson;
@@ -246,7 +246,7 @@
}
response = response_alloc();
- stasis_http_get_docs("resources.json", headers, response);
+ ari_get_docs("resources.json", headers, response);
ast_test_validate(test, 200 == response->response_code);
/* basePath should be relative to the Host header */
@@ -258,7 +258,7 @@
AST_TEST_DEFINE(get_docs_notfound)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
struct ast_variable *headers = NULL;
switch (cmd) {
@@ -273,7 +273,7 @@
}
response = response_alloc();
- stasis_http_get_docs("i-am-not-a-resource.json", headers, response);
+ ari_get_docs("i-am-not-a-resource.json", headers, response);
ast_test_validate(test, 404 == response->response_code);
return AST_TEST_PASS;
@@ -281,7 +281,7 @@
AST_TEST_DEFINE(get_docs_hackerz)
{
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
struct ast_variable *headers = NULL;
switch (cmd) {
@@ -296,7 +296,7 @@
}
response = response_alloc();
- stasis_http_get_docs("../../../../sbin/asterisk", headers, response);
+ ari_get_docs("../../../../sbin/asterisk", headers, response);
ast_test_validate(test, 404 == response->response_code);
return AST_TEST_PASS;
@@ -305,7 +305,7 @@
AST_TEST_DEFINE(invoke_get)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
@@ -343,7 +343,7 @@
"head2", "head-two",
"path_vars");
- stasis_http_invoke(NULL, "foo", AST_HTTP_GET, get_params, headers, response);
+ ari_invoke(NULL, "foo", AST_HTTP_GET, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 200 == response->response_code);
@@ -355,7 +355,7 @@
AST_TEST_DEFINE(invoke_wildcard)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
@@ -380,7 +380,7 @@
"path_vars",
"bam", "foshizzle");
- stasis_http_invoke(NULL, "foo/foshizzle", AST_HTTP_GET, get_params, headers, response);
+ ari_invoke(NULL, "foo/foshizzle", AST_HTTP_GET, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 200 == response->response_code);
@@ -392,7 +392,7 @@
AST_TEST_DEFINE(invoke_delete)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
@@ -417,7 +417,7 @@
"path_vars",
"bam", "foshizzle");
- stasis_http_invoke(NULL, "foo/foshizzle/bang", AST_HTTP_DELETE, get_params, headers, response);
+ ari_invoke(NULL, "foo/foshizzle/bang", AST_HTTP_DELETE, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 204 == response->response_code);
@@ -429,7 +429,7 @@
AST_TEST_DEFINE(invoke_post)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
RAII_VAR(struct ast_json *, expected, NULL, ast_json_unref);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
@@ -467,7 +467,7 @@
"head2", "head-two",
"path_vars");
- stasis_http_invoke(NULL, "foo/bar", AST_HTTP_POST, get_params, headers, response);
+ ari_invoke(NULL, "foo/bar", AST_HTTP_POST, get_params, headers, response);
ast_test_validate(test, 1 == invocation_count);
ast_test_validate(test, 200 == response->response_code);
@@ -479,7 +479,7 @@
AST_TEST_DEFINE(invoke_bad_post)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
@@ -496,7 +496,7 @@
fixture = setup_invocation_test();
response = response_alloc();
- stasis_http_invoke(NULL, "foo", AST_HTTP_POST, get_params, headers, response);
+ ari_invoke(NULL, "foo", AST_HTTP_POST, get_params, headers, response);
ast_test_validate(test, 0 == invocation_count);
ast_test_validate(test, 405 == response->response_code);
@@ -507,7 +507,7 @@
AST_TEST_DEFINE(invoke_not_found)
{
RAII_VAR(void *, fixture, NULL, tear_down_invocation_test);
- RAII_VAR(struct stasis_http_response *, response, NULL, response_free);
+ RAII_VAR(struct ari_response *, response, NULL, response_free);
struct ast_variable *get_params = NULL;
struct ast_variable *headers = NULL;
@@ -524,7 +524,7 @@
fixture = setup_invocation_test();
response = response_alloc();
- stasis_http_invoke(NULL, "foo/fizzle/i-am-not-a-resource", AST_HTTP_GET, get_params, headers, response);
+ ari_invoke(NULL, "foo/fizzle/i-am-not-a-resource", AST_HTTP_GET, get_params, headers, response);
ast_test_validate(test, 0 == invocation_count);
ast_test_validate(test, 404 == response->response_code);
@@ -565,5 +565,5 @@
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Stasis HTTP testing",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http",
+ .nonoptreq = "res_ari",
);
More information about the asterisk-commits
mailing list