123 struct timeval timestamp;
150 if (message ==
NULL) {
211 #define INVOKE_VIRTUAL(fn, ...) \ 216 ast_assert(msg->type != NULL); \ 217 ast_assert(msg->type->vtable != NULL); \ 218 if (!msg->type->vtable->fn) { \ 221 msg->type->vtable->fn(__VA_ARGS__); \ 241 #define HAS_VIRTUAL(fn, msg) \ 246 ast_assert(msg->type != NULL); \ 247 ast_assert(msg->type->vtable != NULL); \ 248 !!msg->type->vtable->fn; \
Struct containing info for an AMI event to send out.
int stasis_message_type_declined(const char *name)
Check whether a message type is declined.
Asterisk main include file. File version handling, generic pbx functions.
static int message_type_id
Virtual table providing methods for messages.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
Generic (perhaps overly so) hashtable implementation Hash Table support in Asterisk.
static void stasis_message_dtor(void *obj)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg)
Allocate and initialize an object.
#define ast_strdup(str)
A wrapper for strdup()
struct ast_event *(* to_event)(struct stasis_message *message)
Build the ast_event representation of the message.
const struct ast_eid * stasis_message_eid(const struct stasis_message *msg)
Get the entity id for a stasis_message.
struct ast_manager_event_blob * stasis_message_to_ami(struct stasis_message *msg)
Build the AMI representation of the message.
An Entity ID is essentially a MAC address, brief and unique.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
Structure containing callbacks for Stasis message sanitization.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_message_type * type
struct ast_json *(* to_json)(struct stasis_message *message, const struct stasis_message_sanitizer *sanitize)
Build the JSON representation of the message.
#define INVOKE_VIRTUAL(fn,...)
#define ao2_ref(o, delta)
const char * stasis_message_type_name(const struct stasis_message_type *type)
Gets the name of a given message type.
static struct stasis_message_vtable null_vtable
int stasis_message_can_be_ami(struct stasis_message *msg)
Determine if the given message can be converted to AMI.
struct stasis_message * stasis_message_create_full(struct stasis_message_type *type, void *data, const struct ast_eid *eid)
Create a new message for an entity.
enum stasis_subscription_message_formatters stasis_message_type_available_formatters(const struct stasis_message_type *type)
Get a bitmap of available formatters for a message type.
struct ast_json * stasis_message_to_json(struct stasis_message *msg, struct stasis_message_sanitizer *sanitize)
Build the JSON representation of the message.
static void message_type_dtor(void *obj)
struct ast_manager_event_blob *(* to_ami)(struct stasis_message *message)
Build the AMI representation of the message.
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)
unsigned int ast_hashtab_hash_string(const void *obj)
Hashes a string to a number.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
struct stasis_message_vtable * vtable
struct ast_eid ast_eid_default
Global EID.
const struct timeval * stasis_message_timestamp(const struct stasis_message *msg)
Get the time when a message was created.
#define HAS_VIRTUAL(fn, msg)
unsigned int stasis_message_type_hash(const struct stasis_message_type *type)
Gets the hash of a given message type.
enum stasis_subscription_message_formatters available_formatters
Abstract JSON element (object, array, string, int, ...).
const struct ast_eid * eid_ptr
int stasis_message_type_id(const struct stasis_message_type *type)
Gets the id of a given message type.
stasis_subscription_message_formatters
Stasis subscription formatter filters.
int stasis_message_type_create(const char *name, struct stasis_message_vtable *vtable, struct stasis_message_type **result)
Create a new message type.
struct ast_event * stasis_message_to_event(struct stasis_message *msg)
Build the Generic event system representation of the message.