BMASession Class Referenceabstract

`#include <BMASession.h>`

Inheritance diagram for BMASession:
[legend]
Collaboration diagram for BMASession:
[legend]

## Public Member Functions

| BMASession (BMAEPoll &ePoll, BMATCPServerSocket &server)
virtual void | init ()
virtual void | output (BMASession *session)
void | send ()
void | sendToAll ()
void | sendToAll (BMASessionFilter *filter)
BMATCPServerSocket & | getServer ()
Public Member Functions inherited from BMATCPSocket
| BMATCPSocket (BMAEPoll &ePoll)
void | connect (BMAIPAddress &address)
virtual void | output (std::stringstream &out)
Public Member Functions inherited from BMASocket
| BMASocket (BMAEPoll &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
BMATCPServerSocket & | server
Public Attributes inherited from BMATCPSocket
BMAIPAddress | ipAddress
Public Attributes inherited from BMASocket
class {
} | bufferSize
Public Attributes inherited from BMAObject
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)=0
Protected Member Functions inherited from BMASocket
void | setBufferSize (int length)
virtual void | onTLSInit ()
void | shutdown ()
virtual void | receiveData (char *buffer, int bufferLength)

## Additional Inherited Members

Protected Attributes inherited from BMASocket
BMAEPoll & | ePoll
bool | shutDown = false

## Detailed Description

BMASession

BMASession 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.

## Member Function Documentation

## onConnected()

void BMASession::onConnected | ( |  | ) |

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 BMASocket.

## onDataReceived()

void BMASession::onDataReceived | ( | std::string | data | ) |

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

Parameters

  data | the data that has been received from the socket.

Implements BMASocket.

## send()

void BMASession::send | ( |  | ) |

The send method is used to output the contents of the out stream to the session containing the stream.

## sendToAll() [1/2]

void BMASession::sendToAll | ( |  | ) |

Use this sendToAll method to output the contents of the out stream to all the connections on the server excluding the sender session.

## sendToAll() [2/2]

void BMASession::sendToAll | ( | BMASessionFilter * | 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.

The documentation for this class was generated from the following files:

- /home/barant/Development/BMA/server_core/ServerCore/BMASession.h
- /home/barant/Development/BMA/server_core/ServerCore/BMASession.cpp