|
INET Framework for OMNeT++/OMNEST
|
UDP application.
More...
#include <UdpBasicBurst.h>
UDP application.
See NED for more info.
◆ SourceSequence
◆ ChooseDestAddrMode
| Enumerator |
|---|
| ONCE | |
| PER_BURST | |
| PER_SEND | |
◆ SelfMsgKinds
| Enumerator |
|---|
| START | |
| SEND | |
| STOP | |
◆ UdpBasicBurst()
| inet::UdpBasicBurst::UdpBasicBurst |
( |
| ) |
|
|
inline |
◆ ~UdpBasicBurst()
| inet::UdpBasicBurst::~UdpBasicBurst |
( |
| ) |
|
◆ chooseDestAddr()
| L3Address inet::UdpBasicBurst::chooseDestAddr |
( |
| ) |
|
|
protectedvirtual |
◆ createPacket()
| Packet * inet::UdpBasicBurst::createPacket |
( |
| ) |
|
|
protectedvirtual |
99 sprintf(msgName,
"UDPBasicAppData-%d",
counter++);
101 Packet *pk =
new Packet(msgName);
102 const auto& payload = makeShared<ApplicationPacket>();
103 payload->setChunkLength(
B(msgByteLength));
104 payload->setSequenceNumber(
numSent);
105 payload->addTag<CreationTimeTag>()->setCreationTime(simTime());
106 pk->insertAtBack(payload);
107 pk->addPar(
"sourceId") = getId();
Referenced by generateBurst().
◆ finish()
| void inet::UdpBasicBurst::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
333 recordScalar(
"Total sent",
numSent);
336 ApplicationBase::finish();
◆ generateBurst()
| void inet::UdpBasicBurst::generateBurst |
( |
| ) |
|
|
protectedvirtual |
280 simtime_t now = simTime();
286 if (sendInterval <= 0.0)
287 throw cRuntimeError(
"The sendInterval parameter must be bigger than 0");
292 if (burstDuration < 0.0)
293 throw cRuntimeError(
"The burstDuration parameter mustn't be smaller than 0");
296 if (burstDuration == 0.0)
299 if (sleepDuration < 0.0)
300 throw cRuntimeError(
"The sleepDuration parameter mustn't be smaller than 0");
314 payload->addTag<FragmentationReq>()->setDontFragment(
true);
315 payload->setTimestamp();
Referenced by processSend().
◆ handleCrashOperation()
◆ handleMessageWhenUp()
| void inet::UdpBasicBurst::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
◆ handleStartOperation()
◆ handleStopOperation()
◆ initialize()
| void inet::UdpBasicBurst::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalMixin< cSimpleModule >.
57 throw cRuntimeError(
"Invalid startTime/stopTime parameters");
69 const char *addrModeStr = par(
"chooseDestAddrMode");
70 int addrMode = cEnum::get(
"inet::ChooseDestAddrMode")->lookup(addrModeStr);
72 throw cRuntimeError(
"Invalid chooseDestAddrMode: '%s'", addrModeStr);
83 timerNext =
new cMessage(
"UDPBasicBurstTimer");
◆ numInitStages()
| virtual int inet::UdpBasicBurst::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ processPacket()
| void inet::UdpBasicBurst::processPacket |
( |
Packet * |
msg | ) |
|
|
protectedvirtual |
235 EV_WARN <<
"UDP error received\n";
240 if (pk->hasPar(
"sourceId") && pk->hasPar(
"msgId")) {
242 int moduleId = pk->par(
"sourceId");
243 int msgId = pk->par(
"msgId");
246 if (it->second >= msgId) {
261 if (simTime() - pk->getTimestamp() >
delayLimit) {
263 PacketDropDetails details;
Referenced by socketDataArrived().
◆ processSend()
| void inet::UdpBasicBurst::processSend |
( |
| ) |
|
|
protectedvirtual |
◆ processStart()
| void inet::UdpBasicBurst::processStart |
( |
| ) |
|
|
protectedvirtual |
119 int timeToLive = par(
"timeToLive");
120 if (timeToLive != -1)
123 int dscp = par(
"dscp");
127 int tos = par(
"tos");
131 const char *destAddrs = par(
"destAddresses");
132 cStringTokenizer tokenizer(destAddrs);
134 bool excludeLocalDestAddresses = par(
"excludeLocalDestAddresses");
136 IInterfaceTable *ift = getModuleFromPar<IInterfaceTable>(par(
"interfaceTableModule"),
this);
138 while ((token = tokenizer.nextToken()) !=
nullptr) {
139 if (strstr(token,
"Broadcast") !=
nullptr)
142 L3Address addr = L3AddressResolver().resolve(token);
143 if (excludeLocalDestAddresses && ift && ift->isLocalAddress(addr))
Referenced by handleMessageWhenUp().
◆ processStop()
| void inet::UdpBasicBurst::processStop |
( |
| ) |
|
|
protectedvirtual |
◆ refreshDisplay()
| void inet::UdpBasicBurst::refreshDisplay |
( |
| ) |
const |
|
overrideprotectedvirtual |
229 getDisplayString().setTagArg(
"t", 0, buf);
◆ socketClosed()
| void inet::UdpBasicBurst::socketClosed |
( |
UdpSocket * |
socket | ) |
|
|
overrideprotectedvirtual |
◆ socketDataArrived()
| void inet::UdpBasicBurst::socketDataArrived |
( |
UdpSocket * |
socket, |
|
|
Packet * |
packet |
|
) |
| |
|
overrideprotectedvirtual |
◆ socketErrorArrived()
Notifies about error indication arrival, indication ownership is transferred to the callee.
Implements inet::UdpSocket::ICallback.
213 EV_WARN <<
"Ignoring UDP error report " << indication->getName() << endl;
◆ activeBurst
| bool inet::UdpBasicBurst::activeBurst = false |
|
protected |
◆ burstDurationPar
| cPar* inet::UdpBasicBurst::burstDurationPar = nullptr |
|
protected |
◆ chooseDestAddrMode
◆ counter
| int inet::UdpBasicBurst::counter |
|
staticprotected |
◆ delayLimit
| simtime_t inet::UdpBasicBurst::delayLimit |
|
protected |
◆ destAddr
◆ destAddresses
| std::vector<L3Address> inet::UdpBasicBurst::destAddresses |
|
protected |
◆ destAddrRNG
| int inet::UdpBasicBurst::destAddrRNG = -1 |
|
protected |
◆ destPort
| int inet::UdpBasicBurst::destPort = -1 |
|
protected |
◆ dontFragment
| bool inet::UdpBasicBurst::dontFragment = false |
|
protected |
◆ haveSleepDuration
| bool inet::UdpBasicBurst::haveSleepDuration = false |
|
protected |
◆ isSource
| bool inet::UdpBasicBurst::isSource = false |
|
protected |
◆ localPort
| int inet::UdpBasicBurst::localPort = -1 |
|
protected |
◆ messageLengthPar
| cPar* inet::UdpBasicBurst::messageLengthPar = nullptr |
|
protected |
◆ nextBurst
| simtime_t inet::UdpBasicBurst::nextBurst |
|
protected |
◆ nextPkt
| simtime_t inet::UdpBasicBurst::nextPkt |
|
protected |
◆ nextSleep
| simtime_t inet::UdpBasicBurst::nextSleep |
|
protected |
◆ numDeleted
| int inet::UdpBasicBurst::numDeleted = 0 |
|
protected |
◆ numDuplicated
| int inet::UdpBasicBurst::numDuplicated = 0 |
|
protected |
◆ numReceived
| int inet::UdpBasicBurst::numReceived = 0 |
|
protected |
◆ numSent
| int inet::UdpBasicBurst::numSent = 0 |
|
protected |
◆ outOfOrderPkSignal
| simsignal_t inet::UdpBasicBurst::outOfOrderPkSignal = registerSignal("outOfOrderPk") |
|
staticprotected |
◆ sendIntervalPar
| cPar* inet::UdpBasicBurst::sendIntervalPar = nullptr |
|
protected |
◆ sleepDurationPar
| cPar* inet::UdpBasicBurst::sleepDurationPar = nullptr |
|
protected |
◆ socket
◆ sourceSequence
◆ startTime
| simtime_t inet::UdpBasicBurst::startTime |
|
protected |
◆ stopTime
| simtime_t inet::UdpBasicBurst::stopTime |
|
protected |
◆ timerNext
| cMessage* inet::UdpBasicBurst::timerNext = nullptr |
|
protected |
The documentation for this class was generated from the following files:
void setOutputGate(cGate *toUdp)
Sets the gate on which to send to UDP.
Definition: UdpSocket.h:117
virtual L3Address chooseDestAddr()
Definition: UdpBasicBurst.cc:87
void setDscp(short dscp)
Sets the Ipv4 / Ipv6 dscp fields of packets sent from the UDP socket.
Definition: UdpSocket.cc:121
void setTimeToLive(int ttl)
Set the TTL (Ipv6: Hop Limit) field on sent packets.
Definition: UdpSocket.cc:112
SourceSequence sourceSequence
Definition: UdpBasicBurst.h:51
State operationalState
Definition: OperationalMixin.h:23
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
bool dontFragment
Definition: UdpBasicBurst.h:59
@ PER_SEND
Definition: UdpBasicBurst.h:26
void sendTo(Packet *msg, L3Address destAddr, int destPort)
Sends a data packet to the given address and port.
Definition: UdpSocket.cc:69
static std::string getReceivedPacketInfo(Packet *pk)
Utility function: returns a line of information about a packet received via UDP.
Definition: UdpSocket.cc:315
cPar * burstDurationPar
Definition: UdpBasicBurst.h:44
int destPort
Definition: UdpBasicBurst.h:39
simtime_t stopTime
Definition: UdpBasicBurst.h:38
cPar * messageLengthPar
Definition: UdpBasicBurst.h:43
int numDeleted
Definition: UdpBasicBurst.h:66
static int counter
Definition: UdpBasicBurst.h:62
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
virtual void processPacket(Packet *msg)
Definition: UdpBasicBurst.cc:232
virtual void destroy() override
Notify the protocol that the owner of ISocket has destroyed the socket.
Definition: UdpSocket.cc:98
simtime_t delayLimit
Definition: UdpBasicBurst.h:36
@ ONCE
Definition: UdpBasicBurst.h:26
simtime_t nextBurst
Definition: UdpBasicBurst.h:54
static simsignal_t outOfOrderPkSignal
Definition: UdpBasicBurst.h:69
simsignal_t packetSentSignal
Definition: Simsignals.cc:96
L3Address destAddr
Definition: UdpBasicBurst.h:50
bool activeBurst
Definition: UdpBasicBurst.h:57
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: UdpSocket.cc:338
bool isSource
Definition: UdpBasicBurst.h:56
simsignal_t packetDroppedSignal
Definition: Simsignals.cc:85
std::vector< L3Address > destAddresses
Definition: UdpBasicBurst.h:34
virtual void processStart()
Definition: UdpBasicBurst.cc:113
static const Ipv4Address ALLONES_ADDRESS
255.255.255.255
Definition: Ipv4Address.h:94
cPar * sendIntervalPar
Definition: UdpBasicBurst.h:46
@ PER_BURST
Definition: UdpBasicBurst.h:26
@ START
Definition: UdpBasicBurst.h:30
intscale< b, 1, 8 > B
Definition: Units.h:1168
int numDuplicated
Definition: UdpBasicBurst.h:67
simsignal_t packetReceivedSignal
Definition: Simsignals.cc:97
virtual void processMessage(cMessage *msg) override
Examines the message, takes ownership, and updates socket state.
Definition: UdpSocket.cc:343
ChooseDestAddrMode chooseDestAddrMode
Definition: UdpBasicBurst.h:35
int numSent
Definition: UdpBasicBurst.h:64
ChooseDestAddrMode
Definition: UdpBasicBurst.h:25
simtime_t nextPkt
Definition: UdpBasicBurst.h:53
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
UdpSocket socket
Definition: UdpBasicBurst.h:49
virtual void close() override
Unbinds the socket.
Definition: UdpSocket.cc:87
cPar * sleepDurationPar
Definition: UdpBasicBurst.h:45
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
virtual void processSend()
Definition: UdpBasicBurst.cc:166
virtual void processStop()
Definition: UdpBasicBurst.cc:175
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
const double k
Definition: Qam1024Modulation.cc:14
@ STOP
Definition: UdpBasicBurst.h:30
simtime_t startTime
Definition: UdpBasicBurst.h:37
simtime_t nextSleep
Definition: UdpBasicBurst.h:55
virtual void generateBurst()
Definition: UdpBasicBurst.cc:278
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
int numReceived
Definition: UdpBasicBurst.h:65
virtual Packet * createPacket()
Definition: UdpBasicBurst.cc:96
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
@ CONGESTION
Definition: Simsignals_m.h:80
int destAddrRNG
Definition: UdpBasicBurst.h:40
void setTos(short tos)
Sets the Ipv4 Type of Service / Ipv6 Traffic Class fields of packets sent from the UDP socket.
Definition: UdpSocket.cc:130
cMessage * timerNext
Definition: UdpBasicBurst.h:52
@ SEND
Definition: UdpBasicBurst.h:30
virtual void refreshDisplay() const override
Definition: OperationalMixinImpl.h:200
@ UDP_I_ERROR
Definition: UdpControlInfo_m.h:158
int localPort
Definition: UdpBasicBurst.h:39