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 protected:
114  int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
115  UserAuthenticationDatabase* authDatabase,
116  unsigned reclamationSeconds);
117  // called only by createNew();
118  virtual ~RTSPServer();
119 
120  virtual char const* allowedCommandNames(); // used to implement "RTSPClientConnection::handleCmd_OPTIONS()"
121  virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
122  char const* proxyURLSuffix, char*& responseStr);
123  // used to implement "RTSPClientConnection::handleCmd_REGISTER()"
124  // Note: "responseStr" is dynamically allocated (or NULL), and should be delete[]d after the call
125  virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
126  char const* url, char const* urlSuffix, int socketToRemoteServer,
127  Boolean deliverViaTCP, char const* proxyURLSuffix);
128  // used to implement "RTSPClientConnection::handleCmd_REGISTER()"
129 
131  virtual Boolean specialClientAccessCheck(int clientSocket, struct sockaddr_storage const& clientAddr,
132  char const* urlSuffix);
133  // a hook that allows subclassed servers to do server-specific access checking
134  // on each client (e.g., based on client IP address), without using digest authentication.
135  virtual Boolean specialClientUserAccessCheck(int clientSocket, struct sockaddr_storage const& clientAddr,
136  char const* urlSuffix, char const *username);
137  // another hook that allows subclassed servers to do server-specific access checking
138  // - this time after 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 
141 private: // redefined virtual functions
142  virtual Boolean isRTSPServer() const;
143 
144 public: // should be protected, but some old compilers complain otherwise
145  // The state of a TCP connection used by a RTSP client:
146  class RTSPClientSession; // forward
148  public:
149  // A data structure that's used to implement the "REGISTER" command:
151  public:
152  ParamsForREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
153  RTSPClientConnection* ourConnection, char const* url, char const* urlSuffix,
154  Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
155  virtual ~ParamsForREGISTER();
156  private:
157  friend class RTSPClientConnection;
158  char const* fCmd;
160  char* fURL;
161  char* fURLSuffix;
164  };
165  protected: // redefined virtual functions:
166  virtual void handleRequestBytes(int newBytesRead);
167 
168  protected:
169  RTSPClientConnection(RTSPServer& ourServer, int clientSocket, struct sockaddr_storage const& clientAddr);
170  virtual ~RTSPClientConnection();
171 
172  friend class RTSPServer;
173  friend class RTSPClientSession;
174 
175  // Make the handler functions for each command virtual, to allow subclasses to reimplement them, if necessary:
176  virtual void handleCmd_OPTIONS();
177  // You probably won't need to subclass/reimplement this function; reimplement "RTSPServer::allowedCommandNames()" instead.
178  virtual void handleCmd_GET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
179  virtual void handleCmd_SET_PARAMETER(char const* fullRequestStr); // when operating on the entire server
180  virtual void handleCmd_DESCRIBE(char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
181  static void DESCRIBELookupCompletionFunction(void* clientData, ServerMediaSession* sessionLookedUp);
182  virtual void handleCmd_DESCRIBE_afterLookup(ServerMediaSession* session);
183  virtual void handleCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
184  char const* url, char const* urlSuffix, char const* fullRequestStr,
185  Boolean reuseConnection, Boolean deliverViaTCP, char const* proxyURLSuffix);
186  // You probably won't need to subclass/reimplement this function;
187  // reimplement "RTSPServer::weImplementREGISTER()" and "RTSPServer::implementCmd_REGISTER()" instead.
188  virtual void handleCmd_bad();
189  virtual void handleCmd_notSupported();
190  virtual void handleCmd_notFound();
191  virtual void handleCmd_sessionNotFound();
192  virtual void handleCmd_unsupportedTransport();
193  // Support for optional RTSP-over-HTTP tunneling:
194  virtual Boolean parseHTTPRequestString(char* resultCmdName, unsigned resultCmdNameMaxSize,
195  char* urlSuffix, unsigned urlSuffixMaxSize,
196  char* sessionCookie, unsigned sessionCookieMaxSize,
197  char* acceptStr, unsigned acceptStrMaxSize);
198  virtual void handleHTTPCmd_notSupported();
199  virtual void handleHTTPCmd_notFound();
200  virtual void handleHTTPCmd_OPTIONS();
201  virtual void handleHTTPCmd_TunnelingGET(char const* sessionCookie);
202  virtual Boolean handleHTTPCmd_TunnelingPOST(char const* sessionCookie, unsigned char const* extraData, unsigned extraDataSize);
203  virtual void handleHTTPCmd_StreamingGET(char const* urlSuffix, char const* fullRequestStr);
204  protected:
205  void resetRequestBuffer();
206  void closeSocketsRTSP();
207  static void handleAlternativeRequestByte(void*, u_int8_t requestByte);
208  void handleAlternativeRequestByte1(u_int8_t requestByte);
209  Boolean authenticationOK(char const* cmdName, char const* urlSuffix, char const* fullRequestStr);
210  void changeClientInputSocket(int newSocketNum, unsigned char const* extraData, unsigned extraDataSize);
211  // used to implement RTSP-over-HTTP tunneling
212  static void continueHandlingREGISTER(ParamsForREGISTER* params);
213  virtual void continueHandlingREGISTER1(ParamsForREGISTER* params);
214 
215  // Shortcuts for setting up a RTSP response (prior to sending it):
216  void setRTSPResponse(char const* responseStr);
217  void setRTSPResponse(char const* responseStr, u_int32_t sessionId);
218  void setRTSPResponse(char const* responseStr, char const* contentStr);
219  void setRTSPResponse(char const* responseStr, u_int32_t sessionId, char const* contentStr);
220 
221  RTSPServer& fOurRTSPServer; // same as ::fOurServer
222  int& fClientInputSocket; // aliased to ::fOurSocket
226  unsigned char* fLastCRLF;
227  unsigned fRecursionCount;
228  char const* fCurrentCSeq;
229  Authenticator fCurrentAuthenticator; // used if access control is needed
230  char* fOurSessionCookie; // used for optional RTSP-over-HTTP tunneling
231  unsigned fBase64RemainderCount; // used for optional RTSP-over-HTTP tunneling (possible values: 0,1,2,3)
232  };
233 
234  // The state of an individual client session (using one or more sequential TCP connections) handled by a RTSP server:
236  protected:
237  RTSPClientSession(RTSPServer& ourServer, u_int32_t sessionId);
238  virtual ~RTSPClientSession();
239 
240  friend class RTSPServer;
241  friend class RTSPClientConnection;
242  // Make the handler functions for each command virtual, to allow subclasses to redefine them:
243  virtual void handleCmd_SETUP(RTSPClientConnection* ourClientConnection,
244  char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr);
245  static void SETUPLookupCompletionFunction1(void* clientData, ServerMediaSession* sessionLookedUp);
247  static void SETUPLookupCompletionFunction2(void* clientData, ServerMediaSession* sessionLookedUp);
249  virtual void handleCmd_withinSession(RTSPClientConnection* ourClientConnection,
250  char const* cmdName,
251  char const* urlPreSuffix, char const* urlSuffix,
252  char const* fullRequestStr);
253  virtual void handleCmd_TEARDOWN(RTSPClientConnection* ourClientConnection,
254  ServerMediaSubsession* subsession);
255  virtual void handleCmd_PLAY(RTSPClientConnection* ourClientConnection,
256  ServerMediaSubsession* subsession, char const* fullRequestStr);
257  virtual void handleCmd_PAUSE(RTSPClientConnection* ourClientConnection,
258  ServerMediaSubsession* subsession);
259  virtual void handleCmd_GET_PARAMETER(RTSPClientConnection* ourClientConnection,
260  ServerMediaSubsession* subsession, char const* fullRequestStr);
261  virtual void handleCmd_SET_PARAMETER(RTSPClientConnection* ourClientConnection,
262  ServerMediaSubsession* subsession, char const* fullRequestStr);
263  protected:
264  void deleteStreamByTrack(unsigned trackNum);
265  void reclaimStreamStates();
266  Boolean isMulticast() const { return fIsMulticast; }
267 
268  // Shortcuts for setting up a RTSP response (prior to sending it):
269  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr) { ourClientConnection->setRTSPResponse(responseStr); }
270  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId) { ourClientConnection->setRTSPResponse(responseStr, sessionId); }
271  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, contentStr); }
272  void setRTSPResponse(RTSPClientConnection* ourClientConnection, char const* responseStr, u_int32_t sessionId, char const* contentStr) { ourClientConnection->setRTSPResponse(responseStr, sessionId, contentStr); }
273 
274  protected:
275  RTSPServer& fOurRTSPServer; // same as ::fOurServer
277  unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP
280  struct streamState {
283  void* streamToken;
284  } * fStreamStates;
285 
286  // Member variables used to implement "handleCmd_SETUP()":
288  char const* fURLPreSuffix; char const* fURLSuffix; char const* fFullRequestStr; char const* fTrackId;
289  };
290 
291 protected: // redefined virtual functions
292  // If you subclass "RTSPClientConnection", then you must also redefine this virtual function in order
293  // to create new objects of your subclass:
294  virtual ClientConnection* createNewClientConnection(int clientSocket, struct sockaddr_storage const& clientAddr);
295 
296 protected:
297  // If you subclass "RTSPClientSession", then you must also redefine this virtual function in order
298  // to create new objects of your subclass:
299  virtual ClientSession* createNewClientSession(u_int32_t sessionId);
300 
301 private:
302  static void incomingConnectionHandlerHTTPIPv4(void*, int /*mask*/);
304  static void incomingConnectionHandlerHTTPIPv6(void*, int /*mask*/);
306 
307  void noteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
308  void unnoteTCPStreamingOnSocket(int socketNum, RTSPClientSession* clientSession, unsigned trackNum);
309  void stopTCPStreamingOnSocket(int socketNum);
310 
311 private:
312  friend class RTSPClientConnection;
313  friend class RTSPClientSession;
314  friend class RegisterRequestRecord;
316  int fHTTPServerSocketIPv4, fHTTPServerSocketIPv6; // for optional RTSP-over-HTTP tunneling
318  HashTable* fClientConnectionsForHTTPTunneling; // maps client-supplied 'session cookie' strings to "RTSPClientConnection"s
319  // (used only for optional RTSP-over-HTTP tunneling)
321  // maps TCP socket numbers to ids of sessions that are streaming over it (RTP/RTCP-over-TCP)
325  Boolean fAllowStreamingRTPOverTCP; // by default, True
326 };
327 
328 
330 
332 public:
334  UserAuthenticationDatabase* authDatabase = NULL,
335  UserAuthenticationDatabase* authDatabaseForREGISTER = NULL,
336  unsigned reclamationSeconds = 65,
337  Boolean streamRTPOverTCP = False,
338  int verbosityLevelForProxying = 0,
339  char const* backEndUsername = NULL,
340  char const* backEndPassword = NULL);
341 
342 protected:
343  RTSPServerWithREGISTERProxying(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
344  UserAuthenticationDatabase* authDatabase, UserAuthenticationDatabase* authDatabaseForREGISTER,
345  unsigned reclamationSeconds,
346  Boolean streamRTPOverTCP, int verbosityLevelForProxying,
347  char const* backEndUsername, char const* backEndPassword);
348  // called only by createNew();
350 
351 protected: // redefined virtual functions
352  virtual char const* allowedCommandNames();
353  virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
354  char const* proxyURLSuffix, char*& responseStr);
355  virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
356  char const* url, char const* urlSuffix, int socketToRemoteServer,
357  Boolean deliverViaTCP, char const* proxyURLSuffix);
359 
360 private:
368 };
369 
370 
371 // A special version of "parseTransportHeader()", used just for parsing the "Transport:" header
372 // in an incoming "REGISTER" command:
373 void parseTransportHeaderForREGISTER(char const* buf, // in
374  Boolean &reuseConnection, // out
375  Boolean& deliverViaTCP, // out
376  char*& proxyURLSuffix); // out
377 
378 #endif
void stopTCPStreamingOnSocket(int socketNum)
unsigned char Boolean
Definition: Boolean.hh:25
void disableStreamingRTPOverTCP()
Definition: RTSPServer.hh:100
virtual void handleCmd_DESCRIBE_afterLookup(ServerMediaSession *session)
void incomingConnectionHandlerHTTPIPv6()
virtual void handleCmd_SETUP_afterLookup1(ServerMediaSession *sms)
virtual void handleHTTPCmd_StreamingGET(char const *urlSuffix, char const *fullRequestStr)
Boolean authenticationOK(char const *cmdName, char const *urlSuffix, char const *fullRequestStr)
virtual void handleCmd_SETUP_afterLookup2(ServerMediaSession *sms)
virtual void continueHandlingREGISTER1(ParamsForREGISTER *params)
static void continueHandlingREGISTER(ParamsForREGISTER *params)
unsigned deregisterStream(ServerMediaSession *serverMediaSession, char const *remoteClientNameOrAddress, portNumBits remoteClientPortNum, responseHandlerForDEREGISTER *responseHandler, char const *username=NULL, char const *password=NULL, char const *proxyURLSuffix=NULL)
ParamsForREGISTER(char const *cmd, RTSPClientConnection *ourConnection, char const *url, char const *urlSuffix, Boolean reuseConnection, Boolean deliverViaTCP, char const *proxyURLSuffix)
const Boolean False
Definition: Boolean.hh:28
u_int16_t portNumBits
Definition: NetAddress.hh:102
char const * name() const
Definition: Media.hh:61
void() responseHandlerForDEREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
Definition: RTSPServer.hh:64
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)
int fHTTPServerSocketIPv4
Definition: RTSPServer.hh:316
Port fHTTPServerPort
Definition: RTSPServer.hh:317
virtual char const * allowedCommandNames()
#define NULL
virtual void handleCmd_GET_PARAMETER(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession, char const *fullRequestStr)
virtual void handleCmd_withinSession(RTSPClientConnection *ourClientConnection, char const *cmdName, char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
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)
friend class RTSPClientSession
Definition: RTSPServer.hh:313
char * ipv4rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1)
Definition: RTSPServer.hh:81
static void handleAlternativeRequestByte(void *, u_int8_t requestByte)
void unnoteTCPStreamingOnSocket(int socketNum, RTSPClientSession *clientSession, unsigned trackNum)
virtual UserAuthenticationDatabase * getAuthenticationDatabaseForCommand(char const *cmdName)
RTSPClientConnection(RTSPServer &ourServer, int clientSocket, struct sockaddr_storage const &clientAddr)
portNumBits httpServerPortNum() const
void noteTCPStreamingOnSocket(int socketNum, RTSPClientSession *clientSession, unsigned trackNum)
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, u_int32_t sessionId)
Definition: RTSPServer.hh:270
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, u_int32_t sessionId, char const *contentStr)
Definition: RTSPServer.hh:272
RTSPServer::RTSPClientConnection * fOurClientConnection
Definition: RTSPServer.hh:287
static void DESCRIBELookupCompletionFunction(void *clientData, ServerMediaSession *sessionLookedUp)
virtual char const * allowedCommandNames()
virtual UserAuthenticationDatabase * getAuthenticationDatabaseForCommand(char const *cmdName)
static void SETUPLookupCompletionFunction2(void *clientData, ServerMediaSession *sessionLookedUp)
virtual void handleCmd_PAUSE(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
virtual Boolean specialClientAccessCheck(int clientSocket, struct sockaddr_storage const &clientAddr, char const *urlSuffix)
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr)
Definition: RTSPServer.hh:269
virtual void implementCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, int socketToRemoteServer, Boolean deliverViaTCP, char const *proxyURLSuffix)
virtual void handleCmd_SET_PARAMETER(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession, char const *fullRequestStr)
void parseTransportHeaderForREGISTER(char const *buf, Boolean &reuseConnection, Boolean &deliverViaTCP, char *&proxyURLSuffix)
virtual Boolean weImplementREGISTER(char const *cmd, char const *proxyURLSuffix, char *&responseStr)
static void SETUPLookupCompletionFunction1(void *clientData, ServerMediaSession *sessionLookedUp)
virtual void handleCmd_unsupportedTransport()
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)
char * ipv6rtspURLPrefix(int clientSocket=-1)
Definition: RTSPServer.hh:94
char * ipv4rtspURLPrefix(int clientSocket=-1)
Definition: RTSPServer.hh:93
virtual void handleHTTPCmd_TunnelingGET(char const *sessionCookie)
RTSPClientSession(RTSPServer &ourServer, u_int32_t sessionId)
friend class DeregisterRequestRecord
Definition: RTSPServer.hh:315
int fHTTPServerSocketIPv6
Definition: RTSPServer.hh:316
virtual Boolean isRTSPServer() const
virtual void handleCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, char const *fullRequestStr, Boolean reuseConnection, Boolean deliverViaTCP, char const *proxyURLSuffix)
void deleteStreamByTrack(unsigned trackNum)
UserAuthenticationDatabase * setAuthenticationDatabase(UserAuthenticationDatabase *newDB)
HashTable * fTCPStreamingDatabase
Definition: RTSPServer.hh:320
virtual void handleCmd_GET_PARAMETER(char const *fullRequestStr)
virtual void handleCmd_SETUP(RTSPClientConnection *ourClientConnection, char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
void changeClientInputSocket(int newSocketNum, unsigned char const *extraData, unsigned extraDataSize)
virtual void handleCmd_DESCRIBE(char const *urlPreSuffix, char const *urlSuffix, char const *fullRequestStr)
virtual void handleCmd_TEARDOWN(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession)
char * rtspURLPrefix(int clientSocket=-1, Boolean useIPv6=False) const
void() responseHandlerForREGISTER(RTSPServer *rtspServer, unsigned requestId, int resultCode, char *resultString)
Definition: RTSPServer.hh:46
virtual ClientSession * createNewClientSession(u_int32_t sessionId)
virtual ClientConnection * createNewClientConnection(int clientSocket, struct sockaddr_storage const &clientAddr)
virtual Boolean specialClientUserAccessCheck(int clientSocket, struct sockaddr_storage const &clientAddr, char const *urlSuffix, char const *username)
RTSPServer(UsageEnvironment &env, int ourSocketIPv4, int ourSocketIPv6, Port ourPort, UserAuthenticationDatabase *authDatabase, unsigned reclamationSeconds)
void setRTSPResponse(char const *responseStr)
Boolean usesTCPTransport() const
Definition: RTSPServer.hh:278
static Boolean lookupByName(UsageEnvironment &env, char const *name, RTSPServer *&resultServer)
friend class RegisterRequestRecord
Definition: RTSPServer.hh:314
virtual Boolean handleHTTPCmd_TunnelingPOST(char const *sessionCookie, unsigned char const *extraData, unsigned extraDataSize)
void setRTSPResponse(RTSPClientConnection *ourClientConnection, char const *responseStr, char const *contentStr)
Definition: RTSPServer.hh:271
struct RTSPServer::RTSPClientSession::streamState * fStreamStates
Boolean fAllowStreamingRTPOverTCP
Definition: RTSPServer.hh:325
virtual ~RTSPServer()
UserAuthenticationDatabase * fAuthDBForREGISTER
Definition: RTSPServer.hh:365
char * rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1, Boolean useIPv6=False) const
unsigned fRegisterOrDeregisterRequestCounter
Definition: RTSPServer.hh:323
virtual void handleCmd_sessionNotFound()
const Boolean True
Definition: Boolean.hh:31
char * ipv6rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1)
Definition: RTSPServer.hh:84
virtual void handleCmd_SET_PARAMETER(char const *fullRequestStr)
HashTable * fClientConnectionsForHTTPTunneling
Definition: RTSPServer.hh:318
virtual void handleHTTPCmd_notSupported()
UserAuthenticationDatabase * fAuthDB
Definition: RTSPServer.hh:324
virtual Boolean parseHTTPRequestString(char *resultCmdName, unsigned resultCmdNameMaxSize, char *urlSuffix, unsigned urlSuffixMaxSize, char *sessionCookie, unsigned sessionCookieMaxSize, char *acceptStr, unsigned acceptStrMaxSize)
virtual Boolean weImplementREGISTER(char const *cmd, char const *proxyURLSuffix, char *&responseStr)
Boolean setUpTunnelingOverHTTP(Port httpPort)
static RTSPServer * createNew(UsageEnvironment &env, Port ourPort=554, UserAuthenticationDatabase *authDatabase=NULL, unsigned reclamationSeconds=65)
void handleAlternativeRequestByte1(u_int8_t requestByte)
void incomingConnectionHandlerHTTPIPv4()
virtual void handleRequestBytes(int newBytesRead)
virtual void handleCmd_PLAY(RTSPClientConnection *ourClientConnection, ServerMediaSubsession *subsession, char const *fullRequestStr)
HashTable * fPendingRegisterOrDeregisterRequests
Definition: RTSPServer.hh:322
virtual void implementCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, int socketToRemoteServer, Boolean deliverViaTCP, char const *proxyURLSuffix)