reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TlsConnection.hxx
Go to the documentation of this file.
1#if !defined(TlsConnection_hxx)
2#define TlsConnection_hxx
3
4#if defined(HAVE_CONFIG_H)
5 #include "config.h"
6#endif
7
8
13
14// If USE_SSL is not defined, this will not be built, and this header will
15// not be installed. If you are including this file from a source tree, and are
16// getting link errors, the source tree was probably built without USE_SSL.
17//#ifdef USE_SSL
18//#include <openssl/ssl.h>
19//#else
20//typedef void BIO;
21//typedef void SSL;
22//#endif
23
24#include <openssl/ssl.h>
25
26namespace resip
27{
28
29class Tuple;
30class Security;
31
33{
34 public:
36
38 Security* security, bool server, Data domain,
40 Compression &compression);
41
42 virtual ~TlsConnection();
43
44 int read( char* buf, const int count );
45 int write( const char* buf, const int count );
46 virtual bool hasDataToRead(); // has data that can be read
47 virtual bool isGood(); // has valid connection
48 virtual bool isWritable();
49
50 virtual bool transportWrite();
51
52 void getPeerNames(std::list<Data> & peerNames) const;
53
57 const Data& getSni() const { return mSni; }
58
60 static const char * fromState(TlsState);
61
62 private:
65 void computePeerName();
66 Data getPeerNamesData() const;
67 TlsState checkState();
68 bool handleOpenSSLErrorQueue(int ret, unsigned long err, const char* op, bool addToAdditionalFailureStrings = false);
69
70 bool mServer;
71 Security* mSecurity;
73 Data mDomain;
74
75 TlsState mTlsState;
76 bool mHandShakeWantsRead;
77
78 SSL* mSsl;
79 BIO* mBio;
80 std::list<BaseSecurity::PeerName> mPeerNames;
81 Data mSni;
82};
83
84}
85
86#endif
87
88/* ====================================================================
89 * The Vovida Software License, Version 1.0
90 *
91 * Copyright (c) 2026 SIP Spectrum, Inc. https://www.sipspectrum.com
92 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
93 *
94 * Redistribution and use in source and binary forms, with or without
95 * modification, are permitted provided that the following conditions
96 * are met:
97 *
98 * 1. Redistributions of source code must retain the above copyright
99 * notice, this list of conditions and the following disclaimer.
100 *
101 * 2. Redistributions in binary form must reproduce the above copyright
102 * notice, this list of conditions and the following disclaimer in
103 * the documentation and/or other materials provided with the
104 * distribution.
105 *
106 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
107 * and "Vovida Open Communication Application Library (VOCAL)" must
108 * not be used to endorse or promote products derived from this
109 * software without prior written permission. For written
110 * permission, please contact vocal@vovida.org.
111 *
112 * 4. Products derived from this software may not be called "VOCAL", nor
113 * may "VOCAL" appear in their name, without prior written
114 * permission of Vovida Networks, Inc.
115 *
116 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
117 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
119 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
120 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
121 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
122 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
123 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
124 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
125 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
127 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
128 * DAMAGE.
129 *
130 * ====================================================================
131 *
132 * This software consists of voluntary contributions made by Vovida
133 * Networks, Inc. and many individuals on behalf of Vovida Networks,
134 * Inc. For more information on Vovida Networks, Inc., please see
135 * <http://www.vovida.org/>.
136 *
137 */
struct ssl_st SSL
virtual Transport * transport() const
Connection implements, via sockets, ConnectionBase for managed connections.
int read()
move data from the connection to the buffer; move this to front of least recently used list.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
static const char * fromState(TlsState)
int write(const char *buf, const int count)
pure virtual, but need concrete Connection for book-ends of lists
virtual bool isGood()
has valid connection
const Data & getSni() const
SNI the client sent in its ClientHello, for connections we accepted (server mode); empty if it sent n...
RESIP_HeapCount(TlsConnection)
virtual bool hasDataToRead()
always true – always add to fdset as read ready
virtual bool transportWrite()
virtual bool isWritable()
void getPeerNames(std::list< Data > &peerNames) const
The base class for Transport classes.
Definition Transport.hxx:83
Represents a network address.
Definition Tuple.hxx:59
SSLType
Note: Before adding to the SSLType enum, please see the comments about mTlsCtx in resip/stack/ssl/Sec...
dcm! – add UnusedChecking(_enum) below;
int Socket
Definition Socket.hxx:94