diff options
author | David M. Lee <dlee@digium.com> | 2013-03-15 17:35:16 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-03-15 17:35:16 +0000 |
commit | 49e3489cac88927c87ce2b9c3e69a51aacf0bdc5 (patch) | |
tree | 501c46235f3b993322cb174f01d7190fc3b2fbd9 /main/stasis_message.c | |
parent | 641fc7ea54618828843e742f17c4d3415c1c5e26 (diff) |
A simplistic router for stasis_message's.
Often times, when subscribing to a topic, one wants to handle
different message types differently. While one could cascade if/else
statements through the subscription handler, it is much cleaner to
specify a different callback for each message type. The
stasis_message_router is here to help!
A stasis_message_router is constructed for a particular stasis_topic,
which is subscribes to. Call stasis_message_router_unsubscribe() to
cancel that subscription.
Once constructed, routes can be added using
stasis_message_router_add() (or stasis_message_router_set_default()
for any messages not handled by other routes). There may be only one
route per stasis_message_type. The route's callback is invoked just as
if it were a callback for a subscription; but it only gets called for
messages of the specified type.
(issue ASTERISK-20887)
Review: https://reviewboard.asterisk.org/r/2390/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383242 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_message.c')
-rw-r--r-- | main/stasis_message.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/main/stasis_message.c b/main/stasis_message.c index 8d397b935..8d2373f4d 100644 --- a/main/stasis_message.c +++ b/main/stasis_message.c @@ -35,7 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/stasis.h" #include "asterisk/utils.h" -/*! \private */ +/*! \internal */ struct stasis_message_type { char *name; }; @@ -70,7 +70,7 @@ const char *stasis_message_type_name(const struct stasis_message_type *type) return type->name; } -/*! \private */ +/*! \internal */ struct stasis_message { /*! Time the message was created */ struct timeval timestamp; |