summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-08-29 15:19:11 +0000
committerJoshua Colp <jcolp@digium.com>2007-08-29 15:19:11 +0000
commit2351d789fddd09f6bea6df2e3ac34df7bf8c1949 (patch)
treea15fa3b222a64edeaaad1e833880ca302cbb2654 /include/asterisk
parentf9d5c43b872f216c12be1e701de2c992a4131493 (diff)
Add API calls for iterating through an event. This should allow events to have multiple information elements (while there was nothing preventing it before you could not actually access any except the first one).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81334 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/event.h57
-rw-r--r--include/asterisk/event_defs.h1
2 files changed, 58 insertions, 0 deletions
diff --git a/include/asterisk/event.h b/include/asterisk/event.h
index 2febeb3f7..767ef1cee 100644
--- a/include/asterisk/event.h
+++ b/include/asterisk/event.h
@@ -413,4 +413,61 @@ const void *ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_i
*/
enum ast_event_type ast_event_get_type(const struct ast_event *event);
+/*!
+ * \brief Initialize an event iterator instance
+ *
+ * \param iterator The iterator instance to initialize
+ * \param event The event that will be iterated through
+ *
+ * \return Nothing
+ */
+void ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event);
+
+/*!
+ * \brief Move iterator instance to next IE
+ *
+ * \param iterator The iterator instance
+ *
+ * \retval 0 on success
+ * \retval -1 if end is reached
+ */
+int ast_event_iterator_next(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the type of the current IE in the iterator instance
+ *
+ * \param iterator The iterator instance
+ *
+ * \return the ie type as represented by one of the value sin the
+ * ast_event_ie_type enum
+ */
+enum ast_event_ie_type ast_event_iterator_get_ie_type(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the value of the current IE in the ierator as an integer payload
+ *
+ * \param iterator The iterator instance
+ *
+ * \return This returns the payload of the information element as a uint.
+ */
+uint32_t ast_event_iteragor_get_ie_uint(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the value of the current IE in the iterator as a string payload
+ *
+ * \param iterator The iterator instance
+ *
+ * \return This returns the payload of the information element as a string.
+ */
+const char *ast_event_iterator_get_ie_str(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the value of the current IE in the iterator instance that has a raw payload
+ *
+ * \param iterator The iterator instance
+ *
+ * \return This returns the payload of the information element as type raw.
+ */
+void *ast_event_iterator_get_ie_raw(struct ast_event_iterator *iterator);
+
#endif /* AST_EVENT_H */
diff --git a/include/asterisk/event_defs.h b/include/asterisk/event_defs.h
index 9aadaebf6..b664ac14b 100644
--- a/include/asterisk/event_defs.h
+++ b/include/asterisk/event_defs.h
@@ -138,5 +138,6 @@ enum ast_event_subscriber_res {
struct ast_event;
struct ast_event_ie;
struct ast_event_sub;
+struct ast_event_iterator;
#endif /* AST_EVENT_DEFS_H */