#include <TunSocket.h>
◆ TunSocket()
| inet::TunSocket::TunSocket |
( |
| ) |
|
19 socketId = getEnvir()->getUniqueNumber();
◆ ~TunSocket()
| inet::TunSocket::~TunSocket |
( |
| ) |
|
|
inline |
◆ belongsToSocket()
| bool inet::TunSocket::belongsToSocket |
( |
cMessage * |
msg | ) |
const |
|
overridevirtual |
Returns true if the message belongs to this socket.
Implements inet::ISocket.
29 auto&
tags = check_and_cast<ITaggedObject *>(msg)->getTags();
Referenced by processMessage().
◆ close()
| void inet::TunSocket::close |
( |
| ) |
|
|
overridevirtual |
Close the socket.
Implements inet::ISocket.
79 TunCloseCommand *command =
new TunCloseCommand();
80 request->setControlInfo(command);
◆ destroy()
| void inet::TunSocket::destroy |
( |
| ) |
|
|
overridevirtual |
Notify the protocol that the owner of ISocket has destroyed the socket.
Typically used when the owner of ISocket has crashed.
Implements inet::ISocket.
88 auto command =
new TunDestroyCommand();
89 request->setControlInfo(command);
◆ getSocketId()
| virtual int inet::TunSocket::getSocketId |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getUserData()
| void* inet::TunSocket::getUserData |
( |
| ) |
const |
|
inline |
◆ isOpen()
| virtual bool inet::TunSocket::isOpen |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ open()
| void inet::TunSocket::open |
( |
int |
interfaceId | ) |
|
◆ processMessage()
| void inet::TunSocket::processMessage |
( |
cMessage * |
msg | ) |
|
|
overridevirtual |
Examines the message, takes ownership, and updates socket state.
Implements inet::ISocket.
38 switch (msg->getKind()) {
52 throw cRuntimeError(
"TunSocket: invalid msg kind %d, one of the TUN_I_xxx constants expected", msg->getKind());
◆ send()
| void inet::TunSocket::send |
( |
Packet * |
packet | ) |
|
|
overridevirtual |
◆ sendToTun()
| void inet::TunSocket::sendToTun |
( |
cMessage * |
msg | ) |
|
|
protected |
97 throw cRuntimeError(
"TunSocket: setOutputGate() must be invoked before socket can be used");
98 auto&
tags = check_and_cast<ITaggedObject *>(msg)->getTags();
Referenced by close(), destroy(), open(), and send().
◆ setCallback()
| void inet::TunSocket::setCallback |
( |
ICallback * |
cb | ) |
|
Sets a callback object, to be used with processMessage().
This callback object may be your simple module itself (if it multiply inherits from ICallback too, that is you declared it as
class MyAppModule : public cSimpleModule, public TunSocket::ICallback
and redefined the necessary virtual functions; or you may use dedicated class (and objects) for this purpose.
TunSocket doesn't delete the callback object in the destructor or on any other occasion.
Referenced by inet::TunnelApp::initialize().
◆ setOutputGate()
| void inet::TunSocket::setOutputGate |
( |
cGate * |
outputGate | ) |
|
|
inline |
◆ setUserData()
| void inet::TunSocket::setUserData |
( |
void * |
userData | ) |
|
|
inline |
◆ callback
| ICallback* inet::TunSocket::callback = nullptr |
|
protected |
◆ interfaceId
| int inet::TunSocket::interfaceId = -1 |
|
protected |
◆ isOpen_
| bool inet::TunSocket::isOpen_ = false |
|
protected |
◆ outputGate
| cGate* inet::TunSocket::outputGate = nullptr |
|
protected |
◆ socketId
| int inet::TunSocket::socketId = -1 |
|
protected |
◆ userData
| void* inet::TunSocket::userData = nullptr |
|
protected |
The documentation for this class was generated from the following files: