21#ifndef _RTSP_SERVER_HH
22#define _RTSP_SERVER_HH
24#ifndef _GENERIC_MEDIA_SERVER_HH
27#ifndef _DIGEST_AUTHENTICATION_HH
35 unsigned reclamationSeconds = 65);
48 char const* remoteClientNameOrAddress,
portNumBits remoteClientPortNum,
50 char const* username =
NULL,
char const* password =
NULL,
52 char const* proxyURLSuffix =
NULL);
66 char const* remoteClientNameOrAddress,
portNumBits remoteClientPortNum,
68 char const* username =
NULL,
char const* password =
NULL,
69 char const* proxyURLSuffix =
NULL);
85 return rtspURL(serverMediaSession, clientSocket,
True);
112 void setTLSState(
char const* certFileName,
char const* privKeyFileName,
117 int ourSocketIPv4,
int ourSocketIPv6,
Port ourPort,
119 unsigned reclamationSeconds);
125 char const* proxyURLSuffix,
char*& responseStr);
129 char const* url,
char const* urlSuffix,
int socketToRemoteServer,
130 Boolean deliverViaTCP,
char const* proxyURLSuffix);
135 struct sockaddr_storage
const& clientAddr,
136 char const* urlSuffix);
140 struct sockaddr_storage
const& clientAddr,
141 char const* urlSuffix,
char const *username);
146 struct sockaddr_storage
const& clientAddr,
147 char const* urlSuffix);
164 Boolean reuseConnection,
Boolean deliverViaTCP,
char const* proxyURLSuffix);
180 int clientSocket,
struct sockaddr_storage
const& clientAddr,
192 virtual void handleCmd_DESCRIBE(
char const* urlPreSuffix,
char const* urlSuffix,
char const* fullRequestStr);
196 char const* url,
char const* urlSuffix,
char const* fullRequestStr,
197 Boolean reuseConnection,
Boolean deliverViaTCP,
char const* proxyURLSuffix);
208 char* urlSuffix,
unsigned urlSuffixMaxSize,
209 char* sessionCookie,
unsigned sessionCookieMaxSize,
210 char* acceptStr,
unsigned acceptStrMaxSize);
224 unsigned char const* extraData,
unsigned extraDataSize);
233 void setRTSPResponse(
char const* responseStr, u_int32_t sessionId,
char const* contentStr);
260 char const* urlPreSuffix,
char const* urlSuffix,
char const* fullRequestStr);
267 char const* urlPreSuffix,
char const* urlSuffix,
268 char const* fullRequestStr);
355 unsigned reclamationSeconds = 65,
357 int verbosityLevelForProxying = 0,
358 char const* backEndUsername =
NULL,
359 char const* backEndPassword =
NULL);
364 unsigned reclamationSeconds,
365 Boolean streamRTPOverTCP,
int verbosityLevelForProxying,
366 char const* backEndUsername,
char const* backEndPassword);
373 char const* proxyURLSuffix,
char*& responseStr);
375 char const* url,
char const* urlSuffix,
int socketToRemoteServer,
376 Boolean deliverViaTCP,
char const* proxyURLSuffix);
395 char*& proxyURLSuffix);
void parseTransportHeaderForREGISTER(char const *buf, Boolean &reuseConnection, Boolean &deliverViaTCP, char *&proxyURLSuffix)
char const * name() const
virtual Boolean weImplementREGISTER(char const *cmd, char const *proxyURLSuffix, char *&responseStr)
UserAuthenticationDatabase * fAuthDBForREGISTER
virtual ~RTSPServerWithREGISTERProxying()
unsigned fRegisteredProxyCounter
virtual char const * allowedCommandNames()
RTSPServerWithREGISTERProxying(UsageEnvironment &env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort, UserAuthenticationDatabase *authDatabase, UserAuthenticationDatabase *authDatabaseForREGISTER, unsigned reclamationSeconds, Boolean streamRTPOverTCP, int verbosityLevelForProxying, char const *backEndUsername, char const *backEndPassword)
char * fAllowedCommandNames
static RTSPServerWithREGISTERProxying * createNew(UsageEnvironment &env, Port ourPort=554, UserAuthenticationDatabase *authDatabase=NULL, UserAuthenticationDatabase *authDatabaseForREGISTER=NULL, unsigned reclamationSeconds=65, Boolean streamRTPOverTCP=False, int verbosityLevelForProxying=0, char const *backEndUsername=NULL, char const *backEndPassword=NULL)
int fVerbosityLevelForProxying
Boolean fStreamRTPOverTCP
virtual void implementCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, int socketToRemoteServer, Boolean deliverViaTCP, char const *proxyURLSuffix)
virtual UserAuthenticationDatabase * getAuthenticationDatabaseForCommand(char const *cmdName)
RTSPClientConnection * fOurConnection
virtual ~ParamsForREGISTER()
ParamsForREGISTER(char const *cmd, RTSPClientConnection *ourConnection, char const *url, char const *urlSuffix, Boolean reuseConnection, Boolean deliverViaTCP, char const *proxyURLSuffix)
unsigned char * fLastCRLF
virtual void handleCmd_DESCRIBE_afterLookup(ServerMediaSession *session)
RTSPClientConnection(RTSPServer &ourServer, int clientSocket, struct sockaddr_storage const &clientAddr, Boolean useTLS=False)
virtual void handleCmd_OPTIONS()
virtual void handleHTTPCmd_notSupported()
void setRTSPResponse(char const *responseStr, char const *contentStr)
ServerTLSState fPOSTSocketTLS
virtual ~RTSPClientConnection()
void setRTSPResponse(char const *responseStr, u_int32_t sessionId)
virtual void handleHTTPCmd_TunnelingGET(char const *sessionCookie)
virtual void handleCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, char const *fullRequestStr, Boolean reuseConnection, Boolean deliverViaTCP, char const *proxyURLSuffix)
void setRTSPResponse(char const *responseStr)
virtual void handleRequestBytes(int newBytesRead)
virtual Boolean handleHTTPCmd_TunnelingPOST(char const *sessionCookie, unsigned char const *extraData, unsigned extraDataSize)
Boolean authenticationOK(char const *cmdName, char const *urlSuffix, char const *fullRequestStr)
char const * fCurrentCSeq
static void continueHandlingREGISTER(ParamsForREGISTER *params)
virtual void continueHandlingREGISTER1(ParamsForREGISTER *params)
static void DESCRIBELookupCompletionFunction(void *clientData, ServerMediaSession *sessionLookedUp)
virtual void handleHTTPCmd_StreamingGET(char const *urlSuffix, char const *fullRequestStr)
virtual void handleHTTPCmd_notFound()
virtual void handleCmd_redirect(char const *urlSuffix)
void changeClientInputSocket(int newSocketNum, ServerTLSState const *newTLSState, unsigned char const *extraData, unsigned extraDataSize)
virtual void handleCmd_notFound()
RTSPServer & fOurRTSPServer
virtual void handleCmd_unsupportedTransport()
unsigned fBase64RemainderCount
virtual Boolean parseHTTPRequestString(char *resultCmdName, unsigned resultCmdNameMaxSize, char *urlSuffix, unsigned urlSuffixMaxSize, char *sessionCookie, unsigned sessionCookieMaxSize, char *acceptStr, unsigned acceptStrMaxSize)
virtual void handleCmd_bad()
Authenticator fCurrentAuthenticator
virtual void handleCmd_DESCRIBE(char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
virtual void handleCmd_GET_PARAMETER(char const *fullRequestStr)
virtual void handleHTTPCmd_OPTIONS()
virtual void handleCmd_SET_PARAMETER(char const *fullRequestStr)
void handleAlternativeRequestByte1(u_int8_t requestByte)
void resetRequestBuffer()
virtual void handleCmd_sessionNotFound()
void setRTSPResponse(char const *responseStr, u_int32_t sessionId, char const *contentStr)
static void handleAlternativeRequestByte(void *, u_int8_t requestByte)
unsigned fScheduledDelayedTask
virtual void handleCmd_notSupported()
RTSPServer::RTSPClientConnection * fOurClientConnection
virtual void handleCmd_PAUSE(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
static void SETUPLookupCompletionFunction2(void *clientData, ServerMediaSession *sessionLookedUp)
Boolean usesTCPTransport() const
struct RTSPServer::RTSPClientSession::streamState * fStreamStates
void reclaimStreamStates()
char const * fURLPreSuffix
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, u_int32_t sessionId)
static void SETUPLookupCompletionFunction1(void *clientData, ServerMediaSession *sessionLookedUp)
Boolean fStreamAfterSETUP
virtual void handleCmd_SETUP(RTSPClientConnection *ourClientConnection, char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr)
virtual void handleCmd_withinSession(RTSPClientConnection *ourClientConnection, char const *cmdName, char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, char const *contentStr)
virtual void handleCmd_SETUP_afterLookup2(ServerMediaSession *sms)
RTSPServer & fOurRTSPServer
virtual void handleCmd_PLAY(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession, char const *fullRequestStr)
virtual void handleCmd_SET_PARAMETER(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession, char const *fullRequestStr)
virtual void handleCmd_SETUP_afterLookup1(ServerMediaSession *sms)
char const * fFullRequestStr
virtual void handleCmd_GET_PARAMETER(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession, char const *fullRequestStr)
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, u_int32_t sessionId, char const *contentStr)
virtual ~RTSPClientSession()
void deleteStreamByTrack(unsigned trackNum)
unsigned char fTCPStreamIdCount
virtual void handleCmd_TEARDOWN(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
RTSPClientSession(RTSPServer &ourServer, u_int32_t sessionId)
Boolean isMulticast() const
unsigned fNumStreamStates
static void incomingConnectionHandlerHTTPIPv6(void *, int)
char * ipv4rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1)
friend class RegisterRequestRecord
void incomingConnectionHandlerHTTPIPv4()
virtual void addServerMediaSession(ServerMediaSession *serverMediaSession)
void incomingConnectionHandlerHTTPIPv6()
portNumBits httpServerPortNum() const
void() responseHandlerForDEREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
unsigned fRegisterOrDeregisterRequestCounter
void noteTCPStreamingOnSocket(int socketNum, RTSPClientSession *clientSession, unsigned trackNum)
char * rtspURLPrefix(int clientSocket=-1, Boolean useIPv6=False) const
unsigned deregisterStream(ServerMediaSession *serverMediaSession, char const *remoteClientNameOrAddress, portNumBits remoteClientPortNum, responseHandlerForDEREGISTER *responseHandler, char const *username=NULL, char const *password=NULL, char const *proxyURLSuffix=NULL)
char * ipv6rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1)
char * ipv6rtspURLPrefix(int clientSocket=-1)
virtual ClientSession * createNewClientSession(u_int32_t sessionId)
virtual void implementCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, int socketToRemoteServer, Boolean deliverViaTCP, char const *proxyURLSuffix)
int fHTTPServerSocketIPv4
UserAuthenticationDatabase * setAuthenticationDatabase(UserAuthenticationDatabase *newDB)
virtual Boolean specialClientAccessCheck(int clientSocket, struct sockaddr_storage const &clientAddr, char const *urlSuffix)
virtual Boolean specialClientUserAccessCheck(int clientSocket, struct sockaddr_storage const &clientAddr, char const *urlSuffix, char const *username)
void stopTCPStreamingOnSocket(int socketNum)
virtual Boolean isRTSPServer() const
Boolean fOurConnectionsUseTLS
virtual ClientConnection * createNewClientConnection(int clientSocket, struct sockaddr_storage const &clientAddr)
HashTable * fPendingRegisterOrDeregisterRequests
char * rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1, Boolean useIPv6=False) const
virtual char const * allowedCommandNames()
static Boolean lookupByName(UsageEnvironment &env, char const *name, RTSPServer *&resultServer)
char * ipv4rtspURLPrefix(int clientSocket=-1)
void disableStreamingRTPOverTCP()
static void incomingConnectionHandlerHTTPIPv4(void *, int)
virtual void specialHandlingOfAuthenticationFailure(int clientSocket, struct sockaddr_storage const &clientAddr, char const *urlSuffix)
virtual UserAuthenticationDatabase * getAuthenticationDatabaseForCommand(char const *cmdName)
RTSPServer(UsageEnvironment &env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort, UserAuthenticationDatabase *authDatabase, unsigned reclamationSeconds)
friend class DeregisterRequestRecord
HashTable * fClientConnectionsForHTTPTunneling
UserAuthenticationDatabase * fAuthDB
HashTable * fTCPStreamingDatabase
Boolean fAllowStreamingRTPOverTCP
int fHTTPServerSocketIPv6
static RTSPServer * createNew(UsageEnvironment &env, Port ourPort=554, UserAuthenticationDatabase *authDatabase=NULL, unsigned reclamationSeconds=65)
void() responseHandlerForREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
void setTLSState(char const *certFileName, char const *privKeyFileName, Boolean weServeSRTP=True, Boolean weEncryptSRTP=True)
void unnoteTCPStreamingOnSocket(int socketNum, RTSPClientSession *clientSession, unsigned trackNum)
unsigned registerStream(ServerMediaSession *serverMediaSession, char const *remoteClientNameOrAddress, portNumBits remoteClientPortNum, responseHandlerForREGISTER *responseHandler, char const *username=NULL, char const *password=NULL, Boolean receiveOurStreamViaTCP=False, char const *proxyURLSuffix=NULL)
Boolean setUpTunnelingOverHTTP(Port httpPort)
virtual Boolean weImplementREGISTER(char const *cmd, char const *proxyURLSuffix, char *&responseStr)
ServerMediaSubsession * subsession