asterisk/res/res_pjsip_pubsub.exports.in

45 lines
2.2 KiB
Text
Raw Normal View History

{
global:
LINKER_SYMBOL_PREFIXast_sip_create_subscription;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_endpoint;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_serializer;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_evsub;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_dlg;
LINKER_SYMBOL_PREFIXast_sip_subscription_accept;
LINKER_SYMBOL_PREFIXast_sip_subscription_send_request;
LINKER_SYMBOL_PREFIXast_sip_subscription_alloc_datastore;
LINKER_SYMBOL_PREFIXast_sip_subscription_add_datastore;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_datastore;
LINKER_SYMBOL_PREFIXast_sip_subscription_remove_datastore;
LINKER_SYMBOL_PREFIXast_sip_register_subscription_handler;
LINKER_SYMBOL_PREFIXast_sip_unregister_subscription_handler;
LINKER_SYMBOL_PREFIXast_sip_create_publication;
LINKER_SYMBOL_PREFIXast_sip_publication_get_endpoint;
LINKER_SYMBOL_PREFIXast_sip_publication_get_resource;
LINKER_SYMBOL_PREFIXast_sip_publication_get_event_configuration;
LINKER_SYMBOL_PREFIXast_sip_publication_create_response;
LINKER_SYMBOL_PREFIXast_sip_publication_send_response;
LINKER_SYMBOL_PREFIXast_sip_register_publish_handler;
LINKER_SYMBOL_PREFIXast_sip_unregister_publish_handler;
LINKER_SYMBOL_PREFIXast_sip_publication_add_datastore;
LINKER_SYMBOL_PREFIXast_sip_publication_get_datastore;
LINKER_SYMBOL_PREFIXast_sip_publication_remove_datastore;
Decouple subscription handling from NOTIFY/PUBLISH body generation. When the PJSIP pubsub framework was created, subscription handlers were required to state what event they handled along with what body types they knew how to generate. While this serves well when implementing a base RFC, it has problems when trying to extend the body to support non-standard or proprietary body elements. The code also was NOTIFY-specific, meaning that when the time comes that we start writing code to send out PUBLISH requests with MWI or presence bodies, we would likely find ourselves duplicating code that had previously been written. This changeset introduces the concept of body generators and body supplements. A body generator is responsible for allocating a native structure for a given body type, providing the primary body content, converting the native structure to a string, and deallocating resources. A body supplement takes the primary body content (the native structure, not a string) generated by the body generator and adds nonstandard elements to the body. With these elements living in their own module, it becomes easy to extend our support for body types and to re-use resources when sending a PUBLISH request. Body generators and body supplements register themselves with the pubsub core, similar to how subscription and publish handlers had done. Now, subscription handlers do not need to know what type of body content they generate, but they still need to inform the pubsub core about what the default body type for a given event package is. The pubsub core keeps track of what body generators and body supplements have been registered. When a SUBSCRIBE arrives, the pubsub core will check that there is a subscription handler for the event in the SUBSCRIBE, then it will check that there is a body generator that can provide the content specified in the Accept header(s). Because of the nature of body generators and supplements, it means res_pjsip_exten_state and res_pjsip_mwi have been completely gutted. They no longer worry about body types, instead calling ast_sip_pubsub_generate_body_content() when they need to generate a NOTIFY body. Review: https://reviewboard.asterisk.org/r/3150 ........ Merged revisions 407016 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 22:27:07 +00:00
LINKER_SYMBOL_PREFIXast_sip_publication_remove_datastore;
LINKER_SYMBOL_PREFIXast_sip_pubsub_register_body_generator;
LINKER_SYMBOL_PREFIXast_sip_pubsub_unregister_body_generator;
LINKER_SYMBOL_PREFIXast_sip_pubsub_register_body_supplement;
LINKER_SYMBOL_PREFIXast_sip_pubsub_unregister_body_supplement;
LINKER_SYMBOL_PREFIXast_sip_pubsub_generate_body_content;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_body_type;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_body_subtype;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_resource_name;
LINKER_SYMBOL_PREFIXast_sip_subscription_notify;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_local_uri;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_remote_uri;
LINKER_SYMBOL_PREFIXast_sip_subscription_get_header;
LINKER_SYMBOL_PREFIXast_sip_subscription_is_terminated;
res_pjsip_pubsub: Solidify lifetime and ownership of objects. There have been crashes and general instability seen in the pubsub code, so this patch introduces three changes to increase the stability. First, the ownership model for subscriptions has been modified. Due to RLS, subscriptions are stored in memory as a tree structure. Prior to my patch, the PJSIP subscription was the owner of the subscription tree. When the PJSIP subscription told us that it was terminating, we started destroying the subscription tree along with all of the individual leaf subscriptions that belong to the tree. The problem with this model is that the two actors in play here, the PJSIP subscription and the individual leaf subscriptions, need to have joint ownership of the subscription tree. So now, the PJSIP subscription and the individual leaf subscriptions each have a reference to the subscription tree. This way, we will not actually free memory until no players are left that care. The PJSIP subscription is a bigger stakeholder, in that if the PJSIP subscription's reference to the subscription tree is removed, the subscription tree instructs the leaf subscriptions to shut down and drop their references to the subscription tree when possible. The individual leaf subscriptions, upon being told to shut down, can drop their stasis subscriptions or whatever they use to learn of new state, and then drop their reference to the subscription tree once they are ready to die. Second, the lifetime of a PJSIP subscription's reference to our subscription tree has been altered. As I learned from doing a deep dive, the PJSIP evsub code can tell Asterisk multiple times that the subscription has been terminated, and not all of these times are especially helpful. I have altered the message flow that we use for SIP subscriptions such that we will always drop the PJSIP subscription's reference to the subscription tree when we send the NOTIFY that terminates a SIP subscription. This also means that we will now queue NOTIFY requests to be sent after responding to incoming SUBSCRIBEs so that we can have predictable state changes from the PJSIP evsub code. Third, the synchronization of operations has been improved. PJSIP can call into our code from a serializer thread (e.g. upon receiving an incoming request) or from the monitor thread (e.g. when a subscription times out). Because of this, there is the possibility of competing threads stepping on each other. PJSIP attempts to do some synchronization on its own by always keeping the dialog lock held when it calls into us. However, since we end up pushing tasks into the serializer, the result was that serialized operations were not grabbing the dialog lock and could, as a result, step on something that was being attempted by a different thread. Now we ensure that serialized operations grab the dialog lock, then check for extenuating circumstances, then proceed with their operation if they can. Change-Id: Iff2990c40178dad9cc5f6a5c7f76932ec644b2e5
2015-09-01 20:47:19 +00:00
LINKER_SYMBOL_PREFIXast_sip_subscription_destroy;
local:
*;
};