Got it compiling and somewhat working, except post.

This commit is contained in:
Brad Arant committed 2020-11-29 13:57:06 -08:00
1 parent 7ee13e87d2
commit bcea21cf96
12 files changed
+373 -133

No files matched your search

+43 -43
View File
@@ -8,23 +8,23 @@
#include "CommandList.h"
namespace core {
///
/// TCPServer
///
/// Manage a socket connection as a TCP server type. Connections to the socket are processed through
/// the accept functionality.
/// the accept functionality.
///
/// A list of connections is maintained in a vector object.
/// A list of connections is maintained in a vector object.
///
/// This object extends the BMACommand object as well so it can be added to a Console object and
/// process commands to display status information.
///
class TCPServer : public TCPSocket, public Command {
public:
///
/// The constructor for the BMATCPSocket object.
///
@@ -34,90 +34,90 @@ namespace core {
/// @param commandName the name of the command used to invoke the status display for this object.
/// @return the instance of the BMATCPServerSocket.
///
TCPServer(EPoll &ePoll, IPAddress address, std::string text = "");
///
/// The destructor for this object.
///
~TCPServer();
///
/// If not NULL the blacklist object can be assigned to this server socket and the server
/// IP addresses connecting to the server attempting to accept a socket are contained in
/// this list then the connection is rejected and no accept is granted.
///
IPAddressList *blackList;
///
/// If not NULL the blacklist object can be assigned to this server socket and the server
/// IP addresses connecting to the server attempting to accept a socket are contained in
/// this list then the connection is rejected and no accept is granted.
/// IP addresses connecting to the server attempting to accept a socket are contained in
/// this list then the connection is rejected and no accept is granted.
///
IPAddressList *blackList;
///
/// If not NULL the blacklist object can be assigned to this server socket and the server
/// IP addresses connecting to the server attempting to accept a socket are contained in
/// this list then the connection is rejected and no accept is granted.
///
IPAddressList *whiteList;
void removeFromSessionList(TCPSession *session);
virtual void sessionErrorHandler(std::string errorString, std::stringstream &out);
virtual void sessionErrorHandler(std::string errorString, std::stringstream &out);
///
/// 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
/// the mechanism where the server can select the protocol dialog for the desired
/// service.
///
///
virtual TCPSession * getSocketAccept(EPoll &epoll);
void output(TCPSession *session); ///<Output the consoles array to the console.
///
/// The list of sessions that are currently open and being maintained by this object.
///
std::vector<TCPSession *> sessions;
///
/// The commands object is a CommandList and is used to store Command objects to be
/// The commands object is a CommandList and is used to store Command objects to be
/// parsed and run as data comes into the session.
///
CommandList commands;
protected:
///
/// Override the virtual dataReceived since for the server these
/// are requests to accept the new connection socket.
/// No data is to be read or written when this method is called. It is the response to
/// the fact that a new connection is coming into the system
/// No data is to be read or written when this method is called. It is the response to
/// the fact that a new connection is coming into the system
///
/// @param data the pointer to the buffer containing the received data.
/// @param length the length of the associated data buffer.
///
void onDataReceived(std::string data) override;
void onDataReceived(std::string data) override;
///
/// This method is called when the Command associated with this object is requested
/// because a user has typed in the associated command name on a command entry line.
/// because a user has typed in the associated command name on a command entry line.
///
/// @param the session object to write the output to.
///
int processCommand(std::string command, TCPSession *session, std::stringstream &data) override;
private:
TCPSession * accept();
std::mutex lock;
};
}
#endif