aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-10 23:19:16 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-10 23:19:16 +0000
commit1dea8c2fc19cdbbbbdbed3c9b1c94b5644d9a345 (patch)
tree0f27a6b8b64113640da26ab50578af9213e8b752 /main
parentbb96c2af4a28c2794f68266567f207d23e956aaa (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: http://svn.digium.com/svn/asterisk/trunk@246260 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-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);