live
RTSPCommon.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 // Common routines used by both RTSP clients and servers
19 // C++ header
20 
21 #ifndef _RTSP_COMMON_HH
22 #define _RTSP_COMMON_HH
23 
24 #ifndef _BOOLEAN_HH
25 #include "Boolean.hh"
26 #endif
27 
28 #ifndef _MEDIA_HH
29 #include <Media.hh> // includes some definitions perhaps needed for Borland compilers?
30 #endif
31 
32 #if defined(__WIN32__) || defined(_WIN32) || defined(_QNX4)
33 #define _strncasecmp _strnicmp
34 #define snprintf _snprintf
35 #else
36 #define _strncasecmp strncasecmp
37 #endif
38 
39 #define RTSP_PARAM_STRING_MAX 200
40 
41 Boolean parseRTSPRequestString(char const *reqStr, unsigned reqStrSize,
42  char *resultCmdName,
43  unsigned resultCmdNameMaxSize,
44  char* resultURLPreSuffix,
45  unsigned resultURLPreSuffixMaxSize,
46  char* resultURLSuffix,
47  unsigned resultURLSuffixMaxSize,
48  char* resultCSeq,
49  unsigned resultCSeqMaxSize,
50  char* resultSessionId,
51  unsigned resultSessionIdMaxSize,
52  unsigned& contentLength);
53 
54 Boolean parseRangeParam(char const* paramStr, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow);
55 Boolean parseRangeHeader(char const* buf, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow);
56 
57 Boolean parseScaleHeader(char const* buf, float& scale);
58 
59 Boolean RTSPOptionIsSupported(char const* commandName, char const* optionsResponseString);
60  // Returns True iff the RTSP command "commandName" is mentioned as one of the commands supported in "optionsResponseString"
61  // (which should be the 'resultString' from a previous RTSP "OPTIONS" request).
62 
63 char const* dateHeader(); // A "Date:" header that can be used in a RTSP (or HTTP) response
64 
65 #endif
unsigned char Boolean
Definition: Boolean.hh:25
Boolean parseRangeHeader(char const *buf, double &rangeStart, double &rangeEnd, char *&absStartTime, char *&absEndTime, Boolean &startTimeIsNow)
Boolean parseRangeParam(char const *paramStr, double &rangeStart, double &rangeEnd, char *&absStartTime, char *&absEndTime, Boolean &startTimeIsNow)
Boolean parseScaleHeader(char const *buf, float &scale)
char const * dateHeader()
Boolean parseRTSPRequestString(char const *reqStr, unsigned reqStrSize, char *resultCmdName, unsigned resultCmdNameMaxSize, char *resultURLPreSuffix, unsigned resultURLPreSuffixMaxSize, char *resultURLSuffix, unsigned resultURLSuffixMaxSize, char *resultCSeq, unsigned resultCSeqMaxSize, char *resultSessionId, unsigned resultSessionIdMaxSize, unsigned &contentLength)
Boolean RTSPOptionIsSupported(char const *commandName, char const *optionsResponseString)