Rename everything Stasis-HTTP to ARI

This renames all files and API calls from several variants of
Stasis-HTTP to ARI including:
* Stasis-HTTP -> ARI
* STASIS_HTTP -> ARI
* stasis_http -> ari (ast_ari for global symbols, file names as well)
* stasis http -> ARI

Review: https://reviewboard.asterisk.org/r/2706/
(closes issue ASTERISK-22136)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2013-07-27 23:11:02 +00:00
parent fc05248bd1
commit d8956f690e
53 changed files with 1636 additions and 1637 deletions

View File

@@ -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}}

View File

@@ -36,7 +36,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
{{#api_declaration}}
{{#models}}
int ari_validate_{{c_id}}(struct ast_json *json)
int ast_ari_validate_{{c_id}}(struct ast_json *json)
{
int res = 1;
struct ast_json_iter *iter;
@@ -59,7 +59,7 @@ int ari_validate_{{c_id}}(struct ast_json *json)
} else
{{#subtypes}}
if (strcmp("{{id}}", discriminator) == 0) {
return ari_validate_{{c_id}}(json);
return ast_ari_validate_{{c_id}}(json);
} else
{{/subtypes}}
{
@@ -78,12 +78,12 @@ int ari_validate_{{c_id}}(struct ast_json *json)
{{/required}}
{{#type}}
{{#is_list}}
prop_is_valid = ari_validate_list(
prop_is_valid = ast_ari_validate_list(
ast_json_object_iter_value(iter),
ari_validate_{{c_singular_name}});
ast_ari_validate_{{c_singular_name}});
{{/is_list}}
{{^is_list}}
prop_is_valid = ari_validate_{{c_name}}(
prop_is_valid = ast_ari_validate_{{c_name}}(
ast_json_object_iter_value(iter));
{{/is_list}}
{{/type}}
@@ -113,9 +113,9 @@ int ari_validate_{{c_id}}(struct ast_json *json)
return res;
}
ari_validator ari_validate_{{c_id}}_fn(void)
ari_validator ast_ari_validate_{{c_id}}_fn(void)
{
return ari_validate_{{c_id}};
return ast_ari_validate_{{c_id}};
}
{{/models}}
{{/api_declaration}}

View File

@@ -19,7 +19,7 @@
* \brief Generated file - Build validators for ARI model objects.
*
* In addition to the normal validation functions one would normally expect,
* each validator has a ari_validate_{id}_fn() companion function that returns
* each validator has a ast_ari_validate_{id}_fn() companion function that returns
* the validator's function pointer.
*
* The reason for this seamingly useless indirection is the way function
@@ -50,7 +50,7 @@
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_void(struct ast_json *json);
int ast_ari_validate_void(struct ast_json *json);
/*!
* \brief Validator for native Swagger byte.
@@ -59,7 +59,7 @@ int ari_validate_void(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_byte(struct ast_json *json);
int ast_ari_validate_byte(struct ast_json *json);
/*!
* \brief Validator for native Swagger boolean.
@@ -68,7 +68,7 @@ int ari_validate_byte(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_boolean(struct ast_json *json);
int ast_ari_validate_boolean(struct ast_json *json);
/*!
* \brief Validator for native Swagger int.
@@ -77,7 +77,7 @@ int ari_validate_boolean(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_int(struct ast_json *json);
int ast_ari_validate_int(struct ast_json *json);
/*!
* \brief Validator for native Swagger long.
@@ -86,7 +86,7 @@ int ari_validate_int(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_long(struct ast_json *json);
int ast_ari_validate_long(struct ast_json *json);
/*!
* \brief Validator for native Swagger float.
@@ -95,7 +95,7 @@ int ari_validate_long(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_float(struct ast_json *json);
int ast_ari_validate_float(struct ast_json *json);
/*!
* \brief Validator for native Swagger double.
@@ -104,7 +104,7 @@ int ari_validate_float(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_double(struct ast_json *json);
int ast_ari_validate_double(struct ast_json *json);
/*!
* \brief Validator for native Swagger string.
@@ -113,7 +113,7 @@ int ari_validate_double(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_string(struct ast_json *json);
int ast_ari_validate_string(struct ast_json *json);
/*!
* \brief Validator for native Swagger date.
@@ -122,7 +122,7 @@ int ari_validate_string(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_date(struct ast_json *json);
int ast_ari_validate_date(struct ast_json *json);
/*!
* \brief Validator for a Swagger List[]/JSON array.
@@ -132,7 +132,7 @@ int ari_validate_date(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *));
int ast_ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *));
/*! @} */
@@ -153,14 +153,14 @@ typedef int (*ari_validator)(struct ast_json *json);
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ari_validate_{{c_id}}(struct ast_json *json);
int ast_ari_validate_{{c_id}}(struct ast_json *json);
/*!
* \brief Function pointer to ari_validate_{{c_id}}().
* \brief Function pointer to ast_ari_validate_{{c_id}}().
*
* See \ref ari_model_validators.h for more details.
* See \ref ast_ari_model_validators.h for more details.
*/
ari_validator ari_validate_{{c_id}}_fn(void);
ari_validator ast_ari_validate_{{c_id}}_fn(void);
{{/models}}
{{/api_declaration}}
{{/apis}}

View File

@@ -33,19 +33,19 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
{{#apis}}
{{#operations}}
{{#is_req}}
void stasis_http_{{c_nickname}}(struct ast_variable *headers,
void ast_ari_{{c_nickname}}(struct ast_variable *headers,
struct ast_{{c_nickname}}_args *args,
struct stasis_http_response *response)
struct ast_ari_response *response)
{
ast_log(LOG_ERROR, "TODO: stasis_http_{{c_nickname}}\n");
ast_log(LOG_ERROR, "TODO: ast_ari_{{c_nickname}}\n");
}
{{/is_req}}
{{#is_websocket}}
void ari_websocket_{{c_nickname}}(struct ari_websocket_session *session,
void ast_ari_websocket_{{c_nickname}}(struct ast_ari_websocket_session *session,
struct ast_variable *headers,
struct ast_{{c_nickname}}_args *args)
{
ast_log(LOG_ERROR, "TODO: ari_websocket_{{c_nickname}}\n");
ast_log(LOG_ERROR, "TODO: ast_ari_websocket_{{c_nickname}}\n");
}
{{/is_websocket}}
{{/operations}}

View File

@@ -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 ast_ari_{{c_nickname}}() */
struct ast_{{c_nickname}}_args {
{{#parameters}}
{{#description}}
@@ -61,7 +61,7 @@ struct ast_{{c_nickname}}_args {
* \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 ast_ari_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nickname}}_args *args, struct ast_ari_response *response);
{{/is_req}}
{{#is_websocket}}
/*!
@@ -75,7 +75,7 @@ void stasis_http_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nic
* \param headers HTTP headers.
* \param args Swagger parameters.
*/
void ari_websocket_{{c_nickname}}(struct ari_websocket_session *session, struct ast_variable *headers, struct ast_{{c_nickname}}_args *args);
void ast_ari_websocket_{{c_nickname}}(struct ast_ari_websocket_session *session, struct ast_variable *headers, struct ast_{{c_nickname}}_args *args);
{{/is_websocket}}
{{/operations}}
{{/apis}}

View File

@@ -44,22 +44,22 @@ WIKI_PREFIX = 'Asterisk 12'
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'),
]

View File

@@ -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 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#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 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
* \param headers HTTP headers.
* \param[out] response Response to the HTTP request.
*/
static void stasis_http_{{c_nickname}}_cb(
static void ast_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 ast_ari_response *response)
{
#if defined(AST_DEVMODE)
int is_valid;
@@ -73,7 +73,7 @@ static void stasis_http_{{c_nickname}}_cb(
#endif /* AST_DEVMODE */
{{> param_parsing}}
stasis_http_{{c_nickname}}(headers, &args, response);
ast_ari_{{c_nickname}}(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -92,11 +92,11 @@ static void stasis_http_{{c_nickname}}_cb(
if (200 <= code && code <= 299) {
{{#response_class}}
{{#is_list}}
is_valid = ari_validate_list(response->message,
ari_validate_{{c_singular_name}}_fn());
is_valid = ast_ari_validate_list(response->message,
ast_ari_validate_{{c_singular_name}}_fn());
{{/is_list}}
{{^is_list}}
is_valid = ari_validate_{{c_name}}(
is_valid = ast_ari_validate_{{c_name}}(
response->message);
{{/is_list}}
{{/response_class}}
@@ -108,18 +108,18 @@ static void stasis_http_{{c_nickname}}_cb(
if (!is_valid) {
ast_log(LOG_ERROR, "Response validation failed for {{path}}\n");
stasis_http_response_error(response, 500,
ast_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 ast_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);
RAII_VAR(struct ari_websocket_session *, session, NULL, ao2_cleanup);
RAII_VAR(struct ast_ari_websocket_session *, session, NULL, ao2_cleanup);
{{#has_path_parameters}}
/* TODO: It's not immediately obvious how to pass path params through
* the websocket code to this callback. Not needed right now, so we'll
@@ -128,16 +128,16 @@ static void stasis_http_{{c_nickname}}_ws_cb(struct ast_websocket *ws_session,
{{/has_path_parameters}}
{{> param_parsing}}
#if defined(AST_DEVMODE)
session = ari_websocket_session_create(ws_session,
ari_validate_{{response_class.c_name}}_fn());
session = ast_ari_websocket_session_create(ws_session,
ast_ari_validate_{{response_class.c_name}}_fn());
#else
session = ari_websocket_session_create(ws_session, NULL);
session = ast_ari_websocket_session_create(ws_session, NULL);
#endif
if (!session) {
ast_log(LOG_ERROR, "Failed to create ARI session\n");
return;
}
ari_websocket_{{c_nickname}}(session, headers, &args);
ast_ari_websocket_{{c_nickname}}(session, headers, &args);
}
{{/is_websocket}}
{{/operations}}
@@ -161,18 +161,18 @@ static int load_module(void)
{{#operations}}
{{#is_websocket}}
res |= ast_websocket_server_add_protocol({{full_name}}.ws_server,
"{{websocket_protocol}}", stasis_http_{{c_nickname}}_ws_cb);
"{{websocket_protocol}}", ast_ari_{{c_nickname}}_ws_cb);
{{/is_websocket}}
{{/operations}}
{{/apis}}
stasis_app_ref();
res |= stasis_http_add_handler(&{{root_full_name}});
res |= ast_ari_add_handler(&{{root_full_name}});
return res;
}
static int unload_module(void)
{
stasis_http_remove_handler(&{{root_full_name}});
ast_ari_remove_handler(&{{root_full_name}});
{{#apis}}
{{#has_websocket}}
ao2_cleanup({{full_name}}.ws_server);
@@ -186,6 +186,6 @@ static int unload_module(void)
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}}

View File

@@ -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 @@ static struct stasis_rest_handlers {{full_name}} = {
.callbacks = {
{{#operations}}
{{#is_req}}
[{{c_http_method}}] = stasis_http_{{c_nickname}}_cb,
[{{c_http_method}}] = ast_ari_{{c_nickname}}_cb,
{{/is_req}}
{{/operations}}
},