BMA Server Framework
|
#include <Session.h>
Public Member Functions | |
Session (EPoll &ePoll, Service &service) | |
virtual void | init () |
virtual void | output (Session *session) |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
![]() | |
TCPSocket (EPoll &ePoll) | |
void | connect (IPAddress &address) |
virtual void | output (std::stringstream &out) |
![]() | |
Socket (EPoll &ePoll) | |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. | |
void | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
void | write (std::string data) |
void | write (char *buffer, int length) |
void | output (std::stringstream &out) |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
virtual void | onUnregistered () |
Called when the socket has finished unregistering for the epoll processing. More... | |
void | enable (bool mode) |
Enable the socket to read or write based upon buffer. | |
Public Attributes | |
std::stringstream | out |
Service & | service |
![]() | |
IPAddress | ipAddress |
![]() | |
class { | |
} | bufferSize |
![]() | |
std::string | name |
std::string | tag |
Protected Member Functions | |
void | onDataReceived (std::string data) override |
Called when data is received from the socket. More... | |
void | onConnected () override |
Called when socket is open and ready to communicate. More... | |
virtual void | protocol (std::string data) |
![]() | |
void | setBufferSize (int length) |
virtual void | onTLSInit () |
void | shutdown () |
virtual void | receiveData (char *buffer, int bufferLength) |
Additional Inherited Members | |
![]() | |
EPoll & | ePoll |
bool | shutDown = false |
Session defines the nature of the interaction with the client and stores persistent data for a defined session. BMASession objects are not sockets but instead provide a communications control mechanism. Protocol conversations are provided through extensions from this object.
|
overrideprotectedvirtual |
Called when socket is open and ready to communicate.
The onConnected method is called when the socket is ready to communicate. Writing to the socket can begin on this call to initiate a contact with the remote device.
Reimplemented from core::Socket.
|
overrideprotectedvirtual |
Called when data is received from the socket.
The onDataReceived method is called when the socket has received an event from epoll and there is data ready to be read from the socket. The default handler will pull the data and put it into the streambuf for the socket. EPOLLIN
data | the data that has been received from the socket. |
Implements core::Socket.
|
protectedvirtual |
Override the protocol method to manage and control the session communications in your inherited session. If you do not override this method then the Session default will process the 'commands' added to the server object using the processRequest method on the session input.
Reimplemented in core::TLSSession, and core::ConsoleSession.
void core::Session::send | ( | ) |
The send method is used to output the contents of the out stream to the session containing the stream.
void core::Session::sendToAll | ( | ) |
Use this sendToAll method to output the contents of the out stream to all the connections on the server excluding the sender session.
void core::Session::sendToAll | ( | SessionFilter | filter | ) |
Use this sendToAll method to output the contents of the out stream to all the connections on the server excluding the sender session and the entries identified by the passed in filter object.