Device state resources.
More...
Go to the source code of this file.
|
static void | __reg_module (void) |
|
static void | __unreg_module (void) |
|
static void | ast_ari_device_states_delete_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response) |
| Parameter parsing callback for /deviceStates/{deviceName}. More...
|
|
static void | ast_ari_device_states_get_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response) |
| Parameter parsing callback for /deviceStates/{deviceName}. More...
|
|
static void | ast_ari_device_states_list_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response) |
| Parameter parsing callback for /deviceStates. More...
|
|
static void | ast_ari_device_states_update_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response) |
| Parameter parsing callback for /deviceStates/{deviceName}. More...
|
|
int | ast_ari_device_states_update_parse_body (struct ast_json *body, struct ast_ari_device_states_update_args *args) |
| Body parsing function for /deviceStates/{deviceName}. More...
|
|
struct ast_module * | AST_MODULE_SELF_SYM (void) |
|
static int | load_module (void) |
|
static int | unload_module (void) |
|
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Device state resources" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_device_state", } |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct stasis_rest_handlers | deviceStates |
| REST handler for /api-docs/deviceStates.json. More...
|
|
static struct stasis_rest_handlers | deviceStates_deviceName |
| REST handler for /api-docs/deviceStates.json. More...
|
|
◆ MAX_VALS
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ ast_ari_device_states_delete_cb()
Parameter parsing callback for /deviceStates/{deviceName}.
- Parameters
-
| get_params | GET parameters in the HTTP request. |
| path_vars | Path variables extracted from the request. |
| headers | HTTP headers. |
[out] | response | Response to the HTTP request. |
Definition at line 250 of file res_ari_device_states.c.
References ast_ari_device_states_delete(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, ast_ari_device_states_delete_args::device_name, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.
257 #if defined(AST_DEVMODE) 262 for (i = path_vars; i; i = i->
next) {
263 if (strcmp(i->
name,
"deviceName") == 0) {
269 #if defined(AST_DEVMODE) 283 if (200 <= code && code <= 299) {
287 ast_log(
LOG_ERROR,
"Invalid error response %d for /deviceStates/{deviceName}\n", code);
293 ast_log(
LOG_ERROR,
"Response validation failed for /deviceStates/{deviceName}\n");
295 "Internal Server Error",
"Response validation failed");
299 fin: __attribute__((unused))
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
void ast_ari_device_states_delete(struct ast_variable *headers, struct ast_ari_device_states_delete_args *args, struct ast_ari_response *response)
Destroy a device-state controlled by ARI.
struct ast_json * message
◆ ast_ari_device_states_get_cb()
Parameter parsing callback for /deviceStates/{deviceName}.
- Parameters
-
| get_params | GET parameters in the HTTP request. |
| path_vars | Path variables extracted from the request. |
| headers | HTTP headers. |
[out] | response | Response to the HTTP request. |
Definition at line 111 of file res_ari_device_states.c.
References ast_ari_device_states_get(), ast_ari_response_error(), ast_ari_validate_device_state(), ast_log, ast_ari_device_states_get_args::device_name, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.
118 #if defined(AST_DEVMODE) 123 for (i = path_vars; i; i = i->
next) {
124 if (strcmp(i->
name,
"deviceName") == 0) {
130 #if defined(AST_DEVMODE) 142 if (200 <= code && code <= 299) {
146 ast_log(
LOG_ERROR,
"Invalid error response %d for /deviceStates/{deviceName}\n", code);
152 ast_log(
LOG_ERROR,
"Response validation failed for /deviceStates/{deviceName}\n");
154 "Internal Server Error",
"Response validation failed");
158 fin: __attribute__((unused))
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
struct ast_json * message
void ast_ari_device_states_get(struct ast_variable *headers, struct ast_ari_device_states_get_args *args, struct ast_ari_response *response)
Retrieve the current state of a device.
int ast_ari_validate_device_state(struct ast_json *json)
Validator for DeviceState.
◆ ast_ari_device_states_list_cb()
Parameter parsing callback for /deviceStates.
- Parameters
-
| get_params | GET parameters in the HTTP request. |
| path_vars | Path variables extracted from the request. |
| headers | HTTP headers. |
[out] | response | Response to the HTTP request. |
Definition at line 61 of file res_ari_device_states.c.
References ast_ari_device_states_list(), ast_ari_response_error(), ast_ari_validate_device_state_fn(), ast_ari_validate_list(), ast_log, LOG_ERROR, ast_ari_response::message, NULL, and ast_ari_response::response_code.
67 #if defined(AST_DEVMODE) 73 #if defined(AST_DEVMODE) 85 if (200 <= code && code <= 299) {
97 "Internal Server Error",
"Response validation failed");
101 fin: __attribute__((unused))
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
struct ast_json * message
ari_validator ast_ari_validate_device_state_fn(void)
Function pointer to ast_ari_validate_device_state().
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
void ast_ari_device_states_list(struct ast_variable *headers, struct ast_ari_device_states_list_args *args, struct ast_ari_response *response)
List all ARI controlled device states.
◆ ast_ari_device_states_update_cb()
Parameter parsing callback for /deviceStates/{deviceName}.
- Parameters
-
| get_params | GET parameters in the HTTP request. |
| path_vars | Path variables extracted from the request. |
| headers | HTTP headers. |
[out] | response | Response to the HTTP request. |
Definition at line 181 of file res_ari_device_states.c.
References ast_ari_device_states_update(), ast_ari_device_states_update_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, ast_ari_device_states_update_args::device_name, ast_ari_device_states_update_args::device_state, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.
188 #if defined(AST_DEVMODE) 193 for (i = get_params; i; i = i->
next) {
194 if (strcmp(i->
name,
"deviceState") == 0) {
199 for (i = path_vars; i; i = i->
next) {
200 if (strcmp(i->
name,
"deviceName") == 0) {
210 #if defined(AST_DEVMODE) 224 if (200 <= code && code <= 299) {
228 ast_log(
LOG_ERROR,
"Invalid error response %d for /deviceStates/{deviceName}\n", code);
234 ast_log(
LOG_ERROR,
"Response validation failed for /deviceStates/{deviceName}\n");
236 "Internal Server Error",
"Response validation failed");
240 fin: __attribute__((unused))
struct ast_variable * next
void ast_ari_device_states_update(struct ast_variable *headers, struct ast_ari_device_states_update_args *args, struct ast_ari_response *response)
Change the state of a device controlled by ARI. (Note - implicitly creates the device state)...
Structure for variables, used for configurations and for channel variables.
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
const char * device_state
int ast_ari_device_states_update_parse_body(struct ast_json *body, struct ast_ari_device_states_update_args *args)
Body parsing function for /deviceStates/{deviceName}.
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
struct ast_json * message
◆ ast_ari_device_states_update_parse_body()
◆ AST_MODULE_SELF_SYM()
◆ load_module()
static int load_module |
( |
void |
| ) |
|
|
static |
◆ unload_module()
static int unload_module |
( |
void |
| ) |
|
|
static |
◆ __mod_info
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Device state resources" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_device_state", } |
|
static |
◆ ast_module_info
◆ deviceStates
◆ deviceStates_deviceName