/usr/include/sipxtapi/net/SipUdpServer.h is in libsipxtapi-dev 3.3.0~test17-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | //
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _SipUdpServer_h_
#define _SipUdpServer_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <net/SipProtocolServerBase.h>
#include <os/OsNatKeepaliveListener.h>
#include <utl/UtlSList.h>
#include <os/OsRWMutex.h>
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
class SipUserAgent;
class OsNatDatagramSocket ;
class OsNotification ;
class OsTimer;
/**
* 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.
*/
class SipUdpServer : public SipProtocolServerBase
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
SipUdpServer(int sipPort = SIP_PORT,
SipUserAgent* userAgent = NULL,
int udpReadBufferSize = -1,
UtlBoolean bUseNextAvailablePort = FALSE,
const char* szBoundIp = NULL);
//:Default constructor
virtual
~SipUdpServer();
//:Destructor
/* ============================ MANIPULATORS ============================== */
int run(void* pArg);
void shutdownListener();
void enableStun(const char* szStunServer,
int iStunPort,
const char* szLocalIp,
int refreshPeriodInSecs,
OsNotification* pNotification) ;
//:Enable stun lookups for UDP signaling
// Use a NULL szStunServer to disable
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) ;
static void SipKeepAliveCallback(const intptr_t userData,
const intptr_t eventData) ;
/* ============================ ACCESSORS ================================= */
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) ;
/* ============================ INQUIRY =================================== */
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
OsSocket* buildClientSocket(int hostPort,
const char* hostAddress,
const char* localIp);
OsMutex mMapLock;
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
UtlString mStunServer ;
int mStunRefreshSecs ;
int mStunPort ;
UtlSList mSipKeepAliveBindings ;
OsRWMutex mKeepAliveMutex ;
OsStatus createServerSocket(const char* localIp,
int& localPort,
const UtlBoolean& bUseNextAvailablePort,
int udpReadBufferSize);
SipUdpServer(const SipUdpServer& rSipUdpServer);
//: disable Copy constructor
SipUdpServer& operator=(const SipUdpServer& rhs);
//:disable Assignment operator
};
/* ============================ INLINE METHODS ============================ */
#endif // _SipUdpServer_h_
|