Bond's TCP Library
1.0
Bond's TCP Client/Server Library
|
|
Go to the documentation of this file.
57 void start(in_port_t port,
string bindaddress,
bool useSSL =
false,
int backlog = 64);
61 void start(in_port_t port,
char *bindaddress,
bool useSSL =
false,
int backlog = 64);
71 bool listening() {
return state_ == SocketState::LISTENING; }
74 static bool printifaddrs();
85 void handleEvents(uint32_t events)
override;
93 virtual Session* createSession(
const int socket,
const sockaddr_in peer_address) = 0;
96 bool findifaddr(
const string ifname, sockaddr *addr);
104 bool bindToAddress(sockaddr *addr, socklen_t len);
105 bool startListening(
int backlog);
106 bool acceptConnection();
107 bool useSSL_ {
false};
109 struct sockaddr_storage addr_;
130 bool connected()
const {
return state_ == SocketState::CONNECTED; }
138 void disconnect()
override;
146 :
DataSocket(epoll,server.domain(),socket), server_(server), port_(peer_addr.sin_port), addr_(peer_addr.sin_addr.s_addr) { }
155 virtual void accepted();
164 void disconnected()
override;
168 void connectionMessage(
string action);
SSLContext * ctx()
Get the SSL context for the server.
Session(EPoll &epoll, Server &server, const int socket, const struct sockaddr_in peer_addr)
Creates a new session.
bool connected() const
Returns true if the session is connected to a peer.
Shared base classes for tcpclient.h and tcpserver.h.
in_port_t peer_port() const
Returns the peer port number used to connect to this Session.
Represents a buffered socket that can send and receive data using optional SSL encryption.
Encapsulates an SSL connection data structure.
bool listening()
Determine if the server is listening.
std::map< int, tcp::Session * > sessions
Maps socket handles to their corresponding tcp::Session objects.
Encapsulates an openSSL SSL_CTX record.
Server(EPoll &epoll, SSLContext *ctx, const int domain=AF_INET)
Construct a server instance.
Encapsulates the EPoll interface.
Listens for TCP connections and establishes Sessions.
Provides ssl client and server functionality.
in_addr_t peer_address() const
Returns the peer address used to connect to this Session.
Server & server() const
Returns a reference to the Server that owns this Session.
A tcp client/server library for linux that supports openSSL and EPoll.
Encapsulates a socket handle that is capable of recieving epoll events.
Represents a TCP connection accepted by the Server.