diff --git a/.gitignore b/.gitignore index a5a9324..06448b5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ Release *~ *.mk libServerCore.a +docs/latex/ +docs/html diff --git a/Command.cpp b/Command.cpp index 6720121..e5fe0bf 100644 --- a/Command.cpp +++ b/Command.cpp @@ -1,23 +1,12 @@ #include "Command.h" #include "Log.h" +#include "CommandList.h" namespace core { - - Command::Command() {} - - Command::Command(CommandList &commandList) : commandList(commandList) {} int Command::processCommand(std::string request, TCPSession *session, std::stringstream &data) { return 0; } - - void grabInput() { - commandList.grapInput(this); - } - - void clearGrab() { - commandList.clearGrab(this); - } void Command::output(Session *session) {} diff --git a/Command.h b/Command.h index 31c66c0..e3c999a 100644 --- a/Command.h +++ b/Command.h @@ -7,6 +7,8 @@ #include "PString.h" namespace core { + + class CommandList; class Session; @@ -20,9 +22,6 @@ namespace core { class Command : public Object { public: - - Command(); - Command(CommandList &commandList); /// /// Implement check method to provide a special check rule upon the request to see @@ -73,14 +72,9 @@ namespace core { void setName(std::string name); std::string getName(); - - void grabInput(); - void clearGrab(); private: - std::string name; - CommandList &commandList; - + std::string name; }; diff --git a/CommandList.cpp b/CommandList.cpp index 9ba6265..1474518 100644 --- a/CommandList.cpp +++ b/CommandList.cpp @@ -14,15 +14,15 @@ namespace core { bool CommandList::processRequest(std::string request, TCPSession *session, std::stringstream &data) { if(session->grab != NULL) - session->grab->processCommand(request, session, data); + return session->grab->processCommand(request, session, data); else { int pos = request.find(" "); std::string function = pos == request.npos ? request: request.substr(0, pos); for(auto *command : commands) if(command->check(function)) - command->processCommand(request, session, data); + return command->processCommand(request, session, data); } - return true; + return false; } bool CommandList::grabInput(TCPSession *session, Command &command) { diff --git a/TCPSession.cpp b/TCPSession.cpp index 775957a..0967014 100644 --- a/TCPSession.cpp +++ b/TCPSession.cpp @@ -16,10 +16,9 @@ namespace core { } void TCPSession::protocol(std::string data = "") { - if(data.length() > 0) { - if(!server.commands.processRequest(data, this, out)) - server.sessionErrorHandler("Invalid data received.", out); - } + if(!server.commands.processRequest(data, this, out)) + if(data != "") + server.sessionErrorHandler("Invalid data received.", out); } void TCPSession::onRegistered() { @@ -38,24 +37,43 @@ namespace core { memcpy(lineBuffer + lineBufferSize, data, len); lineBufferSize += len; while(lineBufferSize > 0) { - int lineLength = strcspn(lineBuffer, "\r\n"); - if(lineLength == lineBufferSize) - break; - onLineReceived(std::string(lineBuffer, lineLength)); - if(lineBuffer[lineLength] == '\r') - ++lineLength; - if(lineBuffer[lineLength] == '\n') - ++lineLength; - lineBufferSize -= lineLength; - if(lineBufferSize > 0) - memmove(lineBuffer, lineBuffer + lineLength, lineBufferSize); - lineBuffer = (char *)realloc(lineBuffer, lineBufferSize); - } + switch(mode) { + case LINE: + int lineLength = strcspn(lineBuffer, "\r\n"); + if(lineLength == lineBufferSize) + break; + onLineReceived(std::string(lineBuffer, lineLength)); + if(lineBuffer[lineLength] == '\r') + ++lineLength; + if(lineBuffer[lineLength] == '\n') + ++lineLength; + lineBufferSize -= lineLength; + if(lineBufferSize > 0) + memmove(lineBuffer, lineBuffer + lineLength, lineBufferSize); + lineBuffer = (char *)realloc(lineBuffer, lineBufferSize); + break; + case BLOCK: + if(lineBufferSize >= blockLength) { + onBlockReceived(std::string(lineBuffer, blockLength)); + lineBufferSize -= blockLength; + if(lineBufferSize > 0) + memmove(lineBuffer, lineBuffer + blockLength, lineBufferSize); + lineBuffer = (char *)realloc(lineBuffer, lineBufferSize); + } + break; + } + } } } + + void setMode(Mode mode, int blockSize = 0) { + this->mode = mode; + this->blockSize = blockSize; + } void TCPSession::onLineReceived(std::string line) { coreutils::Log(coreutils::LOG_DEBUG_3) << "[" << line << "]"; + protocol(line); send(); if(term) diff --git a/TCPSession.h b/TCPSession.h index ddb92fe..c48ca33 100644 --- a/TCPSession.h +++ b/TCPSession.h @@ -14,16 +14,28 @@ namespace core { /// TCPSession /// /// TCPSession defines the nature of the interaction with the client - /// and stores persistent data for a defined session. BMASession objects + /// and stores persistent data for a defined session. TCPSession objects /// are not sockets but instead provide a communications control /// mechanism. Protocol conversations are provided through extensions /// from this object. /// + /// + /// class TCPSession : public TCPSocket { public: + + /// + /// + /// + TCPSession(EPoll &ePoll, TCPServer &server, std::string text = ""); + + /// + /// + /// + ~TCPSession(); Command *grab = NULL; @@ -59,13 +71,13 @@ namespace core { void sendToAll(SessionFilter filter); /// - /// + /// Use this method to terminate this TCPSession. /// void terminate(); /// - /// + /// /// TCPServer &server; @@ -95,6 +107,15 @@ namespace core { virtual void onLineReceived(std::string line); + /// + /// Override the onBlockReceived method to receive a string of characters that + /// represents a single block of data of length determined by the block length value. If + /// onDataReceived was overriden this method will not be called unless the onDataReceived + /// calls this method explicitly using the class and member name. + /// + + virtual void onBlockReceived(std::string block); + /// /// This method is called from within the protocol method when protocol is called /// on the initial connection where the data is an empty string. Use this method @@ -107,16 +128,31 @@ namespace core { /// 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. + /// processRequest method on the session input. + /// + /// When data is received within the session two modes are available to pass the + /// data through the protocol method: LINE or BLOCK. /// virtual void protocol(std::string data); + /// + /// Use the setMode method to set the receiving mode for the data on this socket. + /// Data can be received in LINE mode, which will receive data from the socket one + /// line at a time, or BLOCK mode where a certain specified data block is received + /// before calling the onBlockReceived method. + /// + + void setMode(Mode mode, int size = 0); + private: char *lineBuffer = NULL; int lineBufferSize = 0; std::mutex mtx; bool term = false; + enum Mode {LINE, BLOCK}; + enum Mode mode = LINE; + int blockSize; }; diff --git a/docs/guide/BMASockets Programmer's Guide.tex b/docs/guide/BMASockets Programmer's Guide.tex index b693f69..bf5867d 100644 --- a/docs/guide/BMASockets Programmer's Guide.tex +++ b/docs/guide/BMASockets Programmer's Guide.tex @@ -101,14 +101,22 @@ the BMATCPServerSocket or BMAUDPServerSocket, depending on the type desired, and the BMASession object. When extending the BMATCPServerSocket all that is needed is to -override the getSocketAccept() method to return an extended BMASession +override the getSocketAccept() method to return an extended TCPSession object. This basically tells the server to spawn a new session of a particular type for every new connection to the bound TCP port. -The extended BMASession object can override the onDataReceived() -method to handle the incoming requests for the socket. An entire -application structure could be built upon this mechanism to handle -complex protocols with the client. +Data received in the session can be delivered to the application +using two different modes. The LINE mode will call the onLineReceived() +handler for each line received in the buffer. The line termination can +be LF or CRLF combination and is filtered from the string handed to +the onLineReceived() method call. The BLOCK mode will call the +onBlockReceived() handler for each blockSize bytes received in the +data buffer. + +The extended TCPSession object can override the onLineReceived() +and/or the onBlockReceived() methods to handle the incoming requests +for the socket. An entire application structure could be built upon +this mechanism to handle complex protocols with the client. \chapter{Sample Server Example} diff --git a/docs/html/_command_8cpp.html b/docs/html/_command_8cpp.html new file mode 100644 index 0000000..2e7f369 --- /dev/null +++ b/docs/html/_command_8cpp.html @@ -0,0 +1,135 @@ + + +
+ + + + +
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::Command |
+Namespaces | |
core | |
This is the complete list of members for core::IPAddressList, including all inherited members.
-add(IPAddress ipAddress) (defined in core::IPAddressList) | core::IPAddressList | |
contains(std::string ipAddress) (defined in core::IPAddressList) | core::IPAddressList | |
getList() (defined in core::IPAddressList) | core::IPAddressList | |
IPAddressList() (defined in core::IPAddressList) | core::IPAddressList | |
remove(IPAddress ipAddress) (defined in core::IPAddressList) | core::IPAddressList |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::CommandList |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "includes"
#include "TLSServer.h"
#include "Command.h"
#include "EPoll.h"
#include "LogListener.h"
Go to the source code of this file.
++Classes | |
class | core::ConsoleServer |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::ConsoleSession |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "Log.h"
#include "Socket.h"
#include "Thread.h"
#include "TCPSession.h"
#include "Command.h"
Go to the source code of this file.
++Classes | |
class | core::EPoll |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
Go to the source code of this file.
-Public Member Functions | |
-std::map< std::string, IPAddress > | getList () |
-void | add (IPAddress ipAddress) |
-bool | remove (IPAddress ipAddress) |
-bool | contains (std::string ipAddress) |
+Classes | |
class | core::INotify |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
This is the complete list of members for core::Object, including all inherited members.
-name (defined in core::Object) | core::Object | |
tag (defined in core::Object) | core::Object |
#include "IPAddress.h"
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::IPAddress |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "IPAddressList.h"
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::IPAddressList |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "includes"
Go to the source code of this file.
++Classes | |
class | core::Object |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::SessionFilter |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::Socket |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "TCPServer.h"
#include "EPoll.h"
#include "TCPSession.h"
#include "Exception.h"
#include "Log.h"
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "Socket.h"
#include "TCPSocket.h"
#include "IPAddressList.h"
#include "Command.h"
#include "CommandList.h"
Go to the source code of this file.
++Classes | |
class | core::TCPServer |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+Functions | |
void | core::setMode (Mode mode, int blockSize=0) |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::TCPSession |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::TCPSocket |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "TLSServer.h"
#include "TLSSession.h"
#include "EPoll.h"
#include "TCPSession.h"
#include "Exception.h"
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "Socket.h"
#include "TCPServer.h"
#include "Command.h"
#include "TCPSession.h"
#include "IPAddress.h"
Go to the source code of this file.
++Classes | |
class | core::TLSServer |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+Functions | |
void | core::handshake_complete (const SSL *ssl, int where, int ret) |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::TLSSession |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "TerminalSession.h"
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::TerminalSession |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::Thread |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::Timer |
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
Go to the source code of this file.
++Classes | |
class | core::UDPServerSocket |
+Namespaces | |
core | |
This is the complete list of members for core::SessionFilter, including all inherited members.
-name (defined in core::Object) | core::Object | |
tag (defined in core::Object) | core::Object | |
test(TCPSession &session) (defined in core::SessionFilter) | core::SessionFilter | inlinevirtual |
#include "UDPSocket.h"
+Namespaces | |
core | |
+ ServerCore
+
+ |
+
#include "Socket.h"
Go to the source code of this file.
++Classes | |
class | core::UDPSocket |
+Namespaces | |
core | |
▼Ncore | |
▼Ncore | |
CCommand | |
CCommandList | |
CConsoleServer | |
CConsoleService | |
CConsoleSession | |
CEPoll | |
CConsoleSession | |
CEPoll | |
CINotify | |
CIPAddress | |
CIPAddressList | |
CObject | |
CService | |
CSession | |
CSessionFilter | |
CSocket | |
CTCPServerSocket | |
CTCPSocket | |
CTerminalSession | |
CThread | |
CTimer | |
CTLSServerSocket | |
CTLSService | |
CTLSSession | |
CUDPServerSocket | |
CUDPSocket | |
CSessionFilter | |
CSocket | |
CTCPServer | |
CTCPSession | |
CTCPSocket | |
CTerminalSession | |
CThread | |
CTimer | |
CTLSServer | |
CTLSSession | |
CUDPServerSocket | |
CUDPSocket |
This is the complete list of members for core::Command, including all inherited members.
check(std::string request) | core::Command | virtual |
getName() (defined in core::Command) | core::Command | |
getName() | core::Command | |
output(Session *session) | core::Command | virtual |
processCommand(std::string request, Session *session, std::stringstream &data) | core::Command | virtual |
processCommand(std::string request, TCPSession *session, std::stringstream &data) | core::Command | virtual |
setName(std::string name) | core::Command | |
tag (defined in core::Object) | core::Object | |
tag | core::Object |
virtual bool | check (std::string request) |
virtual int | processCommand (std::string request, Session *session, std::stringstream &data) |
virtual void | output (Session *session) |
virtual int | processCommand (std::string request, TCPSession *session, std::stringstream &data) |
virtual void | output (Session *session) |
void | setName (std::string name) |
-std::string | getName () |
std::string | getName () |
Additional Inherited Members | |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
std::string core::Command::getName | +( | +) | ++ |
Reimplemented in core::Service.
- - -Reimplemented in core::EPoll, core::TCPServerSocket, and core::CommandList.
+Reimplemented in core::CommandList, core::EPoll, and core::TCPServer.
@@ -274,15 +288,15 @@ std::stringadd(Command &command, std::string name="") | core::CommandList | |
check(std::string request) | core::Command | virtual |
CommandList() | core::CommandList | |
commands (defined in core::CommandList) | core::CommandList | protected |
getName() (defined in core::Command) | core::Command | |
output(Session *session) | core::Command | virtual |
processCommand(std::string request, Session *session, std::stringstream &data) override | core::CommandList | virtual |
processRequest(std::string request, Session *session, std::stringstream &data) (defined in core::CommandList) | core::CommandList | |
remove(Command &command) (defined in core::CommandList) | core::CommandList | |
setName(std::string name) | core::Command | |
tag (defined in core::Object) | core::Object | |
~CommandList() | core::CommandList | |
clearGrab(TCPSession *session) | core::CommandList | |
commands | core::CommandList | protected |
getName() | core::Command | |
grabInput(TCPSession *session, Command &command) | core::CommandList | |
output(Session *session) | core::Command | virtual |
processCommand(std::string request, TCPSession *session, std::stringstream &data) | core::CommandList | virtual |
processRequest(std::string request, TCPSession *session, std::stringstream &data) | core::CommandList | |
remove(Command &command) | core::CommandList | |
setName(std::string name) | core::Command | |
tag | core::Object |
Public Member Functions | |
CommandList () | |
~CommandList () | |
void | add (Command &command, std::string name="") |
-void | remove (Command &command) |
void | remove (Command &command) |
-bool | processRequest (std::string request, Session *session, std::stringstream &data) |
int | processCommand (std::string request, Session *session, std::stringstream &data) override |
bool | processRequest (std::string request, TCPSession *session, std::stringstream &data) |
bool | grabInput (TCPSession *session, Command &command) |
void | clearGrab (TCPSession *session) |
int | processCommand (std::string request, TCPSession *session, std::stringstream &data) |
![]() | |
virtual bool | check (std::string request) |
virtual void | output (Session *session) |
virtual void | output (Session *session) |
void | setName (std::string name) |
-std::string | getName () |
std::string | getName () |
Protected Attributes | |
-std::vector< Command * > | commands |
std::vector< Command * > | commands |
Additional Inherited Members | |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
This object organizes Command objects into a list that is used to parse an input and run the process associated with the selected command.
-core::CommandList::CommandList | -( | -) | -- |
The constructor for the object.
- -core::CommandList::~CommandList | -( | -) | -- |
The destructor for the object.
- -void core::CommandList::clearGrab | +( | +TCPSession * | +session | ) | ++ |
bool core::CommandList::grabInput | +( | +TCPSession * | +session, | +
+ | + | Command & | +command | +
+ | ) | ++ |
Use grabInput() within a Command object to force the requesting handler to receive all further input from the socket. Use releaseGrab() method to release the session back to normal command processing.
+ +Reimplemented from core::Command.
+Reimplemented from core::Command.
+ +bool core::CommandList::processRequest | +( | +std::string | +request, | +
+ | + | TCPSession * | +session, | +
+ | + | std::stringstream & | +data | +
+ | ) | ++ |
Use this method to apply a parsed PString to the command set and execute the matching parameter. The selected command will return a true on a call to check(). If there is a handler that has a grab on the process handler then control is given to the process handler holding the grab on the input.
+ +void core::CommandList::remove | +( | +Command & | +command | ) | ++ |
Remove a command object from the command list.
+ +
+
|
+ +protected | +
The vector of all registered commands.
This is the complete list of members for core::ConsoleServer, including all inherited members.
#include <ConsoleServer.h>
Public Member Functions | |
- | ConsoleServer (EPoll &ePoll, Service &service, IPAddress address) |
-void | logSend (std::string out) override |
ConsoleServer (EPoll &ePoll, IPAddress address) | |
void | logSend (std::string out) override |
![]() | |
TCPServerSocket (EPoll &ePoll, Service &service, IPAddress address) | |
~TCPServerSocket () | |
TCPSession * | getSocketAccept (EPoll &ePoll) override |
![]() | |
TCPServer (EPoll &ePoll, IPAddress address, std::string text="") | |
~TCPServer () | |
void | removeFromSessionList (TCPSession *session) |
virtual void | sessionErrorHandler (std::string errorString, std::stringstream &out) |
void | output (TCPSession *session) |
Output the consoles array to the console. More... | |
![]() | |
- | TCPSocket (EPoll &ePoll) |
TCPSocket (EPoll &ePoll) | |
-void | connect (IPAddress &address) |
TCPSocket (EPoll &ePoll, std::string text) | |
~TCPSocket () | |
void | connect (IPAddress &address) |
virtual void | output (std::stringstream &out) |
![]() | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onUnregister () |
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. | |
bool | needsToWrite () |
![]() | |
virtual bool | check (std::string request) |
virtual void | output (Session *session) |
virtual void | output (Session *session) |
void | setName (std::string name) |
-std::string | getName () |
std::string | getName () |
Additional Inherited Members | |
![]() | |
Service & | service |
IPAddressList * | blackList |
IPAddressList * | whiteList |
![]() | |
IPAddressList * | blackList |
IPAddressList * | whiteList |
std::vector< TCPSession * > | sessions |
CommandList | commands |
![]() | |
-IPAddress | ipAddress |
IPAddress | ipAddress |
![]() | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
![]() | |
void | onDataReceived (std::string data) override |
int | processCommand (std::string command, Session *session, std::stringstream &data) override |
![]() | |
void | onDataReceived (std::string data) override |
int | processCommand (std::string command, TCPSession *session, std::stringstream &data) override |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
virtual void | onConnected () |
Called when socket is open and ready to communicate. More... | |
-virtual void | onTLSInit () |
int | getBufferSize () |
virtual void | onDataReceived (char *buffer, int len) |
virtual void | receiveData (char *buffer, int bufferLength) |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
core::ConsoleServer::ConsoleServer | +( | +EPoll & | +ePoll, | +
+ | + | IPAddress | +address | +
+ | ) | ++ |
+
|
+ +overridevirtual | +
getSocketAccept is designed to allow a polymorphic extension of this object to return a type of object that extends the definition of the server socket. Returning the appropriate session object that extends from Session provides the mechanism where the server can select the protocol dialog for the desired service.
+ +Reimplemented from core::TCPServer.
+ +
+
|
+ +override | +
This is the complete list of members for core::ConsoleSession, including all inherited members.
Public Member Functions | |
- | ConsoleSession (EPoll &ePoll, Service &service) |
-void | writeLog (std::string data) |
ConsoleSession (EPoll &ePoll, TCPServer &server) | |
~ConsoleSession () | |
void | writeLog (std::string data) |
![]() | |
- | TerminalSession (EPoll &ePoll, Service &service) |
-int | getLines () |
TerminalSession (EPoll &ePoll, TCPServer &server) | |
~TerminalSession () | |
int | getLines () |
-void | clear () |
void | clear () |
-void | clearEOL () |
void | clearEOL () |
-void | setCursorLocation (int x, int y) |
void | setCursorLocation (int x, int y) |
-void | setColor (int color) |
void | setColor (int color) |
-void | setBackColor (int color) |
void | setBackColor (int color) |
-void | saveCursor () |
void | saveCursor () |
-void | restoreCursor () |
void | restoreCursor () |
-void | NextLine (int lines) |
void | NextLine (int lines) |
-void | PreviousLine (int lines) |
void | PreviousLine (int lines) |
-void | scrollArea (int start, int end) |
void | scrollArea (int start, int end) |
![]() | |
- | Session (EPoll &ePoll, Service &service) |
virtual void | output (std::stringstream &data) |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
![]() | |
TCPSession (EPoll &ePoll, TCPServer &server, std::string text="") | |
~TCPSession () | |
virtual void | output (std::stringstream &data) |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
void | terminate () |
![]() | |
- | TCPSocket (EPoll &ePoll) |
TCPSocket (EPoll &ePoll) | |
-void | connect (IPAddress &address) |
TCPSocket (EPoll &ePoll, std::string text) | |
~TCPSocket () | |
void | connect (IPAddress &address) |
![]() | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onUnregister () |
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. | |
bool | needsToWrite () |
Protected Member Functions | |
void | protocol (std::string data) override |
![]() | |
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 | onRegistered () override |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onDataReceived (char *data, int len) override |
virtual void | onLineReceived (std::string line) |
virtual void | onBlockReceived (std::string block) |
virtual void | onConnected () |
void | setMode (Mode mode, int size=0) |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
-virtual void | onTLSInit () |
int | getBufferSize () |
virtual void | onDataReceived (std::string data) |
Called when data is received from the socket. More... | |
virtual void | receiveData (char *buffer, int bufferLength) |
Additional Inherited Members | |
![]() | |
-std::stringstream | out |
-Service & | service |
![]() | |
Command * | grab = NULL |
std::stringstream | out |
TCPServer & | server |
![]() | |
-IPAddress | ipAddress |
IPAddress | ipAddress |
![]() | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
Extends the session parameters for this TCPSocket derived object. Extend the protocol() method in order to define the behavior and protocol interaction for this socket which is a console session.
-core::ConsoleSession::ConsoleSession | +( | +EPoll & | +ePoll, | +
+ | + | TCPServer & | +server | +
+ | ) | ++ |
core::ConsoleSession::~ConsoleSession | +( | +) | ++ |
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.
+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.
+When data is received within the session two modes are available to pass the data through the protocol method: LINE or BLOCK.
-Reimplemented from core::Session.
+Reimplemented from core::TCPSession.
+ +void core::ConsoleSession::writeLog | +( | +std::string | +data | ) | ++ |
~EPoll () | |
bool | start (int numberOfThreads, int maxSockets) |
Start the BMAEPoll processing. More... | |
Start the BMAEPoll processing. More... | |
bool | stop () |
Stop and shut down the BMAEPoll processing. More... | |
Stop and shut down the BMAEPoll processing. More... | |
bool | isStopping () |
Returns a true if the stop command has been requested. More... | |
Returns a true if the stop command has been requested. More... | |
bool | registerSocket (Socket *socket) |
Register a BMASocket for monitoring by BMAEPoll. More... | |
Register a BMASocket for monitoring by BMAEPoll. More... | |
bool | unregisterSocket (Socket *socket) |
Unregister a BMASocket from monitoring by BMAEPoll. More... | |
Unregister a BMASocket from monitoring by BMAEPoll. More... | |
int | getDescriptor () |
Return the descriptor for the ePoll socket. More... | |
Return the descriptor for the ePoll socket. More... | |
void | eventReceived (struct epoll_event event) |
Dispatch event to appropriate socket. More... | |
Dispatch event to appropriate socket. More... | |
int | processCommand (std::string command, Session *session, std::stringstream &data) override |
Output the threads array to the console. More... | |
int | processCommand (std::string command, TCPSession *session, std::stringstream &data) override |
Output the threads array to the console. More... | |
void | resetSocket (Socket *socket) |
![]() | |
virtual bool | check (std::string request) |
virtual void | output (Session *session) |
virtual void | output (Session *session) |
void | setName (std::string name) |
-std::string | getName () |
std::string | getName () |
Public Attributes | |
int | maxSockets |
The maximum number of socket allowed. More... | |
The maximum number of socket allowed. More... | |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
Manage socket events from the epoll system call.
Use this object to establish a socket server using the epoll network structure of Linux.
-Use this object to establish the basis of working with multiple sockets of all sorts using the epoll capabilities of the Linux platform. Socket objects can register with BMAEPoll which will establish a communication mechanism with that socket.
+Use this object to establish the basis of working with multiple sockets of all sorts using the epoll capabilities of the Linux platform. Socket objects can register with EPoll which will establish a communication mechanism with that socket.
The maximum number of sockets to communicate with is specified on the start method.
Threads are used to establish a read queue for epoll. The desired number of threads (or queues) is established by a parameter on the start method.
Returns a true if the stop command has been requested.
-This method returns a true if the stop() method has been called and the epoll system is shutting.
+This method returns a true if the stop() method has been called and the epoll system is shutting.
Output the threads array to the console.
-The processCommand() method displays the thread array to the requesting console via the session passed as parameter.
+The processCommand() method displays the thread array to the requesting console via the session passed as parameter.
session | the session to write the requested data to. | tag | -tag |
socket | The Socket to register. |
void core::EPoll::resetSocket | +( | +Socket * | +socket | ) | ++ |
Start the BMAEPoll processing.
-Use the start() method to initiate the threads and begin epoll queue processing.
+Use the start() method to initiate the threads and begin epoll queue processing.
numberOfThreads | the number of threads to start for processing epoll entries. | tag | tag |
socket | The Socket to unregister. |
+ ServerCore
+
+ |
+
This is the complete list of members for core::INotify, including all inherited members.
+addWatch(std::string watch) | core::INotify | |
inAccess(std::string name) | core::INotify | inlinevirtual |
inAttrib(std::string name) | core::INotify | inlinevirtual |
inCloseNoWrite(std::string name) | core::INotify | inlinevirtual |
inCloseWrite(std::string name) | core::INotify | inlinevirtual |
inCreate(std::string name) | core::INotify | inlinevirtual |
inDelete(std::string name) | core::INotify | inlinevirtual |
inDeleteSelf(std::string name) | core::INotify | inlinevirtual |
inModify(std::string name) | core::INotify | inlinevirtual |
inMovedFrom(std::string name) | core::INotify | inlinevirtual |
inMovedTo(std::string name) | core::INotify | inlinevirtual |
inMoveSelf(std::string name) | core::INotify | inlinevirtual |
inOpen(std::string name) | core::INotify | inlinevirtual |
INotify(EPoll &ePoll) | core::INotify | |
onDataReceived(char *buffer, int len) override | core::INotify | virtual |
core::Socket::onDataReceived(std::string data) | core::Socket | privatevirtual |
removeWatch(int wd) | core::INotify | |
~INotify() | core::INotify |
+ ServerCore
+
+ |
+
#include <INotify.h>
+Public Member Functions | |
INotify (EPoll &ePoll) | |
~INotify () | |
int | addWatch (std::string watch) |
void | removeWatch (int wd) |
void | onDataReceived (char *buffer, int len) override |
virtual void | inAccess (std::string name) |
virtual void | inAttrib (std::string name) |
virtual void | inCloseWrite (std::string name) |
virtual void | inCloseNoWrite (std::string name) |
virtual void | inCreate (std::string name) |
virtual void | inDelete (std::string name) |
virtual void | inDeleteSelf (std::string name) |
virtual void | inModify (std::string name) |
virtual void | inMoveSelf (std::string name) |
virtual void | inMovedFrom (std::string name) |
virtual void | inMovedTo (std::string name) |
virtual void | inOpen (std::string name) |
core::INotify::INotify | +( | +EPoll & | +ePoll | ) | ++ |
core::INotify::~INotify | +( | +) | ++ |
int core::INotify::addWatch | +( | +std::string | +watch | ) | ++ |
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +inlinevirtual | +
+
|
+ +overridevirtual | +
Reimplemented from core::Socket.
+ +void core::INotify::removeWatch | +( | +int | +wd | ) | ++ |
This is the complete list of members for core::IPAddress, including all inherited members.
addr (defined in core::IPAddress) | core::IPAddress | |
addressLength (defined in core::IPAddress) | core::IPAddress | |
addr | core::IPAddress | |
addressLength | core::IPAddress | |
getClientAddress() | core::IPAddress | |
getClientAddressAndPort() | core::IPAddress | |
getClientPort() | core::IPAddress | |
getPointer() (defined in core::IPAddress) | core::IPAddress | |
IPAddress() (defined in core::IPAddress) | core::IPAddress | |
IPAddress(std::string address) (defined in core::IPAddress) | core::IPAddress | |
IPAddress(std::string address, int port) (defined in core::IPAddress) | core::IPAddress | |
name (defined in core::Object) | core::Object | |
tag (defined in core::Object) | core::Object | |
~IPAddress() (defined in core::IPAddress) | core::IPAddress | |
getPointer() | core::IPAddress | |
IPAddress() | core::IPAddress | |
IPAddress(std::string address) | core::IPAddress | |
IPAddress(std::string address, int port) | core::IPAddress | |
name | core::Object | |
tag | core::Object | |
~IPAddress() | core::IPAddress |
#include <IPAddress.h>
Public Member Functions | |
- | IPAddress (std::string address) |
IPAddress () | |
IPAddress (std::string address) | |
- | IPAddress (std::string address, int port) |
IPAddress (std::string address, int port) | |
-struct sockaddr * | getPointer () |
~IPAddress () | |
struct sockaddr * | getPointer () |
-std::string | getClientAddress () |
Get the client network address as xxx.xxx.xxx.xxx. | |
std::string | getClientAddress () |
Get the client network address as xxx.xxx.xxx.xxx. More... | |
-std::string | getClientAddressAndPort () |
Get the client network address and port as xxx.xxx.xxx.xxx:ppppp. | |
std::string | getClientAddressAndPort () |
Get the client network address and port as xxx.xxx.xxx.xxx:ppppp. More... | |
-int | getClientPort () |
Get the client network port number. | |
int | getClientPort () |
Get the client network port number. More... | |
Public Attributes | |
-struct sockaddr_in | addr |
struct sockaddr_in | addr |
-socklen_t | addressLength |
socklen_t | addressLength |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
core::IPAddress::IPAddress | +( | +) | ++ |
core::IPAddress::IPAddress | +( | +std::string | +address | ) | ++ |
core::IPAddress::IPAddress | +( | +std::string | +address, | +
+ | + | int | +port | +
+ | ) | ++ |
core::IPAddress::~IPAddress | +( | +) | ++ |
std::string core::IPAddress::getClientAddress | +( | +) | ++ |
Get the client network address as xxx.xxx.xxx.xxx.
+ +std::string core::IPAddress::getClientAddressAndPort | +( | +) | ++ |
Get the client network address and port as xxx.xxx.xxx.xxx:ppppp.
+ +int core::IPAddress::getClientPort | +( | +) | ++ |
Get the client network port number.
+ +struct sockaddr * core::IPAddress::getPointer | +( | +) | ++ |
struct sockaddr_in core::IPAddress::addr | +
socklen_t core::IPAddress::addressLength | +
This is the complete list of members for core::IPAddressList, including all inherited members.
add(IPAddress ipAddress) (defined in core::IPAddressList) | core::IPAddressList | |
contains(std::string ipAddress) (defined in core::IPAddressList) | core::IPAddressList | |
getList() (defined in core::IPAddressList) | core::IPAddressList | |
IPAddressList() (defined in core::IPAddressList) | core::IPAddressList | |
remove(IPAddress ipAddress) (defined in core::IPAddressList) | core::IPAddressList | |
add(IPAddress ipAddress) | core::IPAddressList | |
contains(std::string ipAddress) | core::IPAddressList | |
getList() | core::IPAddressList | |
IPAddressList() | core::IPAddressList | |
remove(IPAddress ipAddress) | core::IPAddressList |
#include <IPAddressList.h>
Public Member Functions | |
-std::map< std::string, IPAddress > | getList () |
IPAddressList () | |
std::map< std::string, IPAddress > | getList () |
-bool | add (IPAddress ipAddress) |
-bool | remove (IPAddress ipAddress) |
void | add (IPAddress ipAddress) |
bool | remove (IPAddress ipAddress) |
-bool | contains (std::string ipAddress) |
bool | contains (std::string ipAddress) |
core::IPAddressList::IPAddressList | +( | +) | ++ |
void core::IPAddressList::add | +( | +IPAddress | +ipAddress | ) | ++ |
bool core::IPAddressList::contains | +( | +std::string | +ipAddress | ) | ++ |
std::map< std::string, IPAddress > core::IPAddressList::getList | +( | +) | ++ |
bool core::IPAddressList::remove | +( | +IPAddress | +ipAddress | ) | ++ |
This is the complete list of members for core::Object, including all inherited members.
name (defined in core::Object) | core::Object | |
tag (defined in core::Object) | core::Object | |
name | core::Object | |
tag | core::Object |
#include <Object.h>
Public Attributes | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
std::string core::Object::name | +
std::string core::Object::tag | +
This is the complete list of members for core::SessionFilter, including all inherited members.
name (defined in core::Object) | core::Object | |
tag (defined in core::Object) | core::Object | |
test(Session &session) (defined in core::SessionFilter) | core::SessionFilter | inlinevirtual |
name | core::Object | |
tag | core::Object | |
test(TCPSession &session) | core::SessionFilter | inlinevirtual |
#include <SessionFilter.h>
Public Member Functions | |
-virtual bool | test (Session &session) |
virtual bool | test (TCPSession &session) |
Additional Inherited Members | |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
+
|
+ +inlinevirtual | +
This is the complete list of members for core::Socket, including all inherited members.
bufferSize (defined in core::Socket) | core::Socket | |
enable(bool mode) | core::Socket | |
ePoll (defined in core::Socket) | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getDescriptor() | core::Socket | |
name (defined in core::Object) | core::Object | |
onConnected() | core::Socket | protectedvirtual |
onDataReceived(std::string data)=0 | core::Socket | protectedpure virtual |
onRegistered() | core::Socket | virtual |
onTLSInit() (defined in core::Socket) | core::Socket | protectedvirtual |
onUnregistered() | core::Socket | virtual |
output(std::stringstream &out) (defined in core::Socket) | core::Socket | |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
setBufferSize(int length) (defined in core::Socket) | core::Socket | protected |
ePoll | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getBufferSize() | core::Socket | protected |
getDescriptor() | core::Socket | |
name | core::Object | |
needsToWrite() | core::Socket | |
onDataReceived(std::string data) | core::Socket | protectedvirtual |
onDataReceived(char *buffer, int len) | core::Socket | protectedvirtual |
onRegister() | core::Socket | virtual |
onRegistered() | core::Socket | virtual |
onUnregister() | core::Socket | virtual |
onUnregistered() | core::Socket | virtual |
output(std::stringstream &out) | core::Socket | |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
reset | core::Socket | |
setBufferSize(int length) | core::Socket | protected |
setDescriptor(int descriptor) | core::Socket | |
shutdown() (defined in core::Socket) | core::Socket | |
shutDown (defined in core::Socket) | core::Socket | protected |
Socket(EPoll &ePoll) (defined in core::Socket) | core::Socket | |
tag (defined in core::Object) | core::Object | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) (defined in core::Socket) | core::Socket | |
~Socket() (defined in core::Socket) | core::Socket | |
shutdown(std::string text="unknown") | core::Socket | |
shutDown | core::Socket | protected |
Socket(EPoll &ePoll, std::string text="") | core::Socket | |
tag | core::Object | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) | core::Socket | |
~Socket() | core::Socket |
Public Member Functions | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onUnregister () |
virtual void | onUnregistered () |
Called when the socket has finished unregistering for the epoll processing. More... | |
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. | |
bool | needsToWrite () |
Public Attributes | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
Protected Member Functions | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
virtual void | onConnected () |
Called when socket is open and ready to communicate. More... | |
-virtual void | onTLSInit () |
virtual void | onDataReceived (std::string data)=0 |
Called when data is received from the socket. More... | |
int | getBufferSize () |
virtual void | onDataReceived (std::string data) |
Called when data is received from the socket. More... | |
virtual void | onDataReceived (char *buffer, int len) |
virtual void | receiveData (char *buffer, int bufferLength) |
Protected Attributes | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
The core component to managing a socket.
-Hooks into the EPoll through the registration and unregistration process and provides a communication socket of the specified protocol type. This object provides for all receiving data threading through use of the EPoll object and also provides buffering for output data requests to the socket.
-A program using a socket object can request to open a socket (file or network or whatever) and communicate through the streambuffer interface of the socket object.
-The socket side of the Socket accepts EPOLLIN event and will maintain the data in a buffer for the stream readers to read. A onDataReceived event is then sent with the data received in the buffer that can be read through the stream.
+Hooks into the EPoll through the registration and unregistration process and provides a communication socket of the specified protocol type. This object provides for all receiving data threading through use of the EPoll object and also provides buffering for output data requests to the socket.
+
A program using a socket object can request to open a socket (network or device) and communicate through the streambuffer interface of the socket object.
+The socket side of the Socket accepts EPOLLIN event and will maintain the data in a buffer for the stream readers to read. A onDataReceived event is then sent with the data received in the buffer that can be read through the stream. Only sockets that send events to epoll can be used with this object.
When writing to the stream the data is written into a buffer and a EPOLLOUT is scheduled. Upon receiving the EPOLLOUT event then the buffer is written to the socket output.
-void core::Socket::eventReceived | +core::Socket::Socket | +( | +EPoll & | +ePoll, | +
+ | + | std::string | +text = "" |
+ |
+ | ) | ++ |
Constructor
+ePoll | The EPoll socket descriptor. |
text | A title for this socket. |
core::Socket::~Socket | +( | +) | ++ |
Destructor
+ +bool core::Socket::eventReceived | ( | struct epoll_event | event | ) | @@ -212,8 +265,8 @@ boolshutDown = false<
-
-◆ onConnected()+ +◆ getBufferSize()
@@ -222,7 +275,7 @@ bool | shutDown = false< |
|
+protected | +
int core::Socket::getDescriptor | +( | +) | ++ |
Get the descriptor for the socket.
+
bool core::Socket::needsToWrite | +( | +) | ++ |
+
|
+ +protectedvirtual | +
Reimplemented in core::TCPSession, and core::INotify.
+ +
+
|
+ protectedvirtual |
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.
+Called when data is received from the socket.
+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. 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. |
Reimplemented in core::Session.
+Reimplemented in core::TCPServer, and core::UDPServerSocket.
virtual void core::Socket::onDataReceived | +void core::Socket::onRegister | ( | -std::string | -data | ) | +) |
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. |
Called before the socket has registered with the epoll processing.
+The onRegister method is called before the socket is registered with ePoll so objects extending the Socket definition can initialize the socket before receiving events. Evoked when the descriptor is set using setDescriptor for the socket.
-Implemented in core::TCPServerSocket, core::Session, and core::UDPServerSocket.
+Reimplemented in core::TLSSession.
Called when the socket has finished registering with the epoll processing.
-The onRegistered method is called whenever the socket is registered with ePoll and socket communcation events can be started.
+Called after the socket has been registered with epoll processing.
+ +Reimplemented in core::TCPSession, and core::TLSSession.
+ +
+
|
+ +virtual | +
Called when the socket has finished unregistering for the epoll processing.
The onUnregistered method is called whenever the socket is unregistered with ePoll and socket communcation events will be stopped. The default method will close the socket and clean up the connection. If this is overridden by an extended object then the object should call this method to clean the socket up.
+ + + +void core::Socket::output | +( | +std::stringstream & | +out | ) | ++ |
+
|
+ +protected | +
void core::Socket::setDescriptor | +( | +int | +descriptor | ) | ++ |
Set the descriptor for the socket.
+setDescriptor establishes the file descriptor for the socket and registers the socket on the EPoll controller. setDescriptor will invoke the onRegister() event.
+ +void core::Socket::shutdown | +( | +std::string | +text = "unknown" | ) | ++ |
Use the shutdown() method to terminate the socket connection and remove resources. This method is provided to ensure that all destructors are called for all inherited objects without a virtual destructor.
+ +int core::Socket::write | +( | std::string | data | ) | @@ -391,18 +682,77 @@ bool | shutDown = false<
Write data to the socket. +Member Data Documentation+ +◆ ePoll+ +
+
+
+
+
+
+
+◆ reset+ +
+
+
+
+
+
+
+◆ shutDown+ +
+
+
+
The documentation for this class was generated from the following files:
Generated by ![]()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+core::TCPServer Member List
+
+
+
+This is the complete list of members for core::TCPServer, including all inherited members. ++Generated by + ![]() | ||||||||
- My Project
+ ServerCore
|
Public Member Functions | |
TCPServer (EPoll &ePoll, IPAddress address, std::string text="") | |
TCPServer (EPoll &ePoll, IPAddress address, std::string text="") | |
~TCPServer () | |
-void | removeFromSessionList (TCPSession *session) |
void | removeFromSessionList (TCPSession *session) |
-virtual void | sessionErrorHandler (std::string errorString, std::stringstream &out) |
virtual void | sessionErrorHandler (std::string errorString, std::stringstream &out) |
virtual TCPSession * | getSocketAccept (EPoll &epoll) |
-void | output (TCPSession *session) |
Output the consoles array to the console. | |
void | output (TCPSession *session) |
Output the consoles array to the console. More... | |
![]() | |
- | TCPSocket (EPoll &ePoll) |
TCPSocket (EPoll &ePoll) | |
- | TCPSocket (EPoll &ePoll, std::string text) |
TCPSocket (EPoll &ePoll, std::string text) | |
-void | connect (IPAddress &address) |
~TCPSocket () | |
void | connect (IPAddress &address) |
virtual void | output (std::stringstream &out) |
![]() | |
- | Socket (EPoll &ePoll) |
- | Socket (EPoll &ePoll, std::string text) |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
bool | eventReceived (struct epoll_event event, pid_t threadId) |
Parse epoll event and call specified callbacks. More... | |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
-void | write (char *buffer, int length) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called when the socket has finished registering with the epoll processing. More... | |
Called before the socket has registered with the epoll processing. More... | |
-virtual void | onRegistered () |
virtual void | onRegistered () |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onUnregister () |
Called when the socket has finished unregistering for the epoll processing. More... | |
-bool | needsToWrite () |
virtual void | onUnregistered () |
Called when the socket has finished unregistering for the epoll processing. More... | |
bool | needsToWrite () |
![]() | |
virtual bool | check (std::string request) | needsToWrite () |
void | setName (std::string name) |
-std::string | getName () |
std::string | getName () |
@@ -193,23 +190,15 @@ Public Attributes | |
CommandList | commands |
![]() | |
-IPAddress | ipAddress |
IPAddress | ipAddress |
![]() | |
-class { | |
} | bufferSize |
-bool | active = false |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
@@ -219,11 +208,11 @@ Protected Member Functions | |
int | processCommand (std::string command, TCPSession *session, std::stringstream &data) override |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
-virtual void | onDataReceived (char *buffer, int len) |
int | getBufferSize () |
virtual void | onDataReceived (char *buffer, int len) |
virtual void | receiveData (char *buffer, int bufferLength) |
onDataReceive
Additional Inherited Members![]()
-EPoll & | ePoll | EPoll & | ePoll | |
-bool | shutDown = false | bool | shutDown = false | | |
Reimplemented from core::Socket.
+ + + +void core::TCPServer::output | +( | +TCPSession * | +session | ) | ++ |
Output the consoles array to the console.
+Reimplemented from core::Command.
+ + + +void core::TCPServer::removeFromSessionList | +( | +TCPSession * | +session | ) | ++ |
+
|
+ +virtual | +
+ ServerCore
+
+ |
+
This is the complete list of members for core::TCPSession, including all inherited members.
+
+ ServerCore
+
+ |
+
#include <TCPSession.h>
+Public Member Functions | |
TCPSession (EPoll &ePoll, TCPServer &server, std::string text="") | |
~TCPSession () | |
virtual void | output (std::stringstream &data) |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
void | terminate () |
![]() | |
TCPSocket (EPoll &ePoll) | |
TCPSocket (EPoll &ePoll, std::string text) | |
~TCPSocket () | |
void | connect (IPAddress &address) |
![]() | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onUnregister () |
virtual void | onUnregistered () |
Called when the socket has finished unregistering for the epoll processing. More... | |
bool | needsToWrite () |
+Public Attributes | |
Command * | grab = NULL |
std::stringstream | out |
TCPServer & | server |
![]() | |
IPAddress | ipAddress |
![]() | |
bool | reset = false |
![]() | |
std::string | name |
std::string | tag |
+Protected Member Functions | |
virtual void | onRegistered () override |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onDataReceived (char *data, int len) override |
virtual void | onLineReceived (std::string line) |
virtual void | onBlockReceived (std::string block) |
virtual void | onConnected () |
virtual void | protocol (std::string data) |
void | setMode (Mode mode, int size=0) |
![]() | |
void | setBufferSize (int length) |
int | getBufferSize () |
virtual void | onDataReceived (std::string data) |
Called when data is received from the socket. More... | |
virtual void | receiveData (char *buffer, int bufferLength) |
+Additional Inherited Members | |
![]() | |
EPoll & | ePoll |
bool | shutDown = false |
TCPSession defines the nature of the interaction with the client and stores persistent data for a defined session. TCPSession objects are not sockets but instead provide a communications control mechanism. Protocol conversations are provided through extensions from this object.
+
core::TCPSession::TCPSession | +( | +EPoll & | +ePoll, | +
+ | + | TCPServer & | +server, | +
+ | + | std::string | +text = "" |
+
+ | ) | ++ |
core::TCPSession::~TCPSession | +( | +) | ++ |
+
|
+ +protectedvirtual | +
Override the onBlockReceived method to receive a string of characters that represents a single block of data of length determined by the block length value. If onDataReceived was overriden this method will not be called unless the onDataReceived calls this method explicitly using the class and member name.
+ +
+
|
+ +protectedvirtual | +
This method is called from within the protocol method when protocol is called on the initial connection where the data is an empty string. Use this method to deliver a message to the connection upon connection.
+ +
+
|
+ +overrideprotectedvirtual | +
Override this method to receive data directly from the socket as data is received. If you need data split by line termination characters then override the onLineReceived method instead.
+ +Reimplemented from core::Socket.
+ +
+
|
+ +protectedvirtual | +
Override the onLineReceived method to receive a string of characters that represents a single line of data terminated by a LF or CRLF. If onDataReceived was overriden this method will not be called unless the onDataReceived calls this method explicitly using the class and member name.
+ +
+
|
+ +overrideprotectedvirtual | +
Called after the socket has been registered with epoll processing.
+ +Reimplemented from core::Socket.
+ +Reimplemented in core::TLSSession.
+ +
+
|
+ +virtual | +
The output method is called by a socket session (BMASession) and will output the detail information for the client socket. When extending BMATCPSocket or BMASession you can override the method to add attributes to the list.
+ +Reimplemented from core::TCPSocket.
+ +Reimplemented in core::TLSSession.
+ +
+
|
+ +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.
+When data is received within the session two modes are available to pass the data through the protocol method: LINE or BLOCK.
+ +Reimplemented in core::TLSSession, and core::ConsoleSession.
+ +void core::TCPSession::send | +( | +) | ++ |
The send method is used to output the contents of the out stream to the session containing the stream.
+ +void core::TCPSession::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::TCPSession::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.
+ +
+
|
+ +protected | +
Use the setMode method to set the receiving mode for the data on this socket. Data can be received in LINE mode, which will receive data from the socket one line at a time, or BLOCK mode where a certain specified data block is received before calling the onBlockReceived method.
+ +void core::TCPSession::terminate | +( | +) | ++ |
Use this method to terminate this TCPSession.
+ +Command* core::TCPSession::grab = NULL | +
std::stringstream core::TCPSession::out | +
Use out to send data to the session socket or other session sockets.
+ +TCPServer& core::TCPSession::server | +
This is the complete list of members for core::TCPSocket, including all inherited members.
bufferSize (defined in core::Socket) | core::Socket | |
connect(IPAddress &address) (defined in core::TCPSocket) | core::TCPSocket | |
enable(bool mode) | core::Socket | |
ePoll (defined in core::Socket) | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getDescriptor() | core::Socket | |
ipAddress (defined in core::TCPSocket) | core::TCPSocket | |
name (defined in core::Object) | core::Object | |
onConnected() | core::Socket | protectedvirtual |
onDataReceived(std::string data)=0 | core::Socket | protectedpure virtual |
onRegistered() | core::Socket | virtual |
onTLSInit() (defined in core::Socket) | core::Socket | protectedvirtual |
onUnregistered() | core::Socket | virtual |
output(std::stringstream &out) | core::TCPSocket | virtual |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
setBufferSize(int length) (defined in core::Socket) | core::Socket | protected |
connect(IPAddress &address) | core::TCPSocket | |
ePoll | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getBufferSize() | core::Socket | protected |
getDescriptor() | core::Socket | |
ipAddress | core::TCPSocket | |
name | core::Object | |
needsToWrite() | core::Socket | |
onDataReceived(std::string data) | core::Socket | protectedvirtual |
onDataReceived(char *buffer, int len) | core::Socket | protectedvirtual |
onRegister() | core::Socket | virtual |
onRegistered() | core::Socket | virtual |
onUnregister() | core::Socket | virtual |
onUnregistered() | core::Socket | virtual |
output(std::stringstream &out) | core::TCPSocket | virtual |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
reset | core::Socket | |
setBufferSize(int length) | core::Socket | protected |
setDescriptor(int descriptor) | core::Socket | |
shutdown() (defined in core::Socket) | core::Socket | |
shutDown (defined in core::Socket) | core::Socket | protected |
Socket(EPoll &ePoll) (defined in core::Socket) | core::Socket | |
tag (defined in core::Object) | core::Object | |
TCPSocket(EPoll &ePoll) (defined in core::TCPSocket) | core::TCPSocket | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) (defined in core::Socket) | core::Socket | |
~Socket() (defined in core::Socket) | core::Socket | |
~TCPSocket() (defined in core::TCPSocket) | core::TCPSocket | |
shutDown | core::Socket | protected |
shutdown(std::string text="unknown") | core::Socket | |
Socket(EPoll &ePoll, std::string text="") | core::Socket | |
tag | core::Object | |
TCPSocket(EPoll &ePoll) | core::TCPSocket | |
TCPSocket(EPoll &ePoll, std::string text) | core::TCPSocket | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) | core::Socket | |
~Socket() | core::Socket | |
~TCPSocket() | core::TCPSocket |
Public Member Functions | |
- | TCPSocket (EPoll &ePoll) |
TCPSocket (EPoll &ePoll) | |
-void | connect (IPAddress &address) |
TCPSocket (EPoll &ePoll, std::string text) | |
~TCPSocket () | |
void | connect (IPAddress &address) |
virtual void | output (std::stringstream &out) |
![]() | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onUnregister () |
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. | |
bool | needsToWrite () |
Public Attributes | |
-IPAddress | ipAddress |
IPAddress | ipAddress |
![]() | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
Additional Inherited Members | |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
virtual void | onConnected () |
Called when socket is open and ready to communicate. More... | |
-virtual void | onTLSInit () |
virtual void | onDataReceived (std::string data)=0 |
Called when data is received from the socket. More... | |
int | getBufferSize () |
virtual void | onDataReceived (std::string data) |
Called when data is received from the socket. More... | |
virtual void | onDataReceived (char *buffer, int len) |
virtual void | receiveData (char *buffer, int bufferLength) |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
Provides a network TCP socket.
For accessing TCP network functions use this object. The connection oriented nature of TCP provides a single client persistent connection with data error correction and a durable synchronous data connection.
-core::TCPSocket::TCPSocket | +( | +EPoll & | +ePoll | ) | ++ |
core::TCPSocket::TCPSocket | +( | +EPoll & | +ePoll, | +
+ | + | std::string | +text | +
+ | ) | ++ |
core::TCPSocket::~TCPSocket | +( | +) | ++ |
void core::TCPSocket::connect | +( | +IPAddress & | +address | ) | ++ |
The output method is called by a socket session (BMASession) and will output the detail information for the client socket. When extending BMATCPSocket or BMASession you can override the method to add attributes to the list.
-Reimplemented in core::TLSSession, and core::Session.
+Reimplemented in core::TLSSession, and core::TCPSession.
+ +IPAddress core::TCPSocket::ipAddress | +
+ ServerCore
+
+ |
+
This is the complete list of members for core::TLSServer, including all inherited members.
+Public Member Functions | |
TLSServer (EPoll &ePoll, IPAddress address) | |
TLSServer (EPoll &ePoll, IPAddress address) | |
~TLSServer () | |
-TCPSession * | getSocketAccept () |
TCPSession * | getSocketAccept () |
![]() | |
TCPServer (EPoll &ePoll, IPAddress address, std::string text="") | |
TCPServer (EPoll &ePoll, IPAddress address, std::string text="") | |
~TCPServer () | |
-void | removeFromSessionList (TCPSession *session) |
void | removeFromSessionList (TCPSession *session) |
-virtual void | sessionErrorHandler (std::string errorString, std::stringstream &out) |
virtual void | sessionErrorHandler (std::string errorString, std::stringstream &out) |
virtual TCPSession * | getSocketAccept (EPoll &epoll) |
-void | output (TCPSession *session) |
Output the consoles array to the console. | |
void | output (TCPSession *session) |
Output the consoles array to the console. More... | |
![]() | |
- | TCPSocket (EPoll &ePoll) |
TCPSocket (EPoll &ePoll) | |
- | TCPSocket (EPoll &ePoll, std::string text) |
TCPSocket (EPoll &ePoll, std::string text) | |
-void | connect (IPAddress &address) |
~TCPSocket () | |
void | connect (IPAddress &address) |
virtual void | output (std::stringstream &out) |
![]() | |
- | Socket (EPoll &ePoll) |
- | Socket (EPoll &ePoll, std::string text) |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
bool | eventReceived (struct epoll_event event, pid_t threadId) |
Parse epoll event and call specified callbacks. More... | |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
-void | write (char *buffer, int length) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called when the socket has finished registering with the epoll processing. More... | |
Called before the socket has registered with the epoll processing. More... | |
-virtual void | onRegistered () |
virtual void | onRegistered () |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onUnregister () |
Called when the socket has finished unregistering for the epoll processing. More... | |
-bool | needsToWrite () |
virtual void | onUnregistered () |
Called when the socket has finished unregistering for the epoll processing. More... | |
bool | needsToWrite () |
![]() | |
virtual bool | check (std::string request) | needsToWrite () |
void | setName (std::string name) |
-std::string | getName () |
std::string | getName () |
Public Attributes | |
-SSL_CTX * | ctx |
SSL_CTX * | ctx |
![]() | |
IPAddressList * | blackList | ctx | CommandList | commands |
![]() | |
-IPAddress | ipAddress |
IPAddress | ipAddress |
![]() | |
-class { | |
} | bufferSize |
-bool | active = false |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
@@ -231,20 +218,18 @@ Additional Inherited Members | |
int | processCommand (std::string command, TCPSession *session, std::stringstream &data) override |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
-virtual void | onDataReceived (char *buffer, int len) |
int | getBufferSize () |
virtual void | onDataReceived (char *buffer, int len) |
virtual void | receiveData (char *buffer, int bufferLength) |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
The destructor for this object.
+TCPSession * core::TLSServer::getSocketAccept | +( | +) | ++ |
SSL_CTX* core::TLSServer::ctx | +
This is the complete list of members for core::TLSSession, including all inherited members.
bufferSize (defined in core::Socket) | core::Socket | |
connect(IPAddress &address) (defined in core::TCPSocket) | core::TCPSocket | |
enable(bool mode) | core::Socket | |
ePoll (defined in core::Socket) | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getDescriptor() | core::Socket | |
ipAddress (defined in core::TCPSocket) | core::TCPSocket | |
name (defined in core::Object) | core::Object | |
onConnected() override | core::Session | protectedvirtual |
onDataReceived(std::string data) override | core::Session | protectedvirtual |
onRegistered() | core::Socket | virtual |
onTLSInit() (defined in core::Socket) | core::Socket | protectedvirtual |
onUnregistered() | core::Socket | virtual |
out (defined in core::Session) | core::Session | |
output(std::stringstream &out) | core::TLSSession | virtual |
protocol(std::string data) override | core::TLSSession | virtual |
receiveData(char *buffer, int bufferLength) override | core::TLSSession | protectedvirtual |
send() | core::Session | |
sendToAll() | core::Session | |
sendToAll(SessionFilter filter) | core::Session | |
service (defined in core::Session) | core::Session | |
Session(EPoll &ePoll, Service &service) (defined in core::Session) | core::Session | |
setBufferSize(int length) (defined in core::Socket) | core::Socket | protected |
setDescriptor(int descriptor) | core::Socket | |
shutdown() (defined in core::Socket) | core::Socket | |
shutDown (defined in core::Socket) | core::Socket | protected |
Socket(EPoll &ePoll) (defined in core::Socket) | core::Socket | |
tag (defined in core::Object) | core::Object | |
TCPSocket(EPoll &ePoll) (defined in core::TCPSocket) | core::TCPSocket | |
TLSSession(EPoll &ePoll, Service &service) (defined in core::TLSSession) | core::TLSSession | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) (defined in core::Socket) | core::Socket | |
~Session() (defined in core::Session) | core::Session | |
~Socket() (defined in core::Socket) | core::Socket | |
~TCPSocket() (defined in core::TCPSocket) | core::TCPSocket | |
~TLSSession() (defined in core::TLSSession) | core::TLSSession | |
connect(IPAddress &address) | core::TCPSocket | |
ePoll | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getBufferSize() | core::Socket | protected |
getDescriptor() | core::Socket | |
grab | core::TCPSession | |
ipAddress | core::TCPSocket | |
name | core::Object | |
needsToWrite() | core::Socket | |
onBlockReceived(std::string block) | core::TCPSession | protectedvirtual |
onConnected() | core::TCPSession | protectedvirtual |
onDataReceived(char *data, int len) override | core::TCPSession | protectedvirtual |
core::TCPSocket::onDataReceived(std::string data) | core::Socket | protectedvirtual |
onLineReceived(std::string line) | core::TCPSession | protectedvirtual |
onRegister() | core::TLSSession | protectedvirtual |
onRegistered() | core::TLSSession | protectedvirtual |
onUnregister() | core::Socket | virtual |
onUnregistered() | core::Socket | virtual |
out | core::TCPSession | |
output(std::stringstream &out) | core::TLSSession | virtual |
protocol(std::string data) override | core::TLSSession | virtual |
receiveData(char *buffer, int bufferLength) override | core::TLSSession | protectedvirtual |
reset | core::Socket | |
send() | core::TCPSession | |
sendToAll() | core::TCPSession | |
sendToAll(SessionFilter filter) | core::TCPSession | |
server | core::TCPSession | |
setBufferSize(int length) | core::Socket | protected |
setDescriptor(int descriptor) | core::Socket | |
setMode(Mode mode, int size=0) | core::TCPSession | protected |
shutDown | core::Socket | protected |
shutdown(std::string text="unknown") | core::Socket | |
Socket(EPoll &ePoll, std::string text="") | core::Socket | |
tag | core::Object | |
TCPSession(EPoll &ePoll, TCPServer &server, std::string text="") | core::TCPSession | |
TCPSocket(EPoll &ePoll) | core::TCPSocket | |
TCPSocket(EPoll &ePoll, std::string text) | core::TCPSocket | |
terminate() | core::TCPSession | |
TLSSession(EPoll &ePoll, TCPServer &server) | core::TLSSession | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) | core::Socket | |
~Socket() | core::Socket | |
~TCPSession() | core::TCPSession | |
~TCPSocket() | core::TCPSocket | |
~TLSSession() | core::TLSSession |
Public Member Functions | |
- | TLSSession (EPoll &ePoll, Service &service) |
virtual void | output (std::stringstream &out) |
TLSSession (EPoll &ePoll, TCPServer &server) | |
~TLSSession () | |
virtual void | output (std::stringstream &out) |
virtual void | protocol (std::string data) override |
![]() | |
- | Session (EPoll &ePoll, Service &service) |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
![]() | |
TCPSession (EPoll &ePoll, TCPServer &server, std::string text="") | |
~TCPSession () | |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
void | terminate () |
![]() | |
- | TCPSocket (EPoll &ePoll) |
TCPSocket (EPoll &ePoll) | |
-void | connect (IPAddress &address) |
TCPSocket (EPoll &ePoll, std::string text) | |
~TCPSocket () | |
void | connect (IPAddress &address) |
![]() | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
virtual void | onUnregister () |
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. | |
bool | needsToWrite () |
Protected Member Functions | |
void | receiveData (char *buffer, int bufferLength) override |
![]() | |
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... | |
void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
void | onRegistered () |
Called after the socket has been registered with epoll processing. More... | |
![]() | |
virtual void | onDataReceived (char *data, int len) override |
virtual void | onLineReceived (std::string line) |
virtual void | onBlockReceived (std::string block) |
virtual void | onConnected () |
void | setMode (Mode mode, int size=0) |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
-virtual void | onTLSInit () |
int | getBufferSize () |
virtual void | onDataReceived (std::string data) |
Called when data is received from the socket. More... | |
Additional Inherited Members | |
![]() | |
-std::stringstream | out |
-Service & | service |
![]() | |
Command * | grab = NULL |
std::stringstream | out |
TCPServer & | server |
![]() | |
-IPAddress | ipAddress |
IPAddress | ipAddress |
![]() | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
Provides a network TLS socket.
For accessing TLS network functions use this object. The connection oriented nature of TLS provides a single client persistent connection with data error correction and a durable synchronous data connection.
-core::TLSSession::TLSSession | +( | +EPoll & | +ePoll, | +
+ | + | TCPServer & | +server | +
+ | ) | ++ |
core::TLSSession::~TLSSession | +( | +) | ++ |
+
|
+ +protectedvirtual | +
Called before the socket has registered with the epoll processing.
+The onRegister method is called before the socket is registered with ePoll so objects extending the Socket definition can initialize the socket before receiving events. Evoked when the descriptor is set using setDescriptor for the socket.
+ +Reimplemented from core::Socket.
+ +
+
|
+ +protectedvirtual | +
Called after the socket has been registered with epoll processing.
+ +Reimplemented from core::TCPSession.
+ +The output method is called by a socket session (Session) and will output the detail information for the client socket. When extending TLSSocket or Session you can override the method to add attributes to the list.
+The output method is called by a socket session (Session) and will output the detail information for the client socket. When extending TLSSocket or Session you can override the method to add attributes to the list.
-Reimplemented from core::Session.
+Reimplemented from core::TCPSession.
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.
+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.
+When data is received within the session two modes are available to pass the data through the protocol method: LINE or BLOCK.
-Reimplemented from core::Session.
+Reimplemented from core::TCPSession.
This is the complete list of members for core::TerminalSession, including all inherited members.
#include <TerminalSession.h>
Public Member Functions | |
- | TerminalSession (EPoll &ePoll, Service &service) |
-int | getLines () |
TerminalSession (EPoll &ePoll, TCPServer &server) | |
~TerminalSession () | |
int | getLines () |
-void | clear () |
void | clear () |
-void | clearEOL () |
void | clearEOL () |
-void | setCursorLocation (int x, int y) |
void | setCursorLocation (int x, int y) |
-void | setColor (int color) |
void | setColor (int color) |
-void | setBackColor (int color) |
void | setBackColor (int color) |
-void | saveCursor () |
void | saveCursor () |
-void | restoreCursor () |
void | restoreCursor () |
-void | NextLine (int lines) |
void | NextLine (int lines) |
-void | PreviousLine (int lines) |
void | PreviousLine (int lines) |
-void | scrollArea (int start, int end) |
void | scrollArea (int start, int end) |
![]() | |
- | Session (EPoll &ePoll, Service &service) |
virtual void | output (std::stringstream &data) |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
![]() | |
TCPSession (EPoll &ePoll, TCPServer &server, std::string text="") | |
~TCPSession () | |
virtual void | output (std::stringstream &data) |
void | send () |
void | sendToAll () |
void | sendToAll (SessionFilter filter) |
void | terminate () |
![]() | |
- | TCPSocket (EPoll &ePoll) |
TCPSocket (EPoll &ePoll) | |
-void | connect (IPAddress &address) |
TCPSocket (EPoll &ePoll, std::string text) | |
~TCPSocket () | |
void | connect (IPAddress &address) |
![]() | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onUnregister () |
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. | |
bool | needsToWrite () |
Additional Inherited Members | |
![]() | |
-std::stringstream | out |
-Service & | service |
![]() | |
Command * | grab = NULL |
std::stringstream | out |
TCPServer & | server |
![]() | |
-IPAddress | ipAddress |
IPAddress | ipAddress |
![]() | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
![]() | |
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) |
![]() | |
virtual void | onRegistered () override |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onDataReceived (char *data, int len) override |
virtual void | onLineReceived (std::string line) |
virtual void | onBlockReceived (std::string block) |
virtual void | onConnected () |
virtual void | protocol (std::string data) |
void | setMode (Mode mode, int size=0) |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
-virtual void | onTLSInit () |
int | getBufferSize () |
virtual void | onDataReceived (std::string data) |
Called when data is received from the socket. More... | |
virtual void | receiveData (char *buffer, int bufferLength) |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
core::TerminalSession::TerminalSession | +( | +EPoll & | +ePoll, | +
+ | + | TCPServer & | +server | +
+ | ) | ++ |
core::TerminalSession::~TerminalSession | +( | +) | ++ |
void core::TerminalSession::clear | +( | +) | ++ |
Clear the display.
+ +void core::TerminalSession::clearEOL | +( | +) | ++ |
Clear the display from the cursor to the end of line.
+ +int core::TerminalSession::getLines | +( | +) | ++ |
void core::TerminalSession::NextLine | +( | +int | +lines | ) | ++ |
void core::TerminalSession::PreviousLine | +( | +int | +lines | ) | ++ |
void core::TerminalSession::restoreCursor | +( | +) | ++ |
void core::TerminalSession::saveCursor | +( | +) | ++ |
void core::TerminalSession::scrollArea | +( | +int | +start, | +
+ | + | int | +end | +
+ | ) | ++ |
void core::TerminalSession::setBackColor | +( | +int | +color | ) | ++ |
void core::TerminalSession::setColor | +( | +int | +color | ) | ++ |
void core::TerminalSession::setCursorLocation | +( | +int | +x, | +
+ | + | int | +y | +
+ | ) | ++ |
Set the location of the cursor on the display.
+ +This is the complete list of members for core::Thread, including all inherited members.
getCount() (defined in core::Thread) | core::Thread | |
getStatus() (defined in core::Thread) | core::Thread | |
getThreadId() (defined in core::Thread) | core::Thread | |
join() (defined in core::Thread) | core::Thread | |
name (defined in core::Object) | core::Object | |
output(std::stringstream &data) (defined in core::Thread) | core::Thread | |
getCount() | core::Thread | |
getStatus() | core::Thread | |
getThreadId() | core::Thread | |
join() | core::Thread | |
name | core::Object | |
output(std::stringstream &data) | core::Thread | |
start() | core::Thread | |
tag (defined in core::Object) | core::Object | |
Thread(EPoll &ePoll) (defined in core::Thread) | core::Thread | |
~Thread() (defined in core::Thread) | core::Thread | |
tag | core::Object | |
Thread(EPoll &ePoll) | core::Thread | |
~Thread() | core::Thread |
Public Member Functions | |
- | Thread (EPoll &ePoll) |
Thread (EPoll &ePoll) | |
~Thread () | |
void | start () |
-void | join () |
void | join () |
-std::string | getStatus () |
std::string | getStatus () |
-pid_t | getThreadId () |
pid_t | getThreadId () |
-int | getCount () |
int | getCount () |
-void | output (std::stringstream &data) |
void | output (std::stringstream &data) |
Additional Inherited Members | |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
This thread object is designed to be the thread processor for the EPoll object. It wraps the thread object to allow maintaining a status value for monitoring the thread activity. EPoll will instantiate a Thread object for each thread specified in the EPoll's start method.
-core::Thread::Thread | +( | +EPoll & | +ePoll | ) | ++ |
core::Thread::~Thread | +( | +) | ++ |
int core::Thread::getCount | +( | +) | ++ |
std::string core::Thread::getStatus | +( | +) | ++ |
pid_t core::Thread::getThreadId | +( | +) | ++ |
void core::Thread::join | +( | +) | ++ |
void core::Thread::output | +( | +std::stringstream & | +data | ) | ++ |
This is the complete list of members for core::Timer, including all inherited members.
bufferSize (defined in core::Socket) | core::Socket | private |
clearTimer() | core::Timer | |
enable(bool mode) | core::Socket | private |
ePoll (defined in core::Socket) | core::Socket | private |
eventReceived(struct epoll_event event) | core::Socket | private |
getDescriptor() | core::Socket | private |
getElapsed() | core::Timer | |
getEpoch() (defined in core::Timer) | core::Timer | |
name (defined in core::Object) | core::Object | private |
onConnected() | core::Socket | privatevirtual |
onRegistered() | core::Socket | privatevirtual |
onTimeout()=0 | core::Timer | protectedpure virtual |
onTLSInit() (defined in core::Socket) | core::Socket | privatevirtual |
onUnregistered() | core::Socket | privatevirtual |
output(std::stringstream &out) (defined in core::Socket) | core::Socket | private |
receiveData(char *buffer, int bufferLength) | core::Socket | privatevirtual |
setBufferSize(int length) (defined in core::Socket) | core::Socket | private |
setDescriptor(int descriptor) | core::Socket | private |
setTimer(double delay) | core::Timer | |
shutDown (defined in core::Socket) | core::Socket | private |
shutdown() (defined in core::Socket) | core::Socket | private |
Socket(EPoll &ePoll) (defined in core::Socket) | core::Socket | private |
tag (defined in core::Object) | core::Object | private |
Timer(EPoll &ePoll) (defined in core::Timer) | core::Timer | |
Timer(EPoll &ePoll, double delay) (defined in core::Timer) | core::Timer | |
write(std::string data) | core::Socket | private |
write(char *buffer, int length) (defined in core::Socket) | core::Socket | private |
~Socket() (defined in core::Socket) | core::Socket | private |
~Timer() (defined in core::Timer) | core::Timer | |
clearTimer() | core::Timer | |
getElapsed() | core::Timer | |
getEpoch() | core::Timer | |
core::Socket::onDataReceived(char *buffer, int len) | core::Socket | privatevirtual |
onTimeout()=0 | core::Timer | protectedpure virtual |
setTimer(double delay) | core::Timer | |
Timer(EPoll &ePoll) | core::Timer | |
Timer(EPoll &ePoll, double delay) | core::Timer | |
~Timer() | core::Timer |
Public Member Functions | |
- | Timer (EPoll &ePoll) |
Timer (EPoll &ePoll) | |
- | Timer (EPoll &ePoll, double delay) |
Timer (EPoll &ePoll, double delay) | |
~Timer () | |
void | setTimer (double delay) |
void | clearTimer () |
double | getElapsed () |
-double | getEpoch () |
double | getEpoch () |
@@ -120,7 +124,71 @@ Protected Member Functions |
core::Timer::Timer | +( | +EPoll & | +ePoll | ) | ++ |
core::Timer::Timer | +( | +EPoll & | +ePoll, | +
+ | + | double | +delay = 0.0f |
+
+ | ) | ++ |
core::Timer::~Timer | +( | +) | ++ |
Use the getElapsed() method to obtain the amount of time that has elapsed since the timer was set.
+double core::Timer::getEpoch | +( | +) | ++ |
This is the complete list of members for core::UDPServerSocket, including all inherited members.
bufferSize (defined in core::Socket) | core::Socket | |
check(std::string request) | core::Command | virtual |
enable(bool mode) | core::Socket | |
ePoll (defined in core::Socket) | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getDescriptor() | core::Socket | |
getName() (defined in core::Command) | core::Command | |
name (defined in core::Object) | core::Object | |
onConnected() | core::Socket | protectedvirtual |
onDataReceived(std::string data) override | core::UDPServerSocket | protectedvirtual |
onRegistered() | core::Socket | virtual |
onTLSInit() (defined in core::Socket) | core::Socket | protectedvirtual |
onUnregistered() | core::Socket | virtual |
output(std::stringstream &out) (defined in core::Socket) | core::Socket | |
core::Command::output(Session *session) | core::Command | virtual |
processCommand(std::string request, std::stringstream &data) (defined in core::UDPServerSocket) | core::UDPServerSocket | protected |
core::Command::processCommand(std::string request, Session *session, std::stringstream &data) | core::Command | virtual |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
sessions (defined in core::UDPServerSocket) | core::UDPServerSocket | protected |
setBufferSize(int length) (defined in core::Socket) | core::Socket | protected |
check(std::string request) | core::Command | virtual |
ePoll | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getBufferSize() | core::Socket | protected |
getDescriptor() | core::Socket | |
getName() | core::Command | |
core::name | core::Object | |
needsToWrite() | core::Socket | |
onDataReceived(std::string data) override | core::UDPServerSocket | protectedvirtual |
core::UDPSocket::onDataReceived(char *buffer, int len) | core::Socket | protectedvirtual |
onRegister() | core::Socket | virtual |
onRegistered() | core::Socket | virtual |
onUnregister() | core::Socket | virtual |
onUnregistered() | core::Socket | virtual |
core::output(std::stringstream &out) | core::Socket | |
core::Command::output(Session *session) | core::Command | virtual |
processCommand(std::string request, std::stringstream &data) | core::UDPServerSocket | protected |
core::Command::processCommand(std::string request, TCPSession *session, std::stringstream &data) | core::Command | virtual |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
reset | core::Socket | |
sessions | core::UDPServerSocket | protected |
setBufferSize(int length) | core::Socket | protected |
setDescriptor(int descriptor) | core::Socket | |
setName(std::string name) | core::Command | |
shutdown() (defined in core::Socket) | core::Socket | |
shutDown (defined in core::Socket) | core::Socket | protected |
Socket(EPoll &ePoll) (defined in core::Socket) | core::Socket | |
tag (defined in core::Object) | core::Object | |
tag (defined in core::Object) | core::Object | |
UDPServerSocket(EPoll &ePoll, std::string url, short int port, std::string commandName) (defined in core::UDPServerSocket) | core::UDPServerSocket | |
UDPSocket(EPoll &ePoll) (defined in core::UDPSocket) | core::UDPSocket | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) (defined in core::Socket) | core::Socket | |
~Socket() (defined in core::Socket) | core::Socket | |
~UDPServerSocket() (defined in core::UDPServerSocket) | core::UDPServerSocket | |
~UDPSocket() (defined in core::UDPSocket) | core::UDPSocket | |
shutdown(std::string text="unknown") | core::Socket | |
shutDown | core::Socket | protected |
Socket(EPoll &ePoll, std::string text="") | core::Socket | |
core::tag | core::Object | |
core::Command::tag | core::Object | |
UDPServerSocket(EPoll &ePoll, std::string url, short int port, std::string commandName) | core::UDPServerSocket | |
UDPSocket(EPoll &ePoll) | core::UDPSocket | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) | core::Socket | |
~Socket() | core::Socket | |
~UDPServerSocket() | core::UDPServerSocket | |
~UDPSocket() | core::UDPSocket |
Public Member Functions | |
- | UDPServerSocket (EPoll &ePoll, std::string url, short int port, std::string commandName) |
UDPServerSocket (EPoll &ePoll, std::string url, short int port, std::string commandName) | |
~UDPServerSocket () | |
![]() | |
- | UDPSocket (EPoll &ePoll) |
UDPSocket (EPoll &ePoll) | |
~UDPSocket () | |
![]() | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onUnregister () |
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. | |
bool | needsToWrite () |
![]() | |
virtual bool | check (std::string request) |
virtual int | processCommand (std::string request, Session *session, std::stringstream &data) |
virtual void | output (Session *session) |
virtual int | processCommand (std::string request, TCPSession *session, std::stringstream &data) |
virtual void | output (Session *session) |
void | setName (std::string name) |
-std::string | getName () |
std::string | getName () |
Protected Member Functions | |
void | onDataReceived (std::string data) override |
Called when data is received from the socket. More... | |
Called when data is received from the socket. More... | |
-int | processCommand (std::string request, std::stringstream &data) |
int | processCommand (std::string request, std::stringstream &data) |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
virtual void | onConnected () |
Called when socket is open and ready to communicate. More... | |
-virtual void | onTLSInit () |
int | getBufferSize () |
virtual void | onDataReceived (char *buffer, int len) |
virtual void | receiveData (char *buffer, int bufferLength) |
Protected Attributes | |
-std::vector< Session * > | sessions |
std::vector< Session * > | sessions |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
Additional Inherited Members | |
![]() | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
Manage a socket connection as a UDP server type. Connections to the socket are processed through the session list functionality. A list of sessions is maintained in a vector object.
-core::UDPServerSocket::UDPServerSocket | +( | +EPoll & | +ePoll, | +
+ | + | std::string | +url, | +
+ | + | short int | +port, | +
+ | + | std::string | +commandName | +
+ | ) | ++ |
core::UDPServerSocket::~UDPServerSocket | +( | +) | ++ |
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
+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. 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. | tag | -
+
|
+ +protected | +
+
|
+ +protected | +
This is the complete list of members for core::UDPSocket, including all inherited members.
bufferSize (defined in core::Socket) | core::Socket | |
enable(bool mode) | core::Socket | |
ePoll (defined in core::Socket) | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getDescriptor() | core::Socket | |
name (defined in core::Object) | core::Object | |
onConnected() | core::Socket | protectedvirtual |
onDataReceived(std::string data)=0 | core::Socket | protectedpure virtual |
onRegistered() | core::Socket | virtual |
onTLSInit() (defined in core::Socket) | core::Socket | protectedvirtual |
onUnregistered() | core::Socket | virtual |
output(std::stringstream &out) (defined in core::Socket) | core::Socket | |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
setBufferSize(int length) (defined in core::Socket) | core::Socket | protected |
ePoll | core::Socket | protected |
eventReceived(struct epoll_event event) | core::Socket | |
getBufferSize() | core::Socket | protected |
getDescriptor() | core::Socket | |
name | core::Object | |
needsToWrite() | core::Socket | |
onDataReceived(std::string data) | core::Socket | protectedvirtual |
onDataReceived(char *buffer, int len) | core::Socket | protectedvirtual |
onRegister() | core::Socket | virtual |
onRegistered() | core::Socket | virtual |
onUnregister() | core::Socket | virtual |
onUnregistered() | core::Socket | virtual |
output(std::stringstream &out) | core::Socket | |
receiveData(char *buffer, int bufferLength) | core::Socket | protectedvirtual |
reset | core::Socket | |
setBufferSize(int length) | core::Socket | protected |
setDescriptor(int descriptor) | core::Socket | |
shutdown() (defined in core::Socket) | core::Socket | |
shutDown (defined in core::Socket) | core::Socket | protected |
Socket(EPoll &ePoll) (defined in core::Socket) | core::Socket | |
tag (defined in core::Object) | core::Object | |
UDPSocket(EPoll &ePoll) (defined in core::UDPSocket) | core::UDPSocket | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) (defined in core::Socket) | core::Socket | |
~Socket() (defined in core::Socket) | core::Socket | |
~UDPSocket() (defined in core::UDPSocket) | core::UDPSocket | |
shutdown(std::string text="unknown") | core::Socket | |
shutDown | core::Socket | protected |
Socket(EPoll &ePoll, std::string text="") | core::Socket | |
tag | core::Object | |
UDPSocket(EPoll &ePoll) | core::UDPSocket | |
write(std::string data) | core::Socket | |
write(char *buffer, int length) | core::Socket | |
~Socket() | core::Socket | |
~UDPSocket() | core::UDPSocket |
#include <UDPSocket.h>
Public Member Functions | |
- | UDPSocket (EPoll &ePoll) |
UDPSocket (EPoll &ePoll) | |
~UDPSocket () | |
![]() | |
- | Socket (EPoll &ePoll) |
-void | shutdown () |
-void | setDescriptor (int descriptor) |
Set the descriptor for the socket. | |
Socket (EPoll &ePoll, std::string text="") | |
~Socket () | |
void | shutdown (std::string text="unknown") |
void | setDescriptor (int descriptor) |
Set the descriptor for the socket. More... | |
-int | getDescriptor () |
Get the descriptor for the socket. | |
int | getDescriptor () |
Get the descriptor for the socket. + More... | |
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) |
bool | eventReceived (struct epoll_event event) |
Parse epoll event and call specified callbacks. More... | |
int | write (std::string data) |
void | write (char *buffer, int length) |
-void | output (std::stringstream &out) |
void | output (std::stringstream &out) |
virtual void | onRegister () |
Called before the socket has registered with the epoll processing. More... | |
virtual void | onRegistered () |
Called when the socket has finished registering with the epoll processing. More... | |
Called after the socket has been registered with epoll processing. More... | |
virtual void | onUnregister () |
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. | |
bool | needsToWrite () |
Additional Inherited Members | |
![]() | |
-class { | |
} | bufferSize |
bool | reset = false |
![]() | |
-std::string | name |
std::string | name |
-std::string | tag |
std::string | tag |
![]() | |
-void | setBufferSize (int length) |
void | setBufferSize (int length) |
virtual void | onConnected () |
Called when socket is open and ready to communicate. More... | |
-virtual void | onTLSInit () |
virtual void | onDataReceived (std::string data)=0 |
Called when data is received from the socket. More... | |
int | getBufferSize () |
virtual void | onDataReceived (std::string data) |
Called when data is received from the socket. More... | |
virtual void | onDataReceived (char *buffer, int len) |
virtual void | receiveData (char *buffer, int bufferLength) |
![]() | |
-EPoll & | ePoll |
EPoll & | ePoll |
-bool | shutDown = false |
bool | shutDown = false |
core::UDPSocket::UDPSocket | +( | +EPoll & | +ePoll | ) | ++ |
core::UDPSocket::~UDPSocket | +( | +) | ++ |
|
| Session (core) | Thread (core) | UDPSocket (core) | ||
SessionFilter (core) | Timer (core) | |||||
Command (core) | IPAddress (core) | Socket (core) | TLSServerSocket (core) | |||
CommandList (core) | IPAddressList (core) |
| TLSService (core) | |||
ConsoleServer (core) |
| TLSSession (core) | ||||
ConsoleService (core) | TCPServerSocket (core) |
| ||||
ConsoleSession (core) | Object (core) | TCPSocket (core) |
|
+
|
+TCPSession (core) | +
|
+
+
TCPSocket (core) | +||||||
Command (core) | +INotify (core) | +SessionFilter (core) | +TerminalSession (core) | +UDPServerSocket (core) | +||
CommandList (core) | +IPAddress (core) | +Socket (core) | +Thread (core) | +UDPSocket (core) | +||
ConsoleServer (core) | +IPAddressList (core) | +
|
+Timer (core) | +|||
ConsoleSession (core) | +
|
+TLSServer (core) | +||||
|
| TerminalSession (core) | UDPServerSocket (core) | |||
EPoll (core) | Service (core) | TCPServer (core) | +TLSSession (core) | ++ | ||
Object (core) | +||||||
EPoll (core) | +||||||
Command.h | |
CommandList.h | |
ConsoleServer.h | |
ConsoleService.h | |
ConsoleSession.h | |
EPoll.h | |
IPAddress.h | |
IPAddressList.h | |
Object.h | |
Service.h | |
Session.h | |
SessionFilter.h | |
Socket.h | |
TCPServerSocket.h | |
TCPSocket.h | |
TerminalSession.h | |
Thread.h | |
Timer.h | |
TLSServerSocket.h | |
TLSService.h | |
TLSSession.h | |
UDPServerSocket.h | |
UDPSocket.h | |
Command.cpp | |
Command.h | |
CommandList.cpp | |
CommandList.h | |
ConsoleServer.cpp | |
ConsoleServer.h | |
ConsoleSession.cpp | |
ConsoleSession.h | |
EPoll.cpp | |
EPoll.h | |
INotify.cpp | |
INotify.h | |
IPAddress.cpp | |
IPAddress.h | |
IPAddressList.cpp | |
IPAddressList.h | |
Object.h | |
SessionFilter.h | |
Socket.cpp | |
Socket.h | |
TCPServer.cpp | |
TCPServer.h | |
TCPSession.cpp | |
TCPSession.h | |
TCPSocket.cpp | |
TCPSocket.h | |
TerminalSession.cpp | |
TerminalSession.h | |
Thread.cpp | |
Thread.h | |
Timer.cpp | |
Timer.h | |
TLSServer.cpp | |
TLSServer.h | |
TLSSession.cpp | |
TLSSession.h | |
UDPServerSocket.cpp | |
UDPServerSocket.h | |
UDPSocket.cpp | |
UDPSocket.h |
This page explains how to interpret the graphs that are generated by doxygen.
-Consider the following example:
This will result in the following graph:
-The boxes in the above graph have the following meaning:
+Consider the following example:
This will result in the following graph:
+The boxes in the above graph have the following meaning:
![]() |
![]() |
![]() |
Functions | |
-void | handshake_complete (const SSL *ssl, int where, int ret) |
void | setMode (Mode mode, int blockSize=0) |
void | handshake_complete (const SSL *ssl, int where, int ret) |
void core::handshake_complete | +( | +const SSL * | +ssl, | +
+ | + | int | +where, | +
+ | + | int | +ret | +
+ | ) | ++ |
void core::setMode | +( | +Mode | +mode, | +
+ | + | int | +blockSize = 0 |
+
+ | ) | ++ |