stasis: Add internal filtering of messages.

This change adds the ability for subscriptions to indicate
which message types they are interested in accepting. By
doing so the filtering is done before being dispatched
to the subscriber, reducing the amount of work that has
to be done.

This is optional and if a subscriber does not add
message types they wish to accept and set the subscription
to selective filtering the previous behavior is preserved
and they receive all messages.

There is also the ability to explicitly force the reception
of all messages for cases such as AMI or ARI where a large
number of messages are expected that are then generically
converted into a different format.

ASTERISK-28103

Change-Id: I99bee23895baa0a117985d51683f7963b77aa190
This commit is contained in:
Joshua Colp
2018-09-23 17:50:01 -03:00
parent dd0a3c0bba
commit 8d436a95e7
33 changed files with 457 additions and 17 deletions

View File

@@ -217,3 +217,21 @@ struct stasis_topic *stasis_cp_single_topic_cached(
}
return stasis_caching_get_topic(one->topic_cached);
}
int stasis_cp_single_accept_message_type(struct stasis_cp_single *one,
struct stasis_message_type *type)
{
if (!one) {
return -1;
}
return stasis_caching_accept_message_type(one->topic_cached, type);
}
int stasis_cp_single_set_filter(struct stasis_cp_single *one,
enum stasis_subscription_message_filter filter)
{
if (!one) {
return -1;
}
return stasis_caching_set_filter(one->topic_cached, filter);
}