00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 2007 - 2008, Digium, Inc. 00005 * 00006 * Russell Bryant <russell@digium.com> 00007 * 00008 * See http://www.asterisk.org for more information about 00009 * the Asterisk project. Please do not directly contact 00010 * any of the maintainers of this project for assistance; 00011 * the project provides a web site, mailing lists and IRC 00012 * channels for your use. 00013 * 00014 * This program is free software, distributed under the terms of 00015 * the GNU General Public License Version 2. See the LICENSE file 00016 * at the top of the source tree. 00017 */ 00018 00019 /*! 00020 * \file 00021 * \author Russell Bryant <russell@digium.com> 00022 * \brief Generic event system 00023 */ 00024 00025 #ifndef AST_EVENT_DEFS_H 00026 #define AST_EVENT_DEFS_H 00027 00028 /*! \brief Event types 00029 * \note These values can *never* change. */ 00030 enum ast_event_type { 00031 /*! Reserved to provide the ability to subscribe to all events. A specific 00032 * event should never have a payload of 0. */ 00033 AST_EVENT_ALL = 0x00, 00034 /*! This event type is reserved for use by third-party modules to create 00035 * custom events without having to modify this file. 00036 * \note There are no "custom" IE types, because IEs only have to be 00037 * unique to the event itself, not necessarily across all events. */ 00038 AST_EVENT_CUSTOM = 0x01, 00039 /*! Voicemail message waiting indication */ 00040 AST_EVENT_MWI = 0x02, 00041 /*! Someone has subscribed to events */ 00042 AST_EVENT_SUB = 0x03, 00043 /*! Someone has unsubscribed from events */ 00044 AST_EVENT_UNSUB = 0x04, 00045 /*! The aggregate state of a device across all servers configured to be 00046 * a part of a device state cluster has changed. */ 00047 AST_EVENT_DEVICE_STATE = 0x05, 00048 /*! The state of a device has changed on _one_ server. This should not be used 00049 * directly, in general. Use AST_EVENT_DEVICE_STATE instead. */ 00050 AST_EVENT_DEVICE_STATE_CHANGE = 0x06, 00051 /*! Channel Event Logging events */ 00052 AST_EVENT_CEL = 0x07, 00053 /*! A report of a security related event (see security_events.h) */ 00054 AST_EVENT_SECURITY = 0x08, 00055 /*! Number of event types. This should be the last event type + 1 */ 00056 AST_EVENT_TOTAL = 0x09, 00057 }; 00058 00059 /*! \brief Event Information Element types */ 00060 enum ast_event_ie_type { 00061 /*! Used to terminate the arguments to event functions */ 00062 AST_EVENT_IE_END = -1, 00063 00064 /*! 00065 * \brief Number of new messages 00066 * Used by: AST_EVENT_MWI 00067 * Payload type: UINT 00068 */ 00069 AST_EVENT_IE_NEWMSGS = 0x0001, 00070 /*! 00071 * \brief Number of 00072 * Used by: AST_EVENT_MWI 00073 * Payload type: UINT 00074 */ 00075 AST_EVENT_IE_OLDMSGS = 0x0002, 00076 /*! 00077 * \brief Mailbox name \verbatim (mailbox[@context]) \endverbatim 00078 * Used by: AST_EVENT_MWI 00079 * Payload type: STR 00080 */ 00081 AST_EVENT_IE_MAILBOX = 0x0003, 00082 /*! 00083 * \brief Unique ID 00084 * Used by: AST_EVENT_SUB, AST_EVENT_UNSUB 00085 * Payload type: UINT 00086 */ 00087 AST_EVENT_IE_UNIQUEID = 0x0004, 00088 /*! 00089 * \brief Event type 00090 * Used by: AST_EVENT_SUB, AST_EVENT_UNSUB 00091 * Payload type: UINT 00092 */ 00093 AST_EVENT_IE_EVENTTYPE = 0x0005, 00094 /*! 00095 * \brief Hint that someone cares that an IE exists 00096 * Used by: AST_EVENT_SUB 00097 * Payload type: UINT (ast_event_ie_type) 00098 */ 00099 AST_EVENT_IE_EXISTS = 0x0006, 00100 /*! 00101 * \brief Device Name 00102 * Used by AST_EVENT_DEVICE_STATE_CHANGE 00103 * Payload type: STR 00104 */ 00105 AST_EVENT_IE_DEVICE = 0x0007, 00106 /*! 00107 * \brief Generic State IE 00108 * Used by AST_EVENT_DEVICE_STATE_CHANGE 00109 * Payload type: UINT 00110 * The actual state values depend on the event which 00111 * this IE is a part of. 00112 */ 00113 AST_EVENT_IE_STATE = 0x0008, 00114 /*! 00115 * \brief Context IE 00116 * Used by AST_EVENT_MWI 00117 * Payload type: str 00118 */ 00119 AST_EVENT_IE_CONTEXT = 0x0009, 00120 /*! 00121 * \brief Channel Event Type 00122 * Used by: AST_EVENT_CEL 00123 * Payload type: UINT 00124 */ 00125 AST_EVENT_IE_CEL_EVENT_TYPE = 0x000a, 00126 /*! 00127 * \brief Channel Event Time (seconds) 00128 * Used by: AST_EVENT_CEL 00129 * Payload type: UINT 00130 */ 00131 AST_EVENT_IE_CEL_EVENT_TIME = 0x000b, 00132 /*! 00133 * \brief Channel Event Time (micro-seconds) 00134 * Used by: AST_EVENT_CEL 00135 * Payload type: UINT 00136 */ 00137 AST_EVENT_IE_CEL_EVENT_TIME_USEC = 0x000c, 00138 /*! 00139 * \brief Channel Event User Event Name 00140 * Used by: AST_EVENT_CEL 00141 * Payload type: STR 00142 */ 00143 AST_EVENT_IE_CEL_USEREVENT_NAME = 0x000d, 00144 /*! 00145 * \brief Channel Event CID name 00146 * Used by: AST_EVENT_CEL 00147 * Payload type: STR 00148 */ 00149 AST_EVENT_IE_CEL_CIDNAME = 0x000e, 00150 /*! 00151 * \brief Channel Event CID num 00152 * Used by: AST_EVENT_CEL 00153 * Payload type: STR 00154 */ 00155 AST_EVENT_IE_CEL_CIDNUM = 0x000f, 00156 /*! 00157 * \brief Channel Event extension name 00158 * Used by: AST_EVENT_CEL 00159 * Payload type: STR 00160 */ 00161 AST_EVENT_IE_CEL_EXTEN = 0x0010, 00162 /*! 00163 * \brief Channel Event context name 00164 * Used by: AST_EVENT_CEL 00165 * Payload type: STR 00166 */ 00167 AST_EVENT_IE_CEL_CONTEXT = 0x0011, 00168 /*! 00169 * \brief Channel Event channel name 00170 * Used by: AST_EVENT_CEL 00171 * Payload type: STR 00172 */ 00173 AST_EVENT_IE_CEL_CHANNAME = 0x0012, 00174 /*! 00175 * \brief Channel Event app name 00176 * Used by: AST_EVENT_CEL 00177 * Payload type: STR 00178 */ 00179 AST_EVENT_IE_CEL_APPNAME = 0x0013, 00180 /*! 00181 * \brief Channel Event app args/data 00182 * Used by: AST_EVENT_CEL 00183 * Payload type: STR 00184 */ 00185 AST_EVENT_IE_CEL_APPDATA = 0x0014, 00186 /*! 00187 * \brief Channel Event AMA flags 00188 * Used by: AST_EVENT_CEL 00189 * Payload type: UINT 00190 */ 00191 AST_EVENT_IE_CEL_AMAFLAGS = 0x0015, 00192 /*! 00193 * \brief Channel Event AccountCode 00194 * Used by: AST_EVENT_CEL 00195 * Payload type: STR 00196 */ 00197 AST_EVENT_IE_CEL_ACCTCODE = 0x0016, 00198 /*! 00199 * \brief Channel Event UniqueID 00200 * Used by: AST_EVENT_CEL 00201 * Payload type: STR 00202 */ 00203 AST_EVENT_IE_CEL_UNIQUEID = 0x0017, 00204 /*! 00205 * \brief Channel Event Userfield 00206 * Used by: AST_EVENT_CEL 00207 * Payload type: STR 00208 */ 00209 AST_EVENT_IE_CEL_USERFIELD = 0x0018, 00210 /*! 00211 * \brief Channel Event CID ANI field 00212 * Used by: AST_EVENT_CEL 00213 * Payload type: STR 00214 */ 00215 AST_EVENT_IE_CEL_CIDANI = 0x0019, 00216 /*! 00217 * \brief Channel Event CID RDNIS field 00218 * Used by: AST_EVENT_CEL 00219 * Payload type: STR 00220 */ 00221 AST_EVENT_IE_CEL_CIDRDNIS = 0x001a, 00222 /*! 00223 * \brief Channel Event CID dnid 00224 * Used by: AST_EVENT_CEL 00225 * Payload type: STR 00226 */ 00227 AST_EVENT_IE_CEL_CIDDNID = 0x001b, 00228 /*! 00229 * \brief Channel Event Peer -- for Things involving multiple channels, like BRIDGE 00230 * Used by: AST_EVENT_CEL 00231 * Payload type: STR 00232 */ 00233 AST_EVENT_IE_CEL_PEER = 0x001c, 00234 /*! 00235 * \brief Channel Event LinkedID 00236 * Used by: AST_EVENT_CEL 00237 * Payload type: STR 00238 */ 00239 AST_EVENT_IE_CEL_LINKEDID = 0x001d, 00240 /*! 00241 * \brief Channel Event peeraccount 00242 * Used by: AST_EVENT_CEL 00243 * Payload type: STR 00244 */ 00245 AST_EVENT_IE_CEL_PEERACCT = 0x001e, 00246 /*! 00247 * \brief Channel Event extra data 00248 * Used by: AST_EVENT_CEL 00249 * Payload type: STR 00250 */ 00251 AST_EVENT_IE_CEL_EXTRA = 0x001f, 00252 /*! 00253 * \brief Description 00254 * Used by: AST_EVENT_SUB, AST_EVENT_UNSUB 00255 * Payload type: STR 00256 */ 00257 AST_EVENT_IE_DESCRIPTION = 0x0020, 00258 /*! 00259 * \brief Entity ID 00260 * Used by All events 00261 * Payload type: RAW 00262 * This IE indicates which server the event originated from 00263 */ 00264 AST_EVENT_IE_EID = 0x0021, 00265 AST_EVENT_IE_SECURITY_EVENT = 0x0022, 00266 AST_EVENT_IE_EVENT_VERSION = 0x0023, 00267 AST_EVENT_IE_SERVICE = 0x0024, 00268 AST_EVENT_IE_MODULE = 0x0025, 00269 AST_EVENT_IE_ACCOUNT_ID = 0x0026, 00270 AST_EVENT_IE_SESSION_ID = 0x0027, 00271 AST_EVENT_IE_SESSION_TV = 0x0028, 00272 AST_EVENT_IE_ACL_NAME = 0x0029, 00273 AST_EVENT_IE_LOCAL_ADDR = 0x002a, 00274 AST_EVENT_IE_REMOTE_ADDR = 0x002b, 00275 AST_EVENT_IE_EVENT_TV = 0x002c, 00276 AST_EVENT_IE_REQUEST_TYPE = 0x002d, 00277 AST_EVENT_IE_REQUEST_PARAMS = 0x002e, 00278 AST_EVENT_IE_AUTH_METHOD = 0x002f, 00279 AST_EVENT_IE_SEVERITY = 0x0030, 00280 AST_EVENT_IE_EXPECTED_ADDR = 0x0031, 00281 AST_EVENT_IE_CHALLENGE = 0x0032, 00282 AST_EVENT_IE_RESPONSE = 0x0033, 00283 AST_EVENT_IE_EXPECTED_RESPONSE = 0x0034, 00284 /*! \brief Must be the last IE value +1 */ 00285 AST_EVENT_IE_TOTAL = 0x0035, 00286 }; 00287 00288 /*! 00289 * \brief Payload types for event information elements 00290 */ 00291 enum ast_event_ie_pltype { 00292 AST_EVENT_IE_PLTYPE_UNKNOWN = -1, 00293 /*! Just check if it exists, not the value */ 00294 AST_EVENT_IE_PLTYPE_EXISTS, 00295 /*! Unsigned Integer (Can be used for signed, too ...) */ 00296 AST_EVENT_IE_PLTYPE_UINT, 00297 /*! String */ 00298 AST_EVENT_IE_PLTYPE_STR, 00299 /*! Raw data, compared with memcmp */ 00300 AST_EVENT_IE_PLTYPE_RAW, 00301 /*! Bit flags (unsigned integer, compared using boolean logic) */ 00302 AST_EVENT_IE_PLTYPE_BITFLAGS, 00303 }; 00304 00305 /*! 00306 * \brief Results for checking for subscribers 00307 * 00308 * \ref ast_event_check_subscriber() 00309 */ 00310 enum ast_event_subscriber_res { 00311 /*! No subscribers exist */ 00312 AST_EVENT_SUB_NONE, 00313 /*! At least one subscriber exists */ 00314 AST_EVENT_SUB_EXISTS, 00315 }; 00316 00317 struct ast_event; 00318 struct ast_event_ie; 00319 struct ast_event_sub; 00320 struct ast_event_iterator; 00321 00322 /*! 00323 * \brief supposed to be an opaque type 00324 * 00325 * This is only here so that it can be declared on the stack. 00326 */ 00327 struct ast_event_iterator { 00328 uint16_t event_len; 00329 const struct ast_event *event; 00330 struct ast_event_ie *ie; 00331 }; 00332 00333 #endif /* AST_EVENT_DEFS_H */
1.5.6