#include <connection.h>
Collaboration diagram for Connection:

Public Methods | |
| Connection (SOCKET sock, Server *server) | |
| virtual | ~Connection () |
| Connection (const Connection &r_conn) | |
| bool | operator== (const Connection &r_conn) const |
| virtual void | HandleInput () |
| virtual void | HandleOutput () |
| virtual bool | CanBeDisconnected () |
| virtual bool | HasOutput () |
| virtual void | Disconnect () |
| virtual void | SendMsg (const string &r_msg) |
| virtual string * | ReadMsg () |
| virtual SOCKET | GetSocket () const |
Protected Methods | |
| Connection & | operator= (const Connection &r_conn) |
Protected Attributes | |
| Server * | mServer |
| Server serving this connection. | |
| Socket * | mSock |
| Network Socket stream. | |
| bool | mDisconnectable |
| Indicates connection is to be disconnected. | |
| list< string > | mInBuffer |
| Buffered input waiting to be processed. | |
| list< string > | mOutBuffer |
| Buffered output waiting to be sent. | |
| string | mPendingInput |
| Partially processed or formed input. | |
|
||||||||||||
|
Constructor for Connection. There is no default constructor as all connections must be constructed with a SOCKET. Definition at line 18 of file connection.cpp. References mSock. |
|
|
Destructor for Connection Definition at line 26 of file connection.cpp. References mSock. |
|
|
Copy Constructor for Connection Definition at line 33 of file connection.cpp. References mSock. |
|
|
CanBeDisconnected is called to query the Connection in order to check whether it has been scheduled for disconnection. Currently this status is set only when there is an error.
Definition at line 202 of file connection.cpp. References mDisconnectable. |
|
|
Disconnect is called to shutdown a Connection's socket. Definition at line 162 of file connection.cpp. References Socket::Close(), GetSocket(), mServer, mSock, Server::ServerLog(), and Log::Write(). |
|
|
GetSocket
Definition at line 211 of file connection.cpp. References Socket::GetSocket(), and mSock. Referenced by Server::AcceptConnection(), Disconnect(), HandleInput(), HandleOutput(), and operator==(). |
|
|
HandleInput is called to order a connection to process any input waiting on its socket. Input is parsed into lines based on the occurance of the CRLF terminator, which is stripped and pushed into a buffer which is a list of lines. The buffer expands dynamically as input is processed. Input that has yet to see a CRLF terminator is left in the Connection's pPendingInput array.
Definition at line 73 of file connection.cpp. References GetSocket(), mDisconnectable, mInBuffer, mPendingInput, mServer, mSock, Socket::Read(), Server::ServerLog(), and Log::Write(). |
|
|
HandleOutput is called to order a connection to process any output waiting on its socket.
Definition at line 135 of file connection.cpp. References Socket::Flush(), GetSocket(), mDisconnectable, mOutBuffer, mServer, mSock, Server::ServerLog(), Log::Write(), and Socket::Write(). |
|
|
HasOutput is called to query whether the Connection has output ready to send.
Definition at line 221 of file connection.cpp. References mOutBuffer. |
|
|
Assignment operator for Connection Definition at line 43 of file connection.cpp. References mInBuffer, mOutBuffer, mPendingInput, mServer, and mSock. |
|
|
Equality operator for Connection. If the SOCKET is the same they are equal. Definition at line 59 of file connection.cpp. References GetSocket(). |
|
|
ReadMsg removes a message from the Connection's input buffer.
Definition at line 185 of file connection.cpp. References mInBuffer. |
|
|
SendMsg places a message on the Connection's output buffer.
Definition at line 173 of file connection.cpp. References mOutBuffer. |
|
|
Indicates connection is to be disconnected.
Definition at line 42 of file connection.h. Referenced by CanBeDisconnected(), HandleInput(), and HandleOutput(). |
|
|
Buffered input waiting to be processed.
Definition at line 43 of file connection.h. Referenced by HandleInput(), operator=(), and ReadMsg(). |
|
|
Buffered output waiting to be sent.
Definition at line 44 of file connection.h. Referenced by HandleOutput(), HasOutput(), operator=(), and SendMsg(). |
|
|
Partially processed or formed input.
Definition at line 45 of file connection.h. Referenced by HandleInput(), and operator=(). |
|
|
Server serving this connection.
Definition at line 40 of file connection.h. Referenced by Disconnect(), HandleInput(), HandleOutput(), and operator=(). |
|
|
Network Socket stream.
Definition at line 41 of file connection.h. Referenced by Connection(), Disconnect(), GetSocket(), HandleInput(), HandleOutput(), operator=(), and ~Connection(). |
1.2.17