sipxtacklib
Version 3.3
|
Top level class for accepting and processing SUBSCRIBE requests. More...
#include <SipSubscribeServer.h>
Public Member Functions | |
SipSubscribeServer (SipUserAgent &defaultUserAgent, SipPublishContentMgr &defaultContentMgr, SipSubscriptionMgr &defaultSubscriptionMgr, SipSubscribeServerEventHandler &defaultPlugin) | |
Default Dialog constructor. More... | |
virtual | ~SipSubscribeServer () |
Destructor. More... | |
UtlBoolean | notifySubscribers (const char *resourceId, const char *eventTypeKey, const char *eventType, UtlBoolean isDefaultContent) |
Send a NOTIFY to all subscribers to resource and event state. More... | |
UtlBoolean | enableEventType (const char *eventType, SipUserAgent *userAgent=NULL, SipPublishContentMgr *contentMgr=NULL, SipSubscribeServerEventHandler *eventPlugin=NULL, SipSubscriptionMgr *subscriptionMgr=NULL) |
Tell subscribe server to support given event type. More... | |
UtlBoolean | disableEventType (const char *eventType, SipUserAgent *&userAgent, SipPublishContentMgr *&contentMgr, SipSubscribeServerEventHandler *&eventPlugin, SipSubscriptionMgr *&subscriptionMgr) |
Tell subscribe server to stop supporting given event type. More... | |
UtlBoolean | handleMessage (OsMsg &eventMessage) |
Handler for SUBSCRIBE requests, NOTIFY responses and timers. More... | |
SipSubscribeServerEventHandler * | getEventHandler (const UtlString &eventType) |
Get the event handler for the given eventType. More... | |
SipPublishContentMgr * | getPublishMgr (const UtlString &eventType) |
Get the content manager for the given event type. More... | |
SipSubscriptionMgr * | getSubscriptionMgr (const UtlString &eventType) |
Get the subscription manager for the given event type. More... | |
UtlBoolean | isEventTypeEnabled (const UtlString &eventType) |
Inquire if the given event type is enabled in the server. More... | |
Static Public Member Functions | |
static SipSubscribeServer * | buildBasicServer (SipUserAgent &userAgent, const char *eventType=NULL) |
Helper utility to build a basic server with default behavior. More... | |
static void | contentChangeCallback (void *applicationData, const char *resourceId, const char *eventTypeKey, const char *eventType, UtlBoolean isDefaultContent) |
Callback invoked by SipPublishContentMgr when content changes. More... | |
Top level class for accepting and processing SUBSCRIBE requests.
This implements a generic RFC 3265 SUBSCRIBE server or sometimes called a NOTIFIER. This class receives SUBSCRIBE requests, retrieves the SIP Event content from the SipPublisherContentMgr generates a NOTIFY request with the retrieved Event content and send the NOFITY using the SipUserAgent. The SipSubscribeServer is designed so that it can handle several different event types or so that you can have multiple instances of the SipSubscribeServer each handling different event type. However you can not have an event type that is handled by more than one SipSubScribeServer.
When enabling a SIP event type via the enableEventType method, the SipSubscribeServer registers with the SipUserAgent to receive SUBSCRIBE requests and NOTIFY responses for the event type which are processed by the handleMessage method. Applications that publish event state use the SipPublishContentMgr to update resource specific or default event states. The SipSubscribeServer is notified by the SipPublishContentMgr (via callback) that the content has changed and sends a NOTIFY to those subscribed to the resourceId for the event type key. The SipSubscribeServer uses timers to keep track of when event subscription expire. When a timer fires, a message gets queued on the SipSubscribeServer which is that passed to handleMessage.
SipSubscribeServer | ( | SipUserAgent & | defaultUserAgent, |
SipPublishContentMgr & | defaultContentMgr, | ||
SipSubscriptionMgr & | defaultSubscriptionMgr, | ||
SipSubscribeServerEventHandler & | defaultPlugin | ||
) |
Default Dialog constructor.
|
virtual |
Destructor.
|
static |
Helper utility to build a basic server with default behavior.
|
static |
Callback invoked by SipPublishContentMgr when content changes.
This is used to tell the SipSubscribeServer that a new notify needs to be sent as the event state content has changed.
UtlBoolean notifySubscribers | ( | const char * | resourceId, |
const char * | eventTypeKey, | ||
const char * | eventType, | ||
UtlBoolean | isDefaultContent | ||
) |
Send a NOTIFY to all subscribers to resource and event state.
UtlBoolean enableEventType | ( | const char * | eventType, |
SipUserAgent * | userAgent = NULL , |
||
SipPublishContentMgr * | contentMgr = NULL , |
||
SipSubscribeServerEventHandler * | eventPlugin = NULL , |
||
SipSubscriptionMgr * | subscriptionMgr = NULL |
||
) |
Tell subscribe server to support given event type.
UtlBoolean disableEventType | ( | const char * | eventType, |
SipUserAgent *& | userAgent, | ||
SipPublishContentMgr *& | contentMgr, | ||
SipSubscribeServerEventHandler *& | eventPlugin, | ||
SipSubscriptionMgr *& | subscriptionMgr | ||
) |
Tell subscribe server to stop supporting given event type.
UtlBoolean handleMessage | ( | OsMsg & | eventMessage | ) |
Handler for SUBSCRIBE requests, NOTIFY responses and timers.
SipSubscribeServerEventHandler * getEventHandler | ( | const UtlString & | eventType | ) |
Get the event handler for the given eventType.
WARNING: there is no locking of the event handler once it is returned. If the eventHandler is removed via disableEventType and destroyed, there is no locking protection. The eventHandler is only safe to use if the application knows that it is not going to get the rug pulled out from under it. Returns the default event handler if there is not an event specific handler.
SipPublishContentMgr * getPublishMgr | ( | const UtlString & | eventType | ) |
Get the content manager for the given event type.
WARNING: there is no locking of the content manager once it is returned. If the content manager is removed via disableEventType and destroyed, there is no locking protection. The content manager is only safe to use if the application knows that it is not going to get the rug pulled out from under it. Returns the default content manager if there is not an event specific content manager.
SipSubscriptionMgr * getSubscriptionMgr | ( | const UtlString & | eventType | ) |
Get the subscription manager for the given event type.
WARNING: there is no locking of the subscription manager once it is returned. If the subscription manager is removed via disableEventType and destroyed, there is no locking protection. The subscription manager is only safe to use if the application knows that it is not going to get the rug pulled out from under it. Returns the default subscription manager if there is not an event specific subscription manager.
UtlBoolean isEventTypeEnabled | ( | const UtlString & | eventType | ) |
Inquire if the given event type is enabled in the server.