|
INET Framework for OMNeT++/OMNEST
|
Consumes and prints packets received from the Udp module.
More...
#include <UdpSink.h>
Consumes and prints packets received from the Udp module.
See NED for more info.
◆ SelfMsgKinds
◆ UdpSink()
| inet::UdpSink::UdpSink |
( |
| ) |
|
|
inline |
◆ ~UdpSink()
| inet::UdpSink::~UdpSink |
( |
| ) |
|
|
virtual |
◆ finish()
| void inet::UdpSink::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
92 ApplicationBase::finish();
93 EV_INFO << getFullPath() <<
": received " <<
numReceived <<
" packets\n";
◆ handleCrashOperation()
◆ handleMessageWhenUp()
| void inet::UdpSink::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Implements inet::OperationalMixin< cSimpleModule >.
42 if (msg->isSelfMessage()) {
54 throw cRuntimeError(
"Invalid kind %d in self message", (
int)
selfMsg->getKind());
57 else if (msg->arrivedOn(
"socketIn"))
60 throw cRuntimeError(
"Unknown incoming gate: '%s'", msg->getArrivalGate()->getFullName());
◆ handleStartOperation()
◆ handleStopOperation()
◆ initialize()
| void inet::UdpSink::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ numInitStages()
| virtual int inet::UdpSink::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ processPacket()
| void inet::UdpSink::processPacket |
( |
Packet * |
msg | ) |
|
|
protectedvirtual |
◆ processStart()
| void inet::UdpSink::processStart |
( |
| ) |
|
|
protectedvirtual |
◆ processStop()
| void inet::UdpSink::processStop |
( |
| ) |
|
|
protectedvirtual |
◆ refreshDisplay()
| void inet::UdpSink::refreshDisplay |
( |
| ) |
const |
|
overrideprotectedvirtual |
87 getDisplayString().setTagArg(
"t", 0, buf);
◆ setSocketOptions()
| void inet::UdpSink::setSocketOptions |
( |
| ) |
|
|
protectedvirtual |
98 bool receiveBroadcast = par(
"receiveBroadcast");
102 MulticastGroupList mgl = getModuleFromPar<IInterfaceTable>(par(
"interfaceTableModule"),
this)->collectMulticastGroups();
106 const char *groupAddr = par(
"multicastGroup");
110 throw cRuntimeError(
"Wrong multicastGroup setting: not a multicast address: %s", groupAddr);
Referenced by processStart().
◆ socketClosed()
| void inet::UdpSink::socketClosed |
( |
UdpSocket * |
socket | ) |
|
|
overrideprotectedvirtual |
◆ socketDataArrived()
| void inet::UdpSink::socketDataArrived |
( |
UdpSocket * |
socket, |
|
|
Packet * |
packet |
|
) |
| |
|
overrideprotectedvirtual |
◆ socketErrorArrived()
Notifies about error indication arrival, indication ownership is transferred to the callee.
Implements inet::UdpSocket::ICallback.
71 EV_WARN <<
"Ignoring UDP error report " << indication->getName() << endl;
◆ localPort
| int inet::UdpSink::localPort = -1 |
|
protected |
◆ multicastGroup
◆ numReceived
| int inet::UdpSink::numReceived = 0 |
|
protected |
◆ selfMsg
| cMessage* inet::UdpSink::selfMsg = nullptr |
|
protected |
◆ socket
◆ startTime
| simtime_t inet::UdpSink::startTime |
|
protected |
◆ stopTime
| simtime_t inet::UdpSink::stopTime |
|
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
bool isMulticast() const
Definition: L3Address.cc:190
State operationalState
Definition: OperationalMixin.h:23
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
static std::string getReceivedPacketInfo(Packet *pk)
Utility function: returns a line of information about a packet received via UDP.
Definition: UdpSocket.cc:315
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 destroy() override
Notify the protocol that the owner of ISocket has destroyed the socket.
Definition: UdpSocket.cc:98
virtual void processStart()
Definition: UdpSink.cc:116
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: UdpSocket.cc:338
@ STOP
Definition: UdpSink.h:22
bool isUnspecified() const
Definition: L3Address.cc:138
int localPort
Definition: UdpSink.h:25
UdpSocket socket
Definition: UdpSink.h:24
L3Address multicastGroup
Definition: UdpSink.h:26
simtime_t startTime
Definition: UdpSink.h:27
simsignal_t packetReceivedSignal
Definition: Simsignals.cc:97
void joinLocalMulticastGroups(MulticastGroupList mgl)
Joins the socket to each multicast group that are registered with any of the interfaces.
Definition: UdpSocket.cc:265
virtual void processMessage(cMessage *msg) override
Examines the message, takes ownership, and updates socket state.
Definition: UdpSocket.cc:343
simtime_t stopTime
Definition: UdpSink.h:28
int numReceived
Definition: UdpSink.h:30
void leaveMulticastGroup(const L3Address &multicastAddr)
Causes the socket to leave the given multicast group, i.e.
Definition: UdpSocket.cc:187
virtual void processStop()
Definition: UdpSink.cc:128
void joinMulticastGroup(const L3Address &multicastAddr, int interfaceId=-1)
Adds the socket to the given multicast group, that is, UDP packets arriving to the given multicast ad...
Definition: UdpSocket.cc:175
std::vector< MulticastGroup > MulticastGroupList
Definition: IInterfaceTable.h:26
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
virtual void close() override
Unbinds the socket.
Definition: UdpSocket.cc:87
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
void setBroadcast(bool broadcast)
Set the Broadcast option on the UDP socket.
Definition: UdpSocket.cc:139
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
virtual void setSocketOptions()
Definition: UdpSink.cc:96
cMessage * selfMsg
Definition: UdpSink.h:29
virtual void refreshDisplay() const override
Definition: OperationalMixinImpl.h:200
virtual void processPacket(Packet *msg)
Definition: UdpSink.cc:135
@ START
Definition: UdpSink.h:22