21 #ifndef G_SOCKET_PROTOCOL_H
22 #define G_SOCKET_PROTOCOL_H
33 class SocketProtocol ;
34 class SocketProtocolImp ;
35 class SocketProtocolSink ;
60 G_EXCEPTION( SecureConnectionTimeout ,
"secure connection timeout" ) ;
124 virtual void onSecure(
const std::string & peer_certificate ) = 0 ;
void readEvent()
Called on receipt of a read event.
std::string::size_type size_type
A std::size_t type.
virtual ~SocketProtocolSink()
Destructor.
virtual void onSecure(const std::string &peer_certificate)=0
Called once the secure socket protocol has been successfully negotiated.
void sslAccept()
Accepts the TLS/SSL protocol.
A private implementation class used by GNet::SocketProtocol.
virtual void onData(const char *, std::string::size_type)=0
Called when data is read from the socket.
std::string peerCertificate() const
Returns the peer's TLS/SSL certificate or the empty string.
A derivation of Socket for a stream socket.
~SocketProtocol()
Destructor.
SocketProtocol(EventHandler &, Sink &, StreamSocket &, unsigned int secure_connection_timeout)
Constructor. The references are kept.
A base class for classes that handle asynchronous socket events.
bool send(const std::string &data, std::string::size_type offset=0U)
Sends data.
#define G_EXCEPTION(class_name, description)
define as a function rather than a type if optimising for size
static bool sslCapable()
Returns true if the implementation supports TLS/SSL.
void sslConnect()
Initiates the TLS/SSL protocol.
An interface used by GNet::SocketProtocol to deliver data from a socket.
An interface for implementing a low-level protocol layer by means of calling read() and write() on a ...
bool sslEnabled() const
Returns true if TLS/SSL is active.
bool writeEvent()
Called on receipt of a write event.
#define G_EXCEPTION_CLASS(class_name, description)