CMSDK  2.0.1
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
cmlabs::NetworkChannel Class Reference

Public Member Functions

 NetworkChannel (NetworkManager *manager)
 
bool isConnected (uint64 conid)
 
bool shutdown ()
 
bool startListener (uint64 cid, uint16 port, uint8 encryption, uint8 protocol, bool isAsync, uint32 protocolTimeout=3000, bool isDefaultProtocol=false)
 
bool stopListener (uint16 port, uint8 protocol)
 
uint64 createTCPConnection (const char *addr, uint16 port, uint8 encryption, uint8 protocol, bool isAsync, bool autoreconnect, uint64 &location, uint32 timeoutMS=5000)
 
uint64 createTCPConnection (uint64 location, uint8 encryption, uint8 protocol, bool isAsync, bool autoreconnect, uint32 timeoutMS=5000)
 
uint64 createTCPConnection (const uint32 *addresses, uint16 addressCount, uint16 port, uint8 encryption, uint8 protocol, bool isAsync, bool autoreconnect, uint64 &location, uint32 timeoutMS=5000)
 
uint64 createUDPConnection (uint16 port, uint8 protocol, bool isAsync, bool autoreconnect)
 
uint64 addTCPConnection (const char *addr, uint16 port, uint8 encryption, uint8 protocol, bool isAsync, uint64 &location, uint32 timeoutMS=5000, const char *greetingData=NULL, uint32 greetingSize=0)
 
uint64 addTCPConnection (uint64 location, uint8 encryption, uint8 protocol, bool isAsync, uint32 timeoutMS=5000, const char *greetingData=NULL, uint32 greetingSize=0)
 
bool endConnection (uint64 conid)
 
bool endUDPConnection (uint16 port)
 
uint8 getConnectionType (uint64 conid)
 
uint64 getRemoteAddress (uint64 conid)
 
uint64 autoDetectConnection (NetworkConnection *con, uint16 port, uint32 autoProtocols, uint32 autoProtocolTimeout, uint32 defaultProtocol, bool isAsync, bool autoreconnect)
 
uint64 startConnection (NetworkConnection *con, uint8 protocol, bool isAsync, bool autoreconnect, uint32 timeoutMS=5000)
 
bool setNewReceiver (NetworkReceiver *recv)
 
NetworkEventwaitForNetworkEvent (uint32 ms)
 
HTTPRequestwaitForHTTPRequest (uint64 &conid, uint32 ms)
 
TelnetLinewaitForTelnetLine (uint64 &conid, uint32 ms)
 
DataMessagewaitForMessage (uint64 &conid, uint32 ms)
 
HTTPReplywaitForHTTPReply (uint64 &conid, uint32 ms)
 
bool sendHTTPReply (HTTPReply *reply, uint64 conid)
 
bool sendTelnetLine (TelnetLine *line, uint64 conid)
 
bool sendMessage (DataMessage *msg, uint64 conid)
 
bool sendHTTPRequest (HTTPRequest *req, uint64 conid)
 
HTTPReplysendReceiveHTTPRequest (HTTPRequest *req, uint64 conid, uint32 timeout)
 
TelnetLinesendReceiveTelnetLine (TelnetLine *line, uint64 conid, uint32 timeout, uint32 size=0)
 
uint32 getOutputSpeed (uint64 conid)
 
uint32 getInputSpeed (uint64 conid)
 

Public Attributes

uint32 cid
 

Protected Member Functions

bool enterNetworkEvent (uint8 type, uint8 protocol, uint64 conid)
 
bool enterHTTPRequest (HTTPRequest *req, uint64 conid)
 
bool enterHTTPReply (HTTPReply *reply, HTTPRequest *req, uint64 conid)
 
bool enterMessage (DataMessage *msg, uint64 conid)
 
bool enterTelnetLine (TelnetLine *line, uint64 conid)
 

Static Protected Member Functions

static THREAD_RET THREAD_FUNCTION_CALL NetworkListenerRun (THREAD_ARG arg)
 
static THREAD_RET THREAD_FUNCTION_CALL ConnectionAutodetectRun (THREAD_ARG arg)
 
static THREAD_RET THREAD_FUNCTION_CALL HTTPClientRun (THREAD_ARG arg)
 
static THREAD_RET THREAD_FUNCTION_CALL HTTPServerRun (THREAD_ARG arg)
 
static THREAD_RET THREAD_FUNCTION_CALL MessageConnectionRun (THREAD_ARG arg)
 
static THREAD_RET THREAD_FUNCTION_CALL TelnetServerRun (THREAD_ARG arg)
 

Protected Attributes

NetworkManagermanager
 
NetworkReceiverreceiver
 
std::map< uint64, NetworkThread * > connectionThreads
 
std::map< uint16, NetworkThread * > listeners
 
std::map< uint16, NetworkThread * > udpListeners
 
std::queue< NetworkEvent * > eventQueue
 
utils::Semaphore eventQueueSemaphore
 
utils::Mutex eventQueueMutex
 
std::queue< HTTPRequest * > queueHTTPRequests
 
utils::Semaphore queueHTTPRequestsSemaphore
 
utils::Mutex queueHTTPRequestsMutex
 
std::queue< HTTPReply * > queueHTTPReplies
 
utils::Semaphore queueHTTPRepliesSemaphore
 
utils::Mutex queueHTTPRepliesMutex
 
std::queue< DataMessage * > queueMessages
 
utils::Semaphore queueMessagesSemaphore
 
utils::Mutex queueMessagesMutex
 
std::queue< TelnetLine * > queueTelnetLines
 
utils::Semaphore queueTelnetLinesSemaphore
 
utils::Mutex queueTelnetLinesMutex
 

Friends

class NetworkManager
 

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