Move docs around.
This commit is contained in:
1 parent
63943e02dd
commit
3fee297136
2154 files changed
+19543
-41261
No files matched your search
+40
-4
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user