Asterisk - The Open Source Telephony Project GIT-master-0bf3178
|
#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/utils.h"
#include "asterisk/uuid.h"
#include "asterisk/res_aeap.h"
#include "asterisk/res_aeap_message.h"
Go to the source code of this file.
Functions | |
struct ast_aeap_message * | ast_aeap_message_create1 (const struct ast_aeap_message_type *type, const void *params) |
Create an Asterisk external application message object. More... | |
struct ast_aeap_message * | ast_aeap_message_create2 (const struct ast_aeap_message_type *type, const char *msg_type, const char *name, const char *id, const void *params) |
Create an Asterisk external application message object. More... | |
struct ast_aeap_message * | ast_aeap_message_create_error (const struct ast_aeap_message_type *type, const char *name, const char *id, const char *error_msg) |
Create an Asterisk external application error response object. More... | |
struct ast_aeap_message * | ast_aeap_message_create_request (const struct ast_aeap_message_type *type, const char *name, const char *id, const void *params) |
Create an Asterisk external application request object. More... | |
struct ast_aeap_message * | ast_aeap_message_create_response (const struct ast_aeap_message_type *type, const char *name, const char *id, const void *params) |
Create an Asterisk external application response object. More... | |
void * | ast_aeap_message_data (struct ast_aeap_message *message) |
Retrieve the core message data/body. More... | |
struct ast_aeap_message * | ast_aeap_message_deserialize (const struct ast_aeap_message_type *type, const void *buf, intmax_t size) |
Deserialize the given buffer into an Asterisk external application message object. More... | |
const char * | ast_aeap_message_error_msg (const struct ast_aeap_message *message) |
Retrieve the error message if it has one. More... | |
int | ast_aeap_message_error_msg_set (struct ast_aeap_message *message, const char *error_msg) |
Set an error message. More... | |
const char * | ast_aeap_message_id (const struct ast_aeap_message *message) |
Retrieve a message id. More... | |
const char * | ast_aeap_message_id_generate (struct ast_aeap_message *message) |
Generate an id, and set it for the message. More... | |
int | ast_aeap_message_id_set (struct ast_aeap_message *message, const char *id) |
Set a message id. More... | |
int | ast_aeap_message_is_named (const struct ast_aeap_message *message, const char *name) |
Check whether or not a message's name matches the given one. More... | |
int | ast_aeap_message_is_request (const struct ast_aeap_message *message) |
Retrieve whether or not this is a request message. More... | |
int | ast_aeap_message_is_response (const struct ast_aeap_message *message) |
Retrieve whether or not this is a response message. More... | |
const char * | ast_aeap_message_name (const struct ast_aeap_message *message) |
Retrieve a message name. More... | |
enum AST_AEAP_DATA_TYPE | ast_aeap_message_serial_type (const struct ast_aeap_message_type *type) |
Retrieve the serial type a message type. More... | |
int | ast_aeap_message_serialize (const struct ast_aeap_message *message, void **buf, intmax_t *size) |
Serialize the given message object into a byte/char buffer. More... | |
static struct ast_aeap_message * | message_create (const struct ast_aeap_message_type *type) |
static void | message_destructor (void *obj) |
struct ast_aeap_message * ast_aeap_message_create1 | ( | const struct ast_aeap_message_type * | type, |
const void * | params | ||
) |
Create an Asterisk external application message object.
type | The type of message object to create |
params | Any parameter(s) to pass to the type's constructor |
Definition at line 59 of file res/res_aeap/message.c.
References ao2_ref, ast_assert, ast_log, LOG_ERROR, message_create(), NULL, and type.
Referenced by ast_aeap_message_deserialize().
struct ast_aeap_message * ast_aeap_message_create2 | ( | const struct ast_aeap_message_type * | type, |
const char * | msg_type, | ||
const char * | name, | ||
const char * | id, | ||
const void * | params | ||
) |
Create an Asterisk external application message object.
type | The type of message object to create |
msg_type | The type of message (e.g. request or response) |
name | The name of the message |
id | The message id |
params | Other optional parameter(s) to possibly use |
Definition at line 81 of file res/res_aeap/message.c.
References ao2_ref, ast_assert, ast_log, LOG_ERROR, message_create(), name, NULL, and type.
Referenced by ast_aeap_message_create_request(), and ast_aeap_message_create_response().
struct ast_aeap_message * ast_aeap_message_create_error | ( | const struct ast_aeap_message_type * | type, |
const char * | name, | ||
const char * | id, | ||
const char * | error_msg | ||
) |
Create an Asterisk external application error response object.
type | The type of message object to create |
name | The name of the message |
id | Optional id |
error_msg | Error message to set |
Definition at line 129 of file res/res_aeap/message.c.
References ao2_ref, ast_aeap_message_create_response(), ast_aeap_message_error_msg_set(), name, NULL, and type.
Referenced by handle_request_set(), and raise_msg_handler().
struct ast_aeap_message * ast_aeap_message_create_request | ( | const struct ast_aeap_message_type * | type, |
const char * | name, | ||
const char * | id, | ||
const void * | params | ||
) |
Create an Asterisk external application request object.
type | The type of message object to create |
name | The name of the message |
id | Optional id (if NULL an id is generated) |
params | Other optional parameter(s) to possibly use |
Definition at line 105 of file res/res_aeap/message.c.
References ao2_ref, ast_aeap_message_create2(), ast_aeap_message_id_generate(), name, NULL, and type.
Referenced by AST_TEST_DEFINE(), and speech_aeap_send_request().
struct ast_aeap_message * ast_aeap_message_create_response | ( | const struct ast_aeap_message_type * | type, |
const char * | name, | ||
const char * | id, | ||
const void * | params | ||
) |
Create an Asterisk external application response object.
type | The type of message object to create |
name | The name of the message |
id | Optional id |
params | Other optional parameter(s) to possibly use |
Definition at line 123 of file res/res_aeap/message.c.
References ast_aeap_message_create2(), name, and type.
Referenced by ast_aeap_message_create_error(), AST_TEST_DEFINE(), and handle_request_set().
void * ast_aeap_message_data | ( | struct ast_aeap_message * | message | ) |
Retrieve the core message data/body.
message | A message object |
Definition at line 232 of file res/res_aeap/message.c.
References ast_assert, and NULL.
Referenced by handle_request_set(), handle_response_get(), and handle_response_setup().
struct ast_aeap_message * ast_aeap_message_deserialize | ( | const struct ast_aeap_message_type * | type, |
const void * | buf, | ||
intmax_t | size | ||
) |
Deserialize the given buffer into an Asterisk external application message object.
type | The message type to create, and deserialize to |
buf | The buffer to deserialize |
size | The size/length of the buffer |
Definition at line 147 of file res/res_aeap/message.c.
References ao2_ref, ast_aeap_message_create1(), ast_assert, buf, NULL, and type.
Referenced by raise_msg().
const char * ast_aeap_message_error_msg | ( | const struct ast_aeap_message * | message | ) |
Retrieve the error message if it has one.
message | A message object |
Definition at line 256 of file res/res_aeap/message.c.
References ast_assert, and NULL.
Referenced by raise_msg_handler().
int ast_aeap_message_error_msg_set | ( | struct ast_aeap_message * | message, |
const char * | error_msg | ||
) |
Set an error message.
message | A message object |
error_msg | The error string to set |
Definition at line 264 of file res/res_aeap/message.c.
References ast_assert, and NULL.
Referenced by ast_aeap_message_create_error().
const char * ast_aeap_message_id | ( | const struct ast_aeap_message * | message | ) |
Retrieve a message id.
message | A message object |
Definition at line 177 of file res/res_aeap/message.c.
References ast_assert, id, and NULL.
Referenced by ast_aeap_message_id_generate(), ast_aeap_send_msg_tsx(), handle_msg(), handle_request_set(), raise_msg(), and raise_msg_handler().
const char * ast_aeap_message_id_generate | ( | struct ast_aeap_message * | message | ) |
Generate an id, and set it for the message.
message | A message object |
Definition at line 199 of file res/res_aeap/message.c.
References ast_aeap_message_id(), ast_aeap_message_id_set(), ast_aeap_message_name(), ast_log, ast_uuid_generate_str(), AST_UUID_STR_LEN, LOG_ERROR, and NULL.
Referenced by ast_aeap_message_create_request().
int ast_aeap_message_id_set | ( | struct ast_aeap_message * | message, |
const char * | id | ||
) |
Set a message id.
message | A message object |
id | The id to set |
Definition at line 191 of file res/res_aeap/message.c.
References ast_assert, and NULL.
Referenced by ast_aeap_message_id_generate().
int ast_aeap_message_is_named | ( | const struct ast_aeap_message * | message, |
const char * | name | ||
) |
Check whether or not a message's name matches the given one.
message | A message object |
name | The name to check against |
Definition at line 227 of file res/res_aeap/message.c.
References ast_aeap_message_name(), and name.
Referenced by handle_msg(), and raise_msg_handler().
int ast_aeap_message_is_request | ( | const struct ast_aeap_message * | message | ) |
Retrieve whether or not this is a request message.
message | A message object |
Definition at line 240 of file res/res_aeap/message.c.
References ast_assert, and NULL.
Referenced by raise_msg().
int ast_aeap_message_is_response | ( | const struct ast_aeap_message * | message | ) |
Retrieve whether or not this is a response message.
message | A message object |
Definition at line 248 of file res/res_aeap/message.c.
References ast_assert, and NULL.
Referenced by raise_msg().
const char * ast_aeap_message_name | ( | const struct ast_aeap_message * | message | ) |
Retrieve a message name.
message | A message object |
Definition at line 213 of file res/res_aeap/message.c.
References ast_assert, name, and NULL.
Referenced by ast_aeap_message_id_generate(), ast_aeap_message_is_named(), handle_msg(), handle_request_set(), raise_msg_handler(), and transaction_end().
enum AST_AEAP_DATA_TYPE ast_aeap_message_serial_type | ( | const struct ast_aeap_message_type * | type | ) |
Retrieve the serial type a message type.
type | A message type |
Definition at line 27 of file res/res_aeap/message.c.
References ast_assert, NULL, and type.
Referenced by raise_msg().
int ast_aeap_message_serialize | ( | const struct ast_aeap_message * | message, |
void ** | buf, | ||
intmax_t * | size | ||
) |
Serialize the given message object into a byte/char buffer.
message | The message object to serialize |
buf | [out] The buffer to hold the "packed" data |
size | [out] The size of the data written to the buffer |
Definition at line 168 of file res/res_aeap/message.c.
References ast_assert, buf, and NULL.
Referenced by ast_aeap_send_msg().
|
static |
Definition at line 43 of file res/res_aeap/message.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_t_alloc_options, ast_log, LOG_ERROR, message_destructor(), NULL, type, and ast_aeap_message::type.
Referenced by ast_aeap_message_create1(), and ast_aeap_message_create2().
|
static |
Definition at line 34 of file res/res_aeap/message.c.
References ast_aeap_message_type::destruct, and ast_aeap_message::type.
Referenced by message_create().