| 1 | // |
| 2 | // SecureServerSocketImpl.cpp |
| 3 | // |
| 4 | // Library: NetSSL_OpenSSL |
| 5 | // Package: SSLSockets |
| 6 | // Module: SecureServerSocketImpl |
| 7 | // |
| 8 | // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH. |
| 9 | // and Contributors. |
| 10 | // |
| 11 | // SPDX-License-Identifier: BSL-1.0 |
| 12 | // |
| 13 | |
| 14 | |
| 15 | #include "Poco/Net/SecureServerSocketImpl.h" |
| 16 | |
| 17 | |
| 18 | namespace Poco { |
| 19 | namespace Net { |
| 20 | |
| 21 | |
| 22 | SecureServerSocketImpl::SecureServerSocketImpl(Context::Ptr pContext): |
| 23 | _impl(new ServerSocketImpl, pContext) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | |
| 28 | SecureServerSocketImpl::~SecureServerSocketImpl() |
| 29 | { |
| 30 | try |
| 31 | { |
| 32 | reset(); |
| 33 | } |
| 34 | catch (...) |
| 35 | { |
| 36 | poco_unexpected(); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | |
| 41 | SocketImpl* SecureServerSocketImpl::acceptConnection(SocketAddress& clientAddr) |
| 42 | { |
| 43 | return _impl.acceptConnection(clientAddr); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | void SecureServerSocketImpl::connect(const SocketAddress& /*address*/) |
| 48 | { |
| 49 | throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket" ); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | void SecureServerSocketImpl::connect(const SocketAddress& /*address*/, const Poco::Timespan& /*timeout*/) |
| 54 | { |
| 55 | throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket" ); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | void SecureServerSocketImpl::connectNB(const SocketAddress& /*address*/) |
| 60 | { |
| 61 | throw Poco::InvalidAccessException("Cannot connect() a SecureServerSocket" ); |
| 62 | } |
| 63 | |
| 64 | |
| 65 | void SecureServerSocketImpl::bind(const SocketAddress& address, bool reuseAddress, bool reusePort) |
| 66 | { |
| 67 | _impl.bind(address, reuseAddress, reusePort); |
| 68 | reset(_impl.sockfd()); |
| 69 | } |
| 70 | |
| 71 | void SecureServerSocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only) |
| 72 | { |
| 73 | _impl.bind6(address, reuseAddress, ipV6Only); |
| 74 | reset(_impl.sockfd()); |
| 75 | } |
| 76 | |
| 77 | void SecureServerSocketImpl::listen(int backlog) |
| 78 | { |
| 79 | _impl.listen(backlog); |
| 80 | reset(_impl.sockfd()); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | void SecureServerSocketImpl::close() |
| 85 | { |
| 86 | reset(); |
| 87 | _impl.close(); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | int SecureServerSocketImpl::sendBytes(const void* /*buffer*/, int /*length*/, int /*flags*/) |
| 92 | { |
| 93 | throw Poco::InvalidAccessException("Cannot sendBytes() on a SecureServerSocket" ); |
| 94 | } |
| 95 | |
| 96 | |
| 97 | int SecureServerSocketImpl::receiveBytes(void* /*buffer*/, int /*length*/, int /*flags*/) |
| 98 | { |
| 99 | throw Poco::InvalidAccessException("Cannot receiveBytes() on a SecureServerSocket" ); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | int SecureServerSocketImpl::sendTo(const void* /*buffer*/, int /*length*/, const SocketAddress& /*address*/, int /*flags*/) |
| 104 | { |
| 105 | throw Poco::InvalidAccessException("Cannot sendTo() on a SecureServerSocket" ); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | int SecureServerSocketImpl::receiveFrom(void* /*buffer*/, int /*length*/, SocketAddress& /*address*/, int /*flags*/) |
| 110 | { |
| 111 | throw Poco::InvalidAccessException("Cannot receiveFrom() on a SecureServerSocket" ); |
| 112 | } |
| 113 | |
| 114 | |
| 115 | void SecureServerSocketImpl::sendUrgent(unsigned char /*data*/) |
| 116 | { |
| 117 | throw Poco::InvalidAccessException("Cannot sendUrgent() on a SecureServerSocket" ); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | bool SecureServerSocketImpl::secure() const |
| 122 | { |
| 123 | return true; |
| 124 | } |
| 125 | |
| 126 | |
| 127 | } } // namespace Poco::Net |
| 128 | |