58 } __attribute__((packed));
68 } __attribute__((packed));
87 unsigned char payload[0];
88 } __attribute__((packed));
200 if ((
unsigned int)type >=
ARRAY_LEN(event_names)) {
205 return event_names[
type];
247 iterator->
event = event;
249 iterator->
ie = (
struct ast_event_ie *) ( ((
char *) event) +
sizeof(*event) );
261 return ((iterator->
event_len <= (((
char *) iterator->
ie) - ((
char *) iterator->
event))) ? -1 : 0);
280 return str_payload ? str_payload->
str :
NULL;
290 return ntohs(event->
type);
295 const uint32_t *ie_val;
308 return str_payload ? str_payload->
str :
NULL;
351 payload_len =
sizeof(*str_payload) + strlen(str);
354 strcpy(str_payload->
str, str);
370 flags = htonl(flags);
375 const void *data,
size_t data_len)
379 unsigned int extra_len;
382 event_len = ntohs((*event)->event_len);
383 extra_len =
sizeof(*ie) + data_len;
386 *
event =
ast_realloc(*event, event_len + extra_len);
392 ie = (
struct ast_event_ie *) ( ((
char *) *event) + event_len );
397 (*event)->event_len = htons(event_len + extra_len);
413 "type '%u'!\n", type);
425 memset(ie_value, 0,
sizeof(*ie_value));
439 ie_value->
payload.
str = va_arg(ap,
const char *);
444 void *data = va_arg(ap,
void *);
445 size_t datalen = va_arg(ap,
size_t);
465 if (!(event =
ast_calloc(1,
sizeof(*event)))) {
469 event->type = htons(type);
470 event->event_len = htons(
sizeof(*event));
const char * ast_event_iterator_get_ie_str(struct ast_event_iterator *iterator)
Get the value of the current IE in the iterator as a string payload.
int ast_event_append_ie_uint(struct ast_event **event, enum ast_event_ie_type ie_type, uint32_t data)
Append an information element that has an integer payload.
Channel Event CID name Used by: AST_EVENT_CEL Payload type: STR.
Channel Event app name Used by: AST_EVENT_CEL Payload type: STR.
enum ast_event_ie_type ie_type
enum ast_event_type ast_event_get_type(const struct ast_event *event)
Get the type for an event.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
const char * ast_event_get_ie_type_name(enum ast_event_ie_type ie_type)
Get the string representation of an information element type.
#define ast_realloc(p, len)
A wrapper for realloc()
uint32_t hash
A hash calculated with ast_str_hash(), to speed up comparisons.
Channel Event extra data Used by: AST_EVENT_CEL Payload type: STR.
ast_event_ie_pltype
Payload types for event information elements.
enum ast_event_ie_pltype ie_pltype
Must be the last IE value +1.
Channel Event channel name Used by: AST_EVENT_CEL Payload type: STR.
Hint that someone cares that an IE exists Used by: AST_EVENT_SUB Payload type: UINT (ast_event_ie_typ...
Subscription event check list.
Channel Event UniqueID Used by: AST_EVENT_CEL Payload type: STR.
Channel Event context name Used by: AST_EVENT_CEL Payload type: STR.
uint32_t ast_event_iterator_get_ie_uint(struct ast_event_iterator *iterator)
Get the value of the current IE in the iterator as an integer payload.
Channel Event app args/data Used by: AST_EVENT_CEL Payload type: STR.
Channel Event peeraccount Used by: AST_EVENT_CEL Payload type: STR.
Channel Event Time (micro-seconds) Used by: AST_EVENT_CEL Payload type: UINT.
Channel Event CID dnid Used by: AST_EVENT_CEL Payload type: STR.
static uint16_t event_iterator_get_ie_raw_payload_len(struct ast_event_iterator *iterator)
enum ast_event_ie_pltype ast_event_get_ie_pltype(enum ast_event_ie_type ie_type)
Get the payload type for a given information element type.
Number of new messages Used by: AST_EVENT_MWI Payload type: UINT.
Number of Used by: AST_EVENT_MWI Payload type: UINT.
char str[1]
The actual string, null terminated.
supposed to be an opaque type
static const char *const event_names[AST_EVENT_TOTAL]
Event Names.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Channel Event Type Used by: AST_EVENT_CEL Payload type: UINT.
Entity ID Used by All events Payload type: RAW This IE indicates which server the event originated fr...
uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has an integer payload.
Channel Event Time (seconds) Used by: AST_EVENT_CEL Payload type: UINT.
Channel Event CID num Used by: AST_EVENT_CEL Payload type: STR.
Channel Event extension name Used by: AST_EVENT_CEL Payload type: STR.
int ast_event_append_ie_str(struct ast_event **event, enum ast_event_ie_type ie_type, const char *str)
Append an information element that has a string payload.
const void * ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has a raw payload.
ast_event_ie_type
Event Information Element types.
Handle unaligned data access.
Context IE Used by AST_EVENT_MWI Payload type: str.
A set of macros to manage doubly-linked lists.
int ast_event_append_ie_bitflags(struct ast_event **event, enum ast_event_ie_type ie_type, uint32_t flags)
Append an information element that has a bitflags payload.
An event information element.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
const struct ast_event * event
Channel Event Userfield Used by: AST_EVENT_CEL Payload type: STR.
A set of macros to manage forward-linked lists.
#define ast_malloc(len)
A wrapper for malloc()
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
Channel Event CID RDNIS field Used by: AST_EVENT_CEL Payload type: STR.
static unsigned int get_unaligned_uint32(const void *p)
Event non-cachability flag Used by: All events Payload type: UINT.
static void * event_iterator_get_ie_raw(struct ast_event_iterator *iterator)
int ast_event_append_ie_raw(struct ast_event **event, enum ast_event_ie_type ie_type, const void *data, size_t data_len)
Append an information element that has a raw payload.
Event type Used by: AST_EVENT_SUB, AST_EVENT_UNSUB Payload type: UINT.
int ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event)
Initialize an event iterator instance.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
int ast_event_iterator_next(struct ast_event_iterator *iterator)
Move iterator instance to next IE.
#define AST_LIST_HEAD_NOLOCK_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
struct ast_event * ast_event_new(enum ast_event_type type,...)
Create a new event.
enum ast_event_ie_type ie_type
Channel Event User Event Name Used by: AST_EVENT_CEL Payload type: STR.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define ast_calloc(num, len)
A wrapper for calloc()
Channel Event Peer – for Things involving multiple channels, like BRIDGE Used by: AST_EVENT_CEL Payl...
Channel Event CID ANI field Used by: AST_EVENT_CEL Payload type: STR.
Prototypes for public functions only of internal interest,.
An API for managing task processing threads that can be shared across modules.
Channel Event AMA flags Used by: AST_EVENT_CEL Payload type: UINT.
size_t ast_event_get_size(const struct ast_event *event)
Get the size of an event.
static void * cleanup(void *unused)
void ast_event_destroy(struct ast_event *event)
Destroy an event.
struct ast_eid ast_eid_default
Global EID.
union ast_event_ie_val::@385 payload
Channel Event LinkedID Used by: AST_EVENT_CEL Payload type: STR.
Standard Command Line Interface.
size_t ast_event_minimum_length(void)
Get the minimum length of an ast_event.
const char * ast_event_get_type_name(const struct ast_event *event)
Get the string representation of the type of the given event.
uint16_t ast_event_get_ie_raw_payload_len(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the length of the raw payload for a particular IE.
const char * ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has a string payload.
Unique ID Used by: AST_EVENT_SUB, AST_EVENT_UNSUB Payload type: UINT.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_event_ie_pltype ie_pltype
Generic State IE Used by AST_EVENT_DEVICE_STATE_CHANGE Payload type: UINT The actual state values dep...
static const struct ie_map ie_maps[AST_EVENT_IE_TOTAL]
Device Name Used by AST_EVENT_DEVICE_STATE_CHANGE Payload type: STR.
IE payload types and names.
int ast_event_append_eid(struct ast_event **event)
Append the global EID IE.
Channel Event AccountCode Used by: AST_EVENT_CEL Payload type: STR.
unsigned char ie_payload[0]
enum ast_event_ie_type ast_event_iterator_get_ie_type(struct ast_event_iterator *iterator)
Get the type of the current IE in the iterator instance.
The payload for a string information element.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.