RTSPCommon.hh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. This library is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  9. more details.
  10. You should have received a copy of the GNU Lesser General Public License
  11. along with this library; if not, write to the Free Software Foundation, Inc.,
  12. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  13. **********/
  14. // "liveMedia"
  15. // Copyright (c) 1996-2019 Live Networks, Inc. All rights reserved.
  16. // Common routines used by both RTSP clients and servers
  17. // C++ header
  18. #ifndef _RTSP_COMMON_HH
  19. #define _RTSP_COMMON_HH
  20. #ifndef _BOOLEAN_HH
  21. #include "Boolean.hh"
  22. #endif
  23. #ifndef _MEDIA_HH
  24. #include <Media.hh> // includes some definitions perhaps needed for Borland compilers?
  25. #endif
  26. #if defined(__WIN32__) || defined(_WIN32) || defined(_QNX4)
  27. #define _strncasecmp _strnicmp
  28. #define snprintf _snprintf
  29. #else
  30. #define _strncasecmp strncasecmp
  31. #endif
  32. #define RTSP_PARAM_STRING_MAX 200
  33. Boolean parseRTSPRequestString(char const *reqStr, unsigned reqStrSize,
  34. char *resultCmdName,
  35. unsigned resultCmdNameMaxSize,
  36. char* resultURLPreSuffix,
  37. unsigned resultURLPreSuffixMaxSize,
  38. char* resultURLSuffix,
  39. unsigned resultURLSuffixMaxSize,
  40. char* resultCSeq,
  41. unsigned resultCSeqMaxSize,
  42. char* resultSessionId,
  43. unsigned resultSessionIdMaxSize,
  44. unsigned& contentLength);
  45. Boolean parseRangeParam(char const* paramStr, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow);
  46. Boolean parseRangeHeader(char const* buf, double& rangeStart, double& rangeEnd, char*& absStartTime, char*& absEndTime, Boolean& startTimeIsNow);
  47. Boolean parseScaleHeader(char const* buf, float& scale);
  48. Boolean RTSPOptionIsSupported(char const* commandName, char const* optionsResponseString);
  49. // Returns True iff the RTSP command "commandName" is mentioned as one of the commands supported in "optionsResponseString"
  50. // (which should be the 'resultString' from a previous RTSP "OPTIONS" request).
  51. char const* dateHeader(); // A "Date:" header that can be used in a RTSP (or HTTP) response
  52. #endif