2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 2007 - 2008, Digium, Inc.
6 * Russell Bryant <russell@digium.com>
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.
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.
21 * \author Russell Bryant <russell@digium.com>
22 * \brief Generic event system
25 #ifndef AST_EVENT_DEFS_H
26 #define AST_EVENT_DEFS_H
29 /*! Reserved to provide the ability to subscribe to all events. A specific
30 * event should never have a payload of 0. */
32 /*! This event type is reserved for use by third-party modules to create
33 * custom events without having to modify this file.
34 * \note There are no "custom" IE types, because IEs only have to be
35 * unique to the event itself, not necessarily across all events. */
36 AST_EVENT_CUSTOM = 0x01,
37 /*! Voicemail message waiting indication */
39 /*! Someone has subscribed to events */
41 /*! Someone has unsubscribed from events */
42 AST_EVENT_UNSUB = 0x04,
43 /*! The aggregate state of a device across all servers configured to be
44 * a part of a device state cluster has changed. */
45 AST_EVENT_DEVICE_STATE = 0x05,
46 /*! The state of a device has changed on _one_ server. This should not be used
47 * directly, in general. Use AST_EVENT_DEVICE_STATE instead. */
48 AST_EVENT_DEVICE_STATE_CHANGE = 0x06,
49 /*! Channel Event Logging events */
51 /*! A report of a security related event (see security_events.h) */
52 AST_EVENT_SECURITY = 0x08,
53 /*! Used by res_stun_monitor to alert listeners to an exernal network address change. */
54 AST_EVENT_NETWORK_CHANGE = 0x09,
55 /*! The presence state for a presence provider */
56 AST_EVENT_PRESENCE_STATE = 0x0a,
57 /*! Used to alert listeners when a named ACL has changed. */
58 AST_EVENT_ACL_CHANGE = 0x0b,
59 /*! Send out a ping for debugging distributed events */
60 AST_EVENT_PING = 0x0c,
61 /*! Number of event types. This should be the last event type + 1 */
62 AST_EVENT_TOTAL = 0x0d,
65 /*! \brief Event Information Element types */
66 enum ast_event_ie_type {
67 /*! Used to terminate the arguments to event functions */
68 AST_EVENT_IE_END = -1,
71 * \brief Number of new messages
72 * Used by: AST_EVENT_MWI
75 AST_EVENT_IE_NEWMSGS = 0x0001,
78 * Used by: AST_EVENT_MWI
81 AST_EVENT_IE_OLDMSGS = 0x0002,
83 * \brief Mailbox name \verbatim (mailbox[@context]) \endverbatim
84 * Used by: AST_EVENT_MWI
87 AST_EVENT_IE_MAILBOX = 0x0003,
90 * Used by: AST_EVENT_SUB, AST_EVENT_UNSUB
93 AST_EVENT_IE_UNIQUEID = 0x0004,
96 * Used by: AST_EVENT_SUB, AST_EVENT_UNSUB
99 AST_EVENT_IE_EVENTTYPE = 0x0005,
101 * \brief Hint that someone cares that an IE exists
102 * Used by: AST_EVENT_SUB
103 * Payload type: UINT (ast_event_ie_type)
105 AST_EVENT_IE_EXISTS = 0x0006,
108 * Used by AST_EVENT_DEVICE_STATE_CHANGE
111 AST_EVENT_IE_DEVICE = 0x0007,
113 * \brief Generic State IE
114 * Used by AST_EVENT_DEVICE_STATE_CHANGE
116 * The actual state values depend on the event which
117 * this IE is a part of.
119 AST_EVENT_IE_STATE = 0x0008,
122 * Used by AST_EVENT_MWI
125 AST_EVENT_IE_CONTEXT = 0x0009,
127 * \brief Channel Event Type
128 * Used by: AST_EVENT_CEL
131 AST_EVENT_IE_CEL_EVENT_TYPE = 0x000a,
133 * \brief Channel Event Time (seconds)
134 * Used by: AST_EVENT_CEL
137 AST_EVENT_IE_CEL_EVENT_TIME = 0x000b,
139 * \brief Channel Event Time (micro-seconds)
140 * Used by: AST_EVENT_CEL
143 AST_EVENT_IE_CEL_EVENT_TIME_USEC = 0x000c,
145 * \brief Channel Event User Event Name
146 * Used by: AST_EVENT_CEL
149 AST_EVENT_IE_CEL_USEREVENT_NAME = 0x000d,
151 * \brief Channel Event CID name
152 * Used by: AST_EVENT_CEL
155 AST_EVENT_IE_CEL_CIDNAME = 0x000e,
157 * \brief Channel Event CID num
158 * Used by: AST_EVENT_CEL
161 AST_EVENT_IE_CEL_CIDNUM = 0x000f,
163 * \brief Channel Event extension name
164 * Used by: AST_EVENT_CEL
167 AST_EVENT_IE_CEL_EXTEN = 0x0010,
169 * \brief Channel Event context name
170 * Used by: AST_EVENT_CEL
173 AST_EVENT_IE_CEL_CONTEXT = 0x0011,
175 * \brief Channel Event channel name
176 * Used by: AST_EVENT_CEL
179 AST_EVENT_IE_CEL_CHANNAME = 0x0012,
181 * \brief Channel Event app name
182 * Used by: AST_EVENT_CEL
185 AST_EVENT_IE_CEL_APPNAME = 0x0013,
187 * \brief Channel Event app args/data
188 * Used by: AST_EVENT_CEL
191 AST_EVENT_IE_CEL_APPDATA = 0x0014,
193 * \brief Channel Event AMA flags
194 * Used by: AST_EVENT_CEL
197 AST_EVENT_IE_CEL_AMAFLAGS = 0x0015,
199 * \brief Channel Event AccountCode
200 * Used by: AST_EVENT_CEL
203 AST_EVENT_IE_CEL_ACCTCODE = 0x0016,
205 * \brief Channel Event UniqueID
206 * Used by: AST_EVENT_CEL
209 AST_EVENT_IE_CEL_UNIQUEID = 0x0017,
211 * \brief Channel Event Userfield
212 * Used by: AST_EVENT_CEL
215 AST_EVENT_IE_CEL_USERFIELD = 0x0018,
217 * \brief Channel Event CID ANI field
218 * Used by: AST_EVENT_CEL
221 AST_EVENT_IE_CEL_CIDANI = 0x0019,
223 * \brief Channel Event CID RDNIS field
224 * Used by: AST_EVENT_CEL
227 AST_EVENT_IE_CEL_CIDRDNIS = 0x001a,
229 * \brief Channel Event CID dnid
230 * Used by: AST_EVENT_CEL
233 AST_EVENT_IE_CEL_CIDDNID = 0x001b,
235 * \brief Channel Event Peer -- for Things involving multiple channels, like BRIDGE
236 * Used by: AST_EVENT_CEL
239 AST_EVENT_IE_CEL_PEER = 0x001c,
241 * \brief Channel Event LinkedID
242 * Used by: AST_EVENT_CEL
245 AST_EVENT_IE_CEL_LINKEDID = 0x001d,
247 * \brief Channel Event peeraccount
248 * Used by: AST_EVENT_CEL
251 AST_EVENT_IE_CEL_PEERACCT = 0x001e,
253 * \brief Channel Event extra data
254 * Used by: AST_EVENT_CEL
257 AST_EVENT_IE_CEL_EXTRA = 0x001f,
260 * Used by: AST_EVENT_SUB, AST_EVENT_UNSUB
263 AST_EVENT_IE_DESCRIPTION = 0x0020,
268 * This IE indicates which server the event originated from
270 AST_EVENT_IE_EID = 0x0021,
271 AST_EVENT_IE_SECURITY_EVENT = 0x0022,
272 AST_EVENT_IE_EVENT_VERSION = 0x0023,
273 AST_EVENT_IE_SERVICE = 0x0024,
274 AST_EVENT_IE_MODULE = 0x0025,
275 AST_EVENT_IE_ACCOUNT_ID = 0x0026,
276 AST_EVENT_IE_SESSION_ID = 0x0027,
277 AST_EVENT_IE_SESSION_TV = 0x0028,
278 AST_EVENT_IE_ACL_NAME = 0x0029,
279 AST_EVENT_IE_LOCAL_ADDR = 0x002a,
280 AST_EVENT_IE_REMOTE_ADDR = 0x002b,
281 AST_EVENT_IE_EVENT_TV = 0x002c,
282 AST_EVENT_IE_REQUEST_TYPE = 0x002d,
283 AST_EVENT_IE_REQUEST_PARAMS = 0x002e,
284 AST_EVENT_IE_AUTH_METHOD = 0x002f,
285 AST_EVENT_IE_SEVERITY = 0x0030,
286 AST_EVENT_IE_EXPECTED_ADDR = 0x0031,
287 AST_EVENT_IE_CHALLENGE = 0x0032,
288 AST_EVENT_IE_RESPONSE = 0x0033,
289 AST_EVENT_IE_EXPECTED_RESPONSE = 0x0034,
290 AST_EVENT_IE_RECEIVED_CHALLENGE = 0x0035,
291 AST_EVENT_IE_RECEIVED_HASH = 0x0036,
292 AST_EVENT_IE_USING_PASSWORD = 0x0037,
293 AST_EVENT_IE_ATTEMPTED_TRANSPORT = 0x0038,
294 AST_EVENT_IE_PRESENCE_PROVIDER = 0x0039,
295 AST_EVENT_IE_PRESENCE_STATE = 0x003a,
296 AST_EVENT_IE_PRESENCE_SUBTYPE = 0x003b,
297 AST_EVENT_IE_PRESENCE_MESSAGE = 0x003c,
300 * \brief Event non-cachability flag
301 * Used by: All events
304 AST_EVENT_IE_CACHABLE = 0x003d,
305 /*! \brief Must be the last IE value +1 */
306 AST_EVENT_IE_TOTAL = 0x003e,
310 * \brief Payload types for event information elements
312 enum ast_event_ie_pltype {
313 AST_EVENT_IE_PLTYPE_UNKNOWN = -1,
314 /*! Just check if it exists, not the value */
315 AST_EVENT_IE_PLTYPE_EXISTS,
316 /*! Unsigned Integer (Can be used for signed, too ...) */
317 AST_EVENT_IE_PLTYPE_UINT,
319 AST_EVENT_IE_PLTYPE_STR,
320 /*! Raw data, compared with memcmp */
321 AST_EVENT_IE_PLTYPE_RAW,
322 /*! Bit flags (unsigned integer, compared using boolean logic) */
323 AST_EVENT_IE_PLTYPE_BITFLAGS,
327 * \brief Results for checking for subscribers
329 * \ref ast_event_check_subscriber()
331 enum ast_event_subscriber_res {
332 /*! No subscribers exist */
334 /*! At least one subscriber exists */
335 AST_EVENT_SUB_EXISTS,
340 struct ast_event_iterator;
343 * \brief supposed to be an opaque type
345 * This is only here so that it can be declared on the stack.
347 struct ast_event_iterator {
349 const struct ast_event *event;
350 struct ast_event_ie *ie;
353 #endif /* AST_EVENT_DEFS_H */