#include <BaseTcpSupport.h>
Detailed Description
Definition at line 33 of file BaseTcpSupport.h.
Member Typedef Documentation
Member Enumeration Documentation
- Enumerator:
NO_EST_CONNECTION |
|
PEER_CLOSED |
|
PEER_TIMEDOUT |
|
PEER_REFUSED |
|
CONNECTION_RESET |
|
CONNECTION_SUCC_ClOSED |
|
Definition at line 38 of file BaseTcpSupport.h.
Member Function Documentation
void BaseTcpSupport::bindAndListenTcp |
( |
int |
port | ) |
|
|
protected |
Member function to bind service to the specified port and listen afterwards.
- Parameters
-
port | local portnumber to bind on |
Definition at line 50 of file BaseTcpSupport.cc.
{
return;
}
TCPSocket* newSocket = new TCPSocket();
newSocket->bind(port);
newSocket->setCallbackObject(this);
newSocket->listen();
}
Member function to close an established connection.
- Parameters
-
address | transport address of the remote host |
Definition at line 196 of file BaseTcpSupport.cc.
{
return;
}
oldSocket->close();
}
Member function to establish a connection to the specified node.
- Parameters
-
address | transport address of the remote host |
Definition at line 75 of file BaseTcpSupport.cc.
Referenced by handleConnectionEvent().
{
return;
}
TCPSocket* newSocket = new TCPSocket();
newSocket->setCallbackObject(this);
}
cGate* BaseTcpSupport::getTcpOut |
( |
| ) |
|
|
inlineprotected |
void BaseTcpSupport::handleDataReceived |
( |
TransportAddress |
address, |
|
|
cPacket * |
msg, |
|
|
bool |
urgent |
|
) |
| |
|
protectedvirtual |
Member function to handle incoming data.
- Parameters
-
address | transport address of the remote host |
msg | incoming data message |
urgent | message urgency |
Definition at line 121 of file BaseTcpSupport.cc.
Referenced by socketDataArrived().
Member function to handle newly opened connections.
- Parameters
-
address | transport address of the remote host |
Definition at line 126 of file BaseTcpSupport.cc.
Referenced by handleTCPMessage().
void BaseTcpSupport::handleTCPMessage |
( |
cMessage * |
msg | ) |
|
|
protected |
Member function to handle incoming TCP messages.
Definition at line 30 of file BaseTcpSupport.cc.
{
if (socket == NULL) {
socket = new TCPSocket(msg);
socket->setCallbackObject(this);
socket->getRemotePort());
socket->processMessage(msg);
} else {
socket->processMessage(msg);
}
}
Member function to send TCP data to the specified node.
- Parameters
-
msg | data message |
address | transport address of the remote host |
Definition at line 89 of file BaseTcpSupport.cc.
{
return;
}
if (socket->getState() == TCPSocket::CONNECTED) {
socket->send(msg);
}
transQueue::iterator tx =
queuedTx.find(address);
tx->second->push_back(msg);
} else {
newQueue->push_back(msg);
}
}
void BaseTcpSupport::setTcpOut |
( |
cGate * |
gate | ) |
|
|
inlineprotected |
Member function to set local gate towards the TCP module during init phase.
- Parameters
-
gate | local gate towards the TCP module |
Definition at line 120 of file BaseTcpSupport.h.
void BaseTcpSupport::socketDataArrived |
( |
int |
connId, |
|
|
void * |
yourPtr, |
|
|
cPacket * |
msg, |
|
|
bool |
urgent |
|
) |
| |
|
virtual |
void BaseTcpSupport::socketEstablished |
( |
int |
connId, |
|
|
void * |
yourPtr |
|
) |
| |
|
virtual |
Definition at line 140 of file BaseTcpSupport.cc.
{
if (socket == NULL) {
return;
}
socket->getRemotePort());
transQueue::iterator tx =
queuedTx.find(remoteAddress);
for (uint32 i = 0 ; i < tx->second->size(); i++) {
socket->send(tx->second->at(i));
}
tx->second->clear();
delete tx->second;
}
}
void BaseTcpSupport::socketFailure |
( |
int |
connId, |
|
|
void * |
yourPtr, |
|
|
int |
code |
|
) |
| |
|
virtual |
Definition at line 179 of file BaseTcpSupport.cc.
{
socket->getRemotePort());
if (code == TCP_I_CONNECTION_REFUSED) {
} else if (code == TCP_I_TIMED_OUT) {
} else if (code == TCP_I_CONNECTION_RESET) {
} else {
throw new cRuntimeError("Invalid error code on socketFailure.");
}
}
void BaseTcpSupport::socketPeerClosed |
( |
int |
connId, |
|
|
void * |
yourPtr |
|
) |
| |
|
virtual |
Definition at line 164 of file BaseTcpSupport.cc.
{
socket->getRemotePort());
socket->close();
} else if (socket->getState() == TCPSocket::CLOSED) {
}
}
virtual void BaseTcpSupport::socketStatusArrived |
( |
int |
connId, |
|
|
void * |
yourPtr, |
|
|
TCPStatusInfo * |
status |
|
) |
| |
|
inlinevirtual |
Member Data Documentation
cGate* BaseTcpSupport::tcpOut |
|
private |
The documentation for this class was generated from the following files: