30 #include "transaction.h"
52 #define AEAP_TRANSACTION_BUCKETS 11
69 ao2_cleanup(params->
msg);
76 static void transaction_destructor(
void *
obj)
81 aeap_transaction_cancel_timer(tsx);
83 aeap_transaction_params_cleanup(&tsx->
params);
94 aeap_error(aeap,
"transaction",
"missing transaction id");
95 aeap_transaction_params_cleanup(params);
99 tsx = ao2_alloc(
sizeof(*tsx) + strlen(
id) + 1, transaction_destructor);
101 aeap_error(aeap,
"transaction",
"unable to create for '%s'",
id);
102 aeap_transaction_params_cleanup(params);
138 aeap_transaction_cancel_timer(tsx);
148 aeap_error(tsx->
aeap,
"transaction",
"message '%s' timed out",
162 static int transaction_raise_timeout(
const void *data)
177 transaction_raise_timeout,
ao2_bump(tsx));
179 aeap_error(tsx->
aeap,
"transaction",
"unable to schedule timeout for '%s'", tsx->
id);
200 if (transaction_sched_timer(tsx)) {
206 transaction_wait(tsx);
219 transaction_end(tsx, 0, result);
237 tsx = transaction_create(
id, params, aeap);
243 aeap_error(tsx->
aeap,
"transaction",
"unable to add '%s' to container",
id);
277 aeap_transaction_hash_fn, NULL, aeap_transaction_cmp_fn);
279 ast_log(LOG_ERROR,
"AEAP transaction: unable to create container\n");
Asterisk External Application Protocol API.
Asterisk main include file. File version handling, generic pbx functions.
AO2_STRING_FIELD_HASH_FN(transport_monitor, key)
Hashing function for struct transport_monitor.
Asterisk External Application Protocol Message API.
The arg parameter is a search key, but is not an object.
struct ao2_container * container
AO2_STRING_FIELD_CMP_FN(transport_monitor, key)
Comparison function for struct transport_monitor.
#define AST_SCHED_DEL_UNREF(sched, id, refcall)
schedule task to get deleted and call unref function
Parameters to be used when sending a transaction based message.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
void * ao2_object_get_lockaddr(void *obj)
Return the mutex lock address of an object.
ast_aeap_user_obj_cleanup obj_cleanup
ast_aeap_on_timeout on_timeout
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Scheduler Routines (derived from cheops)
const char * ast_aeap_message_name(const struct ast_aeap_message *message)
Retrieve a message name.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
#define ao2_unlink(container, obj)
Remove an object from a container.
struct ast_aeap_tsx_params params
int ast_sched_add(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
Adds a scheduled event.
struct ast_aeap_message * msg
#define ao2_link(container, obj)
Add an object to a container.