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 <>.)
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.
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 generic RTSP client - for a single "rtsp://" URL
19 // C++ header
21 #ifndef _RTSP_CLIENT_HH
22 #define _RTSP_CLIENT_HH
24 #ifndef _MEDIA_SESSION_HH
25 #include "MediaSession.hh"
26 #endif
27 #ifndef _NET_ADDRESS_HH
28 #include "NetAddress.hh"
29 #endif
31 #include "DigestAuthentication.hh"
32 #endif
33 #ifndef _TLS_STATE_HH
34 #include "TLSState.hh"
35 #endif
37 #ifndef _RTSP_SERVER_HH
38 #include "RTSPServer.hh" // For the optional "HandlerForREGISTERCommand" mini-server
39 #endif
40 #endif
42 class RTSPClient: public Medium {
43 public:
44  static RTSPClient* createNew(UsageEnvironment& env, char const* rtspURL,
45  int verbosityLevel = 0,
46  char const* applicationName = NULL,
47  portNumBits tunnelOverHTTPPortNum = 0,
48  int socketNumToServer = -1);
49  // If "tunnelOverHTTPPortNum" is non-zero, we tunnel RTSP (and RTP)
50  // over a HTTP connection with the given port number, using the technique
51  // described in Apple's document <>
52  // If "socketNumToServer" is >= 0, then it is the socket number of an already-existing TCP connection to the server.
53  // (In this case, "rtspURL" must point to the socket's endpoint, so that it can be accessed via the socket.)
55  typedef void (responseHandler)(RTSPClient* rtspClient,
56  int resultCode, char* resultString);
57  // A function that is called in response to a RTSP command. The parameters are as follows:
58  // "rtspClient": The "RTSPClient" object on which the original command was issued.
59  // "resultCode": If zero, then the command completed successfully. If non-zero, then the command did not complete
60  // successfully, and "resultCode" indicates the error, as follows:
61  // A positive "resultCode" is a RTSP error code (for example, 404 means "not found")
62  // A negative "resultCode" indicates a socket/network error; 0-"resultCode" is the standard "errno" code.
63  // "resultString": A ('\0'-terminated) string returned along with the response, or else NULL.
64  // In particular:
65  // "resultString" for a successful "DESCRIBE" command will be the media session's SDP description.
66  // "resultString" for a successful "OPTIONS" command will be a list of allowed commands.
67  // Note that this string can be present (i.e., not NULL) even if "resultCode" is non-zero - i.e., an error message.
68  // Also, "resultString" can be NULL, even if "resultCode" is zero (e.g., if the RTSP command succeeded, but without
69  // including an appropriate result header).
70  // Note also that this string is dynamically allocated, and must be freed by the handler (or the caller)
71  // - using "delete[]".
74  // Issues a RTSP "DESCRIBE" command, then returns the "CSeq" sequence number that was used in the command.
75  // The (programmer-supplied) "responseHandler" function is called later to handle the response
76  // (or is called immediately - with an error code - if the command cannot be sent).
77  // "authenticator" (optional) is used for access control. If you have username and password strings, you can use this by
78  // passing an actual parameter that you created by creating an "Authenticator(username, password) object".
79  // (Note that if you supply a non-NULL "authenticator" parameter, you need do this only for the first command you send.)
82  // Issues a RTSP "OPTIONS" command, then returns the "CSeq" sequence number that was used in the command.
83  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
85  unsigned sendAnnounceCommand(char const* sdpDescription, responseHandler* responseHandler, Authenticator* authenticator = NULL);
86  // Issues a RTSP "ANNOUNCE" command (with "sdpDescription" as parameter),
87  // then returns the "CSeq" sequence number that was used in the command.
88  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
91  Boolean streamOutgoing = False,
92  Boolean streamUsingTCP = False,
93  Boolean forceMulticastOnUnspecified = False,
94  Authenticator* authenticator = NULL);
95  // Issues a RTSP "SETUP" command, then returns the "CSeq" sequence number that was used in the command.
96  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
99  double start = 0.0f, double end = -1.0f, float scale = 1.0f,
100  Authenticator* authenticator = NULL);
101  // Issues an aggregate RTSP "PLAY" command on "session", then returns the "CSeq" sequence number that was used in the command.
102  // (Note: start=-1 means 'resume'; end=-1 means 'play to end')
103  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
105  double start = 0.0f, double end = -1.0f, float scale = 1.0f,
106  Authenticator* authenticator = NULL);
107  // Issues a RTSP "PLAY" command on "subsession", then returns the "CSeq" sequence number that was used in the command.
108  // (Note: start=-1 means 'resume'; end=-1 means 'play to end')
109  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
111  // Alternative forms of "sendPlayCommand()", used to send "PLAY" commands that include an 'absolute' time range:
112  // (The "absStartTime" string (and "absEndTime" string, if present) *must* be of the form
115  char const* absStartTime, char const* absEndTime = NULL, float scale = 1.0f,
116  Authenticator* authenticator = NULL);
118  char const* absStartTime, char const* absEndTime = NULL, float scale = 1.0f,
119  Authenticator* authenticator = NULL);
121  unsigned sendPauseCommand(MediaSession& session, responseHandler* responseHandler, Authenticator* authenticator = NULL);
122  // Issues an aggregate RTSP "PAUSE" command on "session", then returns the "CSeq" sequence number that was used in the command.
123  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
124  unsigned sendPauseCommand(MediaSubsession& subsession, responseHandler* responseHandler, Authenticator* authenticator = NULL);
125  // Issues a RTSP "PAUSE" command on "subsession", then returns the "CSeq" sequence number that was used in the command.
126  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
128  unsigned sendRecordCommand(MediaSession& session, responseHandler* responseHandler, Authenticator* authenticator = NULL);
129  // Issues an aggregate RTSP "RECORD" command on "session", then returns the "CSeq" sequence number that was used in the command.
130  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
131  unsigned sendRecordCommand(MediaSubsession& subsession, responseHandler* responseHandler, Authenticator* authenticator = NULL);
132  // Issues a RTSP "RECORD" command on "subsession", then returns the "CSeq" sequence number that was used in the command.
133  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
135  unsigned sendTeardownCommand(MediaSession& session, responseHandler* responseHandler, Authenticator* authenticator = NULL);
136  // Issues an aggregate RTSP "TEARDOWN" command on "session", then returns the "CSeq" sequence number that was used in the command.
137  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
138  unsigned sendTeardownCommand(MediaSubsession& subsession, responseHandler* responseHandler, Authenticator* authenticator = NULL);
139  // Issues a RTSP "TEARDOWN" command on "subsession", then returns the "CSeq" sequence number that was used in the command.
140  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
143  char const* parameterName, char const* parameterValue,
144  Authenticator* authenticator = NULL);
145  // Issues an aggregate RTSP "SET_PARAMETER" command on "session", then returns the "CSeq" sequence number that was used in the command.
146  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
148  unsigned sendGetParameterCommand(MediaSession& session, responseHandler* responseHandler, char const* parameterName,
149  Authenticator* authenticator = NULL);
150  // Issues an aggregate RTSP "GET_PARAMETER" command on "session", then returns the "CSeq" sequence number that was used in the command.
151  // (The "responseHandler" and "authenticator" parameters are as described for "sendDescribeCommand".)
153  void sendDummyUDPPackets(MediaSession& session, unsigned numDummyPackets = 2);
154  void sendDummyUDPPackets(MediaSubsession& subsession, unsigned numDummyPackets = 2);
155  // Sends short 'dummy' (i.e., non-RTP or RTCP) UDP packets towards the server, to increase
156  // the likelihood of RTP/RTCP packets from the server reaching us if we're behind a NAT.
157  // (If we requested RTP-over-TCP streaming, then these functions have no effect.)
158  // Our implementation automatically does this just prior to sending each "PLAY" command;
159  // You should not call these functions yourself unless you know what you're doing.
161  void setSpeed(MediaSession& session, float speed = 1.0f);
162  // Set (recorded) media download speed to given value to support faster download using 'Speed:'
163  // option on 'PLAY' command.
165  Boolean changeResponseHandler(unsigned cseq, responseHandler* newResponseHandler);
166  // Changes the response handler for the previously-performed command (whose operation returned "cseq").
167  // (To turn off any response handling for the command, use a "newResponseHandler" value of NULL. This might be done as part
168  // of an implementation of a 'timeout handler' on the command, for example.)
169  // This function returns True iff "cseq" was for a valid previously-performed command (whose response is still unhandled).
171  int socketNum() const { return fInputSocketNum; }
174  char const* sourceName,
175  RTSPClient*& resultClient);
177  Boolean parseRTSPURL(char const* url,
178  char*& username, char*& password, NetAddress& address, portNumBits& portNum, char const** urlSuffix = NULL);
179  // Parses "url" as "rtsp://[<username>[:<password>]@]<server-address-or-name>[:<port>][/<stream-name>]"
180  // (Note that the returned "username" and "password" are either NULL, or heap-allocated strings that the caller must later delete[].)
182  void setUserAgentString(char const* userAgentName);
183  // sets an alternative string to be used in RTSP "User-Agent:" headers
186  // call this if you don't want the server to request 'Basic' authentication
187  // (which would cause the client to send usernames and passwords over the net).
191  char const* url() const { return fBaseURL; }
193  void useTLS() { fTLS.isNeeded = True; }
195  static unsigned responseBufferSize;
197 public: // Some compilers complain if this is "private:"
198  // The state of a request-in-progress:
200  public:
201  RequestRecord(unsigned cseq, char const* commandName, responseHandler* handler,
203  double start = 0.0f, double end = -1.0f, float scale = 1.0f, char const* contentStr = NULL);
205  char const* absStartTime, char const* absEndTime = NULL, float scale = 1.0f,
207  // alternative constructor for creating "PLAY" requests that include 'absolute' time values
208  virtual ~RequestRecord();
210  RequestRecord*& next() { return fNext; }
211  unsigned& cseq() { return fCSeq; }
212  char const* commandName() const { return fCommandName; }
213  MediaSession* session() const { return fSession; }
215  u_int32_t booleanFlags() const { return fBooleanFlags; }
216  double start() const { return fStart; }
217  double end() const { return fEnd; }
218  char const* absStartTime() const { return fAbsStartTime; }
219  char const* absEndTime() const { return fAbsEndTime; }
220  float scale() const { return fScale; }
221  char* contentStr() const { return fContentStr; }
224  private:
226  unsigned fCSeq;
227  char const* fCommandName;
230  u_int32_t fBooleanFlags;
231  double fStart, fEnd;
232  char *fAbsStartTime, *fAbsEndTime; // used for optional 'absolute' (i.e., "time=") range specifications
233  float fScale;
234  char* fContentStr;
236  };
238 protected:
239  RTSPClient(UsageEnvironment& env, char const* rtspURL,
240  int verbosityLevel, char const* applicationName, portNumBits tunnelOverHTTPPortNum, int socketNumToServer);
241  // called only by createNew();
242  virtual ~RTSPClient();
244  void reset();
245  void setBaseURL(char const* url);
246  int grabSocket(); // allows a subclass to reuse our input socket, so that it won't get closed when we're deleted
247  virtual unsigned sendRequest(RequestRecord* request);
248  virtual Boolean setRequestFields(RequestRecord* request,
249  char*& cmdURL, Boolean& cmdURLWasAllocated,
250  char const*& protocolStr,
251  char*& extraHeaders, Boolean& extraHeadersWereAllocated);
252  // used to implement "sendRequest()"; subclasses may reimplement this (e.g., when implementing a new command name)
253  virtual int connectToServer(int socketNum, portNumBits remotePortNum); // used to implement "openConnection()"; result values: -1: failure; 0: pending; 1: success
255 private: // redefined virtual functions
256  virtual Boolean isRTSPClient() const;
258 private:
259  class RequestQueue {
260  public:
261  RequestQueue();
262  RequestQueue(RequestQueue& origQueue); // moves the queue contents to the new queue
263  virtual ~RequestQueue();
265  void enqueue(RequestRecord* request); // "request" must not be NULL
267  void putAtHead(RequestRecord* request); // "request" must not be NULL
268  RequestRecord* findByCSeq(unsigned cseq);
269  Boolean isEmpty() const { return fHead == NULL; }
270  void reset();
272  private:
275  };
277  void resetTCPSockets();
278  void resetResponseBuffer();
279  int openConnection(); // result values: -1: failure; 0: pending; 1: success
280  char* createAuthenticatorString(char const* cmd, char const* url);
281  char* createBlocksizeString(Boolean streamUsingTCP);
282  char* createKeyMgmtString(char const* url, MediaSubsession const& subsession);
283  void handleRequestError(RequestRecord* request);
284  Boolean parseResponseCode(char const* line, unsigned& responseCode, char const*& responseString);
285  void handleIncomingRequest();
286  static Boolean checkForHeader(char const* line, char const* headerName, unsigned headerNameLength, char const*& headerParams);
287  Boolean parseTransportParams(char const* paramsStr,
288  char*& serverAddressStr, portNumBits& serverPortNum,
289  unsigned char& rtpChannelId, unsigned char& rtcpChannelId);
290  Boolean parseScaleParam(char const* paramStr, float& scale);
291  Boolean parseSpeedParam(char const* paramStr, float& speed);
292  Boolean parseRTPInfoParams(char const*& paramStr, u_int16_t& seqNum, u_int32_t& timestamp);
293  Boolean handleSETUPResponse(MediaSubsession& subsession, char const* sessionParamsStr, char const* transportParamsStr,
294  Boolean streamUsingTCP);
296  char const* scaleParamsStr, const char* speedParamsStr,
297  char const* rangeParamsStr, char const* rtpInfoParamsStr);
299  Boolean handleGET_PARAMETERResponse(char const* parameterName, char*& resultValueString, char* resultValueStringEnd);
300  Boolean handleAuthenticationFailure(char const* wwwAuthenticateParamsStr);
302  char const* sessionURL(MediaSession const& session) const;
303  static void handleAlternativeRequestByte(void*, u_int8_t requestByte);
304  void handleAlternativeRequestByte1(u_int8_t requestByte);
305  void constructSubsessionURL(MediaSubsession const& subsession,
306  char const*& prefix,
307  char const*& separator,
308  char const*& suffix);
310  // Support for tunneling RTSP-over-HTTP:
311  Boolean setupHTTPTunneling1(); // send the HTTP "GET"
312  static void responseHandlerForHTTP_GET(RTSPClient* rtspClient, int responseCode, char* responseString);
313  void responseHandlerForHTTP_GET1(int responseCode, char* responseString);
314  Boolean setupHTTPTunneling2(); // send the HTTP "POST"
316  // Support for asynchronous connections to the server:
317  static void connectionHandler(void*, int /*mask*/);
318  void connectionHandler1();
320  // Support for handling data sent back by a server:
321  static void incomingDataHandler(void*, int /*mask*/);
322  void incomingDataHandler1();
323  void handleResponseBytes(int newBytesRead);
325  // Writing/reading data over a (already set-up) connection:
326  int write(const char* data, unsigned count);
327  int read(u_int8_t* buffer, unsigned bufferSize);
329 public:
331  // If set to a value >0, then a "Blocksize:" header with this value (minus an allowance for
332  // IP, UDP, and RTP headers) will be sent with each "SETUP" request.
334 protected:
336  unsigned fCSeq; // sequence number, used in consecutive requests
339  struct sockaddr_storage fServerAddress;
341 private:
346  char* fBaseURL;
347  unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP
349  unsigned fSessionTimeoutParameter; // optionally set in response "Session:" headers
354  // Support for tunneling RTSP-over-HTTP:
355  char fSessionCookie[33];
359  // Optional support for TLS:
361  friend class TLSState;
362 };
368 // A simple server that creates a new "RTSPClient" object whenever a "REGISTER" request arrives (specifying the "rtsp://" URL
369 // of a stream). The new "RTSPClient" object will be created with the specified URL, and passed to the provided handler function.
371 typedef void onRTSPClientCreationFunc(RTSPClient* newRTSPClient, Boolean requestStreamingOverTCP);
374 public:
376  Port ourPort = 0, UserAuthenticationDatabase* authDatabase = NULL,
377  int verbosityLevel = 0, char const* applicationName = NULL);
378  // If ourPort.num() == 0, we'll choose the port number ourself. (Use the following function to get it.)
379  portNumBits serverPortNum() const { return ntohs(fServerPort.num()); }
381 protected:
382  HandlerServerForREGISTERCommand(UsageEnvironment& env, onRTSPClientCreationFunc* creationFunc, int ourSocketIPv4, int ourSocketIPv6, Port ourPort,
383  UserAuthenticationDatabase* authDatabase, int verbosityLevel, char const* applicationName);
384  // called only by createNew();
387  virtual RTSPClient* createNewRTSPClient(char const* rtspURL, int verbosityLevel, char const* applicationName,
388  int socketNumToServer);
389  // This function - by default - creates a (base) "RTSPClient" object. If you want to create a subclass
390  // of "RTSPClient" instead, then subclass this class, and redefine this virtual function.
392 protected: // redefined virtual functions
393  virtual char const* allowedCommandNames(); // "OPTIONS", "REGISTER", and (perhaps) "DEREGISTER" only
394  virtual Boolean weImplementREGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
395  char const* proxyURLSuffix, char*& responseStr);
396  // redefined to return True (for cmd=="REGISTER")
397  virtual void implementCmd_REGISTER(char const* cmd/*"REGISTER" or "DEREGISTER"*/,
398  char const* url, char const* urlSuffix, int socketToRemoteServer,
399  Boolean deliverViaTCP, char const* proxyURLSuffix);
401 private:
405 };
406 #endif
408 #endif
unsigned sendAnnounceCommand(char const *sdpDescription, responseHandler *responseHandler, Authenticator *authenticator=NULL)
unsigned sendSetParameterCommand(MediaSession &session, responseHandler *responseHandler, char const *parameterName, char const *parameterValue, Authenticator *authenticator=NULL)
unsigned char Boolean
Definition: Boolean.hh:25
static HandlerServerForREGISTERCommand * createNew(UsageEnvironment &env, onRTSPClientCreationFunc *creationFunc, Port ourPort=0, UserAuthenticationDatabase *authDatabase=NULL, int verbosityLevel=0, char const *applicationName=NULL)
char * fBaseURL
Definition: RTSPClient.hh:346
int write(const char *data, unsigned count)
char * fLastSessionId
Definition: RTSPClient.hh:348
int grabSocket()
unsigned sendPlayCommand(MediaSession &session, responseHandler *responseHandler, double start=0.0f, double end=-1.0f, float scale=1.0f, Authenticator *authenticator=NULL)
unsigned fCSeq
Definition: RTSPClient.hh:336
Boolean parseResponseCode(char const *line, unsigned &responseCode, char const *&responseString)
Boolean handleGET_PARAMETERResponse(char const *parameterName, char *&resultValueString, char *resultValueStringEnd)
Boolean parseScaleParam(char const *paramStr, float &scale)
RequestRecord(unsigned cseq, char const *commandName, responseHandler *handler, MediaSession *session=NULL, MediaSubsession *subsession=NULL, u_int32_t booleanFlags=0, double start=0.0f, double end=-1.0f, float scale=1.0f, char const *contentStr=NULL)
virtual Boolean isRTSPClient() const
RequestRecord * fHead
Definition: RTSPClient.hh:273
RequestRecord * fTail
Definition: RTSPClient.hh:274
const Boolean False
Definition: Boolean.hh:28
Boolean fHTTPTunnelingConnectionIsPending
Definition: RTSPClient.hh:357
Boolean changeResponseHandler(unsigned cseq, responseHandler *newResponseHandler)
RequestQueue fRequestsAwaitingConnection
Definition: RTSPClient.hh:352
virtual unsigned sendRequest(RequestRecord *request)
int fOutputSocketNum
Definition: RTSPClient.hh:345
u_int16_t portNumBits
Definition: NetAddress.hh:102
unsigned sessionTimeoutParameter() const
Definition: RTSPClient.hh:189
unsigned sendDescribeCommand(responseHandler *responseHandler, Authenticator *authenticator=NULL)
Boolean handleAuthenticationFailure(char const *wwwAuthenticateParamsStr)
char * contentStr() const
Definition: RTSPClient.hh:221
void resetResponseBuffer()
Boolean handlePLAYResponse(MediaSession *session, MediaSubsession *subsession, char const *scaleParamsStr, const char *speedParamsStr, char const *rangeParamsStr, char const *rtpInfoParamsStr)
void responseHandlerForHTTP_GET1(int responseCode, char *responseString)
void incomingDataHandler1()
RequestRecord *& next()
Definition: RTSPClient.hh:210
char * fUserAgentHeaderStr
Definition: RTSPClient.hh:343
unsigned char fTCPStreamIdCount
Definition: RTSPClient.hh:347
unsigned fSessionCookieCounter
Definition: RTSPClient.hh:356
struct sockaddr_storage fServerAddress
Definition: RTSPClient.hh:339
MediaSession * session() const
Definition: RTSPClient.hh:213
void connectionHandler1()
unsigned sendSetupCommand(MediaSubsession &subsession, responseHandler *responseHandler, Boolean streamOutgoing=False, Boolean streamUsingTCP=False, Boolean forceMulticastOnUnspecified=False, Authenticator *authenticator=NULL)
void setUserAgentString(char const *userAgentName)
#define NULL
Boolean parseTransportParams(char const *paramsStr, char *&serverAddressStr, portNumBits &serverPortNum, unsigned char &rtpChannelId, unsigned char &rtcpChannelId)
unsigned fUserAgentHeaderStrLen
Definition: RTSPClient.hh:344
static RTSPClient * createNew(UsageEnvironment &env, char const *rtspURL, int verbosityLevel=0, char const *applicationName=NULL, portNumBits tunnelOverHTTPPortNum=0, int socketNumToServer=-1)
Boolean resendCommand(RequestRecord *request)
portNumBits num() const
Definition: NetAddress.hh:108
void putAtHead(RequestRecord *request)
unsigned sendOptionsCommand(responseHandler *responseHandler, Authenticator *authenticator=NULL)
void() responseHandler(RTSPClient *rtspClient, int resultCode, char *resultString)
Definition: RTSPClient.hh:55
void handleResponseBytes(int newBytesRead)
char const * sessionURL(MediaSession const &session) const
Boolean parseRTPInfoParams(char const *&paramStr, u_int16_t &seqNum, u_int32_t &timestamp)
char * createBlocksizeString(Boolean streamUsingTCP)
MediaSession * fSession
Definition: RTSPClient.hh:228
void disallowBasicAuthentication()
Definition: RTSPClient.hh:185
portNumBits serverPortNum() const
Definition: RTSPClient.hh:379
virtual ~RTSPClient()
void handleAlternativeRequestByte1(u_int8_t requestByte)
Boolean parseSpeedParam(char const *paramStr, float &speed)
static void incomingDataHandler(void *, int)
RequestQueue fRequestsAwaitingResponse
Definition: RTSPClient.hh:352
void enqueue(RequestRecord *request)
onRTSPClientCreationFunc * fCreationFunc
Definition: RTSPClient.hh:402
unsigned fResponseBufferBytesLeft
Definition: RTSPClient.hh:351
virtual int connectToServer(int socketNum, portNumBits remotePortNum)
Definition: RTSPClient.hh:360
void setBaseURL(char const *url)
int fInputSocketNum
Definition: RTSPClient.hh:345
void handleRequestError(RequestRecord *request)
static Boolean lookupByName(UsageEnvironment &env, char const *sourceName, RTSPClient *&resultClient)
Boolean isNeeded
Definition: TLSState.hh:40
void sendDummyUDPPackets(MediaSession &session, unsigned numDummyPackets=2)
portNumBits portNum(struct sockaddr_storage const &address)
unsigned fResponseBytesAlreadySeen
Definition: RTSPClient.hh:351
static void connectionHandler(void *, int)
Boolean parseRTSPURL(char const *url, char *&username, char *&password, NetAddress &address, portNumBits &portNum, char const **urlSuffix=NULL)
void useTLS()
Definition: RTSPClient.hh:193
void constructSubsessionURL(MediaSubsession const &subsession, char const *&prefix, char const *&separator, char const *&suffix)
virtual Boolean weImplementREGISTER(char const *cmd, char const *proxyURLSuffix, char *&responseStr)
RequestRecord * fNext
Definition: RTSPClient.hh:225
virtual Boolean setRequestFields(RequestRecord *request, char *&cmdURL, Boolean &cmdURLWasAllocated, char const *&protocolStr, char *&extraHeaders, Boolean &extraHeadersWereAllocated)
static void handleAlternativeRequestByte(void *, u_int8_t requestByte)
virtual RTSPClient * createNewRTSPClient(char const *rtspURL, int verbosityLevel, char const *applicationName, int socketNumToServer)
Boolean fAllowBasicAuthentication
Definition: RTSPClient.hh:338
unsigned sendRecordCommand(MediaSession &session, responseHandler *responseHandler, Authenticator *authenticator=NULL)
RTSPClient(UsageEnvironment &env, char const *rtspURL, int verbosityLevel, char const *applicationName, portNumBits tunnelOverHTTPPortNum, int socketNumToServer)
Definition: Media.hh:50
void reset()
Authenticator fCurrentAuthenticator
Definition: RTSPClient.hh:337
Boolean setupHTTPTunneling1()
static unsigned responseBufferSize
Definition: RTSPClient.hh:195
Boolean handleTEARDOWNResponse(MediaSession &session, MediaSubsession &subsession)
virtual char const * allowedCommandNames()
char * fResponseBuffer
Definition: RTSPClient.hh:350
char const * commandName() const
Definition: RTSPClient.hh:212
char * createKeyMgmtString(char const *url, MediaSubsession const &subsession)
static Boolean checkForHeader(char const *line, char const *headerName, unsigned headerNameLength, char const *&headerParams)
int fVerbosityLevel
Definition: RTSPClient.hh:335
virtual void implementCmd_REGISTER(char const *cmd, char const *url, char const *urlSuffix, int socketToRemoteServer, Boolean deliverViaTCP, char const *proxyURLSuffix)
int socketNum() const
Definition: RTSPClient.hh:171
Boolean handleSETUPResponse(MediaSubsession &subsession, char const *sessionParamsStr, char const *transportParamsStr, Boolean streamUsingTCP)
char const * url() const
Definition: RTSPClient.hh:191
char fSessionCookie[33]
Definition: RTSPClient.hh:355
char * createAuthenticatorString(char const *cmd, char const *url)
unsigned sendTeardownCommand(MediaSession &session, responseHandler *responseHandler, Authenticator *authenticator=NULL)
Boolean setupHTTPTunneling2()
char const * absStartTime() const
Definition: RTSPClient.hh:218
int read(u_int8_t *buffer, unsigned bufferSize)
static void responseHandlerForHTTP_GET(RTSPClient *rtspClient, int responseCode, char *responseString)
char * rtspURL(ServerMediaSession const *serverMediaSession, int clientSocket=-1, Boolean useIPv6=False) const
int openConnection()
const Boolean True
Definition: Boolean.hh:31
RequestQueue fRequestsAwaitingHTTPTunneling
Definition: RTSPClient.hh:352
u_int16_t desiredMaxIncomingPacketSize
Definition: RTSPClient.hh:330
void handleIncomingRequest()
void resetTCPSockets()
responseHandler * fHandler
Definition: RTSPClient.hh:235
portNumBits fTunnelOverHTTPPortNum
Definition: RTSPClient.hh:342
HandlerServerForREGISTERCommand(UsageEnvironment &env, onRTSPClientCreationFunc *creationFunc, int ourSocketIPv4, int ourSocketIPv6, Port ourPort, UserAuthenticationDatabase *authDatabase, int verbosityLevel, char const *applicationName)
Boolean isEmpty() const
Definition: RTSPClient.hh:269
unsigned sendGetParameterCommand(MediaSession &session, responseHandler *responseHandler, char const *parameterName, Authenticator *authenticator=NULL)
unsigned fSessionTimeoutParameter
Definition: RTSPClient.hh:349
RequestRecord * dequeue()
void setSpeed(MediaSession &session, float speed=1.0f)
responseHandler *& handler()
Definition: RTSPClient.hh:222
RequestRecord * findByCSeq(unsigned cseq)
char const * absEndTime() const
Definition: RTSPClient.hh:219
u_int32_t booleanFlags() const
Definition: RTSPClient.hh:215
unsigned sendPauseCommand(MediaSession &session, responseHandler *responseHandler, Authenticator *authenticator=NULL)
void onRTSPClientCreationFunc(RTSPClient *newRTSPClient, Boolean requestStreamingOverTCP)
Definition: RTSPClient.hh:371
MediaSubsession * fSubsession
Definition: RTSPClient.hh:229
MediaSubsession * subsession() const
Definition: RTSPClient.hh:214