live
RTSPServer.hh
Go to the documentation of this file.
1 /**********
2 This library is free software; you can redistribute it and/or modify it under
3 the terms of the GNU Lesser General Public License as published by the
4 Free Software Foundation; either version 3 of the License, or (at your
5 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6 
7 This library is distributed in the hope that it will be useful, but WITHOUT
8 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10 more details.
11 
12 You should have received a copy of the GNU Lesser General Public License
13 along with this library; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 **********/
16 // "liveMedia"
17 // Copyright (c) 1996-2021 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
28 #include "DigestAuthentication.hh"
29 #endif
30 
32 public:
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 
114 protected:
116  int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
117  UserAuthenticationDatabase* authDatabase,
118  unsigned reclamationSeconds);
119  // called only by createNew();
120  virtual ~RTSPServer();
121 
122  virtual char const* allowedCommandNames(); // used to implement "RTSPClientConnection::handleCmd_OPTIONS()"
123  virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
124  char const* proxyURLSuffix, char*& responseStr);
125  // used to implement "RTSPClientConnection::handleCmd_REGISTER()"
126  // Note: "responseStr" is dynamically allocated (or NULL), and should be delete[]d after the call
127  virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
128  char const* url, char const* urlSuffix, int socketToRemoteServer,
129  Boolean deliverViaTCP, char const* proxyURLSuffix);
130  // used to implement "RTSPClientConnection::handleCmd_REGISTER()"
131 
133  virtual Boolean specialClientAccessCheck(int clientSocket, struct sockaddr_storage const& clientAddr,
134  char const* urlSuffix);
135  // a hook that allows subclassed servers to do server-specific access checking
136  // on each client (e.g., based on client IP address), without using digest authentication.
137  virtual Boolean specialClientUserAccessCheck(int clientSocket, struct sockaddr_storage const& clientAddr,
138  char const* urlSuffix, char const *username);
139  // another hook that allows subclassed servers to do server-specific access checking
140  // - this time after normal digest authentication has already taken place (and would otherwise allow access).
141  // (This test can only be used to further restrict access, not to grant additional access.)
142 
143 private: // redefined virtual functions
144  virtual Boolean isRTSPServer() const;
145 
146 public: // should be protected, but some old compilers complain otherwise
147  // The state of a TCP connection used by a RTSP client:
148  class RTSPClientSession; // forward
150  public:
151  // A data structure that's used to implement the "REGISTER" command:
153  public:
154  ParamsForREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
155  RTSPClientConnection* ourConnection, char const* url, char const* urlSuffix,
156  Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
158  private:
159  friend class RTSPClientConnection;
160  char const* fCmd;
162  char* fURL;
163  char* fURLSuffix;
166  };
167  protected: // redefined virtual functions:
168  virtual void handleRequestBytes(int newBytesRead);
169 
170  protected:
172  int clientSocket, struct sockaddr_storage const& clientAddr,
173  Boolean useTLS = False);
175 
176  friend class RTSPServer;
177  friend class RTSPClientSession;
178 
179  // Make the handler functions for each command virtual, to allow subclasses to reimplement them, if necessary:
180  virtual void handleCmd_OPTIONS();
181  // You probably won't need to subclass/reimplement this function; reimplement "RTSPServer::allowedCommandNames()" instead.
182  virtual void handleCmd_GET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
183  virtual void handleCmd_SET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
184  virtual void handleCmd_DESCRIBE(char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
185  static void DESCRIBELookupCompletionFunction(void* clientData, ServerMediaSession* sessionLookedUp);
187  virtual void handleCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
188  char const* url, char const* urlSuffix, char const* fullRequestStr,
189  Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
190  // You probably won't need to subclass/reimplement this function;
191  // reimplement "RTSPServer::weImplementREGISTER()" and "RTSPServer::implementCmd_REGISTER()" instead.
192  virtual void handleCmd_bad();
193  virtual void handleCmd_notSupported();
194  virtual void handleCmd_notFound();
197  // Support for optional RTSP-over-HTTP tunneling:
198  virtual Boolean parseHTTPRequestString(char* resultCmdName, unsigned resultCmdNameMaxSize,
199  char* urlSuffix, unsigned urlSuffixMaxSize,
200  char* sessionCookie, unsigned sessionCookieMaxSize,
201  char* acceptStr, unsigned acceptStrMaxSize);
203  virtual void handleHTTPCmd_notFound();
204  virtual void handleHTTPCmd_OPTIONS();
205  virtual void handleHTTPCmd_TunnelingGET(char const* sessionCookie);
206  virtual Boolean handleHTTPCmd_TunnelingPOST(char const* sessionCookie, unsigned char const* extraData, unsigned extraDataSize);
207  virtual void handleHTTPCmd_StreamingGET(char const* urlSuffix, char const* fullRequestStr);
208  protected:
211  static void handleAlternativeRequestByte(void*, u_int8_t requestByte);
212  void handleAlternativeRequestByte1(u_int8_t requestByte);
213  Boolean authenticationOK(char const* cmdName, char const* urlSuffix, char const* fullRequestStr);
214  void changeClientInputSocket(int newSocketNum, unsigned char const* extraData, unsigned extraDataSize);
215  // used to implement RTSP-over-HTTP tunneling
218 
219  // Shortcuts for setting up a RTSP response (prior to sending it):
220  void setRTSPResponse(char const* responseStr);
221  void setRTSPResponse(char const* responseStr, u_int32_t sessionId);
222  void setRTSPResponse(char const* responseStr, char const* contentStr);
223  void setRTSPResponse(char const* responseStr, u_int32_t sessionId, char const* contentStr);
224 
225  RTSPServer& fOurRTSPServer; // same as ::fOurServer
226  int& fClientInputSocket; // aliased to ::fOurSocket
230  unsigned char* fLastCRLF;
231  unsigned fRecursionCount;
232  char const* fCurrentCSeq;
233  Authenticator fCurrentAuthenticator; // used if access control is needed
234  char* fOurSessionCookie; // used for optional RTSP-over-HTTP tunneling
235  unsigned fBase64RemainderCount; // used for optional RTSP-over-HTTP tunneling (possible values: 0,1,2,3)
237  };
238 
239  // The state of an individual client session (using one or more sequential TCP connections) handled by a RTSP server:
241  protected:
242  RTSPClientSession(RTSPServer& ourServer, u_int32_t sessionId);
244 
245  friend class RTSPServer;
246  friend class RTSPClientConnection;
247  // Make the handler functions for each command virtual, to allow subclasses to redefine them:
248  virtual void handleCmd_SETUP(RTSPClientConnection* ourClientConnection,
249  char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
250  static void SETUPLookupCompletionFunction1(void* clientData, ServerMediaSession* sessionLookedUp);
252  static void SETUPLookupCompletionFunction2(void* clientData, ServerMediaSession* sessionLookedUp);
254  virtual void handleCmd_withinSession(RTSPClientConnection* ourClientConnection,
255  char const* cmdName,
256  char const* urlPreSuffix, char const* urlSuffix,
257  char const* fullRequestStr);
258  virtual void handleCmd_TEARDOWN(RTSPClientConnection* ourClientConnection,
259  ServerMediaSubsession* subsession);
260  virtual void handleCmd_PLAY(RTSPClientConnection* ourClientConnection,
261  ServerMediaSubsession* subsession, char const* fullRequestStr);
262  virtual void handleCmd_PAUSE(RTSPClientConnection* ourClientConnection,
263  ServerMediaSubsession* subsession);
264  virtual void handleCmd_GET_PARAMETER(RTSPClientConnection* ourClientConnection,
265  ServerMediaSubsession* subsession, char const* fullRequestStr);
266  virtual void handleCmd_SET_PARAMETER(RTSPClientConnection* ourClientConnection,
267  ServerMediaSubsession* subsession, char const* fullRequestStr);
268  protected:
269  void deleteStreamByTrack(unsigned trackNum);
271  Boolean isMulticast() const { return fIsMulticast; }
272 
273  // Shortcuts for setting up a RTSP response (prior to sending it):
274  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr) { ourClientConnection->setRTSPResponse(responseStr); }
275  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId) { ourClientConnection->setRTSPResponse(responseStr, sessionId); }
276  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, contentStr); }
277  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, sessionId, contentStr); }
278 
279  protected:
280  RTSPServer& fOurRTSPServer; // same as ::fOurServer
282  unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP
285  struct streamState {
288  void* streamToken;
290 
291  // Member variables used to implement "handleCmd_SETUP()":
293  char const* fURLPreSuffix; char const* fURLSuffix; char const* fFullRequestStr; char const* fTrackId;
294  };
295 
296 protected: // redefined virtual functions
297  // If you subclass "RTSPClientConnection", then you must also redefine this virtual function in order
298  // to create new objects of your subclass:
299  virtual ClientConnection* createNewClientConnection(int clientSocket, struct sockaddr_storage const& clientAddr);
300 
301 protected:
302  // If you subclass "RTSPClientSession", then you must also redefine this virtual function in order
303  // to create new objects of your subclass:
304  virtual ClientSession* createNewClientSession(u_int32_t sessionId);
305 
306 private:
307  static void incomingConnectionHandlerHTTPIPv4(void*, int /*mask*/);
309  static void incomingConnectionHandlerHTTPIPv6(void*, int /*mask*/);
311 
312  void noteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
313  void unnoteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
314  void stopTCPStreamingOnSocket(int socketNum);
315 
316 private:
317  friend class RTSPClientConnection;
318  friend class RTSPClientSession;
319  friend class RegisterRequestRecord;
321  int fHTTPServerSocketIPv4, fHTTPServerSocketIPv6; // for optional RTSP-over-HTTP tunneling
323  HashTable* fClientConnectionsForHTTPTunneling; // maps client-supplied 'session cookie' strings to "RTSPClientConnection"s
324  // (used only for optional RTSP-over-HTTP tunneling)
326  // maps TCP socket numbers to ids of sessions that are streaming over it (RTP/RTCP-over-TCP)
330  Boolean fAllowStreamingRTPOverTCP; // by default, True
331  Boolean fOurConnectionsUseTLS; // by default, False
332 };
333 
334 
336 
338 public:
340  UserAuthenticationDatabase* authDatabase = NULL,
341  UserAuthenticationDatabase* authDatabaseForREGISTER = NULL,
342  unsigned reclamationSeconds = 65,
343  Boolean streamRTPOverTCP = False,
344  int verbosityLevelForProxying = 0,
345  char const* backEndUsername = NULL,
346  char const* backEndPassword = NULL);
347 
348 protected:
349  RTSPServerWithREGISTERProxying(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
350  UserAuthenticationDatabase* authDatabase, UserAuthenticationDatabase* authDatabaseForREGISTER,
351  unsigned reclamationSeconds,
352  Boolean streamRTPOverTCP, int verbosityLevelForProxying,
353  char const* backEndUsername, char const* backEndPassword);
354  // called only by createNew();
356 
357 protected: // redefined virtual functions
358  virtual char const* allowedCommandNames();
359  virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
360  char const* proxyURLSuffix, char*& responseStr);
361  virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
362  char const* url, char const* urlSuffix, int socketToRemoteServer,
363  Boolean deliverViaTCP, char const* proxyURLSuffix);
365 
366 private:
374 };
375 
376 
377 // A special version of "parseTransportHeader()", used just for parsing the "Transport:" header
378 // in an incoming "REGISTER" command:
379 void parseTransportHeaderForREGISTER(char const* buf, // in
380  Boolean &reuseConnection, // out
381  Boolean& deliverViaTCP, // out
382  char*& proxyURLSuffix); // out
383 
384 #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)
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)
UserAuthenticationDatabase * fAuthDBForREGISTER
Definition: RTSPServer.hh:371
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)
virtual char const * allowedCommandNames()
virtual UserAuthenticationDatabase * getAuthenticationDatabaseForCommand(char const *cmdName)
virtual void implementCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, int socketToRemoteServer, Boolean deliverViaTCP, char const *proxyURLSuffix)
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_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)
void changeClientInputSocket(int newSocketNum, unsigned char const *extraData, unsigned extraDataSize)
RTSPServer::RTSPClientConnection * fOurClientConnection
Definition: RTSPServer.hh:292
virtual void handleCmd_PAUSE(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
static void SETUPLookupCompletionFunction2(void *clientData, ServerMediaSession *sessionLookedUp)
Boolean usesTCPTransport() const
Definition: RTSPServer.hh:283
struct RTSPServer::RTSPClientSession::streamState * fStreamStates
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, u_int32_t sessionId)
Definition: RTSPServer.hh:275
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:274
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:276
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:277
void deleteStreamByTrack(unsigned trackNum)
virtual void handleCmd_TEARDOWN(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
RTSPClientSession(RTSPServer &ourServer, u_int32_t sessionId)
UserAuthenticationDatabase * setAuthenticationDatabase(UserAuthenticationDatabase *newDB)
char * ipv4rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1)
Definition: RTSPServer.hh:81
static void incomingConnectionHandlerHTTPIPv6(void *, int)
friend class RegisterRequestRecord
Definition: RTSPServer.hh:319
void setTLSState(char const *certFileName, char const *privKeyFileName)
void incomingConnectionHandlerHTTPIPv4()
void incomingConnectionHandlerHTTPIPv6()
portNumBits httpServerPortNum() const
void() responseHandlerForDEREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
Definition: RTSPServer.hh:64
unsigned fRegisterOrDeregisterRequestCounter
Definition: RTSPServer.hh:328
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)
virtual ClientConnection * createNewClientConnection(int clientSocket, struct sockaddr_storage const &clientAddr)
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:321
char * rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1, Boolean useIPv6=False) const
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
char * ipv6rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1)
Definition: RTSPServer.hh:84
virtual ~RTSPServer()
Boolean fOurConnectionsUseTLS
Definition: RTSPServer.hh:331
Port fHTTPServerPort
Definition: RTSPServer.hh:322
HashTable * fPendingRegisterOrDeregisterRequests
Definition: RTSPServer.hh:327
static Boolean lookupByName(UsageEnvironment &env, char const *name, RTSPServer *&resultServer)
void disableStreamingRTPOverTCP()
Definition: RTSPServer.hh:100
static void incomingConnectionHandlerHTTPIPv4(void *, int)
RTSPServer(UsageEnvironment &env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort, UserAuthenticationDatabase *authDatabase, unsigned reclamationSeconds)
static RTSPServer * createNew(UsageEnvironment &env, Port ourPort=554, UserAuthenticationDatabase *authDatabase=NULL, unsigned reclamationSeconds=65)
virtual char const * allowedCommandNames()
friend class DeregisterRequestRecord
Definition: RTSPServer.hh:320
HashTable * fClientConnectionsForHTTPTunneling
Definition: RTSPServer.hh:323
UserAuthenticationDatabase * fAuthDB
Definition: RTSPServer.hh:329
HashTable * fTCPStreamingDatabase
Definition: RTSPServer.hh:325
Boolean fAllowStreamingRTPOverTCP
Definition: RTSPServer.hh:330
virtual UserAuthenticationDatabase * getAuthenticationDatabaseForCommand(char const *cmdName)
int fHTTPServerSocketIPv6
Definition: RTSPServer.hh:321
char * ipv4rtspURLPrefix(int clientSocket=-1)
Definition: RTSPServer.hh:93
void() responseHandlerForREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
Definition: RTSPServer.hh:46
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)