TLSState.hh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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-2020 Live Networks, Inc. All rights reserved.
  16. // State encapsulating a TLS connection
  17. // C++ header
  18. #ifndef _TLS_STATE_HH
  19. #define _TLS_STATE_HH
  20. #ifndef _NET_COMMON_H
  21. #include "NetCommon.h"
  22. #endif
  23. #ifndef _BOOLEAN_HH
  24. #include "Boolean.hh"
  25. #endif
  26. #ifndef NO_OPENSSL
  27. #include <openssl/ssl.h>
  28. #endif
  29. class TLSState {
  30. public:
  31. TLSState(class RTSPClient& client);
  32. virtual ~TLSState();
  33. public:
  34. Boolean isNeeded;
  35. int connect(int socketNum); // returns: -1 (unrecoverable error), 0 (pending), 1 (done)
  36. int write(const char* data, unsigned count);
  37. int read(u_int8_t* buffer, unsigned bufferSize);
  38. private:
  39. void reset();
  40. Boolean setup(int socketNum);
  41. #ifndef NO_OPENSSL
  42. private:
  43. class RTSPClient& fClient;
  44. Boolean fHasBeenSetup;
  45. SSL_CTX* fCtx;
  46. SSL* fCon;
  47. #endif
  48. };
  49. #endif