live
RTSPServer.hh
Go to the documentation of this file.
1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2026 Live Networks, Inc. All rights reserved.
18// A RTSP server
19// C++ header
20
21#ifndef _RTSP_SERVER_HH
22#define _RTSP_SERVER_HH
23
24#ifndef _GENERIC_MEDIA_SERVER_HH
25#include "GenericMediaServer.hh"
26#endif
27#ifndef _DIGEST_AUTHENTICATION_HH
29#endif
30
32public:
33 static RTSPServer* createNew(UsageEnvironment& env, Port ourPort = 554,
34 UserAuthenticationDatabase* authDatabase = NULL,
35 unsigned reclamationSeconds = 65);
36 // If ourPort.num() == 0, we'll choose the port number
37 // Note: The caller is responsible for reclaiming "authDatabase"
38 // If "reclamationSeconds" > 0, then the "RTSPClientSession" state for
39 // each client will get reclaimed (and the corresponding RTP stream(s)
40 // torn down) if no RTSP commands - or RTCP "RR" packets - from the
41 // client are received in at least "reclamationSeconds" seconds.
42
43 static Boolean lookupByName(UsageEnvironment& env, char const* name,
44 RTSPServer*& resultServer);
45
46 typedef void (responseHandlerForREGISTER)(RTSPServer* rtspServer, unsigned requestId, int resultCode, char* resultString);
47 unsigned registerStream(ServerMediaSession* serverMediaSession,
48 char const* remoteClientNameOrAddress, portNumBits remoteClientPortNum,
49 responseHandlerForREGISTER* responseHandler,
50 char const* username = NULL, char const* password = NULL,
51 Boolean receiveOurStreamViaTCP = False,
52 char const* proxyURLSuffix = NULL);
53 // 'Register' the stream represented by "serverMediaSession" with the given remote client (specifed by name and port number).
54 // This is done using our custom "REGISTER" RTSP command.
55 // The function returns a unique number that can be used to identify the request; this number is also passed to "responseHandler".
56 // When a response is received from the remote client (or the "REGISTER" request fails), the specified response handler
57 // (if non-NULL) is called. (Note that the "resultString" passed to the handler was dynamically allocated,
58 // and should be delete[]d by the handler after use.)
59 // If "receiveOurStreamViaTCP" is True, then we're requesting that the remote client access our stream using RTP/RTCP-over-TCP.
60 // (Otherwise, the remote client may choose regular RTP/RTCP-over-UDP streaming.)
61 // "proxyURLSuffix" (optional) is used only when the remote client is also a proxy server.
62 // It tells the proxy server the suffix that it should use in its "rtsp://" URL (when front-end clients access the stream)
63
64 typedef void (responseHandlerForDEREGISTER)(RTSPServer* rtspServer, unsigned requestId, int resultCode, char* resultString);
65 unsigned deregisterStream(ServerMediaSession* serverMediaSession,
66 char const* remoteClientNameOrAddress, portNumBits remoteClientPortNum,
67 responseHandlerForDEREGISTER* responseHandler,
68 char const* username = NULL, char const* password = NULL,
69 char const* proxyURLSuffix = NULL);
70 // Used to turn off a previous "registerStream()" - using our custom "DEREGISTER" RTSP command.
71
72 char* rtspURL(ServerMediaSession const* serverMediaSession,
73 int clientSocket = -1, Boolean useIPv6 = False) const;
74 // returns a "rtsp://" URL that could be used to access the
75 // specified session (which must already have been added to
76 // us using "addServerMediaSession()".
77 // This string is dynamically allocated; caller should delete[]
78 // (If "clientSocket" is non-negative, then it is used (by calling "getsockname()") to determine
79 // the IP address to be used in the URL.)
80 // Shortcuts:
81 char* ipv4rtspURL(ServerMediaSession const* serverMediaSession, int clientSocket = -1) {
82 return rtspURL(serverMediaSession, clientSocket, False);
83 }
84 char* ipv6rtspURL(ServerMediaSession const* serverMediaSession, int clientSocket = -1) {
85 return rtspURL(serverMediaSession, clientSocket, True);
86 }
87
88 char* rtspURLPrefix(int clientSocket = -1, Boolean useIPv6 = False) const;
89 // like "rtspURL()", except that it returns just the common prefix used by
90 // each session's "rtsp://" URL.
91 // This string is dynamically allocated; caller should delete[]
92 // Shortcuts:
93 char* ipv4rtspURLPrefix(int clientSocket = -1) { return rtspURLPrefix(clientSocket, False); }
94 char* ipv6rtspURLPrefix(int clientSocket = -1) { return rtspURLPrefix(clientSocket, True); }
95
97 // Changes the server's authentication database to "newDB", returning a pointer to the old database (if there was one).
98 // "newDB" may be NULL (you can use this to disable authentication at runtime, if desired).
99
102 }
103
105 // (Attempts to) enable RTSP-over-HTTP tunneling on the specified port.
106 // Returns True iff the specified port can be used in this way (i.e., it's not already being used for a separate HTTP server).
107 // Note: RTSP-over-HTTP tunneling is described in
108 // http://mirror.informatimago.com/next/developer.apple.com/quicktime/icefloe/dispatch028.html
109 // and http://images.apple.com/br/quicktime/pdf/QTSS_Modules.pdf
110 portNumBits httpServerPortNum() const; // in host byte order. (Returns 0 if not present.)
111
112 void setTLSState(char const* certFileName, char const* privKeyFileName,
113 Boolean weServeSRTP = True, Boolean weEncryptSRTP = True);
114
115protected:
117 int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
118 UserAuthenticationDatabase* authDatabase,
119 unsigned reclamationSeconds);
120 // called only by createNew();
121 virtual ~RTSPServer();
122
123 virtual char const* allowedCommandNames(); // used to implement "RTSPClientConnection::handleCmd_OPTIONS()"
124 virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
125 char const* proxyURLSuffix, char*& responseStr);
126 // used to implement "RTSPClientConnection::handleCmd_REGISTER()"
127 // Note: "responseStr" is dynamically allocated (or NULL), and should be delete[]d after the call
128 virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
129 char const* url, char const* urlSuffix, int socketToRemoteServer,
130 Boolean deliverViaTCP, char const* proxyURLSuffix);
131 // used to implement "RTSPClientConnection::handleCmd_REGISTER()"
132
134 virtual Boolean specialClientUserAccessCheck(int clientSocket,
135 struct sockaddr_storage const& clientAddr,
136 char const* urlSuffix, char const *username);
137 // a hook that allows subclassed servers to do server-specific access checking - after
138 // normal digest authentication has already taken place (and would otherwise allow access).
139 // (This test can only be used to further restrict access, not to grant additional access.)
140 virtual void specialHandlingOfAuthenticationFailure(int clientSocket,
141 struct sockaddr_storage const& clientAddr,
142 char const* urlSuffix);
143 // a hook that allows subclassed servers to take extra action whenevever an authentication failure occurs
144
145public: // redefined virtual functions
146 virtual Boolean isRTSPServer() const;
147 virtual void addServerMediaSession(ServerMediaSession* serverMediaSession);
148
149public: // should be protected, but some old compilers complain otherwise
150 // The state of a TCP connection used by a RTSP client:
151 class RTSPClientSession; // forward
153 public:
154 // A data structure that's used to implement the "REGISTER" command:
156 public:
157 ParamsForREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
158 RTSPClientConnection* ourConnection, char const* url, char const* urlSuffix,
159 Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
161 private:
163 char const* fCmd;
165 char* fURL;
169 };
170 protected: // redefined virtual functions:
171 virtual void handleRequestBytes(int newBytesRead);
172
173 protected:
175 int clientSocket, struct sockaddr_storage const& clientAddr,
176 Boolean useTLS = False);
178
179 friend class RTSPServer;
180 friend class RTSPClientSession;
181
182 // Make the handler functions for each command virtual, to allow subclasses to reimplement them, if necessary:
183 virtual void handleCmd_OPTIONS();
184 // You probably won't need to subclass/reimplement this function; reimplement "RTSPServer::allowedCommandNames()" instead.
185 virtual void handleCmd_GET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
186 virtual void handleCmd_SET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
187 virtual void handleCmd_DESCRIBE(char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
188 static void DESCRIBELookupCompletionFunction(void* clientData, ServerMediaSession* sessionLookedUp);
190 virtual void handleCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
191 char const* url, char const* urlSuffix, char const* fullRequestStr,
192 Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
193 // You probably won't need to subclass/reimplement this function;
194 // reimplement "RTSPServer::weImplementREGISTER()" and "RTSPServer::implementCmd_REGISTER()" instead.
195 virtual void handleCmd_bad();
197 virtual void handleCmd_redirect(char const* urlSuffix);
198 virtual void handleCmd_notFound();
201 // Support for optional RTSP-over-HTTP tunneling:
202 virtual Boolean parseHTTPRequestString(char* resultCmdName, unsigned resultCmdNameMaxSize,
203 char* urlSuffix, unsigned urlSuffixMaxSize,
204 char* sessionCookie, unsigned sessionCookieMaxSize,
205 char* acceptStr, unsigned acceptStrMaxSize);
208 virtual void handleHTTPCmd_OPTIONS();
209 virtual void handleHTTPCmd_TunnelingGET(char const* sessionCookie);
210 virtual Boolean handleHTTPCmd_TunnelingPOST(char const* sessionCookie, unsigned char const* extraData, unsigned extraDataSize);
211 virtual void handleHTTPCmd_StreamingGET(char const* urlSuffix, char const* fullRequestStr);
212 protected:
215 static void handleAlternativeRequestByte(void*, u_int8_t requestByte);
216 void handleAlternativeRequestByte1(u_int8_t requestByte);
217 virtual Boolean authenticationOK(char const* cmdName, char const* urlSuffix, char const* fullRequestStr);
218 void changeClientInputSocket(int newSocketNum, ServerTLSState const* newTLSState,
219 unsigned char const* extraData, unsigned extraDataSize);
220 // used to implement RTSP-over-HTTP tunneling
223
224 // Shortcuts for setting up a RTSP response (prior to sending it):
225 void setRTSPResponse(char const* responseStr);
226 void setRTSPResponse(char const* responseStr, u_int32_t sessionId);
227 void setRTSPResponse(char const* responseStr, char const* contentStr);
228 void setRTSPResponse(char const* responseStr, u_int32_t sessionId, char const* contentStr);
229
230 RTSPServer& fOurRTSPServer; // same as ::fOurServer
231 int& fClientInputSocket; // aliased to ::fOurSocket
233 ServerTLSState fPOSTSocketTLS; // used only for RTSP-over-HTTPS
236 unsigned char* fLastCRLF;
238 char const* fCurrentCSeq;
239 Authenticator fCurrentAuthenticator; // used if access control is needed
240 char* fOurSessionCookie; // used for optional RTSP-over-HTTP tunneling
241 unsigned fBase64RemainderCount; // used for optional RTSP-over-HTTP tunneling (possible values: 0,1,2,3)
243 };
244
245 // The state of an individual client session (using one or more sequential TCP connections) handled by a RTSP server:
247 protected:
248 RTSPClientSession(RTSPServer& ourServer, u_int32_t sessionId);
250
251 friend class RTSPServer;
253 // Make the handler functions for each command virtual, to allow subclasses to redefine them:
254 virtual void handleCmd_SETUP(RTSPClientConnection* ourClientConnection,
255 char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
256 static void SETUPLookupCompletionFunction1(void* clientData, ServerMediaSession* sessionLookedUp);
258 static void SETUPLookupCompletionFunction2(void* clientData, ServerMediaSession* sessionLookedUp);
260 virtual void handleCmd_withinSession(RTSPClientConnection* ourClientConnection,
261 char const* cmdName,
262 char const* urlPreSuffix, char const* urlSuffix,
263 char const* fullRequestStr);
264 virtual void handleCmd_TEARDOWN(RTSPClientConnection* ourClientConnection,
265 ServerMediaSubsession* subsession);
266 virtual void handleCmd_PLAY(RTSPClientConnection* ourClientConnection,
267 ServerMediaSubsession* subsession, char const* fullRequestStr);
268 virtual void handleCmd_PAUSE(RTSPClientConnection* ourClientConnection,
269 ServerMediaSubsession* subsession);
270 virtual void handleCmd_GET_PARAMETER(RTSPClientConnection* ourClientConnection,
271 ServerMediaSubsession* subsession, char const* fullRequestStr);
272 virtual void handleCmd_SET_PARAMETER(RTSPClientConnection* ourClientConnection,
273 ServerMediaSubsession* subsession, char const* fullRequestStr);
274 protected:
275 void deleteStreamByTrack(unsigned trackNum);
277 Boolean isMulticast() const { return fIsMulticast; }
278
279 // Shortcuts for setting up a RTSP response (prior to sending it):
280 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr) { ourClientConnection->setRTSPResponse(responseStr); }
281 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId) { ourClientConnection->setRTSPResponse(responseStr, sessionId); }
282 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, contentStr); }
283 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, sessionId, contentStr); }
284
285 protected:
286 RTSPServer& fOurRTSPServer; // same as ::fOurServer
288 unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP
291 struct streamState {
296
297 // Member variables used to implement "handleCmd_SETUP()":
299 char const* fURLPreSuffix; char const* fURLSuffix; char const* fFullRequestStr; char const* fTrackId;
300 };
301
302protected: // redefined virtual functions
303 // If you subclass "RTSPClientConnection", then you must also redefine this virtual function in order
304 // to create new objects of your subclass:
305 virtual ClientConnection* createNewClientConnection(int clientSocket, struct sockaddr_storage const& clientAddr);
306
307protected:
308 // If you subclass "RTSPClientSession", then you must also redefine this virtual function in order
309 // to create new objects of your subclass:
310 virtual ClientSession* createNewClientSession(u_int32_t sessionId);
311
312private:
313 static void incomingConnectionHandlerHTTPIPv4(void*, int /*mask*/);
315 static void incomingConnectionHandlerHTTPIPv6(void*, int /*mask*/);
317
318 void noteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
319 void unnoteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
320 void stopTCPStreamingOnSocket(int socketNum);
321
322private:
324 friend class RTSPClientSession;
327 int fHTTPServerSocketIPv4, fHTTPServerSocketIPv6; // for optional RTSP-over-HTTP tunneling
329 HashTable* fClientConnectionsForHTTPTunneling; // maps client-supplied 'session cookie' strings to "RTSPClientConnection"s
330 // (used only for optional RTSP-over-HTTP tunneling)
332 // maps TCP socket numbers to ids of sessions that are streaming over it (RTP/RTCP-over-TCP)
337 Boolean fOurConnectionsUseTLS; // by default, False
338 Boolean fWeServeSRTP; // used only if "fOurConnectionsUseTLS" is True
339 Boolean fWeEncryptSRTP; // used only if "fWeServeSRTP" is True
340};
341
342
344
346public:
348 UserAuthenticationDatabase* authDatabase = NULL,
349 UserAuthenticationDatabase* authDatabaseForREGISTER = NULL,
350 unsigned reclamationSeconds = 65,
351 Boolean streamRTPOverTCP = False,
352 int verbosityLevelForProxying = 0,
353 char const* backEndUsername = NULL,
354 char const* backEndPassword = NULL);
355
356protected:
357 RTSPServerWithREGISTERProxying(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
358 UserAuthenticationDatabase* authDatabase, UserAuthenticationDatabase* authDatabaseForREGISTER,
359 unsigned reclamationSeconds,
360 Boolean streamRTPOverTCP, int verbosityLevelForProxying,
361 char const* backEndUsername, char const* backEndPassword);
362 // called only by createNew();
364
365protected: // redefined virtual functions
366 virtual char const* allowedCommandNames();
367 virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
368 char const* proxyURLSuffix, char*& responseStr);
369 virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
370 char const* url, char const* urlSuffix, int socketToRemoteServer,
371 Boolean deliverViaTCP, char const* proxyURLSuffix);
373
374private:
382};
383
384
385// A special version of "parseTransportHeader()", used just for parsing the "Transport:" header
386// in an incoming "REGISTER" command:
387void parseTransportHeaderForREGISTER(char const* buf, // in
388 Boolean &reuseConnection, // out
389 Boolean& deliverViaTCP, // out
390 char*& proxyURLSuffix); // out
391
392#endif
const Boolean False
Definition: Boolean.hh:28
const Boolean True
Definition: Boolean.hh:31
unsigned char Boolean
Definition: Boolean.hh:25
u_int16_t portNumBits
Definition: NetAddress.hh:102
void parseTransportHeaderForREGISTER(char const *buf, Boolean &reuseConnection, Boolean &deliverViaTCP, char *&proxyURLSuffix)
#define NULL
char const * name() const
Definition: Media.hh:61
virtual Boolean weImplementREGISTER(char const *cmd, char const *proxyURLSuffix, char *&responseStr)
UserAuthenticationDatabase * fAuthDBForREGISTER
Definition: RTSPServer.hh:379
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)
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)
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)
ParamsForREGISTER(char const *cmd, RTSPClientConnection *ourConnection, char const *url, char const *urlSuffix, Boolean reuseConnection, Boolean deliverViaTCP, char const *proxyURLSuffix)
virtual void handleCmd_DESCRIBE_afterLookup(ServerMediaSession *session)
RTSPClientConnection(RTSPServer &ourServer, int clientSocket, struct sockaddr_storage const &clientAddr, Boolean useTLS=False)
virtual void handleHTTPCmd_notSupported()
void setRTSPResponse(char const *responseStr, char const *contentStr)
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)
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 handleCmd_redirect(char const *urlSuffix)
void changeClientInputSocket(int newSocketNum, ServerTLSState const *newTLSState, unsigned char const *extraData, unsigned extraDataSize)
virtual void handleCmd_unsupportedTransport()
virtual Boolean authenticationOK(char const *cmdName, char const *urlSuffix, char const *fullRequestStr)
virtual Boolean parseHTTPRequestString(char *resultCmdName, unsigned resultCmdNameMaxSize, char *urlSuffix, unsigned urlSuffixMaxSize, char *sessionCookie, unsigned sessionCookieMaxSize, char *acceptStr, unsigned acceptStrMaxSize)
virtual void handleCmd_DESCRIBE(char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
virtual void handleCmd_GET_PARAMETER(char const *fullRequestStr)
virtual void handleCmd_SET_PARAMETER(char const *fullRequestStr)
void handleAlternativeRequestByte1(u_int8_t requestByte)
virtual void handleCmd_sessionNotFound()
void setRTSPResponse(char const *responseStr, u_int32_t sessionId, char const *contentStr)
static void handleAlternativeRequestByte(void *, u_int8_t requestByte)
RTSPServer::RTSPClientConnection * fOurClientConnection
Definition: RTSPServer.hh:298
virtual void handleCmd_PAUSE(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
static void SETUPLookupCompletionFunction2(void *clientData, ServerMediaSession *sessionLookedUp)
Boolean usesTCPTransport() const
Definition: RTSPServer.hh:289
struct RTSPServer::RTSPClientSession::streamState * fStreamStates
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, u_int32_t sessionId)
Definition: RTSPServer.hh:281
static void SETUPLookupCompletionFunction1(void *clientData, ServerMediaSession *sessionLookedUp)
virtual void handleCmd_SETUP(RTSPClientConnection *ourClientConnection, char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr)
Definition: RTSPServer.hh:280
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)
Definition: RTSPServer.hh:282
virtual void handleCmd_SETUP_afterLookup2(ServerMediaSession *sms)
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)
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)
Definition: RTSPServer.hh:283
void deleteStreamByTrack(unsigned trackNum)
virtual void handleCmd_TEARDOWN(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
RTSPClientSession(RTSPServer &ourServer, u_int32_t sessionId)
static void incomingConnectionHandlerHTTPIPv6(void *, int)
char * ipv4rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1)
Definition: RTSPServer.hh:81
friend class RegisterRequestRecord
Definition: RTSPServer.hh:325
void incomingConnectionHandlerHTTPIPv4()
virtual void addServerMediaSession(ServerMediaSession *serverMediaSession)
void incomingConnectionHandlerHTTPIPv6()
portNumBits httpServerPortNum() const
void() responseHandlerForDEREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
Definition: RTSPServer.hh:64
unsigned fRegisterOrDeregisterRequestCounter
Definition: RTSPServer.hh:334
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)
Definition: RTSPServer.hh:84
char * ipv6rtspURLPrefix(int clientSocket=-1)
Definition: RTSPServer.hh:94
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
Definition: RTSPServer.hh:327
Boolean fWeServeSRTP
Definition: RTSPServer.hh:338
UserAuthenticationDatabase * setAuthenticationDatabase(UserAuthenticationDatabase *newDB)
virtual Boolean specialClientUserAccessCheck(int clientSocket, struct sockaddr_storage const &clientAddr, char const *urlSuffix, char const *username)
void stopTCPStreamingOnSocket(int socketNum)
Boolean fWeEncryptSRTP
Definition: RTSPServer.hh:339
virtual Boolean isRTSPServer() const
virtual ~RTSPServer()
Boolean fOurConnectionsUseTLS
Definition: RTSPServer.hh:337
virtual ClientConnection * createNewClientConnection(int clientSocket, struct sockaddr_storage const &clientAddr)
Port fHTTPServerPort
Definition: RTSPServer.hh:328
HashTable * fPendingRegisterOrDeregisterRequests
Definition: RTSPServer.hh:333
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)
Definition: RTSPServer.hh:93
void disableStreamingRTPOverTCP()
Definition: RTSPServer.hh:100
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
Definition: RTSPServer.hh:326
HashTable * fClientConnectionsForHTTPTunneling
Definition: RTSPServer.hh:329
UserAuthenticationDatabase * fAuthDB
Definition: RTSPServer.hh:335
HashTable * fTCPStreamingDatabase
Definition: RTSPServer.hh:331
Boolean fAllowStreamingRTPOverTCP
Definition: RTSPServer.hh:336
int fHTTPServerSocketIPv6
Definition: RTSPServer.hh:327
static RTSPServer * createNew(UsageEnvironment &env, Port ourPort=554, UserAuthenticationDatabase *authDatabase=NULL, unsigned reclamationSeconds=65)
void() responseHandlerForREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
Definition: RTSPServer.hh:46
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)