event.h File Reference

#include "asterisk/event_defs.h"

Include dependency graph for event.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int ast_event_append_eid (struct ast_event **event)
 Append the global EID IE.
int ast_event_append_ie_bitflags (struct ast_event **event, enum ast_event_ie_type ie_type, uint32_t bitflags)
 Append an information element that has a bitflags payload.
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.
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.
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.
void ast_event_destroy (struct ast_event *event)
 Destroy an event.
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.
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.
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.
const char * ast_event_get_ie_type_name (enum ast_event_ie_type ie_type)
 Get the string representation of an information element type.
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.
size_t ast_event_get_size (const struct ast_event *event)
 Get the size of an event.
enum ast_event_type ast_event_get_type (const struct ast_event *event)
 Get the type for an event.
const char * ast_event_get_type_name (const struct ast_event *event)
 Get the string representation of the type of the given 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.
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.
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.
int ast_event_iterator_init (struct ast_event_iterator *iterator, const struct ast_event *event)
 Initialize an event iterator instance.
int ast_event_iterator_next (struct ast_event_iterator *iterator)
 Move iterator instance to next IE.
size_t ast_event_minimum_length (void)
 Get the minimum length of an ast_event.
struct ast_eventast_event_new (enum ast_event_type event_type,...)
 Create a new event.
int ast_event_str_to_ie_type (const char *str, enum ast_event_ie_type *ie_type)
 Convert a string to an IE type.


Detailed Description

Author:
Russell Bryant <russell@digium.com> Generic event system

Definition in file event.h.


Function Documentation

int ast_event_append_eid ( struct ast_event **  event  ) 

Append the global EID IE.

Parameters:
event the event to append IE to
Note:
For ast_event_new() that includes IEs, this is done automatically for you.
Return values:
0 success
-1 failure

Definition at line 509 of file event.c.

References ast_eid_default, ast_event_append_ie_raw(), and AST_EVENT_IE_EID.

Referenced by ast_event_new().

00510 {
00511    return ast_event_append_ie_raw(event, AST_EVENT_IE_EID,
00512          &ast_eid_default, sizeof(ast_eid_default));
00513 }

int ast_event_append_ie_bitflags ( struct ast_event **  event,
enum ast_event_ie_type  ie_type,
uint32_t  bitflags 
)

Append an information element that has a bitflags payload.

Parameters:
event the event that the IE will be appended to
ie_type the type of IE to append
bitflags the flags that are the payload of the IE
Return values:
0 success
-1 failure
Since:
1.8
The pointer to the event will get updated with the new location for the event that now contains the appended information element. If the re-allocation of the memory for this event fails, it will be set to NULL.

Definition at line 369 of file event.c.

References ast_event_append_ie_raw().

Referenced by ast_event_new().

00371 {
00372    flags = htonl(flags);
00373    return ast_event_append_ie_raw(event, ie_type, &flags, sizeof(flags));
00374 }

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.

Parameters:
event the event that the IE will be appended to
ie_type the type of IE to append
data A pointer to the raw data for the payload of the IE
data_len The amount of data to copy into the payload
Return values:
0 success
-1 failure
The pointer to the event will get updated with the new location for the event that now contains the appended information element. If the re-allocation of the memory for this event fails, it will be set to NULL.

Definition at line 376 of file event.c.

References ast_free, ast_realloc, ast_event::event_len, ast_event_ie::ie_payload, and ast_event_ie::ie_payload_len.

Referenced by ast_event_append_eid(), ast_event_append_ie_bitflags(), ast_event_append_ie_str(), ast_event_append_ie_uint(), and ast_event_new().

00378 {
00379    struct ast_event_ie *ie;
00380    struct ast_event *old_event;
00381    unsigned int extra_len;
00382    uint16_t event_len;
00383 
00384    event_len = ntohs((*event)->event_len);
00385    extra_len = sizeof(*ie) + data_len;
00386 
00387    old_event = *event;
00388    *event = ast_realloc(*event, event_len + extra_len);
00389    if (!*event) {
00390       ast_free(old_event);
00391       return -1;
00392    }
00393 
00394    ie = (struct ast_event_ie *) ( ((char *) *event) + event_len );
00395    ie->ie_type = htons(ie_type);
00396    ie->ie_payload_len = htons(data_len);
00397    memcpy(ie->ie_payload, data, data_len);
00398 
00399    (*event)->event_len = htons(event_len + extra_len);
00400 
00401    return 0;
00402 }

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.

Parameters:
event the event that the IE will be appended to
ie_type the type of IE to append
str The string for the payload of the IE
Return values:
0 success
-1 failure
The pointer to the event will get updated with the new location for the event that now contains the appended information element. If the re-allocation of the memory for this event fails, it will be set to NULL.

Definition at line 347 of file event.c.

References ast_alloca, ast_event_append_ie_raw(), ast_str_hash(), ast_event_ie_str_payload::hash, and ast_event_ie_str_payload::str.

Referenced by ast_event_new(), and AST_TEST_DEFINE().

00349 {
00350    struct ast_event_ie_str_payload *str_payload;
00351    size_t payload_len;
00352 
00353    payload_len = sizeof(*str_payload) + strlen(str);
00354    str_payload = ast_alloca(payload_len);
00355 
00356    strcpy(str_payload->str, str);
00357    str_payload->hash = ast_str_hash(str);
00358 
00359    return ast_event_append_ie_raw(event, ie_type, str_payload, payload_len);
00360 }

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.

Parameters:
event the event that the IE will be appended to
ie_type the type of IE to append
data The integer for the payload of the IE
Return values:
0 success
-1 failure
The pointer to the event will get updated with the new location for the event that now contains the appended information element. If the re-allocation of the memory for this event fails, it will be set to NULL.

Definition at line 362 of file event.c.

References ast_event_append_ie_raw().

Referenced by ast_event_new(), and AST_TEST_DEFINE().

00364 {
00365    data = htonl(data);
00366    return ast_event_append_ie_raw(event, ie_type, &data, sizeof(data));
00367 }

void ast_event_destroy ( struct ast_event event  ) 

Destroy an event.

Parameters:
event the event to destroy
Returns:
Nothing

Definition at line 515 of file event.c.

References ast_free.

Referenced by AST_TEST_DEFINE(), cel_report_event(), and publish_to_corosync().

00516 {
00517    ast_free(event);
00518 }

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.

Parameters:
ie_type the information element type to get the payload type of
Returns:
the payload type for the provided IE type
Since:
1.6.1

Definition at line 220 of file event.c.

References ARRAY_LEN, AST_EVENT_IE_PLTYPE_UNKNOWN, ast_log, ie_maps, ie_map::ie_pltype, and LOG_ERROR.

Referenced by dump_event(), and match_ie_val().

00221 {
00222    if (ie_type <= 0 || ie_type >= ARRAY_LEN(ie_maps)) {
00223       ast_log(LOG_ERROR, "Invalid IE type - '%d'\n", ie_type);
00224       return AST_EVENT_IE_PLTYPE_UNKNOWN;
00225    }
00226 
00227    return ie_maps[ie_type].ie_pltype;
00228 }

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.

Parameters:
event The event to get the IE from
ie_type the type of information element to retrieve
Returns:
This returns the payload of the information element with the given type. If the information element isn't found, NULL will be returned.

Definition at line 313 of file event.c.

References ast_event_iterator_get_ie_type(), ast_event_iterator_init(), ast_event_iterator_next(), event_iterator_get_ie_raw(), and NULL.

Referenced by ast_event_get_ie_str(), ast_event_get_ie_uint(), ast_event_new(), corosync_ping_to_event(), cpg_deliver_cb(), publish_device_state_to_stasis(), publish_mwi_to_stasis(), and publish_to_corosync().

00314 {
00315    struct ast_event_iterator iterator;
00316    int res;
00317 
00318    for (res = ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
00319       if (ast_event_iterator_get_ie_type(&iterator) == ie_type) {
00320          return event_iterator_get_ie_raw(&iterator);
00321       }
00322    }
00323 
00324    return NULL;
00325 }

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.

Parameters:
event The event to get the IE payload length from
ie_type the type of information element to get the length of
Returns:
If an IE of type ie_type is found, its payload length is returned. Otherwise, 0 is returned.

Definition at line 332 of file event.c.

References ast_event_iterator_get_ie_type(), ast_event_iterator_init(), ast_event_iterator_next(), and event_iterator_get_ie_raw_payload_len().

00333 {
00334    struct ast_event_iterator iterator;
00335    int res;
00336 
00337    for (res = ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
00338       if (ast_event_iterator_get_ie_type(&iterator) == ie_type) {
00339          return event_iterator_get_ie_raw_payload_len(&iterator);
00340       }
00341    }
00342 
00343    return 0;
00344 }

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.

Parameters:
event The event to get the IE from
ie_type the type of information element to retrieve
Returns:
This returns the payload of the information element with the given type. If the information element isn't found, NULL will be returned.

Definition at line 304 of file event.c.

References ast_event_get_ie_raw(), NULL, and ast_event_ie_str_payload::str.

Referenced by ast_cel_fill_record(), check_event(), match_ie_val(), publish_device_state_to_stasis(), publish_mwi_to_stasis(), and test_sub().

00305 {
00306    const struct ast_event_ie_str_payload *str_payload;
00307 
00308    str_payload = ast_event_get_ie_raw(event, ie_type);
00309 
00310    return str_payload ? str_payload->str : NULL;
00311 }

const char* ast_event_get_ie_type_name ( enum ast_event_ie_type  ie_type  ) 

Get the string representation of an information element type.

Parameters:
ie_type the information element type to get the string representation of
Returns:
the string representation of the information element type
Since:
1.6.1

Definition at line 210 of file event.c.

References ARRAY_LEN, ast_log, ie_maps, LOG_ERROR, and ie_map::name.

Referenced by add_ip_json_object(), add_json_object(), alloc_security_event_json_object(), append_event_str_single(), append_json_single(), dump_event(), and events_are_equal().

00211 {
00212    if (ie_type <= 0 || ie_type >= ARRAY_LEN(ie_maps)) {
00213       ast_log(LOG_ERROR, "Invalid IE type - '%d'\n", ie_type);
00214       return "";
00215    }
00216 
00217    return ie_maps[ie_type].name;
00218 }

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.

Parameters:
event The event to get the IE from
ie_type the type of information element to retrieve
Returns:
This returns the payload of the information element with the given type. However, an IE with a payload of 0, and the case where no IE is found yield the same return value.

Definition at line 295 of file event.c.

References ast_event_get_ie_raw(), and get_unaligned_uint32().

Referenced by ast_cel_fill_record(), check_event(), dump_event(), match_ie_val(), publish_device_state_to_stasis(), and publish_mwi_to_stasis().

00296 {
00297    const uint32_t *ie_val;
00298 
00299    ie_val = ast_event_get_ie_raw(event, ie_type);
00300 
00301    return ie_val ? ntohl(get_unaligned_uint32(ie_val)) : 0;
00302 }

size_t ast_event_get_size ( const struct ast_event event  ) 

Get the size of an event.

Parameters:
event the event to get the size of
Returns:
the number of bytes contained in the event
Since:
1.6.1

Definition at line 230 of file event.c.

References ast_event::event_len.

Referenced by ao2_dup_event(), ast_event_iterator_init(), AST_TEST_DEFINE(), and publish_to_corosync().

00231 {
00232    size_t res;
00233 
00234    res = ntohs(event->event_len);
00235 
00236    return res;
00237 }

enum ast_event_type ast_event_get_type ( const struct ast_event event  ) 

Get the type for an event.

Parameters:
event the event to get the type for
Returns:
the event type as represented by one of the values in the ast_event_type enum

Definition at line 290 of file event.c.

Referenced by ast_event_get_type_name(), check_event(), check_events(), cpg_deliver_cb(), events_are_equal(), publish_corosync_ping_to_stasis(), publish_device_state_to_stasis(), publish_mwi_to_stasis(), and publish_to_corosync().

00291 {
00292    return ntohs(event->type);
00293 }

const char* ast_event_get_type_name ( const struct ast_event event  ) 

Get the string representation of the type of the given event.

Returns:
the string representation of the event type of the provided event
Since:
1.6.1

Definition at line 196 of file event.c.

References ARRAY_LEN, ast_event_get_type(), ast_log, LOG_ERROR, and type.

Referenced by cpg_deliver_cb(), and publish_to_corosync().

00197 {
00198    enum ast_event_type type;
00199 
00200    type = ast_event_get_type(event);
00201 
00202    if (type >= ARRAY_LEN(event_names)) {
00203       ast_log(LOG_ERROR, "Invalid event type - '%u'\n", type);
00204       return "";
00205    }
00206 
00207    return event_names[type];
00208 }

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.

Parameters:
iterator The iterator instance
Returns:
This returns the payload of the information element as a string.

Definition at line 276 of file event.c.

References ast_event_iterator::ie, ast_event_ie::ie_payload, NULL, and ast_event_ie_str_payload::str.

Referenced by dump_event().

00277 {
00278    const struct ast_event_ie_str_payload *str_payload;
00279 
00280    str_payload = (struct ast_event_ie_str_payload *) iterator->ie->ie_payload;
00281 
00282    return str_payload ? str_payload->str : NULL;
00283 }

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.

Parameters:
iterator The iterator instance
Returns:
the ie type as represented by one of the value sin the ast_event_ie_type enum

Definition at line 266 of file event.c.

References ast_event_iterator::ie.

Referenced by ast_event_get_ie_raw(), ast_event_get_ie_raw_payload_len(), dump_event(), and events_are_equal().

00267 {
00268    return ntohs(iterator->ie->ie_type);
00269 }

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.

Parameters:
iterator The iterator instance
Returns:
This returns the payload of the information element as a uint.

Definition at line 271 of file event.c.

References get_unaligned_uint32(), ast_event_iterator::ie, and ast_event_ie::ie_payload.

Referenced by dump_event().

00272 {
00273    return ntohl(get_unaligned_uint32(iterator->ie->ie_payload));
00274 }

int ast_event_iterator_init ( struct ast_event_iterator iterator,
const struct ast_event event 
)

Initialize an event iterator instance.

Parameters:
iterator The iterator instance to initialize
event The event that will be iterated through
Return values:
0 Success, there are IEs available to iterate
-1 Failure, there are no IEs in the event to iterate

Definition at line 244 of file event.c.

References ast_event_get_size(), and NULL.

Referenced by ast_event_get_ie_raw(), ast_event_get_ie_raw_payload_len(), dump_event(), and events_are_equal().

00245 {
00246    int res = 0;
00247 
00248    iterator->event_len = ast_event_get_size(event);
00249    iterator->event = event;
00250    if (iterator->event_len >= sizeof(*event) + sizeof(struct ast_event_ie)) {
00251       iterator->ie = (struct ast_event_ie *) ( ((char *) event) + sizeof(*event) );
00252    } else {
00253       iterator->ie = NULL;
00254       res = -1;
00255    }
00256 
00257    return res;
00258 }

int ast_event_iterator_next ( struct ast_event_iterator iterator  ) 

Move iterator instance to next IE.

Parameters:
iterator The iterator instance
Return values:
0 on success
-1 if end is reached

Definition at line 260 of file event.c.

References ast_event_iterator::event, ast_event_iterator::event_len, ast_event_iterator::ie, and ast_event_ie::ie_payload_len.

Referenced by ast_event_get_ie_raw(), ast_event_get_ie_raw_payload_len(), dump_event(), and events_are_equal().

00261 {
00262    iterator->ie = (struct ast_event_ie *) ( ((char *) iterator->ie) + sizeof(*iterator->ie) + ntohs(iterator->ie->ie_payload_len));
00263    return ((iterator->event_len <= (((char *) iterator->ie) - ((char *) iterator->event))) ? -1 : 0);
00264 }

size_t ast_event_minimum_length ( void   ) 

Get the minimum length of an ast_event.

Returns:
minimum amount of memory that will be consumed by any ast_event.

Definition at line 520 of file event.c.

Referenced by cpg_deliver_cb().

00521 {
00522    return sizeof(struct ast_event);
00523 }

struct ast_event* ast_event_new ( enum ast_event_type  event_type,
  ... 
) [read]

Create a new event.

Parameters:
event_type The type of event to create
The rest of the arguments to this function specify information elements to add to the event. They are specified in the form: and must end with AST_EVENT_IE_END.

If the ie_type specified is *not* AST_EVENT_IE_END, then it must be followed by a valid IE payload type. A payload must also be specified after the IE payload type.

Note:
The EID IE will be appended automatically when this function is used with at least one IE specified.
Returns:
This returns the event that has been created. If there is an error creating the event, NULL will be returned.
Example usage:

This creates a MWI event with 3 information elements, a mailbox which is a string, and the number of new and old messages, specified as integers.

Examples:
/tmp/asterisk-trunk/trunk/main/app.c.

Definition at line 404 of file event.c.

References ast_alloca, ast_calloc, ast_event_append_eid(), ast_event_append_ie_bitflags(), ast_event_append_ie_raw(), ast_event_append_ie_str(), ast_event_append_ie_uint(), ast_event_get_ie_raw(), AST_EVENT_IE_EID, AST_EVENT_IE_END, AST_EVENT_IE_PLTYPE_BITFLAGS, AST_EVENT_IE_PLTYPE_EXISTS, AST_EVENT_IE_PLTYPE_RAW, AST_EVENT_IE_PLTYPE_STR, AST_EVENT_IE_PLTYPE_UINT, AST_EVENT_IE_PLTYPE_UNKNOWN, AST_EVENT_TOTAL, AST_LIST_HEAD_NOLOCK_STATIC, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_log, ast_event_ie_val::ie_pltype, ast_event_ie_val::ie_type, ast_ev_check_list::ie_vals, LOG_WARNING, NULL, ast_event_ie_val::payload, ast_event_ie_val::raw, ast_event_ie_val::raw_datalen, ast_event_ie_val::str, and ast_event_ie_val::uint.

Referenced by ast_cel_create_event(), AST_TEST_DEFINE(), corosync_ping(), corosync_ping_to_event(), devstate_to_event(), and mwi_to_event().

00405 {
00406    va_list ap;
00407    struct ast_event *event;
00408    enum ast_event_ie_type ie_type;
00409    struct ast_event_ie_val *ie_val;
00410    AST_LIST_HEAD_NOLOCK_STATIC(ie_vals, ast_event_ie_val);
00411 
00412    /* Invalid type */
00413    if (type >= AST_EVENT_TOTAL) {
00414       ast_log(LOG_WARNING, "Someone tried to create an event of invalid "
00415          "type '%u'!\n", type);
00416       return NULL;
00417    }
00418 
00419    va_start(ap, type);
00420    for (ie_type = va_arg(ap, enum ast_event_ie_type);
00421       ie_type != AST_EVENT_IE_END;
00422       ie_type = va_arg(ap, enum ast_event_ie_type))
00423    {
00424       struct ast_event_ie_val *ie_value = ast_alloca(sizeof(*ie_value));
00425       int insert = 0;
00426 
00427       memset(ie_value, 0, sizeof(*ie_value));
00428       ie_value->ie_type = ie_type;
00429       ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
00430 
00431       switch (ie_value->ie_pltype) {
00432       case AST_EVENT_IE_PLTYPE_UINT:
00433          ie_value->payload.uint = va_arg(ap, uint32_t);
00434          insert = 1;
00435          break;
00436       case AST_EVENT_IE_PLTYPE_BITFLAGS:
00437          ie_value->payload.uint = va_arg(ap, uint32_t);
00438          insert = 1;
00439          break;
00440       case AST_EVENT_IE_PLTYPE_STR:
00441          ie_value->payload.str = va_arg(ap, const char *);
00442          insert = 1;
00443          break;
00444       case AST_EVENT_IE_PLTYPE_RAW:
00445       {
00446          void *data = va_arg(ap, void *);
00447          size_t datalen = va_arg(ap, size_t);
00448          ie_value->payload.raw = ast_alloca(datalen);
00449          memcpy(ie_value->payload.raw, data, datalen);
00450          ie_value->raw_datalen = datalen;
00451          insert = 1;
00452          break;
00453       }
00454       case AST_EVENT_IE_PLTYPE_UNKNOWN:
00455       case AST_EVENT_IE_PLTYPE_EXISTS:
00456          break;
00457       }
00458 
00459       if (insert) {
00460          AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
00461       } else {
00462          ast_log(LOG_WARNING, "Unsupported PLTYPE(%d)\n", ie_value->ie_pltype);
00463       }
00464    }
00465    va_end(ap);
00466 
00467    if (!(event = ast_calloc(1, sizeof(*event)))) {
00468       return NULL;
00469    }
00470 
00471    event->type = htons(type);
00472    event->event_len = htons(sizeof(*event));
00473 
00474    AST_LIST_TRAVERSE(&ie_vals, ie_val, entry) {
00475       switch (ie_val->ie_pltype) {
00476       case AST_EVENT_IE_PLTYPE_STR:
00477          ast_event_append_ie_str(&event, ie_val->ie_type, ie_val->payload.str);
00478          break;
00479       case AST_EVENT_IE_PLTYPE_UINT:
00480          ast_event_append_ie_uint(&event, ie_val->ie_type, ie_val->payload.uint);
00481          break;
00482       case AST_EVENT_IE_PLTYPE_BITFLAGS:
00483          ast_event_append_ie_bitflags(&event, ie_val->ie_type, ie_val->payload.uint);
00484          break;
00485       case AST_EVENT_IE_PLTYPE_RAW:
00486          ast_event_append_ie_raw(&event, ie_val->ie_type,
00487                ie_val->payload.raw, ie_val->raw_datalen);
00488          break;
00489       case AST_EVENT_IE_PLTYPE_EXISTS:
00490       case AST_EVENT_IE_PLTYPE_UNKNOWN:
00491          break;
00492       }
00493 
00494       /* realloc inside one of the append functions failed */
00495       if (!event) {
00496          return NULL;
00497       }
00498    }
00499 
00500    if (!ast_event_get_ie_raw(event, AST_EVENT_IE_EID)) {
00501       /* If the event is originating on this server, add the server's
00502        * entity ID to the event. */
00503       ast_event_append_eid(&event);
00504    }
00505 
00506    return event;
00507 }

int ast_event_str_to_ie_type ( const char *  str,
enum ast_event_ie_type ie_type 
)

Convert a string to an IE type.

Parameters:
str the string to convert
ie_type an output parameter for the IE type
Return values:
0 success
non-zero failure
Since:
1.6.1


Generated on Thu Apr 16 06:30:53 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6