reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TlsBaseTransport.hxx
Go to the documentation of this file.
1#if !defined(RESIP_TLSBASETRANSPORT_HXX)
2#define RESIP_TLSBASETRANSPORT_HXX
3
4#if defined(HAVE_CONFIG_H)
5 #include "config.h"
6#endif
7
8
13
14#include <openssl/ssl.h>
15
16#include <atomic>
17
18namespace resip
19{
20
21class Connection;
22class Message;
23class Security;
24
26{
27 public:
30 int portNum,
31 IpVersion version,
32 const Data& interfaceObj,
33 Security& security,
34 const Data& sipDomain,
36 TransportType transportType,
37 AfterSocketCreationFuncPtr socketFunc=0,
39 unsigned transportFlags = 0,
41 bool useEmailAsSIP = false,
42 const Data& certificateFilename = "",
43 const Data& privateKeyFilename = "",
44 const Data& privateKeyPassPhrase = "");
45 virtual ~TlsBaseTransport();
46
47 void onReload();
48
49 SSL_CTX* getCtx();
50
54 { return mUseEmailAsSIP; };
55
78 void *func,
79 void *arg);
80
81 protected:
82 Connection* createConnection(const Tuple& who, Socket fd, bool server=false);
83
88 /* If true, we will accept the email address in a client's subjectAltName
89 as if it were a SIP URI. This is convenient because many commercial
90 CAs offer email certificates but not sip: certificates */
95 // Set by onReload(), which runs on another thread than the transport's
96 std::atomic<bool> mReloadCertificate;
97
98 private:
99 SSL_CTX* createDomainCtx();
100 void reloadDomainCtx();
101
102 // Kept so that a reloaded mDomainCtx gets the callback too
103 int (*mCertVerifyCallback)(X509_STORE_CTX*, void*) = nullptr;
104 void* mCertVerifyCallbackArg = nullptr;
105};
106
107}
108
109#endif
110
111/* ====================================================================
112 * The Vovida Software License, Version 1.0
113 *
114 * Copyright (c) 2026 SIP Spectrum, Inc. https://www.sipspectrum.com
115 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
116 *
117 * Redistribution and use in source and binary forms, with or without
118 * modification, are permitted provided that the following conditions
119 * are met:
120 *
121 * 1. Redistributions of source code must retain the above copyright
122 * notice, this list of conditions and the following disclaimer.
123 *
124 * 2. Redistributions in binary form must reproduce the above copyright
125 * notice, this list of conditions and the following disclaimer in
126 * the documentation and/or other materials provided with the
127 * distribution.
128 *
129 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
130 * and "Vovida Open Communication Application Library (VOCAL)" must
131 * not be used to endorse or promote products derived from this
132 * software without prior written permission. For written
133 * permission, please contact vocal@vovida.org.
134 *
135 * 4. Products derived from this software may not be called "VOCAL", nor
136 * may "VOCAL" appear in their name, without prior written
137 * permission of Vovida Networks, Inc.
138 *
139 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
140 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
141 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
142 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
143 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
144 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
145 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
146 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
147 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
148 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
149 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
150 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
151 * DAMAGE.
152 *
153 * ====================================================================
154 *
155 * This software consists of voluntary contributions made by Vovida
156 * Networks, Inc. and many individuals on behalf of Vovida Networks,
157 * Inc. For more information on Vovida Networks, Inc., please see
158 * <http://www.vovida.org/>.
159 *
160 */
struct ssl_ctx_st SSL_CTX
static Compression Disabled
Represents a compression configuration object with compression disabled.
Connection implements, via sockets, ConnectionBase for managed connections.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
A templated, threadsafe message-queue class.
Definition Fifo.hxx:16
SecurityTypes::TlsClientVerificationMode mClientVerificationMode
SecurityTypes::TlsClientVerificationMode getClientVerificationMode()
std::atomic< bool > mReloadCertificate
bool setPeerCertificateVerificationCallback(SecurityTypes::SSLVendor vendor, void *func, void *arg)
Set a custom callback function to be used by the SSL stack to inspect the peer certificate.
RESIP_HeapCount(TlsBaseTransport)
SecurityTypes::SSLType mSslType
Connection * createConnection(const Tuple &who, Socket fd, bool server=false)
Makes new Connection using provided socket.
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;
void(* AfterSocketCreationFuncPtr)(Socket s, int transportType, const char *file, int line)
Definition Socket.hxx:107
int Socket
Definition Socket.hxx:94
TransportType
An enumeration of transport protocols.
IpVersion
An enumeration of IP versions.