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-2020 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
41Boolean 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
54Boolean parseRangeParam(char const* paramStr, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow);
55Boolean parseRangeHeader(char const* buf, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow);
56
57Boolean parseScaleHeader(char const* buf, float& scale);
58
59Boolean 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
63char const* dateHeader(); // A "Date:" header that can be used in a RTSP (or HTTP) response
64
65#endif
66