sipxtacklib  Version 3.3
Public Member Functions | Static Public Member Functions | List of all members
SipPublishServer Class Reference

Top level class for accepting and processing PUBLISH requests. More...

#include <SipPublishServer.h>

Inheritance diagram for SipPublishServer:
Inheritance graph
[legend]
Collaboration diagram for SipPublishServer:
Collaboration graph
[legend]

Public Member Functions

 SipPublishServer (SipUserAgent &defaultUserAgent, SipPublishServerEventStateMgr &defaultEventStateMgr, SipPublishServerEventStateCompositor &defaultCompositor)
 Default SipPublishServer constructor. More...
 
virtual ~SipPublishServer ()
 Destructor. More...
 
UtlBoolean enableEventType (const char *eventType, SipUserAgent *userAgent=NULL, SipPublishServerEventStateMgr *eventStateMgr=NULL, SipPublishServerEventStateCompositor *compositor=NULL)
 Tell the publish server to support given event type. More...
 
UtlBoolean disableEventType (const char *eventType, SipUserAgent *&userAgent, SipPublishServerEventStateMgr *&eventStateMgr, SipPublishServerEventStateCompositor *&compositor)
 Tell the publish server to stop supporting given event type. More...
 
UtlBoolean handleMessage (OsMsg &eventMessage)
 Handler for PUBLISH requests and timers. More...
 
SipPublishServerEventStateCompositorgetEventStateCompositor (const UtlString &eventType)
 Get the event state compositor for the given eventType. More...
 
SipPublishServerEventStateMgrgetEventStateMgr (const UtlString &eventType)
 Get the event state manager for the given event type. More...
 

Static Public Member Functions

static SipPublishServerbuildBasicServer (SipUserAgent &userAgent, const char *eventType)
 Helper utility to build a basic server with default behavior. More...
 

Detailed Description

Top level class for accepting and processing PUBLISH requests.

This implements a generic RFC 3903 PUBLISH server. This class receives PUBLISH requests, passes the event content to the event state compositor class, and send back the appropriate response. The SipPublishServer is designed to handle several different event types so that you can have multiple instances of the SipPublishServer each handling different event type. However you can not have an event type that is handled by more than one SipPublishServer.

Event Specific Handling and Processing
Event types are enabled with the enableEventType method. This method handling and processing of the specified Event type to be specialized by providing an Event specific: SipEventPlugin and SipUserAgent.
Event State Compositor
Event State
The SipPublishServerEventStateMgr is used by SipPublishServer to maintain the event state (PUBLISH event state not event state content).
Overall Data Flow
The SipPublishServer needs to address 2 general stimulus: 1) Respond to incoming PUBLISH requests. 2) Some notification error responses should cause the subscription to expire

When enabling a SIP event type via the enableEventType method, the SipPublishServer registers with the SipUserAgent to receive PUBLISH requests for the event type which are processed by the handleMessage method. The SipPublishServer uses timers to keep track of when event publication expire. When a timer fires, a message gets queued on the SipPublishServer which is that passed to handleMessage.

Constructor & Destructor Documentation

SipPublishServer ( SipUserAgent defaultUserAgent,
SipPublishServerEventStateMgr defaultEventStateMgr,
SipPublishServerEventStateCompositor defaultCompositor 
)

Default SipPublishServer constructor.

~SipPublishServer ( )
virtual

Destructor.

Member Function Documentation

SipPublishServer * buildBasicServer ( SipUserAgent userAgent,
const char *  eventType 
)
static

Helper utility to build a basic server with default behavior.

UtlBoolean enableEventType ( const char *  eventType,
SipUserAgent userAgent = NULL,
SipPublishServerEventStateMgr eventStateMgr = NULL,
SipPublishServerEventStateCompositor compositor = NULL 
)

Tell the publish server to support given event type.

UtlBoolean disableEventType ( const char *  eventType,
SipUserAgent *&  userAgent,
SipPublishServerEventStateMgr *&  eventStateMgr,
SipPublishServerEventStateCompositor *&  compositor 
)

Tell the publish server to stop supporting given event type.

UtlBoolean handleMessage ( OsMsg &  eventMessage)

Handler for PUBLISH requests and timers.

SipPublishServerEventStateCompositor * getEventStateCompositor ( const UtlString &  eventType)

Get the event state compositor for the given eventType.

WARNING: there is no locking of the event state compositor once it is returned. If the eventStateCompositor is removed via disableEventType and destroyed, there is no locking protection. The eventStateCompositor 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 state compositor if there is not an event specific state compositor.

SipPublishServerEventStateMgr * getEventStateMgr ( const UtlString &  eventType)

Get the event state manager for the given event type.

WARNING: there is no locking of the event state manager once it is returned. If the event state manager is removed via disableEventType and destroyed, there is no locking protection. The event state 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 event state manager if there is not an event specific state manager.


sipXtackLib home page