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-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 | |
34 | class TLSState { |
35 | public: |
36 | TLSState(class RTSPClient& client); |
37 | virtual ~TLSState(); |
38 | |
39 | public: |
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 | |
46 | private: |
47 | void reset(); |
48 | Boolean setup(int socketNum); |
49 | |
50 | #ifndef NO_OPENSSL |
51 | private: |
52 | class RTSPClient& fClient; |
53 | Boolean fHasBeenSetup; |
54 | SSL_CTX* fCtx; |
55 | SSL* fCon; |
56 | #endif |
57 | }; |
58 | |
59 | #endif |
60 | |