Asterisk - The Open Source Telephony Project GIT-master-5782b03
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" },
194
195const char *ast_event_get_type_name(const struct ast_event *event)
196{
197 enum ast_event_type type;
198
200
201 if ((unsigned int)type >= ARRAY_LEN(event_names)) {
202 ast_log(LOG_ERROR, "Invalid event type - '%u'\n", type);
203 return "";
204 }
205
206 return event_names[type];
207}
208
210{
211 if (ie_type <= 0 || ie_type >= ARRAY_LEN(ie_maps)) {
212 ast_log(LOG_ERROR, "Invalid IE type - '%d'\n", ie_type);
213 return "";
214 }
215
216 return ie_maps[ie_type].name;
217}
218
220{
221 if (ie_type <= 0 || ie_type >= ARRAY_LEN(ie_maps)) {
222 ast_log(LOG_ERROR, "Invalid IE type - '%d'\n", ie_type);
224 }
225
226 return ie_maps[ie_type].ie_pltype;
227}
228
229size_t ast_event_get_size(const struct ast_event *event)
230{
231 size_t res;
232
233 res = ntohs(event->event_len);
234
235 return res;
236}
237
238/*! \brief Subscription event check list. */
241};
242
243int ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event)
244{
245 int res = 0;
246
248 iterator->event = event;
249 if (iterator->event_len >= sizeof(*event) + sizeof(struct ast_event_ie)) {
250 iterator->ie = (struct ast_event_ie *) ( ((char *) event) + sizeof(*event) );
251 } else {
252 iterator->ie = NULL;
253 res = -1;
254 }
255
256 return res;
257}
258
260{
261 iterator->ie = (struct ast_event_ie *) ( ((char *) iterator->ie) + sizeof(*iterator->ie) + ntohs(iterator->ie->ie_payload_len));
262 return ((iterator->event_len <= (((char *) iterator->ie) - ((char *) iterator->event))) ? -1 : 0);
263}
264
266{
267 return ntohs(iterator->ie->ie_type);
268}
269
271{
272 return ntohl(get_unaligned_uint32(iterator->ie->ie_payload));
273}
274
276{
277 const struct ast_event_ie_str_payload *str_payload;
278
279 str_payload = (struct ast_event_ie_str_payload *) iterator->ie->ie_payload;
280
281 return str_payload ? str_payload->str : NULL;
282}
283
284static void *event_iterator_get_ie_raw(struct ast_event_iterator *iterator)
285{
286 return iterator->ie->ie_payload;
287}
288
290{
291 return ntohs(event->type);
292}
293
294uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
295{
296 const uint32_t *ie_val;
297
298 ie_val = ast_event_get_ie_raw(event, ie_type);
299
300 return ie_val ? ntohl(get_unaligned_uint32(ie_val)) : 0;
301}
302
303const char *ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
304{
305 const struct ast_event_ie_str_payload *str_payload;
306
307 str_payload = ast_event_get_ie_raw(event, ie_type);
308
309 return str_payload ? str_payload->str : NULL;
310}
311
312const void *ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type)
313{
314 struct ast_event_iterator iterator;
315 int res;
316
317 for (res = ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
318 if (ast_event_iterator_get_ie_type(&iterator) == ie_type) {
319 return event_iterator_get_ie_raw(&iterator);
320 }
321 }
322
323 return NULL;
324}
325
327{
328 return ntohs(iterator->ie->ie_payload_len);
329}
330
332{
333 struct ast_event_iterator iterator;
334 int res;
335
336 for (res = ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
337 if (ast_event_iterator_get_ie_type(&iterator) == ie_type) {
339 }
340 }
341
342 return 0;
343}
344
345
347 const char *str)
348{
349 struct ast_event_ie_str_payload *str_payload;
350 size_t payload_len;
351
352 payload_len = sizeof(*str_payload) + strlen(str);
353 str_payload = ast_alloca(payload_len);
354
355 strcpy(str_payload->str, str);
356 str_payload->hash = ast_str_hash(str);
357
358 return ast_event_append_ie_raw(event, ie_type, str_payload, payload_len);
359}
360
362 uint32_t data)
363{
364 data = htonl(data);
365 return ast_event_append_ie_raw(event, ie_type, &data, sizeof(data));
366}
367
369 uint32_t flags)
370{
371 flags = htonl(flags);
372 return ast_event_append_ie_raw(event, ie_type, &flags, sizeof(flags));
373}
374
376 const void *data, size_t data_len)
377{
378 struct ast_event_ie *ie;
379 struct ast_event *old_event;
380 unsigned int extra_len;
381 uint16_t event_len;
382
383 event_len = ntohs((*event)->event_len);
384 extra_len = sizeof(*ie) + data_len;
385
386 old_event = *event;
387 *event = ast_realloc(*event, event_len + extra_len);
388 if (!*event) {
389 ast_free(old_event);
390 return -1;
391 }
392
393 ie = (struct ast_event_ie *) ( ((char *) *event) + event_len );
394 ie->ie_type = htons(ie_type);
395 ie->ie_payload_len = htons(data_len);
396 memcpy(ie->ie_payload, data, data_len);
397
398 (*event)->event_len = htons(event_len + extra_len);
399
400 return 0;
401}
402
404{
405 va_list ap;
406 struct ast_event *event;
407 enum ast_event_ie_type ie_type;
408 struct ast_event_ie_val *ie_val;
410
411 /* Invalid type */
412 if (type >= AST_EVENT_TOTAL) {
413 ast_log(LOG_WARNING, "Someone tried to create an event of invalid "
414 "type '%u'!\n", type);
415 return NULL;
416 }
417
418 va_start(ap, type);
419 for (ie_type = va_arg(ap, enum ast_event_ie_type);
421 ie_type = va_arg(ap, enum ast_event_ie_type))
422 {
423 struct ast_event_ie_val *ie_value = ast_malloc(sizeof(*ie_value));
424 int insert = 0;
425
426 memset(ie_value, 0, sizeof(*ie_value));
427 ie_value->ie_type = ie_type;
428 ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
429
430 switch (ie_value->ie_pltype) {
432 ie_value->payload.uint = va_arg(ap, uint32_t);
433 insert = 1;
434 break;
436 ie_value->payload.uint = va_arg(ap, uint32_t);
437 insert = 1;
438 break;
440 ie_value->payload.str = va_arg(ap, const char *);
441 insert = 1;
442 break;
444 {
445 void *data = va_arg(ap, void *);
446 size_t datalen = va_arg(ap, size_t);
447 ie_value->payload.raw = ast_malloc(datalen);
448 memcpy(ie_value->payload.raw, data, datalen);
449 ie_value->raw_datalen = datalen;
450 insert = 1;
451 break;
452 }
455 break;
456 }
457
458 if (insert) {
459 AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
460 } else {
461 ast_log(LOG_WARNING, "Unsupported PLTYPE(%d)\n", ie_value->ie_pltype);
462 }
463 }
464 va_end(ap);
465
466 if (!(event = ast_calloc(1, sizeof(*event)))) {
467 return NULL;
468 }
469
470 event->type = htons(type);
471 event->event_len = htons(sizeof(*event));
472
473 AST_LIST_TRAVERSE(&ie_vals, ie_val, entry) {
474 switch (ie_val->ie_pltype) {
476 ast_event_append_ie_str(&event, ie_val->ie_type, ie_val->payload.str);
477 break;
480 break;
483 break;
486 ie_val->payload.raw, ie_val->raw_datalen);
487 break;
490 break;
491 }
492
493 /* realloc inside one of the append functions failed */
494 if (!event) {
495 goto cleanup;
496 }
497 }
498
500 /* If the event is originating on this server, add the server's
501 * entity ID to the event. */
503 }
504
505cleanup:
506 AST_LIST_TRAVERSE_SAFE_BEGIN(&ie_vals, ie_val, entry) {
508
509 if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
510 ast_free(ie_val->payload.raw);
511 }
512 ast_free(ie_val);
513 }
515
516 return event;
517}
518
520{
523}
524
526{
528}
529
531{
532 return sizeof(struct ast_event);
533}
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:530
static uint16_t event_iterator_get_ie_raw_payload_len(struct ast_event_iterator *iterator)
Definition: event.c:326
size_t ast_event_get_size(const struct ast_event *event)
Get the size of an event.
Definition: event.c:229
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:209
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:368
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:294
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:219
void ast_event_destroy(struct ast_event *event)
Destroy an event.
Definition: event.c:525
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:346
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:303
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:312
static void * event_iterator_get_ie_raw(struct ast_event_iterator *iterator)
Definition: event.c:284
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:195
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:331
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:265
int ast_event_iterator_next(struct ast_event_iterator *iterator)
Move iterator instance to next IE.
Definition: event.c:259
struct ast_event * ast_event_new(enum ast_event_type type,...)
Create a new event.
Definition: event.c:403
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:375
enum ast_event_type ast_event_get_type(const struct ast_event *event)
Get the type for an event.
Definition: event.c:289
int ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event)
Initialize an event iterator instance.
Definition: event.c:243
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:361
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:275
int ast_event_append_eid(struct ast_event **event)
Append the global EID IE.
Definition: event.c:519
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:270
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:322
@ 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_TENANTID
Channel Event TenantID Used by: AST_EVENT_CEL Payload type: STR.
Definition: event_defs.h:320
@ 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:328
@ AST_EVENT_IE_PLTYPE_RAW
Definition: event_defs.h:337
@ AST_EVENT_IE_PLTYPE_UINT
Definition: event_defs.h:333
@ AST_EVENT_IE_PLTYPE_BITFLAGS
Definition: event_defs.h:339
@ AST_EVENT_IE_PLTYPE_EXISTS
Definition: event_defs.h:331
@ AST_EVENT_IE_PLTYPE_STR
Definition: event_defs.h:335
@ AST_EVENT_IE_PLTYPE_UNKNOWN
Definition: event_defs.h:329
#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:239
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:359
const struct ast_event * event
Definition: event_defs.h:361
uint16_t event_len
Definition: event_defs.h:360
struct ast_event_ie * ie
Definition: event_defs.h:362
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