|
INET Framework for OMNeT++/OMNEST
|
An example Telnet client application.
More...
#include <TelnetApp.h>
|
| virtual int | numInitStages () const override |
| |
| virtual void | initialize (int stage) override |
| |
| virtual void | handleTimer (cMessage *msg) override |
| |
| virtual void | socketEstablished (TcpSocket *socket) override |
| |
| virtual void | socketDataArrived (TcpSocket *socket, Packet *msg, bool urgent) override |
| | Notifies about data arrival, packet ownership is transferred to the callee. More...
|
| |
| virtual void | socketClosed (TcpSocket *socket) override |
| |
| virtual void | socketFailure (TcpSocket *socket, int code) override |
| |
| virtual void | checkedScheduleAt (simtime_t t, cMessage *msg) |
| |
| virtual void | sendGenericAppMsg (int numBytes, int expectedReplyBytes) |
| |
| virtual void | handleStartOperation (LifecycleOperation *operation) override |
| |
| virtual void | handleStopOperation (LifecycleOperation *operation) override |
| |
| virtual void | handleCrashOperation (LifecycleOperation *operation) override |
| |
| virtual void | handleMessageWhenUp (cMessage *msg) override |
| |
| virtual void | finish () override |
| |
| virtual void | refreshDisplay () const override |
| |
| virtual void | connect () |
| |
| virtual void | close () |
| |
| virtual void | sendPacket (Packet *pkt) |
| |
| virtual void | socketAvailable (TcpSocket *socket, TcpAvailableInfo *availableInfo) override |
| |
| virtual void | socketPeerClosed (TcpSocket *socket) override |
| |
| virtual void | socketStatusArrived (TcpSocket *socket, TcpStatusInfo *status) override |
| |
| virtual void | socketDeleted (TcpSocket *socket) override |
| |
| virtual bool | isInitializeStage (int stage) const override |
| |
| virtual bool | isModuleStartStage (int stage) const override |
| |
| virtual bool | isModuleStopStage (int stage) const override |
| |
| virtual int | numInitStages () const override |
| |
| virtual void | refreshDisplay () const override |
| |
| virtual void | handleMessage (cMessage *msg) override |
| |
| virtual void | handleMessageWhenDown (cMessage *msg) |
| |
| virtual bool | handleOperationStage (LifecycleOperation *operation, IDoneCallback *doneCallback) override |
| | Perform one stage of a lifecycle operation. More...
|
| |
| virtual State | getInitialOperationalState () const |
| | Returns initial operational state: OPERATING or NOT_OPERATING. More...
|
| |
| virtual void | handleActiveOperationTimeout (cMessage *message) |
| |
| virtual bool | isUp () const |
| | utility functions More...
|
| |
| virtual bool | isDown () const |
| |
| virtual void | setOperationalState (State newState) |
| |
| virtual void | scheduleOperationTimeout (simtime_t timeout) |
| |
| virtual void | setupActiveOperation (LifecycleOperation *operation, IDoneCallback *doneCallback, State) |
| |
| virtual void | delayActiveOperationFinish (simtime_t timeout) |
| |
| virtual void | startActiveOperationExtraTime (simtime_t delay=SIMTIME_ZERO) |
| |
| virtual void | startActiveOperationExtraTimeOrFinish (simtime_t extraTime) |
| |
| virtual void | finishActiveOperation () |
| |
An example Telnet client application.
The server app should be TcpGenericServerApp.
◆ TelnetApp()
| inet::TelnetApp::TelnetApp |
( |
| ) |
|
|
inline |
◆ ~TelnetApp()
| inet::TelnetApp::~TelnetApp |
( |
| ) |
|
|
virtual |
◆ checkedScheduleAt()
| void inet::TelnetApp::checkedScheduleAt |
( |
simtime_t |
t, |
|
|
cMessage * |
msg |
|
) |
| |
|
protectedvirtual |
◆ handleCrashOperation()
◆ handleStartOperation()
◆ handleStopOperation()
◆ handleTimer()
| void inet::TelnetApp::handleTimer |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Implements inet::TcpAppBase.
81 switch (msg->getKind()) {
83 EV_INFO <<
"user fires up telnet program\n";
90 EV_INFO <<
"user types one character, " <<
numCharsToType - 1 <<
" more to go\n";
96 EV_INFO <<
"user hits Enter key\n";
108 EV_INFO <<
"user exits telnet program\n";
◆ initialize()
| void inet::TelnetApp::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::TcpAppBase.
44 simtime_t startTime = par(
"startTime");
47 throw cRuntimeError(
"Invalid startTime/stopTime parameters");
◆ numInitStages()
| virtual int inet::TelnetApp::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ sendGenericAppMsg()
| void inet::TelnetApp::sendGenericAppMsg |
( |
int |
numBytes, |
|
|
int |
expectedReplyBytes |
|
) |
| |
|
protectedvirtual |
116 EV_INFO <<
"sending " << numBytes <<
" bytes, expecting " << expectedReplyBytes << endl;
118 const auto& payload = makeShared<GenericAppMsg>();
119 Packet *packet =
new Packet(
"data");
120 payload->setChunkLength(
B(numBytes));
121 payload->setExpectedReplyLength(
B(expectedReplyBytes));
122 payload->setServerClose(
false);
123 payload->addTag<CreationTimeTag>()->setCreationTime(simTime());
124 packet->insertAtBack(payload);
Referenced by handleTimer().
◆ socketClosed()
| void inet::TelnetApp::socketClosed |
( |
TcpSocket * |
socket | ) |
|
|
overrideprotectedvirtual |
◆ socketDataArrived()
| void inet::TelnetApp::socketDataArrived |
( |
TcpSocket * |
socket, |
|
|
Packet * |
packet, |
|
|
bool |
urgent |
|
) |
| |
|
overrideprotectedvirtual |
Notifies about data arrival, packet ownership is transferred to the callee.
Reimplemented from inet::TcpAppBase.
142 int len = msg->getByteLength();
147 EV_INFO <<
"received echo\n";
151 EV_INFO <<
"received output of command typed\n";
158 EV_INFO <<
"user has no more commands to type\n";
165 EV_INFO <<
"user looks at output, then starts typing next command\n";
◆ socketEstablished()
| void inet::TelnetApp::socketEstablished |
( |
TcpSocket * |
socket | ) |
|
|
overrideprotectedvirtual |
◆ socketFailure()
| void inet::TelnetApp::socketFailure |
( |
TcpSocket * |
socket, |
|
|
int |
code |
|
) |
| |
|
overrideprotectedvirtual |
◆ numCharsToType
| int inet::TelnetApp::numCharsToType = 0 |
|
protected |
◆ numLinesToType
| int inet::TelnetApp::numLinesToType = 0 |
|
protected |
◆ stopTime
| simtime_t inet::TelnetApp::stopTime |
|
protected |
◆ timeoutMsg
| cMessage* inet::TelnetApp::timeoutMsg = nullptr |
|
protected |
The documentation for this class was generated from the following files:
virtual void sendGenericAppMsg(int numBytes, int expectedReplyBytes)
Definition: TelnetApp.cc:114
State operationalState
Definition: OperationalMixin.h:23
cMessage * timeoutMsg
Definition: TelnetApp.h:22
#define MSGKIND_SEND
Definition: TelnetApp.cc:20
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
virtual bool isOpen() const override
Definition: TcpSocket.cc:257
virtual void initialize(int stage) override
Definition: TcpAppBase.cc:17
virtual void socketEstablished(TcpSocket *socket) override
Definition: TcpAppBase.cc:113
virtual void sendPacket(Packet *pkt)
Definition: TcpAppBase.cc:97
intscale< b, 1, 8 > B
Definition: Units.h:1168
virtual void connect()
Definition: TcpAppBase.cc:50
virtual void checkedScheduleAt(simtime_t t, cMessage *msg)
Definition: TelnetApp.cc:30
TcpSocket socket
Definition: TcpAppBase.h:25
virtual void socketDataArrived(TcpSocket *socket, Packet *msg, bool urgent) override
Notifies about data arrival, packet ownership is transferred to the callee.
Definition: TcpAppBase.cc:119
#define MSGKIND_CLOSE
Definition: TelnetApp.cc:21
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
simtime_t stopTime
Definition: TelnetApp.h:25
virtual void destroy() override
Destroy the connection.
Definition: TcpSocket.cc:186
virtual void socketFailure(TcpSocket *socket, int code) override
Definition: TcpAppBase.cc:144
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
int numCharsToType
Definition: TelnetApp.h:24
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
virtual void socketClosed(TcpSocket *socket) override
Definition: TcpAppBase.cc:138
#define MSGKIND_CONNECT
Definition: TelnetApp.cc:19
virtual void close()
Definition: TcpAppBase.cc:90
int numLinesToType
Definition: TelnetApp.h:23