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-2024 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 specialClientAccessCheck(int clientSocket,
135 struct sockaddr_storage const& clientAddr,
136 char const* urlSuffix);
137 // a hook that allows subclassed servers to do server-specific access checking
138 // on each client (e.g., based on client IP address), without using digest authentication.
139 virtual Boolean specialClientUserAccessCheck(int clientSocket,
140 struct sockaddr_storage const& clientAddr,
141 char const* urlSuffix, char const *username);
142 // another hook that allows subclassed servers to do server-specific access checking
143 // - this time after normal digest authentication has already taken place (and would otherwise allow access).
144 // (This test can only be used to further restrict access, not to grant additional access.)
145 virtual void specialHandlingOfAuthenticationFailure(int clientSocket,
146 struct sockaddr_storage const& clientAddr,
147 char const* urlSuffix);
148 // a hook that allows subclassed servers to take extra action whenevever an authentication failure occurs
149
150public: // redefined virtual functions
151 virtual Boolean isRTSPServer() const;
152 virtual void addServerMediaSession(ServerMediaSession* serverMediaSession);
153
154public: // should be protected, but some old compilers complain otherwise
155 // The state of a TCP connection used by a RTSP client:
156 class RTSPClientSession; // forward
158 public:
159 // A data structure that's used to implement the "REGISTER" command:
161 public:
162 ParamsForREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
163 RTSPClientConnection* ourConnection, char const* url, char const* urlSuffix,
164 Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
166 private:
168 char const* fCmd;
170 char* fURL;
174 };
175 protected: // redefined virtual functions:
176 virtual void handleRequestBytes(int newBytesRead);
177
178 protected:
180 int clientSocket, struct sockaddr_storage const& clientAddr,
181 Boolean useTLS = False);
183
184 friend class RTSPServer;
185 friend class RTSPClientSession;
186
187 // Make the handler functions for each command virtual, to allow subclasses to reimplement them, if necessary:
188 virtual void handleCmd_OPTIONS();
189 // You probably won't need to subclass/reimplement this function; reimplement "RTSPServer::allowedCommandNames()" instead.
190 virtual void handleCmd_GET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
191 virtual void handleCmd_SET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
192 virtual void handleCmd_DESCRIBE(char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
193 static void DESCRIBELookupCompletionFunction(void* clientData, ServerMediaSession* sessionLookedUp);
195 virtual void handleCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
196 char const* url, char const* urlSuffix, char const* fullRequestStr,
197 Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
198 // You probably won't need to subclass/reimplement this function;
199 // reimplement "RTSPServer::weImplementREGISTER()" and "RTSPServer::implementCmd_REGISTER()" instead.
200 virtual void handleCmd_bad();
202 virtual void handleCmd_redirect(char const* urlSuffix);
203 virtual void handleCmd_notFound();
206 // Support for optional RTSP-over-HTTP tunneling:
207 virtual Boolean parseHTTPRequestString(char* resultCmdName, unsigned resultCmdNameMaxSize,
208 char* urlSuffix, unsigned urlSuffixMaxSize,
209 char* sessionCookie, unsigned sessionCookieMaxSize,
210 char* acceptStr, unsigned acceptStrMaxSize);
213 virtual void handleHTTPCmd_OPTIONS();
214 virtual void handleHTTPCmd_TunnelingGET(char const* sessionCookie);
215 virtual Boolean handleHTTPCmd_TunnelingPOST(char const* sessionCookie, unsigned char const* extraData, unsigned extraDataSize);
216 virtual void handleHTTPCmd_StreamingGET(char const* urlSuffix, char const* fullRequestStr);
217 protected:
220 static void handleAlternativeRequestByte(void*, u_int8_t requestByte);
221 void handleAlternativeRequestByte1(u_int8_t requestByte);
222 Boolean authenticationOK(char const* cmdName, char const* urlSuffix, char const* fullRequestStr);
223 void changeClientInputSocket(int newSocketNum, ServerTLSState const* newTLSState,
224 unsigned char const* extraData, unsigned extraDataSize);
225 // used to implement RTSP-over-HTTP tunneling
228
229 // Shortcuts for setting up a RTSP response (prior to sending it):
230 void setRTSPResponse(char const* responseStr);
231 void setRTSPResponse(char const* responseStr, u_int32_t sessionId);
232 void setRTSPResponse(char const* responseStr, char const* contentStr);
233 void setRTSPResponse(char const* responseStr, u_int32_t sessionId, char const* contentStr);
234
235 RTSPServer& fOurRTSPServer; // same as ::fOurServer
236 int& fClientInputSocket; // aliased to ::fOurSocket
238 ServerTLSState fPOSTSocketTLS; // used only for RTSP-over-HTTPS
241 unsigned char* fLastCRLF;
243 char const* fCurrentCSeq;
244 Authenticator fCurrentAuthenticator; // used if access control is needed
245 char* fOurSessionCookie; // used for optional RTSP-over-HTTP tunneling
246 unsigned fBase64RemainderCount; // used for optional RTSP-over-HTTP tunneling (possible values: 0,1,2,3)
248 };
249
250 // The state of an individual client session (using one or more sequential TCP connections) handled by a RTSP server:
252 protected:
253 RTSPClientSession(RTSPServer& ourServer, u_int32_t sessionId);
255
256 friend class RTSPServer;
258 // Make the handler functions for each command virtual, to allow subclasses to redefine them:
259 virtual void handleCmd_SETUP(RTSPClientConnection* ourClientConnection,
260 char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
261 static void SETUPLookupCompletionFunction1(void* clientData, ServerMediaSession* sessionLookedUp);
263 static void SETUPLookupCompletionFunction2(void* clientData, ServerMediaSession* sessionLookedUp);
265 virtual void handleCmd_withinSession(RTSPClientConnection* ourClientConnection,
266 char const* cmdName,
267 char const* urlPreSuffix, char const* urlSuffix,
268 char const* fullRequestStr);
269 virtual void handleCmd_TEARDOWN(RTSPClientConnection* ourClientConnection,
270 ServerMediaSubsession* subsession);
271 virtual void handleCmd_PLAY(RTSPClientConnection* ourClientConnection,
272 ServerMediaSubsession* subsession, char const* fullRequestStr);
273 virtual void handleCmd_PAUSE(RTSPClientConnection* ourClientConnection,
274 ServerMediaSubsession* subsession);
275 virtual void handleCmd_GET_PARAMETER(RTSPClientConnection* ourClientConnection,
276 ServerMediaSubsession* subsession, char const* fullRequestStr);
277 virtual void handleCmd_SET_PARAMETER(RTSPClientConnection* ourClientConnection,
278 ServerMediaSubsession* subsession, char const* fullRequestStr);
279 protected:
280 void deleteStreamByTrack(unsigned trackNum);
282 Boolean isMulticast() const { return fIsMulticast; }
283
284 // Shortcuts for setting up a RTSP response (prior to sending it):
285 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr) { ourClientConnection->setRTSPResponse(responseStr); }
286 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId) { ourClientConnection->setRTSPResponse(responseStr, sessionId); }
287 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, contentStr); }
288 void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, sessionId, contentStr); }
289
290 protected:
291 RTSPServer& fOurRTSPServer; // same as ::fOurServer
293 unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP
296 struct streamState {
301
302 // Member variables used to implement "handleCmd_SETUP()":
304 char const* fURLPreSuffix; char const* fURLSuffix; char const* fFullRequestStr; char const* fTrackId;
305 };
306
307protected: // redefined virtual functions
308 // If you subclass "RTSPClientConnection", then you must also redefine this virtual function in order
309 // to create new objects of your subclass:
310 virtual ClientConnection* createNewClientConnection(int clientSocket, struct sockaddr_storage const& clientAddr);
311
312protected:
313 // If you subclass "RTSPClientSession", then you must also redefine this virtual function in order
314 // to create new objects of your subclass:
315 virtual ClientSession* createNewClientSession(u_int32_t sessionId);
316
317private:
318 static void incomingConnectionHandlerHTTPIPv4(void*, int /*mask*/);
320 static void incomingConnectionHandlerHTTPIPv6(void*, int /*mask*/);
322
323 void noteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
324 void unnoteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
325 void stopTCPStreamingOnSocket(int socketNum);
326
327private:
329 friend class RTSPClientSession;
332 int fHTTPServerSocketIPv4, fHTTPServerSocketIPv6; // for optional RTSP-over-HTTP tunneling
334 HashTable* fClientConnectionsForHTTPTunneling; // maps client-supplied 'session cookie' strings to "RTSPClientConnection"s
335 // (used only for optional RTSP-over-HTTP tunneling)
337 // maps TCP socket numbers to ids of sessions that are streaming over it (RTP/RTCP-over-TCP)
342 Boolean fOurConnectionsUseTLS; // by default, False
343 Boolean fWeServeSRTP; // used only if "fOurConnectionsUseTLS" is True
344 Boolean fWeEncryptSRTP; // used only if "fWeServeSRTP" is True
345};
346
347
349
351public:
353 UserAuthenticationDatabase* authDatabase = NULL,
354 UserAuthenticationDatabase* authDatabaseForREGISTER = NULL,
355 unsigned reclamationSeconds = 65,
356 Boolean streamRTPOverTCP = False,
357 int verbosityLevelForProxying = 0,
358 char const* backEndUsername = NULL,
359 char const* backEndPassword = NULL);
360
361protected:
362 RTSPServerWithREGISTERProxying(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
363 UserAuthenticationDatabase* authDatabase, UserAuthenticationDatabase* authDatabaseForREGISTER,
364 unsigned reclamationSeconds,
365 Boolean streamRTPOverTCP, int verbosityLevelForProxying,
366 char const* backEndUsername, char const* backEndPassword);
367 // called only by createNew();
369
370protected: // redefined virtual functions
371 virtual char const* allowedCommandNames();
372 virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
373 char const* proxyURLSuffix, char*& responseStr);
374 virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
375 char const* url, char const* urlSuffix, int socketToRemoteServer,
376 Boolean deliverViaTCP, char const* proxyURLSuffix);
378
379private:
387};
388
389
390// A special version of "parseTransportHeader()", used just for parsing the "Transport:" header
391// in an incoming "REGISTER" command:
392void parseTransportHeaderForREGISTER(char const* buf, // in
393 Boolean &reuseConnection, // out
394 Boolean& deliverViaTCP, // out
395 char*& proxyURLSuffix); // out
396
397#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:384
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)
Boolean authenticationOK(char const *cmdName, char const *urlSuffix, char const *fullRequestStr)
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 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:303
virtual void handleCmd_PAUSE(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
static void SETUPLookupCompletionFunction2(void *clientData, ServerMediaSession *sessionLookedUp)
Boolean usesTCPTransport() const
Definition: RTSPServer.hh:294
struct RTSPServer::RTSPClientSession::streamState * fStreamStates
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, u_int32_t sessionId)
Definition: RTSPServer.hh:286
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:285
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:287
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:288
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:330
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:339
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:332
Boolean fWeServeSRTP
Definition: RTSPServer.hh:343
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)
Boolean fWeEncryptSRTP
Definition: RTSPServer.hh:344
virtual Boolean isRTSPServer() const
virtual ~RTSPServer()
Boolean fOurConnectionsUseTLS
Definition: RTSPServer.hh:342
virtual ClientConnection * createNewClientConnection(int clientSocket, struct sockaddr_storage const &clientAddr)
Port fHTTPServerPort
Definition: RTSPServer.hh:333
HashTable * fPendingRegisterOrDeregisterRequests
Definition: RTSPServer.hh:338
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:331
HashTable * fClientConnectionsForHTTPTunneling
Definition: RTSPServer.hh:334
UserAuthenticationDatabase * fAuthDB
Definition: RTSPServer.hh:340
HashTable * fTCPStreamingDatabase
Definition: RTSPServer.hh:336
Boolean fAllowStreamingRTPOverTCP
Definition: RTSPServer.hh:341
int fHTTPServerSocketIPv6
Definition: RTSPServer.hh:332
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)