summaryrefslogtreecommitdiff
path: root/main/event.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2010-02-10 23:19:16 +0000
committerRussell Bryant <russell@russellbryant.com>2010-02-10 23:19:16 +0000
commit1321748c19228e051a8db1dd497f10e1d6e55e20 (patch)
tree0f27a6b8b64113640da26ab50578af9213e8b752 /main/event.c
parentf57e5150e51331a97ef3db5da523b0adde5931ae (diff)
Add a test module for the event API, test_event.c.
This module includes a single test so far that creates events using two different methods and does some verification on the result to make sure the correct data can be retrieved from the event that was created. One bug was found in the event API while developing this test, which makes me happy. :-) Review: https://reviewboard.asterisk.org/r/495/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/event.c')
-rw-r--r--main/event.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/main/event.c b/main/event.c
index 7a953c508..673f8a11c 100644
--- a/main/event.c
+++ b/main/event.c
@@ -913,7 +913,7 @@ struct ast_event_sub *ast_event_unsubscribe(struct ast_event_sub *sub)
void ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event)
{
- iterator->event_len = ntohs(event->event_len);
+ iterator->event_len = ast_event_get_size(event);
iterator->event = event;
iterator->ie = (struct ast_event_ie *) ( ((char *) event) + sizeof(*event) );
}
@@ -1159,12 +1159,18 @@ struct ast_event *ast_event_new(enum ast_event_type type, ...)
if (has_ie && !ast_event_get_ie_raw(event, AST_EVENT_IE_EID)) {
/* If the event is originating on this server, add the server's
* entity ID to the event. */
- ast_event_append_ie_raw(&event, AST_EVENT_IE_EID, &ast_eid_default, sizeof(ast_eid_default));
+ ast_event_append_eid(&event);
}
return event;
}
+int ast_event_append_eid(struct ast_event **event)
+{
+ return ast_event_append_ie_raw(event, AST_EVENT_IE_EID,
+ &ast_eid_default, sizeof(ast_eid_default));
+}
+
void ast_event_destroy(struct ast_event *event)
{
ast_free(event);