1#if defined(HAVE_CONFIG_H)
14#define RESIPROCATE_SUBSYSTEM ReTurnSubsystem::RETURN
27 mContext.set_options(asio::ssl::context::default_workarounds |
28 asio::ssl::context::single_dh_use);
33 mContext.set_password_callback(std::bind(&TlsServer::getPassword,
this));
40 throw asio::system_error(
ec);
49 mContext.use_private_key_file(
keyFilename.c_str(), asio::ssl::context::pem,
ec);
52 ErrLog(<<
"Unable to load server private key file: " <<
keyFilename <<
", error=" <<
ec.value() <<
"(" <<
ec.message() <<
")");
53 throw asio::system_error(
ec);
61 throw asio::system_error(
ec);
65 asio::ip::tcp::endpoint
endpoint(address, port);
68 mAcceptor.set_option(asio::ip::tcp::acceptor::reuse_address(
true));
73 asio::ip::v6_only
v6_opt(
true);
74 mAcceptor.set_option(
v6_opt);
81 InfoLog(<<
"TlsServer started. Listening on " << address.to_string() <<
":" << port);
87 mNewConnection.reset(
new TlsConnection(mIOService, mConnectionManager, mRequestHandler, mContext));
88 mAcceptor.async_accept(((
TlsConnection*)mNewConnection.get())->socket(), std::bind(&TlsServer::handleAccept,
this, std::placeholders::_1));
92TlsServer::getPassword()
const
98TlsServer::handleAccept(
const asio::error_code&
e)
104 const asio::ip::address
remoteAddress = ((TlsConnection*)mNewConnection.get())->socket().remote_endpoint(
ec).address();
111 mNewConnection->stop();
114 mNewConnection.reset(
new TlsConnection(mIOService, mConnectionManager, mRequestHandler, mContext));
115 mAcceptor.async_accept(((TlsConnection*)mNewConnection.get())->socket(), std::bind(&TlsServer::handleAccept,
this, std::placeholders::_1));
119 ErrLog(<<
"Error in handleAccept: " <<
e.value() <<
"-" <<
e.message());
120 if(
e == asio::error::no_descriptors)
123 mNewConnection.reset(
new TlsConnection(mIOService, mConnectionManager, mRequestHandler, mContext));
124 mAcceptor.async_accept(((TlsConnection*)mNewConnection.get())->socket(), std::bind(&TlsServer::handleAccept,
this, std::placeholders::_1));
void start(ConnectionPtr c, const asio::ip::address &remoteAddress)
Add the specified connection, from remoteAddress, to the manager and start it - or,...
long mOpenSSLCTXClearOptions
resip::Data mTlsTempDhFilename
resip::Data mTlsPrivateKeyPassword
long mOpenSSLCTXSetOptions
resip::Data mTlsServerCertificateFilename
resip::Data mTlsServerPrivateKeyFilename
The common handler for all incoming requests.
const ReTurnConfig & getConfig()
Represents a single connection from a client.
TlsServer(const TlsServer &)=delete
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
const char * c_str() const
Returns a null-terminated string representing.