Asterisk - The Open Source Telephony Project
18.5.0
|
Asterisk JSON abstraction layer. More...
#include "asterisk/netsock2.h"
Go to the source code of this file.
Data Structures | |
struct | ast_json_error |
JSON parsing error information. More... | |
struct | ast_json_payload |
Functions | |
struct ast_json * | ast_json_true (void) |
Get the JSON true value. More... | |
struct ast_json * | ast_json_false (void) |
Get the JSON false value. More... | |
struct ast_json * | ast_json_boolean (int value) |
Get the JSON boolean corresponding to value. More... | |
struct ast_json * | ast_json_null (void) |
Get the JSON null value. More... | |
int | ast_json_is_true (const struct ast_json *value) |
Check if value is JSON true. More... | |
int | ast_json_is_false (const struct ast_json *value) |
Check if value is JSON false. More... | |
int | ast_json_is_null (const struct ast_json *value) |
Check if value is JSON null. More... | |
struct ast_json * | ast_json_string_create (const char *value) |
Construct a JSON string from value. More... | |
const char * | ast_json_string_get (const struct ast_json *string) |
Get the value of a JSON string. More... | |
int | ast_json_string_set (struct ast_json *string, const char *value) |
Change the value of a JSON string. More... | |
struct ast_json * | ast_json_stringf (const char *format,...) |
Create a JSON string, printf style. More... | |
struct ast_json * | ast_json_vstringf (const char *format, va_list args) |
Create a JSON string, vprintf style. More... | |
struct ast_json * | ast_json_integer_create (intmax_t value) |
Create a JSON integer. More... | |
intmax_t | ast_json_integer_get (const struct ast_json *integer) |
Get the value from a JSON integer. More... | |
int | ast_json_integer_set (struct ast_json *integer, intmax_t value) |
Set the value of a JSON integer. More... | |
struct ast_json * | ast_json_real_create (double value) |
Create a JSON real number. More... | |
double | ast_json_real_get (const struct ast_json *real) |
Get the value from a JSON real number. More... | |
int | ast_json_real_set (struct ast_json *real, double value) |
Set the value of a JSON real number. More... | |
struct ast_json * | ast_json_array_create (void) |
Create a empty JSON array. More... | |
size_t | ast_json_array_size (const struct ast_json *array) |
Get the size of a JSON array. More... | |
struct ast_json * | ast_json_array_get (const struct ast_json *array, size_t index) |
Get an element from an array. More... | |
int | ast_json_array_set (struct ast_json *array, size_t index, struct ast_json *value) |
Change an element in an array. More... | |
int | ast_json_array_append (struct ast_json *array, struct ast_json *value) |
Append to an array. More... | |
int | ast_json_array_insert (struct ast_json *array, size_t index, struct ast_json *value) |
Insert into an array. More... | |
int | ast_json_array_remove (struct ast_json *array, size_t index) |
Remove an element from an array. More... | |
int | ast_json_array_clear (struct ast_json *array) |
Remove all elements from an array. More... | |
int | ast_json_array_extend (struct ast_json *array, struct ast_json *tail) |
Append all elements from tail to array. More... | |
int | ast_json_equal (const struct ast_json *lhs, const struct ast_json *rhs) |
Compare two JSON objects. More... | |
struct ast_json * | ast_json_copy (const struct ast_json *value) |
Copy a JSON value, but not its children. More... | |
struct ast_json * | ast_json_deep_copy (const struct ast_json *value) |
Copy a JSON value, and its children. More... | |
typedef AST_JSON_INT_T | ast_json_int_t |
Primarily used to cast when packing to an "I" type. More... | |
int | ast_json_init (void) |
Initialize the JSON library. More... | |
void | ast_json_set_alloc_funcs (void *(*malloc_fn)(size_t), void(*free_fn)(void *)) |
Set custom allocators instead of the standard ast_malloc() and ast_free(). More... | |
void | ast_json_reset_alloc_funcs (void) |
Change alloc funcs back to the resource module defaults. More... | |
void * | ast_json_malloc (size_t size) |
Asterisk's custom JSON allocator. Exposed for use by unit tests. More... | |
void | ast_json_free (void *p) |
Asterisk's custom JSON allocator. Exposed for use by unit tests. More... | |
struct ast_json * | ast_json_ref (struct ast_json *value) |
Increase refcount on value. More... | |
void | ast_json_unref (struct ast_json *value) |
Decrease refcount on value. If refcount reaches zero, value is freed. More... | |
enum | ast_json_type { AST_JSON_OBJECT, AST_JSON_ARRAY, AST_JSON_STRING, AST_JSON_INTEGER, AST_JSON_REAL, AST_JSON_TRUE, AST_JSON_FALSE, AST_JSON_NULL } |
Valid types of a JSON element. More... | |
enum ast_json_type | ast_json_typeof (const struct ast_json *value) |
Get the type of value. More... | |
const char * | ast_json_typename (enum ast_json_type type) |
Get the string name for the given type. More... | |
#define | AST_JSON_UTF8_VALIDATE(str) (ast_json_utf8_check(str) ? (str) : "") |
Check str for UTF-8 and replace with an empty string if fails the check. More... | |
int | ast_json_utf8_check_len (const char *str, size_t len) |
Check the string of the given length for UTF-8 format. More... | |
int | ast_json_utf8_check (const char *str) |
Check the nul terminated string for UTF-8 format. More... | |
#define | ast_json_object_string_get(object, key) ast_json_string_get(ast_json_object_get(object, key)) |
Get a string field from a JSON object. More... | |
struct ast_json * | ast_json_object_create (void) |
Create a new JSON object. More... | |
size_t | ast_json_object_size (struct ast_json *object) |
Get size of JSON object. More... | |
struct ast_json * | ast_json_object_get (struct ast_json *object, const char *key) |
Get a field from a JSON object. More... | |
int | ast_json_object_set (struct ast_json *object, const char *key, struct ast_json *value) |
Set a field in a JSON object. More... | |
int | ast_json_object_del (struct ast_json *object, const char *key) |
Delete a field from a JSON object. More... | |
int | ast_json_object_clear (struct ast_json *object) |
Delete all elements from a JSON object. More... | |
int | ast_json_object_update (struct ast_json *object, struct ast_json *other) |
Update object with all of the fields of other. More... | |
int | ast_json_object_update_existing (struct ast_json *object, struct ast_json *other) |
Update existing fields in object with the fields of other. More... | |
int | ast_json_object_update_missing (struct ast_json *object, struct ast_json *other) |
Add new fields to object with the fields of other. More... | |
struct ast_json_iter * | ast_json_object_iter (struct ast_json *object) |
Get an iterator pointing to the first field in a JSON object. More... | |
struct ast_json_iter * | ast_json_object_iter_at (struct ast_json *object, const char *key) |
Get an iterator pointing to a specified key in object. More... | |
struct ast_json_iter * | ast_json_object_iter_next (struct ast_json *object, struct ast_json_iter *iter) |
Get the next iterator. More... | |
const char * | ast_json_object_iter_key (struct ast_json_iter *iter) |
Get the key from an iterator. More... | |
struct ast_json * | ast_json_object_iter_value (struct ast_json_iter *iter) |
Get the value from an iterator. More... | |
int | ast_json_object_iter_set (struct ast_json *object, struct ast_json_iter *iter, struct ast_json *value) |
Set the value of the field pointed to by an iterator. More... | |
#define | ast_json_dump_string(root) ast_json_dump_string_format(root, AST_JSON_COMPACT) |
Encode a JSON value to a compact string. More... | |
#define | ast_json_dump_str(root, dst) ast_json_dump_str_format(root, dst, AST_JSON_COMPACT) |
#define | ast_json_dump_file(root, output) ast_json_dump_file_format(root, output, AST_JSON_COMPACT) |
#define | ast_json_dump_new_file(root, path) ast_json_dump_new_file_format(root, path, AST_JSON_COMPACT) |
#define | AST_JSON_ERROR_TEXT_LENGTH 160 |
#define | AST_JSON_ERROR_SOURCE_LENGTH 80 |
enum | ast_json_encoding_format { AST_JSON_COMPACT, AST_JSON_PRETTY } |
Encoding format type. More... | |
char * | ast_json_dump_string_format (struct ast_json *root, enum ast_json_encoding_format format) |
Encode a JSON value to a string. More... | |
int | ast_json_dump_str_format (struct ast_json *root, struct ast_str **dst, enum ast_json_encoding_format format) |
Encode a JSON value to an ast_str. More... | |
int | ast_json_dump_file_format (struct ast_json *root, FILE *output, enum ast_json_encoding_format format) |
Encode a JSON value to a FILE . More... | |
int | ast_json_dump_new_file_format (struct ast_json *root, const char *path, enum ast_json_encoding_format format) |
Encode a JSON value to a file at the given location. More... | |
struct ast_json * | ast_json_load_string (const char *input, struct ast_json_error *error) |
Parse null terminated string into a JSON object or array. More... | |
struct ast_json * | ast_json_load_str (const struct ast_str *input, struct ast_json_error *error) |
Parse ast_str into a JSON object or array. More... | |
struct ast_json * | ast_json_load_buf (const char *buffer, size_t buflen, struct ast_json_error *error) |
Parse buffer with known length into a JSON object or array. More... | |
struct ast_json * | ast_json_load_file (FILE *input, struct ast_json_error *error) |
Parse a FILE into JSON object or array. More... | |
struct ast_json * | ast_json_load_new_file (const char *path, struct ast_json_error *error) |
Parse file at path into JSON object or array. More... | |
struct ast_json * | ast_json_pack (char const *format,...) |
Helper for creating complex JSON values. More... | |
struct ast_json * | ast_json_vpack (char const *format, va_list ap) |
Helper for creating complex JSON values simply. More... | |
enum | ast_json_to_ast_vars_code { AST_JSON_TO_AST_VARS_CODE_SUCCESS, AST_JSON_TO_AST_VARS_CODE_INVALID_TYPE, AST_JSON_TO_AST_VARS_CODE_OOM } |
struct ast_json * | ast_json_name_number (const char *name, const char *number) |
Common JSON rendering functions for common 'objects'. More... | |
struct ast_json * | ast_json_timeval (const struct timeval tv, const char *zone) |
Construct a timeval as JSON. More... | |
struct ast_json * | ast_json_ipaddr (const struct ast_sockaddr *addr, enum ast_transport transport_type) |
Construct an IP address as JSON. More... | |
struct ast_json * | ast_json_dialplan_cep_app (const char *context, const char *exten, int priority, const char *app_name, const char *app_data) |
Construct a context/exten/priority/application/application_data as JSON. More... | |
struct ast_json * | ast_json_dialplan_cep (const char *context, const char *exten, int priority) |
Construct a context/exten/priority as JSON. More... | |
struct ast_json_payload * | ast_json_payload_create (struct ast_json *json) |
Create an ao2 object to pass json blobs as data payloads for stasis. More... | |
struct ast_json * | ast_json_party_id (struct ast_party_id *party) |
Construct an ast_party_id as JSON. More... | |
enum ast_json_to_ast_vars_code | ast_json_to_ast_variables (struct ast_json *json_variables, struct ast_variable **variables) |
Convert a ast_json list of key/value pair tuples into a ast_variable list. More... | |
struct ast_json * | ast_json_channel_vars (struct varshead *channelvars) |
Construct a JSON object from a ast_var_t list. More... | |
Asterisk JSON abstraction layer.
This is a very thin wrapper around the Jansson API. For more details on it, see its docs at http://www.digip.org/jansson/doc/2.11/apiref.html.
Rather than provide the multiple ways of doing things that the Jansson API does, the Asterisk wrapper is always reference-stealing, and always NULL safe.
And by always, I mean that the reference is stolen even if the function fails. This avoids lots of conditional logic, and also avoids having to track zillions of local variables when building complex JSON objects. You can instead chain ast_json_*
calls together safely and only worry about cleaning up the root object.
In the cases where you have a need to introduce intermediate objects, just wrap them with json_ref() when passing them to other ast_json_*
() functions.
Definition in file json.h.
#define ast_json_dump_file | ( | root, | |
output | |||
) | ast_json_dump_file_format(root, output, AST_JSON_COMPACT) |
Definition at line 794 of file json.h.
Referenced by AST_TEST_DEFINE().
#define ast_json_dump_new_file | ( | root, | |
path | |||
) | ast_json_dump_new_file_format(root, path, AST_JSON_COMPACT) |
Definition at line 808 of file json.h.
Referenced by AST_TEST_DEFINE().
#define ast_json_dump_str | ( | root, | |
dst | |||
) | ast_json_dump_str_format(root, dst, AST_JSON_COMPACT) |
Definition at line 778 of file json.h.
Referenced by AST_TEST_DEFINE().
#define ast_json_dump_string | ( | root | ) | ast_json_dump_string_format(root, AST_JSON_COMPACT) |
Encode a JSON value to a compact string.
Returned string must be freed by calling ast_json_free().
root | JSON value. |
NULL
on error. Definition at line 763 of file json.h.
Referenced by add_identity_header(), ast_ari_events_event_websocket_ws_attempted_cb(), ast_ari_events_event_websocket_ws_established_cb(), ast_cel_create_event_with_time(), ast_stir_shaken_sign(), AST_TEST_DEFINE(), asterisk_publication_send_refresh(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), beanstalk_put(), cel_bs_put(), format_log_json(), persistence_generator_data_struct2str(), rtcp_message_handler(), and sorcery_astdb_create().
#define ast_json_object_string_get | ( | object, | |
key | |||
) | ast_json_string_get(ast_json_object_get(object, key)) |
Get a string field from a JSON object.
object | JSON object. |
key | Key of string field to look up. |
NULL
on error, or key value is not a string. Definition at line 573 of file json.h.
Referenced by app_event_filter_matched(), and app_event_filter_set().
#define AST_JSON_UTF8_VALIDATE | ( | str | ) | (ast_json_utf8_check(str) ? (str) : "") |
Check str for UTF-8 and replace with an empty string if fails the check.
Definition at line 224 of file json.h.
Referenced by association_to_json(), ast_json_name_number(), channel_dialplan(), currency_to_json(), json_party_name(), json_party_number(), json_party_subaddress(), phase_e_handler(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), and set_channel_variables().
typedef AST_JSON_INT_T ast_json_int_t |
Encoding format type.
Enumerator | |
---|---|
AST_JSON_COMPACT | Compact format, low human readability |
AST_JSON_PRETTY | Formatted for human readability |
Definition at line 745 of file json.h.
Definition at line 1051 of file json.h.
enum ast_json_type |
Valid types of a JSON element.
Enumerator | |
---|---|
AST_JSON_OBJECT | |
AST_JSON_ARRAY | |
AST_JSON_STRING | |
AST_JSON_INTEGER | |
AST_JSON_REAL | |
AST_JSON_TRUE | |
AST_JSON_FALSE | |
AST_JSON_NULL |
Definition at line 162 of file json.h.
Append to an array.
array | JSON array to modify. |
value | New JSON value to store at the end of array. |
Definition at line 368 of file json.c.
Referenced by add_format_information_cb(), app_to_json(), append_json(), append_sound_cb(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_bucket_json(), ast_endpoint_snapshot_to_json(), AST_TEST_DEFINE(), conf_send_event_to_participants(), container_to_json_array(), device_to_json_cb(), generate_filenames_json(), json_array_from_list(), process_log_list(), process_module_list(), report_receive_fax_status(), return_sorcery_object(), rtcp_report_to_json(), s_to_json(), send_start_msg_snapshots(), stasis_app_device_states_to_json(), stasis_app_exec(), stasis_app_mailboxes_to_json(), test_handler(), and units_to_json().
int ast_json_array_clear | ( | struct ast_json * | array | ) |
Remove all elements from an array.
array | JSON array to clear. |
Definition at line 380 of file json.c.
Referenced by AST_TEST_DEFINE().
struct ast_json* ast_json_array_create | ( | void | ) |
Create a empty JSON array.
NULL
on error. Definition at line 352 of file json.c.
Referenced by app_data_create(), ast_ari_applications_list(), ast_ari_asterisk_list_log_channels(), ast_ari_asterisk_list_modules(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_ari_sounds_list(), ast_bucket_json(), AST_TEST_DEFINE(), conf_send_event_to_participants(), container_to_json_array(), devices_to_json(), generate_filenames_json(), json_array_from_list(), report_receive_fax_status(), return_sorcery_object(), rtcp_report_to_json(), s_to_json(), stasis_app_device_states_to_json(), stasis_app_event_filter_to_json(), stasis_app_mailboxes_to_json(), and units_to_json().
Append all elements from tail to array.
The tail argument is not changed, so ast_json_unref() it when you are done with it.
array | JSON array to modify. |
tail | JSON array with contents to append to array. |
Definition at line 384 of file json.c.
Referenced by AST_TEST_DEFINE().
Get an element from an array.
The returned element is a borrowed reference; use ast_json_ref() to safely keep a pointer to it.
array | JSON array. |
index | Zero-based index into array. |
NULL
if array not an array. NULL
if index is out of bounds. Definition at line 360 of file json.c.
Referenced by app_event_filter_matched(), app_event_filter_set(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_validate_list(), AST_TEST_DEFINE(), channel_fax_cb(), and manager_json_to_ast_str().
Insert into an array.
array | JSON array to modify. |
index | Zero-based index into array. |
value | New JSON value to store in array at index. |
Definition at line 372 of file json.c.
Referenced by AST_TEST_DEFINE().
int ast_json_array_remove | ( | struct ast_json * | array, |
size_t | index | ||
) |
Remove an element from an array.
array | JSON array to modify. |
index | Zero-based index into array. |
Definition at line 376 of file json.c.
Referenced by AST_TEST_DEFINE().
Change an element in an array.
array | JSON array to modify. |
index | Zero-based index into array. |
value | New JSON value to store in array at index. |
Definition at line 364 of file json.c.
Referenced by AST_TEST_DEFINE().
size_t ast_json_array_size | ( | const struct ast_json * | array | ) |
Get the size of a JSON array.
array | JSON array. |
Definition at line 356 of file json.c.
Referenced by app_event_filter_matched(), app_event_filter_set(), ast_ari_applications_list(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_sounds_list(), ast_ari_validate_list(), AST_TEST_DEFINE(), channel_fax_cb(), create_sound_blob(), and manager_json_to_ast_str().
struct ast_json* ast_json_boolean | ( | int | value | ) |
Get the JSON boolean corresponding to value.
Definition at line 243 of file json.c.
Referenced by AST_TEST_DEFINE(), attended_transfer_to_json(), and blind_transfer_to_json().
Construct a JSON object from a ast_var_t
list.
channelvars | The list of ast_var_t to represent as JSON |
Definition at line 843 of file json.c.
References ast_json_object_create(), ast_json_object_set(), ast_json_string_create(), AST_LIST_TRAVERSE, ast_var_t::entries, ast_var_t::name, ast_var_t::value, and var.
Referenced by ast_channel_snapshot_to_json(), external_media_audiosocket_tcp(), and external_media_rtp_udp().
Copy a JSON value, but not its children.
If value is a JSON object or array, its children are shared with the returned copy.
value | JSON value to copy. |
NULL
on error. Definition at line 616 of file json.c.
Referenced by AST_TEST_DEFINE(), channel_blob_to_json(), channel_to_json(), and test_handler().
Copy a JSON value, and its children.
If value is a JSON object or array, they are also copied.
value | JSON value to copy. |
NULL
on error. Definition at line 620 of file json.c.
Referenced by AST_TEST_DEFINE(), and stir_shaken_verify_json().
struct ast_json* ast_json_dialplan_cep | ( | const char * | context, |
const char * | exten, | ||
int | priority | ||
) |
Construct a context/exten/priority as JSON.
If a NULL
is passed for context
or exten
, or -1 for priority
, the fields is set to ast_json_null().
context | Context name. |
exten | Extension. |
priority | Dialplan priority. |
context
, exten
and priority
fields Definition at line 644 of file json.c.
References ast_json_dialplan_cep_app().
struct ast_json* ast_json_dialplan_cep_app | ( | const char * | context, |
const char * | exten, | ||
int | priority, | ||
const char * | app_name, | ||
const char * | app_data | ||
) |
Construct a context/exten/priority/application/application_data as JSON.
If a NULL
is passed for context
or exten
or app_name
or app_data
, or -1 for priority
, the fields is set to ast_json_null().
context | Context name. |
exten | Extension. |
priority | Dialplan priority. |
app_name | Application name. |
app_data | Application argument. |
context
, exten
and priority
app_name
app_data
fields Definition at line 632 of file json.c.
References ast_json_integer_create(), ast_json_null(), and ast_json_pack().
Referenced by ast_channel_snapshot_to_json(), ast_json_dialplan_cep(), and AST_TEST_DEFINE().
int ast_json_dump_file_format | ( | struct ast_json * | root, |
FILE * | output, | ||
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to a FILE
.
root | JSON value. |
output | File to write JSON encoding to. |
format | encoding format type. |
Definition at line 505 of file json.c.
References dump_flags().
int ast_json_dump_new_file_format | ( | struct ast_json * | root, |
const char * | path, | ||
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to a file at the given location.
root | JSON value. |
path | Path to file to write JSON encoding to. |
format | encoding format type. |
Definition at line 512 of file json.c.
References dump_flags().
int ast_json_dump_str_format | ( | struct ast_json * | root, |
struct ast_str ** | dst, | ||
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to an ast_str.
If dst is too small, it will be grown as needed.
root | JSON value. |
dst | ast_str to store JSON encoding. |
format | encoding format type. |
Definition at line 499 of file json.c.
References dump_flags(), and write_to_ast_str().
Referenced by ast_ari_callback().
char* ast_json_dump_string_format | ( | struct ast_json * | root, |
enum ast_json_encoding_format | format | ||
) |
Encode a JSON value to a string.
Returned string must be freed by calling ast_json_free().
root | JSON value. |
format | encoding format type. |
NULL
on error. Definition at line 463 of file json.c.
References dump_flags().
Referenced by ast_ari_callback(), ast_ari_websocket_session_write(), send_message(), and stasis_app_message_handler().
Compare two JSON objects.
Two JSON objects are equal if they are of the same type, and their contents are equal.
lhs | Value to compare. |
rhs | Other value to compare. |
Definition at line 347 of file json.c.
Referenced by AST_TEST_DEFINE(), and test_name_number().
struct ast_json* ast_json_false | ( | void | ) |
Get the JSON false value.
The returned value is a singleton, and does not need to be ast_json_unref()'ed.
Definition at line 238 of file json.c.
Referenced by AST_TEST_DEFINE().
void ast_json_free | ( | void * | p | ) |
Asterisk's custom JSON allocator. Exposed for use by unit tests.
Definition at line 52 of file json.c.
References ast_free.
Referenced by add_identity_header(), ast_ari_callback(), ast_ari_events_event_websocket_ws_attempted_cb(), ast_ari_events_event_websocket_ws_established_cb(), ast_ari_websocket_session_write(), ast_cel_create_event_with_time(), ast_json_reset_alloc_funcs(), AST_TEST_DEFINE(), asterisk_publication_send_refresh(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), beanstalk_put(), cel_bs_put(), compare_caller_id(), compare_timestamp(), format_log_json(), get_attestation_from_payload(), json_debug_free(), persistence_generator_data_struct2str(), rtcp_message_handler(), send_message(), sorcery_astdb_create(), and stasis_app_message_handler().
int ast_json_init | ( | void | ) |
Initialize the JSON library.
Definition at line 705 of file json.c.
References ast_json_reset_alloc_funcs(), ast_log, LOG_ERROR, and NULL.
Referenced by asterisk_daemon().
struct ast_json* ast_json_integer_create | ( | intmax_t | value | ) |
Create a JSON integer.
value | Value of the new JSON integer. |
NULL
on error. Definition at line 317 of file json.c.
Referenced by alloc_security_event_json_object(), ast_ari_asterisk_get_info(), ast_endpoint_snapshot_to_json(), ast_json_dialplan_cep_app(), ast_rtp_convert_stats_json(), AST_TEST_DEFINE(), dialog_info_generate_body_content(), identify_module(), meetme_stasis_generate_msg(), stasis_app_recording_to_json(), and stir_shaken_add_iat().
intmax_t ast_json_integer_get | ( | const struct ast_json * | integer | ) |
Get the value from a JSON integer.
integer | JSON integer. |
Definition at line 322 of file json.c.
Referenced by agent_logoff_to_ami(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_channels_continue_in_dialplan_parse_body(), ast_ari_channels_dial_parse_body(), ast_ari_channels_originate_parse_body(), ast_ari_channels_originate_with_id_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_channels_record_parse_body(), ast_ari_channels_send_dtmf_parse_body(), ast_ari_mailboxes_update_parse_body(), AST_TEST_DEFINE(), asterisk_publication_devicestate(), asterisk_publication_mailboxstate(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cel_generic_cb(), channel_dtmf_end_cb(), channel_hangup_request_cb(), check_range(), compare_timestamp(), dahdichannel_to_ami(), dialog_info_generate_body_content(), dtmf_end_to_json(), handle_local_optimization_begin(), handle_local_optimization_end(), local_message_to_ami(), manager_generic_msg_cb(), manager_json_value_str_append(), meetme_stasis_cb(), queue_agent_cb(), security_event_stasis_cb(), security_event_to_ami_blob(), talking_stop_to_ami(), and test_suite_event_to_ami().
int ast_json_integer_set | ( | struct ast_json * | integer, |
intmax_t | value | ||
) |
Set the value of a JSON integer.
integer | JSON integer to modify. |
value | New value for integer. |
Definition at line 327 of file json.c.
Referenced by AST_TEST_DEFINE().
struct ast_json* ast_json_ipaddr | ( | const struct ast_sockaddr * | addr, |
enum ast_transport | transport_type | ||
) |
Construct an IP address as JSON.
XXX some comments describing the need for this here
addr | ast_sockaddr to encode |
transport_type | ast_transport to include in the address string if any. Should just be one. |
NULL
on error. Definition at line 661 of file json.c.
References ast_json_string_create(), ast_sockaddr_is_ipv4(), ast_sockaddr_is_ipv4_mapped(), ast_sockaddr_stringify_addr(), ast_sockaddr_stringify_port(), ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_str_set(), AST_TRANSPORT_TCP, AST_TRANSPORT_TLS, AST_TRANSPORT_UDP, AST_TRANSPORT_WS, AST_TRANSPORT_WSS, and NULL.
Referenced by add_ip_json_object().
int ast_json_is_false | ( | const struct ast_json * | value | ) |
Check if value is JSON false.
Definition at line 258 of file json.c.
Referenced by AST_TEST_DEFINE().
int ast_json_is_null | ( | const struct ast_json * | value | ) |
Check if value is JSON null.
Definition at line 263 of file json.c.
Referenced by aoc_publish_blob(), ast_ari_callback(), ast_manager_str_from_json_object(), AST_TEST_DEFINE(), and channel_blob_to_json().
int ast_json_is_true | ( | const struct ast_json * | value | ) |
Check if value is JSON true.
Definition at line 253 of file json.c.
Referenced by ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_channels_record_parse_body(), AST_TEST_DEFINE(), channel_hangup_request_cb(), channel_mixmonitor_mute_cb(), get_bool_header(), and local_message_to_ami().
struct ast_json* ast_json_load_buf | ( | const char * | buffer, |
size_t | buflen, | ||
struct ast_json_error * | error | ||
) |
Parse buffer with known length into a JSON object or array.
buffer | Buffer to parse. | |
buflen | Length of buffer. | |
[out] | error | Filled with information on error. |
NULL
on error. Definition at line 564 of file json.c.
References copy_error().
Referenced by ast_ari_websocket_session_read(), ast_http_get_json(), AST_TEST_DEFINE(), asterisk_publication_devicestate_state_change(), and asterisk_publication_mwi_state_change().
struct ast_json* ast_json_load_file | ( | FILE * | input, |
struct ast_json_error * | error | ||
) |
Parse a FILE
into JSON object or array.
input | FILE to parse. | |
[out] | error | Filled with information on error. |
NULL
on error. Definition at line 571 of file json.c.
References copy_error(), NULL, and parse_error().
Referenced by AST_TEST_DEFINE().
struct ast_json* ast_json_load_new_file | ( | const char * | path, |
struct ast_json_error * | error | ||
) |
Parse file at path into JSON object or array.
path | Path of file to parse. | |
[out] | error | Filled with information on error. |
NULL
on error. Definition at line 583 of file json.c.
References copy_error().
Referenced by ast_ari_get_docs(), and AST_TEST_DEFINE().
struct ast_json* ast_json_load_str | ( | const struct ast_str * | input, |
struct ast_json_error * | error | ||
) |
Parse ast_str into a JSON object or array.
input | ast_str to parse. | |
[out] | error | Filled with information on error. |
NULL
on error. Definition at line 559 of file json.c.
References ast_json_load_string(), and ast_str_buffer().
Referenced by AST_TEST_DEFINE().
struct ast_json* ast_json_load_string | ( | const char * | input, |
struct ast_json_error * | error | ||
) |
Parse null terminated string into a JSON object or array.
input | String to parse. | |
[out] | error | Filled with information on error. |
NULL
on error. Definition at line 546 of file json.c.
References copy_error(), NULL, and parse_error().
Referenced by ast_json_load_str(), ast_stir_shaken_verify(), AST_TEST_DEFINE(), compare_caller_id(), compare_timestamp(), fetch_access_token(), fetch_google_access_token(), get_attestation_from_payload(), persistence_generator_data_str2struct(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), and sorcery_astdb_retrieve_regex().
void* ast_json_malloc | ( | size_t | size | ) |
Asterisk's custom JSON allocator. Exposed for use by unit tests.
Definition at line 47 of file json.c.
References ast_malloc.
Referenced by ast_json_reset_alloc_funcs(), and json_debug_malloc().
struct ast_json* ast_json_name_number | ( | const char * | name, |
const char * | number | ||
) |
Common JSON rendering functions for common 'objects'.
Simple name/number pair.
name | Name |
number | Number |
Definition at line 625 of file json.c.
References ast_json_pack(), and AST_JSON_UTF8_VALIDATE.
Referenced by ast_channel_snapshot_to_json(), and test_name_number().
struct ast_json* ast_json_null | ( | void | ) |
Get the JSON null value.
The returned value is a singleton, and does not need to be ast_json_unref()'ed.
Definition at line 248 of file json.c.
Referenced by association_to_json(), ast_ari_callback(), ast_ari_recordings_get_stored_file(), ast_ari_response_accepted(), ast_ari_response_no_content(), ast_channel_publish_blob(), ast_channel_publish_cached_blob(), ast_endpoint_blob_create(), ast_json_dialplan_cep_app(), AST_TEST_DEFINE(), create_channel_blob_message(), local_optimization_finished_cb(), local_optimization_started_cb(), publish_chanspy_message(), rtcp_report_to_json(), s_to_json(), send_call_pickup_stasis_message(), send_message(), and units_to_json().
int ast_json_object_clear | ( | struct ast_json * | object | ) |
Delete all elements from a JSON object.
object | JSON object to clear. |
Definition at line 412 of file json.c.
Referenced by AST_TEST_DEFINE().
struct ast_json* ast_json_object_create | ( | void | ) |
Create a new JSON object.
NULL
on error. Definition at line 389 of file json.c.
Referenced by alloc_security_event_json_object(), ast_ari_asterisk_get_info(), ast_ari_asterisk_get_module(), ast_bucket_file_json(), ast_json_channel_vars(), ast_rtp_convert_stats_json(), ast_sip_subscription_set_persistence_data(), ast_sorcery_objectset_json_create(), AST_TEST_DEFINE(), channel_blob_to_json(), msg_to_json(), multi_user_event_to_json(), peerstatus_to_json(), publish_acl_change(), stun_monitor_request(), and units_to_json().
int ast_json_object_del | ( | struct ast_json * | object, |
const char * | key | ||
) |
Delete a field from a JSON object.
object | JSON object to modify. |
key | Key of field to delete. |
Definition at line 408 of file json.c.
Referenced by ast_ari_get_docs(), AST_TEST_DEFINE(), bridge_to_json(), and channel_to_json().
Get a field from a JSON object.
The returned element is a borrowed reference; use ast_json_ref() to safely keep a pointer to it.
object | JSON object. |
key | Key of field to look up. |
NULL
on error. Definition at line 397 of file json.c.
References NULL.
Referenced by add_identity_header(), agent_login_to_ami(), agent_logoff_to_ami(), allocate_subscription(), app_event_filter_set(), app_send(), app_to_json(), append_event_str_single(), append_json_single(), assign_uuid(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_add_log_parse_body(), ast_ari_asterisk_get_global_var_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_set_global_var_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_create_parse_body(), ast_ari_bridges_create_with_id_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_bridges_start_moh_parse_body(), ast_ari_callback(), ast_ari_channels_continue_in_dialplan_parse_body(), ast_ari_channels_create(), ast_ari_channels_create_parse_body(), ast_ari_channels_dial_parse_body(), ast_ari_channels_external_media(), ast_ari_channels_external_media_parse_body(), ast_ari_channels_get_channel_var_parse_body(), ast_ari_channels_hangup_parse_body(), ast_ari_channels_move_parse_body(), ast_ari_channels_mute_parse_body(), ast_ari_channels_originate(), ast_ari_channels_originate_parse_body(), ast_ari_channels_originate_with_id(), ast_ari_channels_originate_with_id_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_channels_record_parse_body(), ast_ari_channels_redirect_parse_body(), ast_ari_channels_send_dtmf_parse_body(), ast_ari_channels_set_channel_var_parse_body(), ast_ari_channels_snoop_channel_parse_body(), ast_ari_channels_snoop_channel_with_id_parse_body(), ast_ari_channels_start_moh_parse_body(), ast_ari_channels_unmute_parse_body(), ast_ari_device_states_update_parse_body(), ast_ari_endpoints_send_message(), ast_ari_endpoints_send_message_parse_body(), ast_ari_endpoints_send_message_to_endpoint(), ast_ari_endpoints_send_message_to_endpoint_parse_body(), ast_ari_events_user_event(), ast_ari_events_user_event_parse_body(), ast_ari_get_docs(), ast_ari_mailboxes_update_parse_body(), ast_ari_playbacks_control_parse_body(), ast_ari_recordings_copy_stored_parse_body(), ast_ari_sounds_list_parse_body(), ast_ari_validate_event(), ast_ari_validate_message(), ast_endpoint_snapshot_to_json(), ast_stir_shaken_sign(), AST_TEST_DEFINE(), asterisk_publication_devicestate(), asterisk_publication_devicestate_state_change(), asterisk_publication_mailboxstate(), asterisk_publication_mwi_state_change(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cel_generic_cb(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_enter_cb(), channel_fax_cb(), channel_hangup_handler_cb(), channel_hangup_request_cb(), channel_hold_cb(), channel_mixmonitor_mute_cb(), channel_moh_start_cb(), compare_caller_id(), compare_timestamp(), conf_send_event_to_participants(), confbridge_publish_manager_event(), confbridge_talking_cb(), contactstatus_to_ami(), contactstatus_to_json(), create_sound_blob(), dahdichannel_to_ami(), dial_to_json(), dtmf_end_to_json(), fetch_access_token(), fetch_google_access_token(), get_attestation_from_payload(), get_blob_variable(), get_bool_header(), handle_dial_message(), handle_local_optimization_begin(), handle_local_optimization_end(), handle_masquerade(), handler(), hold_to_json(), local_message_to_ami(), manager_generic_msg_cb(), meetme_stasis_cb(), multi_user_event_to_ami(), multi_user_event_to_json(), mwi_app_event_cb(), mwi_startup_event_cb(), peerstatus_to_ami(), playback_to_json(), queue_agent_cb(), recording_to_json(), registry_message_cb(), rtcp_message_handler(), rtcp_report_to_ami(), security_event_stasis_cb(), security_event_to_ami_blob(), send_start_msg_snapshots(), session_timeout_to_ami(), startup_event_cb(), stasis_app_exec(), stasis_app_message_handler(), stasis_end_to_json(), stasis_start_to_json(), stir_shaken_add_attest(), stir_shaken_add_iat(), stir_shaken_add_origid(), stir_shaken_add_x5u(), stir_shaken_verify_json(), subscription_persistence_event_cb(), system_registry_to_ami(), talking_stop_to_ami(), test_suite_event_to_ami(), and varset_to_ami().
struct ast_json_iter* ast_json_object_iter | ( | struct ast_json * | object | ) |
Get an iterator pointing to the first field in a JSON object.
The order of the fields in an object are not specified. However, iterating forward from this iterator will cover all fields in object. Adding or removing fields from object may invalidate its iterators.
object | JSON object. |
NULL
object is empty. NULL
on error. Definition at line 429 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialed(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), and manager_json_to_ast_str().
struct ast_json_iter* ast_json_object_iter_at | ( | struct ast_json * | object, |
const char * | key | ||
) |
Get an iterator pointing to a specified key in object.
Iterating forward from this iterator may not to cover all elements in object.
object | JSON object to iterate. |
key | Key of field to lookup. |
NULL
if key does not exist. NULL
on error. Definition at line 433 of file json.c.
Referenced by AST_TEST_DEFINE().
const char* ast_json_object_iter_key | ( | struct ast_json_iter * | iter | ) |
Get the key from an iterator.
iter | JSON object iterator. |
Definition at line 441 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialed(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), and manager_json_to_ast_str().
struct ast_json_iter* ast_json_object_iter_next | ( | struct ast_json * | object, |
struct ast_json_iter * | iter | ||
) |
Get the next iterator.
object | JSON object iter was obtained from. |
iter | JSON object iterator. |
NULL
if iter was the last field. Definition at line 437 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialed(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), and manager_json_to_ast_str().
int ast_json_object_iter_set | ( | struct ast_json * | object, |
struct ast_json_iter * | iter, | ||
struct ast_json * | value | ||
) |
Set the value of the field pointed to by an iterator.
object | JSON object iter was obtained from. |
iter | JSON object iterator. |
value | JSON value to store in 's field. |
Definition at line 449 of file json.c.
Referenced by AST_TEST_DEFINE().
struct ast_json* ast_json_object_iter_value | ( | struct ast_json_iter * | iter | ) |
Get the value from an iterator.
The returned element is a borrowed reference; use ast_json_ref() to safely keep a pointer to it.
iter | JSON object iterator. |
Definition at line 445 of file json.c.
Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_info(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), and manager_json_to_ast_str().
Set a field in a JSON object.
object | JSON object to modify. |
key | Key of field to set. |
value | JSON value to set for field. |
Definition at line 404 of file json.c.
Referenced by add_ip_json_object(), add_json_object(), alloc_security_event_json_object(), app_send(), ast_ari_asterisk_get_info(), ast_ari_get_docs(), ast_bridge_snapshot_to_json(), ast_bucket_file_json(), ast_bucket_json(), ast_channel_snapshot_to_json(), ast_endpoint_snapshot_to_json(), ast_json_channel_vars(), ast_rtp_convert_stats_json(), ast_sip_subscription_set_persistence_data(), ast_sorcery_objectset_json_create(), AST_TEST_DEFINE(), attended_transfer_to_json(), blind_transfer_to_json(), channel_blob_to_json(), devices_to_json(), dial_to_json(), external_media_audiosocket_tcp(), external_media_rtp_udp(), handler(), identify_module(), launch_asyncagi(), meetme_stasis_generate_msg(), msg_to_json(), multi_user_event_to_json(), publish_acl_change(), recording_publish(), stasis_app_event_filter_to_json(), stasis_app_message_handler(), stasis_app_recording_to_json(), stasis_app_user_event(), stasis_start_to_json(), stir_shaken_add_attest(), stir_shaken_add_iat(), stir_shaken_add_origid(), stir_shaken_add_x5u(), sub_bridge_update_handler(), units_to_json(), and userevent_exec().
size_t ast_json_object_size | ( | struct ast_json * | object | ) |
Get size of JSON object.
object | JSON object. |
Definition at line 393 of file json.c.
Referenced by app_event_filter_set(), and AST_TEST_DEFINE().
Update object with all of the fields of other.
All of the fields of other are copied into object, overwriting existing keys. The other object is not changed, so ast_json_unref() it when you are done with it.
object | JSON object to modify. |
other | JSON object to copy into object. |
Definition at line 416 of file json.c.
Referenced by AST_TEST_DEFINE(), cc_publish(), channel_to_json(), meetme_stasis_generate_msg(), peerstatus_to_json(), send_conf_stasis(), and send_conf_stasis_snapshots().
Update existing fields in object with the fields of other.
Like ast_json_object_update(), but only existing fields are updated. No new fields will get added. The other object is not changed, so ast_json_unref() it when you are done with it.
object | JSON object to modify. |
other | JSON object to copy into object. |
Definition at line 420 of file json.c.
Referenced by AST_TEST_DEFINE().
Add new fields to object with the fields of other.
Like ast_json_object_update(), but only missing fields are added. No existing fields will be modified. The other object is not changed, so ast_json_unref() it when you are done with it.
object | JSON object to modify. |
other | JSON object to copy into object. |
Definition at line 424 of file json.c.
Referenced by AST_TEST_DEFINE().
struct ast_json* ast_json_pack | ( | char const * | format, |
... | |||
) |
Helper for creating complex JSON values.
See original Jansson docs at http://www.digip.org/jansson/doc/2.11/apiref.html#apiref-pack for more details.
Definition at line 591 of file json.c.
References args, and ast_json_vpack().
Referenced by __ast_test_suite_event_notify(), __expire_registry(), __iax2_poke_noanswer(), add_format_information_cb(), add_identity_header(), agi_handle_command(), analog_publish_channel_alarm_clear(), analog_publish_dnd_state(), app_send_end_msg(), app_to_json(), app_update(), association_to_json(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_info(), ast_ari_asterisk_ping(), ast_ari_channels_get_channel_var(), ast_ari_response_error(), ast_bridge_channel_write_hold(), ast_bridge_merge_message_to_json(), ast_bridge_publish_enter(), ast_bridge_snapshot_to_json(), ast_cel_publish_event(), ast_channel_move(), ast_channel_publish_dial_internal(), ast_channel_publish_varset(), ast_channel_snapshot_to_json(), ast_endpoint_snapshot_to_json(), ast_json_dialplan_cep_app(), ast_json_name_number(), ast_json_party_id(), ast_manager_publish_event(), ast_queue_hangup_with_cause(), ast_queue_hold(), ast_rtcp_calculate_sr_rr_statistics(), ast_rtcp_interpret(), ast_sip_persistent_endpoint_publish_contact_state(), ast_sip_persistent_endpoint_update_state(), ast_softhangup(), ast_system_publish_registry(), AST_TEST_DEFINE(), asterisk_publication_send_refresh(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), attended_transfer_to_json(), beanstalk_put(), blind_transfer_to_json(), cc_publish(), cc_publish_available(), cc_publish_callerrecalling(), cc_publish_callerstartmonitoring(), cc_publish_callerstopmonitoring(), cc_publish_failure(), cc_publish_monitorfailed(), cc_publish_offertimerstart(), cc_publish_recallcomplete(), cc_publish_requestacknowledged(), cc_publish_requested(), cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_bs_put(), cel_channel_state_change(), cel_dial_cb(), cel_local_cb(), cel_parking_cb(), cel_pickup_cb(), celgenuserevent_exec(), channel_callerid(), channel_connected_line(), channel_destroyed_event(), channel_dialplan(), charge_to_json(), conf_handle_talker_cb(), confbridge_handle_atxfer(), contactstatus_to_json(), create_sound_blob(), currency_to_json(), d_to_json(), dial_to_json(), dtmf_end_to_json(), e_to_json(), expire_register(), format_log_json(), handle_response_peerpoke(), handler(), hold_to_json(), join_queue(), json_party_name(), json_party_number(), json_party_subaddress(), launch_asyncagi(), leave_queue(), load_module(), local_optimization_finished_cb(), local_optimization_started_cb(), mailbox_to_json(), manager_mute_mixmonitor(), meetme_stasis_generate_msg(), message_received_handler(), moh_post_start(), msg_to_json(), notify_new_message(), pack_bridge_and_channels(), parse_register_contact(), peerstatus_to_json(), phase_e_handler(), playback_to_json(), process_log_list(), process_module_list(), publish_async_exec_end(), publish_channel_alarm(), publish_channel_alarm_clear(), publish_cluster_discovery_to_stasis_full(), publish_dahdichannel(), publish_dnd_state(), publish_format_update(), publish_fully_booted(), publish_hangup_handler_message(), publish_load_message_type(), publish_local_bridge_message(), publish_qualify_peer_done(), publish_span_alarm(), publish_span_alarm_clear(), queue_member_blob_create(), really_quit(), record_abandoned(), recording_to_json(), register_verify(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), return_sorcery_object(), ring_entry(), rna(), rtcp_report_to_json(), s_to_json(), send_agent_complete(), send_agent_login(), send_agent_logoff(), send_conf_stasis(), send_conf_stasis_snapshots(), send_device_state(), send_dtmf_begin_event(), send_dtmf_end_event(), send_join_event(), send_leave_event(), send_mute_event(), send_session_timeout(), send_start_msg_snapshots(), send_unmute_event(), simple_bridge_channel_event(), simple_bridge_event(), simple_channel_event(), simple_endpoint_event(), sip_poke_noanswer(), skinny_register(), skinny_session_cleanup(), socket_process_helper(), stasis_app_device_state_to_json(), stasis_app_exec(), stasis_app_playback_to_json(), stasis_app_recording_to_json(), stasis_app_stored_recording_to_json(), stasis_app_user_event(), stasis_end_to_json(), stasis_start_to_json(), status_to_json(), talk_detect_audiohook_cb(), test_name_number(), try_calling(), unhold_to_json(), unload_module(), update_registry(), and userevent_exec().
struct ast_json* ast_json_party_id | ( | struct ast_party_id * | party | ) |
Construct an ast_party_id as JSON.
party | The party ID to represent as JSON. |
name
, number
and subaddress
objects for those that are valid in the party ID Definition at line 784 of file json.c.
References ast_describe_caller_presentation(), ast_json_pack(), ast_party_id_presentation(), json_party_name(), json_party_number(), json_party_subaddress(), ast_party_id::name, ast_party_id::number, and ast_party_id::subaddress.
struct ast_json_payload* ast_json_payload_create | ( | struct ast_json * | json | ) |
Create an ao2 object to pass json blobs as data payloads for stasis.
json | the ast_json blob we are loading |
NULL | if we fail to alloc it |
pointer | to the ast_json_payload created |
Definition at line 735 of file json.c.
References ao2_alloc, ast_json_ref(), ast_json_payload::json, json_payload_destructor(), and NULL.
Referenced by ast_manager_publish_event(), ast_system_publish_registry(), cc_publish(), handle_security_event(), publish_acl_change(), publish_cluster_discovery_to_stasis_full(), publish_format_update(), publish_load_message_type(), queue_publish_member_blob(), and stun_monitor_request().
struct ast_json* ast_json_real_create | ( | double | value | ) |
Create a JSON real number.
value | Value of the new JSON real number. |
NULL
on error. Definition at line 332 of file json.c.
Referenced by ast_ari_asterisk_get_info(), and ast_rtp_convert_stats_json().
double ast_json_real_get | ( | const struct ast_json * | real | ) |
Get the value from a JSON real number.
real | JSON real number. |
Definition at line 337 of file json.c.
Referenced by rtcp_report_to_ami().
int ast_json_real_set | ( | struct ast_json * | real, |
double | value | ||
) |
Set the value of a JSON real number.
integer | JSON real number to modify. |
value | New value for real. |
Increase refcount on value.
value | JSON value to reference. |
Definition at line 67 of file json.c.
Referenced by alloc_security_event_json_object(), allocate_subscription(), aoc_publish_blob(), app_event_filter_set(), ari_bridges_play_found(), ari_bridges_play_new(), ast_ari_applications_list(), ast_ari_applications_subscribe(), ast_ari_applications_unsubscribe(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_info(), ast_ari_bridges_list(), ast_ari_bridges_record(), ast_ari_channels_get_channel_var(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_websocket_session_read(), ast_bridge_blob_create(), ast_bridge_blob_create_from_snapshots(), ast_bucket_file_json(), ast_bucket_json(), ast_cel_publish_event(), ast_endpoint_blob_create(), ast_json_payload_create(), ast_manager_publish_event(), ast_multi_channel_blob_create(), ast_multi_object_blob_create(), ast_mwi_blob_create(), ast_rtp_publish_rtcp_message(), ast_sip_subscription_set_persistence_data(), AST_TEST_DEFINE(), attended_transfer_to_json(), create_channel_blob_message(), create_sound_blob(), generate_filenames_json(), json_array_from_list(), message_received_handler(), multi_user_event_to_json(), phase_e_handler(), publish_load_message_type(), report_receive_fax_status(), return_sorcery_object(), stasis_app_event_filter_to_json(), stasis_app_message_handler(), stasis_app_playback_to_json(), stasis_app_recording_to_json(), and stasis_app_user_event().
void ast_json_reset_alloc_funcs | ( | void | ) |
Change alloc funcs back to the resource module defaults.
If you use ast_json_set_alloc_funcs() to temporarily change the allocator functions (i.e., from in a unit test), this function sets them back to ast_malloc() and ast_free().
Definition at line 62 of file json.c.
References ast_json_free(), and ast_json_malloc().
Referenced by ast_json_init(), and json_test_cleanup().
void ast_json_set_alloc_funcs | ( | void *(*)(size_t) | malloc_fn, |
void(*)(void *) | free_fn | ||
) |
Set custom allocators instead of the standard ast_malloc() and ast_free().
This is used by the unit tests to do JSON specific memory leak detection. Since it affects all users of the JSON library, shouldn't normally be used.
malloc_fn | Custom allocation function. |
free_fn | Matching free function. |
Definition at line 57 of file json.c.
Referenced by json_test_init().
struct ast_json* ast_json_string_create | ( | const char * | value | ) |
Construct a JSON string from value.
The given value must be a valid ASCII or UTF-8 encoded string.
value | Value of new JSON string. |
NULL
on error. Definition at line 268 of file json.c.
Referenced by add_json_object(), alloc_security_event_json_object(), app_send(), app_to_json(), ast_bridge_snapshot_to_json(), ast_bucket_file_json(), ast_bucket_json(), ast_endpoint_snapshot_to_json(), ast_json_channel_vars(), ast_json_ipaddr(), ast_json_timeval(), ast_rtp_convert_stats_json(), ast_sorcery_objectset_json_create(), AST_TEST_DEFINE(), attended_transfer_to_json(), channel_blob_to_json(), container_to_json_array(), device_to_json_cb(), fake_json(), generate_filenames_json(), handler(), identify_module(), json_array_from_list(), launch_asyncagi(), msg_to_json(), multi_user_event_to_json(), publish_acl_change(), recording_publish(), report_receive_fax_status(), send_start_msg_snapshots(), stasis_app_exec(), stasis_app_message_handler(), stasis_app_user_event(), stir_shaken_add_attest(), stir_shaken_add_origid(), stir_shaken_add_x5u(), sub_bridge_update_handler(), and userevent_exec().
const char* ast_json_string_get | ( | const struct ast_json * | string | ) |
Get the value of a JSON string.
string | JSON string. |
NULL
on error. Definition at line 273 of file json.c.
Referenced by agent_login_to_ami(), agent_logoff_to_ami(), app_send(), append_event_str_single(), append_json_single(), assign_uuid(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_add_log_parse_body(), ast_ari_asterisk_get_global_var_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_asterisk_set_global_var_parse_body(), ast_ari_asterisk_update_object(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_create_parse_body(), ast_ari_bridges_create_with_id_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_record_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_bridges_start_moh_parse_body(), ast_ari_callback(), ast_ari_channels_continue_in_dialplan_parse_body(), ast_ari_channels_create_parse_body(), ast_ari_channels_dial_parse_body(), ast_ari_channels_external_media_parse_body(), ast_ari_channels_get_channel_var_parse_body(), ast_ari_channels_hangup_parse_body(), ast_ari_channels_move_parse_body(), ast_ari_channels_mute_parse_body(), ast_ari_channels_originate_parse_body(), ast_ari_channels_originate_with_id_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_channels_record_parse_body(), ast_ari_channels_redirect_parse_body(), ast_ari_channels_send_dtmf_parse_body(), ast_ari_channels_set_channel_var_parse_body(), ast_ari_channels_snoop_channel_parse_body(), ast_ari_channels_snoop_channel_with_id_parse_body(), ast_ari_channels_start_moh_parse_body(), ast_ari_channels_unmute_parse_body(), ast_ari_device_states_update_parse_body(), ast_ari_endpoints_send_message_parse_body(), ast_ari_endpoints_send_message_to_endpoint_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_playbacks_control_parse_body(), ast_ari_recordings_copy_stored_parse_body(), ast_ari_sounds_list_parse_body(), ast_ari_validate_date(), ast_ari_validate_event(), ast_ari_validate_message(), ast_json_to_ast_variables(), ast_stir_shaken_sign(), AST_TEST_DEFINE(), asterisk_publication_devicestate(), asterisk_publication_devicestate_state_change(), asterisk_publication_mailboxstate(), asterisk_publication_mwi_state_change(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cel_generic_cb(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_enter_cb(), channel_fax_cb(), channel_hangup_handler_cb(), channel_hold_cb(), channel_mixmonitor_mute_cb(), channel_moh_start_cb(), compare_caller_id(), confbridge_publish_manager_event(), confbridge_talking_cb(), contactstatus_to_ami(), contactstatus_to_json(), dahdichannel_to_ami(), dial_to_json(), dtmf_end_to_json(), fetch_access_token(), fetch_google_access_token(), get_attestation_from_payload(), get_blob_variable(), handle_dial_message(), handle_masquerade(), hold_to_json(), local_message_to_ami(), manager_generic_msg_cb(), manager_json_value_str_append(), meetme_stasis_cb(), multi_user_event_to_ami(), mwi_app_event_cb(), mwi_startup_event_cb(), peerstatus_to_ami(), playback_to_json(), queue_agent_cb(), recording_to_json(), registry_message_cb(), rtcp_message_handler(), rtcp_report_to_ami(), session_timeout_to_ami(), startup_event_cb(), stasis_app_message_handler(), stir_shaken_verify_json(), subscription_persistence_event_cb(), system_registry_to_ami(), test_suite_event_to_ami(), and varset_to_ami().
int ast_json_string_set | ( | struct ast_json * | string, |
const char * | value | ||
) |
Change the value of a JSON string.
The given value must be a valid ASCII or UTF-8 encoded string.
string | JSON string to modify. |
value | New value to store in string. |
Definition at line 278 of file json.c.
Referenced by AST_TEST_DEFINE(), and conf_send_event_to_participants().
struct ast_json* ast_json_stringf | ( | const char * | format, |
... | |||
) |
Create a JSON string, printf style.
The formatted value must be a valid ASCII or UTF-8 encoded string.
format | printf style format string. |
NULL
on error. Definition at line 283 of file json.c.
References args, and ast_json_vstringf().
Referenced by add_json_object(), alloc_security_event_json_object(), ast_ari_get_docs(), AST_TEST_DEFINE(), and units_to_json().
struct ast_json* ast_json_timeval | ( | const struct timeval | tv, |
const char * | zone | ||
) |
Construct a timeval as JSON.
JSON does not define a standard date format (boo), but the de facto standard is to use ISO 8601 formatted string. We build a millisecond resolution string from the timeval
tv | timeval to encode. |
zone | Text string of a standard system zoneinfo file. If NULL, the system localtime will be used. |
NULL
on error. Definition at line 649 of file json.c.
References AST_ISO8601_FORMAT, AST_ISO8601_LEN, ast_json_string_create(), ast_localtime(), ast_strftime(), and buf.
Referenced by add_json_object(), alloc_security_event_json_object(), app_send_end_msg(), app_update(), ast_ari_asterisk_get_info(), ast_ari_asterisk_ping(), ast_bridge_merge_message_to_json(), ast_bridge_snapshot_to_json(), ast_channel_snapshot_to_json(), AST_TEST_DEFINE(), attended_transfer_to_json(), blind_transfer_to_json(), channel_blob_to_json(), channel_callerid(), channel_connected_line(), channel_destroyed_event(), channel_dialplan(), contactstatus_to_json(), dial_to_json(), dtmf_end_to_json(), hold_to_json(), message_received_handler(), multi_user_event_to_json(), pack_bridge_and_channels(), peerstatus_to_json(), playback_to_json(), recording_to_json(), send_device_state(), send_start_msg_snapshots(), simple_bridge_channel_event(), simple_bridge_event(), simple_channel_event(), simple_endpoint_event(), stasis_app_exec(), and unhold_to_json().
enum ast_json_to_ast_vars_code ast_json_to_ast_variables | ( | struct ast_json * | json_variables, |
struct ast_variable ** | variables | ||
) |
Convert a ast_json
list of key/value pair tuples into a ast_variable
list.
json_variables | The JSON blob containing the variable |
variables | An out reference to the variables to populate. |
Definition at line 797 of file json.c.
References ast_assert, ast_json_object_iter(), ast_json_object_iter_key(), ast_json_object_iter_next(), ast_json_object_iter_value(), AST_JSON_STRING, ast_json_string_get(), AST_JSON_TO_AST_VARS_CODE_INVALID_TYPE, AST_JSON_TO_AST_VARS_CODE_OOM, AST_JSON_TO_AST_VARS_CODE_SUCCESS, ast_json_typeof(), ast_strlen_zero, ast_variable_list_append_hint(), ast_variable_new, ast_variables_destroy(), NULL, and value.
Referenced by json_to_ast_variables(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), and sorcery_astdb_retrieve_regex().
struct ast_json* ast_json_true | ( | void | ) |
Get the JSON true value.
The returned value is a singleton, and does not need to be ast_json_unref()'ed.
Definition at line 233 of file json.c.
Referenced by AST_TEST_DEFINE().
const char* ast_json_typename | ( | enum ast_json_type | type | ) |
Get the string name for the given type.
type | Type to convert to string. |
"?"
for invalid types. Definition at line 95 of file json.c.
References ast_assert, AST_JSON_ARRAY, AST_JSON_FALSE, AST_JSON_INTEGER, AST_JSON_NULL, AST_JSON_OBJECT, AST_JSON_REAL, AST_JSON_STRING, and AST_JSON_TRUE.
Referenced by ast_ari_validate_boolean(), and check_type().
enum ast_json_type ast_json_typeof | ( | const struct ast_json * | value | ) |
Get the type of value.
value | Value to query. |
Definition at line 78 of file json.c.
References ast_assert, AST_JSON_ARRAY, AST_JSON_FALSE, AST_JSON_INTEGER, AST_JSON_NULL, AST_JSON_OBJECT, AST_JSON_REAL, AST_JSON_STRING, and AST_JSON_TRUE.
Referenced by app_event_filter_set(), ast_ari_applications_subscribe_parse_body(), ast_ari_applications_unsubscribe_parse_body(), ast_ari_asterisk_get_info_parse_body(), ast_ari_bridges_add_channel_parse_body(), ast_ari_bridges_play_parse_body(), ast_ari_bridges_play_with_id_parse_body(), ast_ari_bridges_remove_channel_parse_body(), ast_ari_channels_play_parse_body(), ast_ari_channels_play_with_id_parse_body(), ast_ari_events_user_event_parse_body(), ast_ari_validate_boolean(), ast_json_to_ast_variables(), AST_TEST_DEFINE(), check_type(), manager_json_to_ast_str(), manager_json_value_str_append(), and pack_bridge_and_channels().
void ast_json_unref | ( | struct ast_json * | value | ) |
Decrease refcount on value. If refcount reaches zero, value is freed.
NULL
to this function. Definition at line 73 of file json.c.
Referenced by __expire_registry(), __iax2_poke_noanswer(), agi_handle_command(), alloc_security_event_json_object(), analog_publish_channel_alarm_clear(), analog_publish_dnd_state(), aoc_event_blob_dtor(), app_data_dtor(), app_dtor(), app_event_filter_set(), app_send_end_msg(), app_to_json(), app_update(), ari_bridges_play_found(), ari_bridges_play_new(), ast_aoc_manager_event(), ast_ari_applications_list(), ast_ari_applications_subscribe(), ast_ari_applications_unsubscribe(), ast_ari_asterisk_get_global_var(), ast_ari_asterisk_get_info(), ast_ari_asterisk_get_module(), ast_ari_asterisk_list_log_channels(), ast_ari_bridges_list(), ast_ari_bridges_record(), ast_ari_callback(), ast_ari_channels_get_channel_var(), ast_ari_channels_list(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_ari_recordings_list_stored(), ast_ari_response_error(), ast_ari_sounds_list(), ast_ari_websocket_events_event_websocket_established(), ast_ari_websocket_session_read(), ast_bridge_channel_write_hold(), ast_bridge_merge_message_to_json(), ast_bridge_publish_enter(), ast_bucket_file_json(), ast_bucket_json(), ast_cel_publish_event(), ast_channel_move(), ast_channel_publish_dial_internal(), ast_channel_publish_varset(), ast_endpoint_snapshot_to_json(), ast_manager_publish_event(), ast_queue_hangup_with_cause(), ast_queue_hold(), ast_rtcp_calculate_sr_rr_statistics(), ast_rtcp_interpret(), ast_rtp_convert_stats_json(), ast_sip_persistent_endpoint_publish_contact_state(), ast_sip_persistent_endpoint_update_state(), ast_sip_subscription_set_persistence_data(), ast_softhangup(), ast_sorcery_objectset_json_create(), ast_stir_shaken_payload_free(), ast_system_publish_registry(), AST_TEST_DEFINE(), asterisk_publication_devicestate_state_change(), asterisk_publication_mwi_state_change(), asterisk_publication_send_refresh(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), attended_transfer_to_json(), beanstalk_put(), blind_transfer_to_json(), bridge_blob_dtor(), cc_publish(), cc_publish_available(), cc_publish_callerrecalling(), cc_publish_callerstartmonitoring(), cc_publish_callerstopmonitoring(), cc_publish_failure(), cc_publish_monitorfailed(), cc_publish_offertimerstart(), cc_publish_recallcomplete(), cc_publish_requestacknowledged(), cc_publish_requested(), cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_bs_put(), cel_channel_state_change(), cel_dial_cb(), cel_local_cb(), cel_parking_cb(), cel_pickup_cb(), celgenuserevent_exec(), channel_blob_dtor(), channel_blob_to_json(), channel_to_json(), conf_handle_talker_cb(), conf_run(), conf_send_event_to_participants(), confbridge_handle_atxfer(), contactstatus_to_json(), container_to_json_array(), create_sound_blob(), destroy_subscription(), dial_to_json(), endpoint_blob_dtor(), event_session_shutdown(), event_session_update_websocket(), expire_register(), fetch_access_token(), fetch_google_access_token(), format_log_json(), generate_filenames_json(), handle_msg_cb(), handle_response_peerpoke(), handle_security_event(), join_queue(), json_array_from_list(), json_payload_destructor(), launch_asyncagi(), leave_queue(), local_optimization_finished_cb(), local_optimization_started_cb(), manager_mute_mixmonitor(), meetme_stasis_generate_msg(), message_received_handler(), moh_post_start(), msg_to_json(), multi_channel_blob_dtor(), multi_object_blob_dtor(), mwi_blob_dtor(), notify_new_message(), parse_register_contact(), peerstatus_to_json(), phase_e_handler(), playback_publish(), publish_acl_change(), publish_async_exec_end(), publish_channel_alarm(), publish_channel_alarm_clear(), publish_chanspy_message(), publish_cluster_discovery_to_stasis_full(), publish_dahdichannel(), publish_dnd_state(), publish_format_update(), publish_fully_booted(), publish_hangup_handler_message(), publish_load_message_type(), publish_local_bridge_message(), publish_qualify_peer_done(), publish_span_alarm(), publish_span_alarm_clear(), queue_publish_member_blob(), really_quit(), record_abandoned(), recording_publish(), register_verify(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), response_free(), return_sorcery_object(), ring_entry(), rna(), rtcp_message_handler(), rtcp_message_payload_dtor(), rtcp_report_to_json(), send_agent_complete(), send_agent_login(), send_agent_logoff(), send_conf_stasis(), send_conf_stasis_snapshots(), send_device_state(), send_dtmf_begin_event(), send_dtmf_end_event(), send_join_event(), send_leave_event(), send_mute_event(), send_session_timeout(), send_talking_event(), send_unmute_event(), simple_bridge_channel_event(), sip_poke_noanswer(), skinny_register(), skinny_session_cleanup(), socket_process_helper(), sorcery_astdb_create(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_id(), sorcery_astdb_retrieve_prefix(), sorcery_astdb_retrieve_regex(), start_message_blob_dtor(), stasis_app_exec(), stasis_app_mailboxes_to_json(), stasis_app_playback_to_json(), stasis_app_recording_to_json(), stasis_app_user_event(), stasis_start_to_json(), stun_monitor_request(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_default_handler(), sub_endpoint_update_handler(), subscription_persistence_destroy(), talk_detect_audiohook_cb(), test_name_number(), test_suite_message_payload_dtor(), try_calling(), unload_module(), update_registry(), and userevent_exec().
int ast_json_utf8_check | ( | const char * | str | ) |
Check the nul terminated string for UTF-8 format.
str | String to check. |
0 | if not UTF-8 encoded or str is NULL. |
1 | if UTF-8 encoded. |
Definition at line 228 of file json.c.
References ast_json_utf8_check_len().
int ast_json_utf8_check_len | ( | const char * | str, |
size_t | len | ||
) |
Check the string of the given length for UTF-8 format.
str | String to check. |
len | Length of string to check. |
0 | if not UTF-8 encoded or str is NULL. |
1 | if UTF-8 encoded. |
Definition at line 186 of file json.c.
References ast_debug, json_utf8_check_first(), json_utf8_check_full(), and len().
Referenced by ast_json_utf8_check().
struct ast_json* ast_json_vpack | ( | char const * | format, |
va_list | ap | ||
) |
Helper for creating complex JSON values simply.
See original Jansson docs at http://www.digip.org/jansson/doc/2.11/apiref.html#apiref-pack for more details.
Definition at line 600 of file json.c.
References ast_log, ast_log_backtrace(), ast_strlen_zero, error(), LOG_ERROR, and NULL.
Referenced by ast_json_pack().
struct ast_json* ast_json_vstringf | ( | const char * | format, |
va_list | args | ||
) |
Create a JSON string, vprintf style.
The formatted value must be a valid ASCII or UTF-8 encoded string.
format | printf style format string. |
NULL
on error. Definition at line 293 of file json.c.
References ast_free, ast_vasprintf, NULL, and str.
Referenced by ast_ari_response_error(), and ast_json_stringf().