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