sipxtacklib  Version 3.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SipUdpServer Class Reference

The SipUdpServer is owner/container of the sockets used for UDP communications. More...

#include <SipUdpServer.h>

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

Public Member Functions

 SipUdpServer (int sipPort=SIP_PORT, SipUserAgent *userAgent=NULL, int udpReadBufferSize=-1, UtlBoolean bUseNextAvailablePort=FALSE, const char *szBoundIp=NULL)
 
virtual ~SipUdpServer ()
 
int run (void *pArg)
 
void shutdownListener ()
 
void enableStun (const char *szStunServer, int iStunPort, const char *szLocalIp, int refreshPeriodInSecs, OsNotification *pNotification)
 
UtlBoolean sendTo (const SipMessage &message, const char *address, int port, const char *szLocalSipIp=NULL)
 
UtlBoolean addCrLfKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
 
UtlBoolean removeCrLfKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort)
 
UtlBoolean addStunKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
 
UtlBoolean removeStunKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort)
 
UtlBoolean addSipKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const char *szMethod, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
 
UtlBoolean removeSipKeepAlive (const char *szLocalIp, const char *szRemoteIp, const int remotePort, const char *szMethod)
 
void updateSipKeepAlive (const char *szLocalIp, const char *szMethod, const char *szRemoteIp, const int remotePort, const char *szContactIp, const int contactPort)
 
void sendSipKeepAlive (OsTimer *pTimer)
 
void printStatus ()
 
int getServerPort (const char *szLocalIp=NULL)
 
UtlBoolean getStunAddress (UtlString *pIpAddress, int *pPort, const char *szLocalIp=NULL)
 
UtlBoolean addKeepAliveBinding (void *pBinding)
 
UtlBoolean removeKeepAliveBinding (void *pBinding)
 
void * findKeepAliveBinding (OsTimer *pTimer)
 
void * findKeepAliveBinding (OsSocket *pSocket, const char *szRemoteIp, const int remotePort, const char *szMethod)
 
- Public Member Functions inherited from SipProtocolServerBase
 SipProtocolServerBase (SipUserAgent *userAgent, const char *protocolString, const char *taskName)
 
virtual ~SipProtocolServerBase ()
 
virtual UtlBoolean startListener ()
 
UtlBoolean send (SipMessage *message, const char *hostAddress, int hostPort=SIP_PORT)
 
void removeOldClients (long oldTime)
 
int getClientCount ()
 
virtual UtlBoolean isOk ()
 

Static Public Member Functions

static void SipKeepAliveCallback (const intptr_t userData, const intptr_t eventData)
 

Protected Member Functions

OsSocket * buildClientSocket (int hostPort, const char *hostAddress, const char *localIp)
 
- Protected Member Functions inherited from SipProtocolServerBase
SipClientcreateClient (const char *hostAddress, int hostPort, const char *localIp)
 
void releaseClient (SipClient *client)
 
void startClients ()
 
void shutdownClients ()
 
UtlBoolean clientExists (SipClient *client)
 
void addClient (SipClient *client)
 

Protected Attributes

OsMutex mMapLock
 
- Protected Attributes inherited from SipProtocolServerBase
UtlString mProtocolString
 
UtlString mDefaultIp
 
int mDefaultPort
 
SipUserAgentmSipUserAgent
 
UtlHashMap mServerSocketMap
 
UtlHashMap mServerPortMap
 
UtlHashMap mServers
 
SipServerBrokerListenermpServerBrokerListener
 

Detailed Description

The SipUdpServer is owner/container of the sockets used for UDP communications.

The SipUdpServer has a number of NAT APIs and coordinates NAT detection/keepalives with the OsNatDatagramSocket / OsNatAgentTask.

The SipUdpServer may contain multiple sockets if being used in a multi- home configuration. This mostly works, but needs additional testing and tweaking.

Most of the NAT keepalives are delegated to the OsNatAgentTask. The exception is the Sip keepalive. For this, the SipUdpServer uses callbacks to send off the Sip messages (as opposed to introducing a OsMsgQueue). The SipUdpServer never listens for responses, however, the SipUserAgent itself pays attention to rport results and notifies the OsNatAgentTask of local ip -> remote IP NAT bindings.

Constructor & Destructor Documentation

SipUdpServer ( int  sipPort = SIP_PORT,
SipUserAgent userAgent = NULL,
int  udpReadBufferSize = -1,
UtlBoolean  bUseNextAvailablePort = FALSE,
const char *  szBoundIp = NULL 
)
~SipUdpServer ( )
virtual

Member Function Documentation

int run ( void *  pArg)
virtual

Implements SipProtocolServerBase.

void shutdownListener ( )
virtual

Implements SipProtocolServerBase.

void enableStun ( const char *  szStunServer,
int  iStunPort,
const char *  szLocalIp,
int  refreshPeriodInSecs,
OsNotification *  pNotification 
)
UtlBoolean sendTo ( const SipMessage message,
const char *  address,
int  port,
const char *  szLocalSipIp = NULL 
)
UtlBoolean addCrLfKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const int  keepAliveSecs,
OsNatKeepaliveListener *  pListener 
)
UtlBoolean removeCrLfKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort 
)
UtlBoolean addStunKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const int  keepAliveSecs,
OsNatKeepaliveListener *  pListener 
)
UtlBoolean removeStunKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort 
)
UtlBoolean addSipKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const char *  szMethod,
const int  keepAliveSecs,
OsNatKeepaliveListener *  pListener 
)
UtlBoolean removeSipKeepAlive ( const char *  szLocalIp,
const char *  szRemoteIp,
const int  remotePort,
const char *  szMethod 
)
void updateSipKeepAlive ( const char *  szLocalIp,
const char *  szMethod,
const char *  szRemoteIp,
const int  remotePort,
const char *  szContactIp,
const int  contactPort 
)
void sendSipKeepAlive ( OsTimer *  pTimer)
void SipKeepAliveCallback ( const intptr_t  userData,
const intptr_t  eventData 
)
static
void printStatus ( )
virtual

Reimplemented from SipProtocolServerBase.

int getServerPort ( const char *  szLocalIp = NULL)
UtlBoolean getStunAddress ( UtlString *  pIpAddress,
int *  pPort,
const char *  szLocalIp = NULL 
)
UtlBoolean addKeepAliveBinding ( void *  pBinding)
UtlBoolean removeKeepAliveBinding ( void *  pBinding)
void * findKeepAliveBinding ( OsTimer *  pTimer)
void * findKeepAliveBinding ( OsSocket *  pSocket,
const char *  szRemoteIp,
const int  remotePort,
const char *  szMethod 
)
OsSocket * buildClientSocket ( int  hostPort,
const char *  hostAddress,
const char *  localIp 
)
protectedvirtual

Implements SipProtocolServerBase.

Member Data Documentation

OsMutex mMapLock
protected

sipXtackLib home page