mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-09 14:36:48 +00:00
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:
@@ -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@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);
|
||||
enum ast_json_encoding_format ast_ari_json_format(void);
|
||||
|
||||
struct stasis_http_response;
|
||||
struct ast_ari_response;
|
||||
|
||||
/*!
|
||||
* \brief Callback type for RESTful method handlers.
|
||||
@@ -51,7 +51,7 @@ struct stasis_http_response;
|
||||
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 ast_ari_response *response);
|
||||
|
||||
/*!
|
||||
* \brief Handler for a single RESTful path segment.
|
||||
@@ -79,7 +79,7 @@ struct stasis_rest_handlers {
|
||||
/*!
|
||||
* Response type for RESTful requests
|
||||
*/
|
||||
struct stasis_http_response {
|
||||
struct ast_ari_response {
|
||||
/*! Response message */
|
||||
struct ast_json *message;
|
||||
/*! \r\n seperated response headers */
|
||||
@@ -99,7 +99,7 @@ struct stasis_http_response {
|
||||
* \return 0 on success.
|
||||
* \return non-zero on failure.
|
||||
*/
|
||||
int stasis_http_add_handler(struct stasis_rest_handlers *handler);
|
||||
int ast_ari_add_handler(struct stasis_rest_handlers *handler);
|
||||
|
||||
/*!
|
||||
* Remove a resource for REST handling.
|
||||
@@ -107,13 +107,13 @@ int stasis_http_add_handler(struct stasis_rest_handlers *handler);
|
||||
* \return 0 on success.
|
||||
* \return non-zero on failure.
|
||||
*/
|
||||
int stasis_http_remove_handler(struct stasis_rest_handlers *handler);
|
||||
int ast_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,26 +123,26 @@ int stasis_http_remove_handler(struct stasis_rest_handlers *handler);
|
||||
* \param headers HTTP headers.
|
||||
* \param[out] response RESTful HTTP response.
|
||||
*/
|
||||
void stasis_http_invoke(struct ast_tcptls_session_instance *ser,
|
||||
void ast_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 ast_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 ast_ari_get_docs(const char *uri, struct ast_variable *headers, struct ast_ari_response *response);
|
||||
|
||||
/*! \brief Abstraction for reading/writing JSON to a WebSocket */
|
||||
struct ari_websocket_session;
|
||||
struct ast_ari_websocket_session;
|
||||
|
||||
/*!
|
||||
* \brief Create an ARI WebSocket session.
|
||||
@@ -155,7 +155,7 @@ struct ari_websocket_session;
|
||||
* \return New ARI WebSocket session.
|
||||
* \return \c NULL on error.
|
||||
*/
|
||||
struct ari_websocket_session *ari_websocket_session_create(
|
||||
struct ast_ari_websocket_session *ast_ari_websocket_session_create(
|
||||
struct ast_websocket *ws_session, int (*validator)(struct ast_json *));
|
||||
|
||||
/*!
|
||||
@@ -165,8 +165,8 @@ struct ari_websocket_session *ari_websocket_session_create(
|
||||
* \return Message received.
|
||||
* \return \c NULL if WebSocket could not be read.
|
||||
*/
|
||||
struct ast_json *ari_websocket_session_read(
|
||||
struct ari_websocket_session *session);
|
||||
struct ast_json *ast_ari_websocket_session_read(
|
||||
struct ast_ari_websocket_session *session);
|
||||
|
||||
/*!
|
||||
* \brief Send a message to an ARI WebSocket.
|
||||
@@ -176,7 +176,7 @@ struct ast_json *ari_websocket_session_read(
|
||||
* \return 0 on success.
|
||||
* \return Non-zero on error.
|
||||
*/
|
||||
int ari_websocket_session_write(struct ari_websocket_session *session,
|
||||
int ast_ari_websocket_session_write(struct ast_ari_websocket_session *session,
|
||||
struct ast_json *message);
|
||||
|
||||
/*!
|
||||
@@ -187,45 +187,45 @@ int ari_websocket_session_write(struct ari_websocket_session *session,
|
||||
*
|
||||
* \return JSON message specifying an out-of-memory error.
|
||||
*/
|
||||
struct ast_json *ari_oom_json(void);
|
||||
struct ast_json *ast_ari_oom_json(void);
|
||||
|
||||
/*!
|
||||
* \brief Fill in an error \a stasis_http_response.
|
||||
* \brief Fill in an error \a ast_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 ast_ari_response_error(struct ast_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 ast_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 ast_ari_response_ok(struct ast_ari_response *response,
|
||||
struct ast_json *message);
|
||||
|
||||
/*!
|
||||
* \brief Fill in a <tt>No Content</tt> (204) \a stasis_http_response.
|
||||
* \brief Fill in a <tt>No Content</tt> (204) \a ast_ari_response.
|
||||
*/
|
||||
void stasis_http_response_no_content(struct stasis_http_response *response);
|
||||
void ast_ari_response_no_content(struct ast_ari_response *response);
|
||||
|
||||
/*!
|
||||
* \brief Fill in a <tt>Created</tt> (201) \a stasis_http_response.
|
||||
* \brief Fill in a <tt>Created</tt> (201) \a ast_ari_response.
|
||||
*/
|
||||
void stasis_http_response_created(struct stasis_http_response *response,
|
||||
void ast_ari_response_created(struct ast_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);
|
||||
void ast_ari_response_alloc_failed(struct ast_ari_response *response);
|
||||
|
||||
#endif /* _ASTERISK_STASIS_HTTP_H */
|
||||
#endif /* _ASTERISK_ARI_H */
|
Reference in New Issue
Block a user