Asterisk - The Open Source Telephony Project GIT-master-55f4e6d
event.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2007 - 2008, Digium, Inc.
5 *
6 * Russell Bryant <russell@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*! \file
20 *
21 * \brief Internal generic event system
22 *
23 * \author Russell Bryant <russell@digium.com>
24 */
25
26/*** MODULEINFO
27 <support_level>core</support_level>
28 ***/
29
30#include "asterisk.h"
31
32#include "asterisk/_private.h"
33
34#include "asterisk/event.h"
37#include "asterisk/lock.h"
38#include "asterisk/utils.h"
39#include "asterisk/unaligned.h"
40#include "asterisk/utils.h"
42#include "asterisk/astobj2.h"
43#include "asterisk/cli.h"
44
45/*!
46 * \brief An event information element
47 *
48 * \note The format of this structure is important. Since these events may
49 * be sent directly over a network, changing this structure will break
50 * compatibility with older versions. However, at this point, this code
51 * has not made it into a release, so it is still fair game for change.
52 */
55 /*! Total length of the IE payload */
57 unsigned char ie_payload[0];
58} __attribute__((packed));
59
60/*!
61 * \brief The payload for a string information element
62 */
64 /*! \brief A hash calculated with ast_str_hash(), to speed up comparisons */
65 uint32_t hash;
66 /*! \brief The actual string, null terminated */
67 char str[1];
68} __attribute__((packed));
69
70/*!
71 * \brief An event
72 *
73 * An ast_event consists of an event header (this structure), and zero or
74 * more information elements defined by ast_event_ie.
75 *
76 * \note The format of this structure is important. Since these events may
77 * be sent directly over a network, changing this structure will break
78 * compatibility with older versions. However, at this point, this code
79 * has not made it into a release, so it is still fair game for change.
80 */
81struct ast_event {
82 /*! Event type */
84 /*! Total length of the event */
85 uint16_t event_len:16;
86 /*! The data payload of the event, made up of information elements */
87 unsigned char payload[0];
88} __attribute__((packed));
89
90
95 union {
96 uint32_t uint;
97 struct {
98 uint32_t hash;
99 const char *str;
100 };
101 void *raw;
104};
105
106/*!
107 * \brief Event Names
108 */
109static const char * const event_names[AST_EVENT_TOTAL] = {
110 [AST_EVENT_ALL] = "All",
111 [AST_EVENT_CUSTOM] = "Custom",
112 [AST_EVENT_MWI] = "MWI",
113 [AST_EVENT_SUB] = "Subscription",
114 [AST_EVENT_UNSUB] = "Unsubscription",
115 [AST_EVENT_DEVICE_STATE] = "DeviceState",
116 [AST_EVENT_DEVICE_STATE_CHANGE] = "DeviceStateChange",
117 [AST_EVENT_CEL] = "CEL",
118 [AST_EVENT_SECURITY] = "Security",
119 [AST_EVENT_NETWORK_CHANGE] = "NetworkChange",
120 [AST_EVENT_PRESENCE_STATE] = "PresenceState",
121 [AST_EVENT_ACL_CHANGE] = "ACLChange",
122 [AST_EVENT_PING] = "Ping",
123};
124
125/*!
126 * \brief IE payload types and names
127 */
128static const struct ie_map {
130 const char *name;
132 [AST_EVENT_IE_NEWMSGS] = { AST_EVENT_IE_PLTYPE_UINT, "NewMessages" },
133 [AST_EVENT_IE_OLDMSGS] = { AST_EVENT_IE_PLTYPE_UINT, "OldMessages" },
141 [AST_EVENT_IE_EID] = { AST_EVENT_IE_PLTYPE_RAW, "EntityID" },
172 [AST_EVENT_IE_LOCAL_ADDR] = { AST_EVENT_IE_PLTYPE_STR, "LocalAddress" },
173 [AST_EVENT_IE_REMOTE_ADDR] = { AST_EVENT_IE_PLTYPE_STR, "RemoteAddress" },
179 [AST_EVENT_IE_EXPECTED_ADDR] = { AST_EVENT_IE_PLTYPE_STR, "ExpectedAddress" },
183 [AST_EVENT_IE_RECEIVED_CHALLENGE] = { AST_EVENT_IE_PLTYPE_STR, "ReceivedChallenge" },
186 [AST_EVENT_IE_ATTEMPTED_TRANSPORT] = { AST_EVENT_IE_PLTYPE_STR, "AttemptedTransport" },
193
194const char *ast_event_get_type_name(const struct ast_event *event)
195{
196 enum ast_event_type type;
197
199
200 if ((unsigned int)type >= ARRAY_LEN(event_names)) {
201 ast_log(LOG_ERROR, "Invalid event type - '%u'\n", type);
202 return "";
203 }
204
205 return event_names[type];
206}
207
209{
210 if (ie_type <= 0 || ie_type >= ARRAY_LEN(ie_maps)) {
211 ast_log(LOG_ERROR, "Invalid IE type - '%d'\n", ie_type);
212 return "";
213 }
214
215 return ie_maps[ie_type].name;
216}
217
219{
220 if (ie_type <= 0 || ie_type >= ARRAY_LEN(ie_maps)) {
221 ast_log(LOG_ERROR, "Invalid IE type - '%d'\n", ie_type);
223 }
224
225 return ie_maps[ie_type].ie_pltype;
226}
227
228size_t ast_event_get_size(const struct ast_event *event)
229{
230 size_t res;
231
232 res = ntohs(event->event_len);
233
234 return res;
235}
236
237/*! \brief Subscription event check list. */
240};
241
242int ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event)
243{
244 int res = 0;
245
247 iterator->event = event;
248 if (iterator->event_len >= sizeof(*event) + sizeof(struct ast_event_ie)) {
249 iterator->ie = (struct ast_event_ie *) ( ((char *) event) + sizeof(*event) );
250 } else {
251 iterator->ie = NULL;
252 res = -1;
253 }
254
255 return res;
256}
257
259{
260 iterator->ie = (struct ast_event_ie *) ( ((char *) iterator->ie) + sizeof(*iterator->ie) + ntohs(iterator->ie->ie_payload_len));
261 return ((iterator->event_len <= (((char *) iterator->ie) - ((char *) iterator->event))) ? -1 : 0);
262}
263
265{
266 return ntohs(iterator->ie->ie_type);
267}
268
270{
271 return ntohl(get_unaligned_uint32(iterator->ie->ie_payload));
272}
273
275{
276 const struct ast_event_ie_str_payload *str_payload;
277
278 str_payload = (struct ast_event_ie_str_payload *) iterator->ie->ie_payload;
279
280 return str_payload ? str_payload->str : NULL;
281}
282
283static void *event_iterator_get_ie_raw(struct ast_event_iterator *iterator)
284{
285 return iterator->ie->ie_payload;
286}
287
289{
290 return ntohs(event->type);
291}
292
293uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
294{
295 const uint32_t *ie_val;
296
297 ie_val = ast_event_get_ie_raw(event, ie_type);
298
299 return ie_val ? ntohl(get_unaligned_uint32(ie_val)) : 0;
300}
301
302const char *ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
303{
304 const struct ast_event_ie_str_payload *str_payload;
305
306 str_payload = ast_event_get_ie_raw(event, ie_type);
307
308 return str_payload ? str_payload->str : NULL;
309}
310
311const void *ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type)
312{
313 struct ast_event_iterator iterator;
314 int res;
315
316 for (res = ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
317 if (ast_event_iterator_get_ie_type(&iterator) == ie_type) {
318 return event_iterator_get_ie_raw(&iterator);
319 }
320 }
321
322 return NULL;
323}
324
326{
327 return ntohs(iterator->ie->ie_payload_len);
328}
329
331{
332 struct ast_event_iterator iterator;
333 int res;
334
335 for (res = ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
336 if (ast_event_iterator_get_ie_type(&iterator) == ie_type) {
338 }
339 }
340
341 return 0;
342}
343
344
346 const char *str)
347{
348 struct ast_event_ie_str_payload *str_payload;
349 size_t payload_len;
350
351 payload_len = sizeof(*str_payload) + strlen(str);
352 str_payload = ast_alloca(payload_len);
353
354 strcpy(str_payload->str, str);
355 str_payload->hash = ast_str_hash(str);
356
357 return ast_event_append_ie_raw(event, ie_type, str_payload, payload_len);
358}
359
361 uint32_t data)
362{
363 data = htonl(data);
364 return ast_event_append_ie_raw(event, ie_type, &data, sizeof(data));
365}
366
368 uint32_t flags)
369{
370 flags = htonl(flags);
371 return ast_event_append_ie_raw(event, ie_type, &flags, sizeof(flags));
372}
373
375 const void *data, size_t data_len)
376{
377 struct ast_event_ie *ie;
378 struct ast_event *old_event;
379 unsigned int extra_len;
380 uint16_t event_len;
381
382 event_len = ntohs((*event)->event_len);
383 extra_len = sizeof(*ie) + data_len;
384
385 old_event = *event;
386 *event = ast_realloc(*event, event_len + extra_len);
387 if (!*event) {
388 ast_free(old_event);
389 return -1;
390 }
391
392 ie = (struct ast_event_ie *) ( ((char *) *event) + event_len );
393 ie->ie_type = htons(ie_type);
394 ie->ie_payload_len = htons(data_len);
395 memcpy(ie->ie_payload, data, data_len);
396
397 (*event)->event_len = htons(event_len + extra_len);
398
399 return 0;
400}
401
403{
404 va_list ap;
405 struct ast_event *event;
406 enum ast_event_ie_type ie_type;
407 struct ast_event_ie_val *ie_val;
409
410 /* Invalid type */
411 if (type >= AST_EVENT_TOTAL) {
412 ast_log(LOG_WARNING, "Someone tried to create an event of invalid "
413 "type '%u'!\n", type);
414 return NULL;
415 }
416
417 va_start(ap, type);
418 for (ie_type = va_arg(ap, enum ast_event_ie_type);
420 ie_type = va_arg(ap, enum ast_event_ie_type))
421 {
422 struct ast_event_ie_val *ie_value = ast_malloc(sizeof(*ie_value));
423 int insert = 0;
424
425 memset(ie_value, 0, sizeof(*ie_value));
426 ie_value->ie_type = ie_type;
427 ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
428
429 switch (ie_value->ie_pltype) {
431 ie_value->payload.uint = va_arg(ap, uint32_t);
432 insert = 1;
433 break;
435 ie_value->payload.uint = va_arg(ap, uint32_t);
436 insert = 1;
437 break;
439 ie_value->payload.str = va_arg(ap, const char *);
440 insert = 1;
441 break;
443 {
444 void *data = va_arg(ap, void *);
445 size_t datalen = va_arg(ap, size_t);
446 ie_value->payload.raw = ast_malloc(datalen);
447 memcpy(ie_value->payload.raw, data, datalen);
448 ie_value->raw_datalen = datalen;
449 insert = 1;
450 break;
451 }
454 break;
455 }
456
457 if (insert) {
458 AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
459 } else {
460 ast_log(LOG_WARNING, "Unsupported PLTYPE(%d)\n", ie_value->ie_pltype);
461 }
462 }
463 va_end(ap);
464
465 if (!(event = ast_calloc(1, sizeof(*event)))) {
466 return NULL;
467 }
468
469 event->type = htons(type);
470 event->event_len = htons(sizeof(*event));
471
472 AST_LIST_TRAVERSE(&ie_vals, ie_val, entry) {
473 switch (ie_val->ie_pltype) {
475 ast_event_append_ie_str(&event, ie_val->ie_type, ie_val->payload.str);
476 break;
479 break;
482 break;
485 ie_val->payload.raw, ie_val->raw_datalen);
486 break;
489 break;
490 }
491
492 /* realloc inside one of the append functions failed */
493 if (!event) {
494 goto cleanup;
495 }
496 }
497
499 /* If the event is originating on this server, add the server's
500 * entity ID to the event. */
502 }
503
504cleanup:
505 AST_LIST_TRAVERSE_SAFE_BEGIN(&ie_vals, ie_val, entry) {
507
508 if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
509 ast_free(ie_val->payload.raw);
510 }
511 ast_free(ie_val);
512 }
514
515 return event;
516}
517
519{
522}
523
525{
527}
528
530{
531 return sizeof(struct ast_event);
532}
Prototypes for public functions only of internal interest,.
const char * str
Definition: app_jack.c:147
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition: astmm.h:288
#define ast_free(a)
Definition: astmm.h:180
#define ast_realloc(p, len)
A wrapper for realloc()
Definition: astmm.h:226
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:202
#define ast_malloc(len)
A wrapper for malloc()
Definition: astmm.h:191
#define ast_log
Definition: astobj2.c:42
static const char type[]
Definition: chan_ooh323.c:109
Standard Command Line Interface.
A set of macros to manage doubly-linked lists.
size_t ast_event_minimum_length(void)
Get the minimum length of an ast_event.
Definition: event.c:529
static uint16_t event_iterator_get_ie_raw_payload_len(struct ast_event_iterator *iterator)
Definition: event.c:325
size_t ast_event_get_size(const struct ast_event *event)
Get the size of an event.
Definition: event.c:228
const char * ast_event_get_ie_type_name(enum ast_event_ie_type ie_type)
Get the string representation of an information element type.
Definition: event.c:208
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.
Definition: event.c:367
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.
Definition: event.c:293
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.
Definition: event.c:218
void ast_event_destroy(struct ast_event *event)
Destroy an event.
Definition: event.c:524
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.
Definition: event.c:345
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.
Definition: event.c:302
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.
Definition: event.c:311
static void * event_iterator_get_ie_raw(struct ast_event_iterator *iterator)
Definition: event.c:283
const char * ast_event_get_type_name(const struct ast_event *event)
Get the string representation of the type of the given event.
Definition: event.c:194
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.
Definition: event.c:330
static const struct ie_map ie_maps[AST_EVENT_IE_TOTAL]
static const char *const event_names[AST_EVENT_TOTAL]
Event Names.
Definition: event.c:109
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.
Definition: event.c:264
int ast_event_iterator_next(struct ast_event_iterator *iterator)
Move iterator instance to next IE.
Definition: event.c:258
struct ast_event * ast_event_new(enum ast_event_type type,...)
Create a new event.
Definition: event.c:402
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.
Definition: event.c:374
enum ast_event_type ast_event_get_type(const struct ast_event *event)
Get the type for an event.
Definition: event.c:288
int ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event)
Initialize an event iterator instance.
Definition: event.c:242
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.
Definition: event.c:360
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.
Definition: event.c:274
int ast_event_append_eid(struct ast_event **event)
Append the global EID IE.
Definition: event.c:518
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.
Definition: event.c:269
ast_event_ie_type
Event Information Element types.
Definition: event_defs.h:68
@ AST_EVENT_IE_CEL_ACCTCODE
Channel Event AccountCode Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:205
@ AST_EVENT_IE_EVENT_VERSION
Definition: event_defs.h:274
@ AST_EVENT_IE_END
Definition: event_defs.h:70
@ AST_EVENT_IE_CEL_EXTRA
Channel Event extra data Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:259
@ AST_EVENT_IE_CEL_CONTEXT
Channel Event context name Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:175
@ AST_EVENT_IE_CEL_PEERACCT
Channel Event peeraccount Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:253
@ AST_EVENT_IE_REMOTE_ADDR
Definition: event_defs.h:282
@ AST_EVENT_IE_STATE
Generic State IE Used by AST_EVENT_DEVICE_STATE_CHANGE Payload type: UINT The actual state values dep...
Definition: event_defs.h:121
@ AST_EVENT_IE_ATTEMPTED_TRANSPORT
Definition: event_defs.h:295
@ AST_EVENT_IE_MODULE
Definition: event_defs.h:276
@ AST_EVENT_IE_CONTEXT
Context IE Used by AST_EVENT_MWI Payload type: str.
Definition: event_defs.h:127
@ AST_EVENT_IE_CEL_CIDRDNIS
Channel Event CID RDNIS field Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:229
@ AST_EVENT_IE_CEL_EVENT_TIME
Channel Event Time (seconds) Used by: AST_EVENT_CEL Payload type: UINT.
Definition: event_defs.h:139
@ AST_EVENT_IE_EVENT_TV
Definition: event_defs.h:283
@ AST_EVENT_IE_ACCOUNT_ID
Definition: event_defs.h:277
@ AST_EVENT_IE_SESSION_ID
Definition: event_defs.h:278
@ AST_EVENT_IE_UNIQUEID
Unique ID Used by: AST_EVENT_SUB, AST_EVENT_UNSUB Payload type: UINT.
Definition: event_defs.h:95
@ AST_EVENT_IE_SECURITY_EVENT
Definition: event_defs.h:273
@ AST_EVENT_IE_CHALLENGE
Definition: event_defs.h:289
@ AST_EVENT_IE_CEL_CHANNAME
Channel Event channel name Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:181
@ AST_EVENT_IE_PRESENCE_STATE
Definition: event_defs.h:297
@ AST_EVENT_IE_LOCAL_ADDR
Definition: event_defs.h:281
@ AST_EVENT_IE_RECEIVED_HASH
Definition: event_defs.h:293
@ AST_EVENT_IE_CEL_CIDANI
Channel Event CID ANI field Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:223
@ AST_EVENT_IE_PRESENCE_MESSAGE
Definition: event_defs.h:299
@ AST_EVENT_IE_DEVICE
Device Name Used by AST_EVENT_DEVICE_STATE_CHANGE Payload type: STR.
Definition: event_defs.h:113
@ AST_EVENT_IE_CEL_CIDDNID
Channel Event CID dnid Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:235
@ AST_EVENT_IE_ACL_NAME
Definition: event_defs.h:280
@ AST_EVENT_IE_AUTH_METHOD
Definition: event_defs.h:286
@ AST_EVENT_IE_TOTAL
Must be the last IE value +1.
Definition: event_defs.h:315
@ AST_EVENT_IE_PRESENCE_SUBTYPE
Definition: event_defs.h:298
@ AST_EVENT_IE_PRESENCE_PROVIDER
Definition: event_defs.h:296
@ AST_EVENT_IE_CEL_EXTEN
Channel Event extension name Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:169
@ AST_EVENT_IE_EID
Entity ID Used by All events Payload type: RAW This IE indicates which server the event originated fr...
Definition: event_defs.h:272
@ AST_EVENT_IE_CEL_CIDNAME
Channel Event CID name Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:157
@ AST_EVENT_IE_SEVERITY
Definition: event_defs.h:287
@ AST_EVENT_IE_CEL_AMAFLAGS
Channel Event AMA flags Used by: AST_EVENT_CEL Payload type: UINT.
Definition: event_defs.h:199
@ AST_EVENT_IE_CEL_USEREVENT_NAME
Channel Event User Event Name Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:151
@ AST_EVENT_IE_CEL_LINKEDID
Channel Event LinkedID Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:247
@ AST_EVENT_IE_CEL_EVENT_TIME_USEC
Channel Event Time (micro-seconds) Used by: AST_EVENT_CEL Payload type: UINT.
Definition: event_defs.h:145
@ AST_EVENT_IE_MAILBOX
Mailbox name.
Definition: event_defs.h:89
@ AST_EVENT_IE_CEL_EVENT_TYPE
Channel Event Type Used by: AST_EVENT_CEL Payload type: UINT.
Definition: event_defs.h:133
@ AST_EVENT_IE_EXISTS
Hint that someone cares that an IE exists Used by: AST_EVENT_SUB Payload type: UINT (ast_event_ie_typ...
Definition: event_defs.h:107
@ AST_EVENT_IE_RECEIVED_CHALLENGE
Definition: event_defs.h:292
@ AST_EVENT_IE_REQUEST_TYPE
Definition: event_defs.h:284
@ AST_EVENT_IE_EXPECTED_RESPONSE
Definition: event_defs.h:291
@ AST_EVENT_IE_CEL_UNIQUEID
Channel Event UniqueID Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:211
@ AST_EVENT_IE_CACHABLE
Event non-cacheability flag Used by: All events Payload type: UINT.
Definition: event_defs.h:306
@ AST_EVENT_IE_EXPECTED_ADDR
Definition: event_defs.h:288
@ AST_EVENT_IE_USING_PASSWORD
Definition: event_defs.h:294
@ AST_EVENT_IE_EVENTTYPE
Event type Used by: AST_EVENT_SUB, AST_EVENT_UNSUB Payload type: UINT.
Definition: event_defs.h:101
@ AST_EVENT_IE_RESPONSE
Definition: event_defs.h:290
@ AST_EVENT_IE_CEL_APPNAME
Channel Event app name Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:187
@ AST_EVENT_IE_CEL_APPDATA
Channel Event app args/data Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:193
@ AST_EVENT_IE_SESSION_TV
Definition: event_defs.h:279
@ AST_EVENT_IE_OLDMSGS
Number of Used by: AST_EVENT_MWI Payload type: UINT.
Definition: event_defs.h:83
@ AST_EVENT_IE_REQUEST_PARAMS
Definition: event_defs.h:285
@ AST_EVENT_IE_CEL_PEER
Channel Event Peer – for Things involving multiple channels, like BRIDGE Used by: AST_EVENT_CEL Paylo...
Definition: event_defs.h:241
@ AST_EVENT_IE_CEL_CIDNUM
Channel Event CID num Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:163
@ AST_EVENT_IE_SERVICE
Definition: event_defs.h:275
@ AST_EVENT_IE_CEL_USERFIELD
Channel Event Userfield Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:217
@ AST_EVENT_IE_NEWMSGS
Number of new messages Used by: AST_EVENT_MWI Payload type: UINT.
Definition: event_defs.h:77
ast_event_type
Definition: event_defs.h:28
@ AST_EVENT_TOTAL
Definition: event_defs.h:64
@ AST_EVENT_ACL_CHANGE
Definition: event_defs.h:58
@ AST_EVENT_UNSUB
Definition: event_defs.h:42
@ AST_EVENT_PING
Definition: event_defs.h:60
@ AST_EVENT_DEVICE_STATE_CHANGE
Definition: event_defs.h:48
@ AST_EVENT_DEVICE_STATE
Definition: event_defs.h:45
@ AST_EVENT_CEL
Definition: event_defs.h:50
@ AST_EVENT_MWI
Definition: event_defs.h:38
@ AST_EVENT_ALL
Definition: event_defs.h:31
@ AST_EVENT_CUSTOM
Definition: event_defs.h:36
@ AST_EVENT_NETWORK_CHANGE
Definition: event_defs.h:54
@ AST_EVENT_PRESENCE_STATE
Definition: event_defs.h:56
@ AST_EVENT_SUB
Definition: event_defs.h:40
@ AST_EVENT_SECURITY
Definition: event_defs.h:52
ast_event_ie_pltype
Payload types for event information elements.
Definition: event_defs.h:321
@ AST_EVENT_IE_PLTYPE_RAW
Definition: event_defs.h:330
@ AST_EVENT_IE_PLTYPE_UINT
Definition: event_defs.h:326
@ AST_EVENT_IE_PLTYPE_BITFLAGS
Definition: event_defs.h:332
@ AST_EVENT_IE_PLTYPE_EXISTS
Definition: event_defs.h:324
@ AST_EVENT_IE_PLTYPE_STR
Definition: event_defs.h:328
@ AST_EVENT_IE_PLTYPE_UNKNOWN
Definition: event_defs.h:322
#define LOG_ERROR
#define LOG_WARNING
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
Definition: linkedlists.h:225
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:731
#define AST_LIST_HEAD_NOLOCK_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
Definition: linkedlists.h:346
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
Definition: linkedlists.h:410
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
Asterisk locking-related definitions:
static void * cleanup(void *unused)
Definition: pbx_realtime.c:124
#define NULL
Definition: resample.c:96
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
Definition: strings.h:1259
Subscription event check list.
Definition: event.c:238
struct ast_ev_check_list::@350 ie_vals
The payload for a string information element.
Definition: event.c:63
char str[1]
The actual string, null terminated.
Definition: event.c:67
uint32_t hash
A hash calculated with ast_str_hash(), to speed up comparisons.
Definition: event.c:65
struct ast_event_ie_val::@346 entry
uint32_t hash
Definition: event.c:98
enum ast_event_ie_pltype ie_pltype
Definition: event.c:94
union ast_event_ie_val::@347 payload
size_t raw_datalen
Definition: event.c:103
void * raw
Definition: event.c:101
uint32_t uint
Definition: event.c:96
enum ast_event_ie_type ie_type
Definition: event.c:93
const char * str
Definition: event.c:99
An event information element.
Definition: event.c:53
unsigned char ie_payload[0]
Definition: event.c:57
uint16_t ie_payload_len
Definition: event.c:56
enum ast_event_ie_type ie_type
Definition: event.c:54
supposed to be an opaque type
Definition: event_defs.h:352
const struct ast_event * event
Definition: event_defs.h:354
uint16_t event_len
Definition: event_defs.h:353
struct ast_event_ie * ie
Definition: event_defs.h:355
An event.
Definition: event.c:81
enum ast_event_type type
Definition: event.c:83
uint16_t event_len
Definition: event.c:85
unsigned char payload[0]
Definition: event.c:87
Definition: search.h:40
Definition: astman.c:222
IE payload types and names.
Definition: event.c:128
enum ast_event_ie_pltype ie_pltype
Definition: event.c:129
const char * name
Definition: event.c:130
An API for managing task processing threads that can be shared across modules.
Handle unaligned data access.
static unsigned int get_unaligned_uint32(const void *p)
Definition: unaligned.h:38
Utility functions.
#define ARRAY_LEN(a)
Definition: utils.h:666
struct ast_eid ast_eid_default
Global EID.
Definition: options.c:93