|
INET Framework for OMNeT++/OMNEST
|
Implements a simple VoIP source.
More...
#include <SimpleVoipSender.h>
Implements a simple VoIP source.
See the NED file for more information.
◆ ~SimpleVoipSender()
| inet::SimpleVoipSender::~SimpleVoipSender |
( |
| ) |
|
|
virtual |
◆ SimpleVoipSender()
| inet::SimpleVoipSender::SimpleVoipSender |
( |
| ) |
|
◆ handleMessage()
| void inet::SimpleVoipSender::handleMessage |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
76 if (msg->isSelfMessage()) {
83 throw cRuntimeError(
"Unknown incoming message: '%s' on gate '%s'", msg->getClassName(), msg->getArrivalGate()->getFullName());
◆ initialize()
| void inet::SimpleVoipSender::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
32 EV_TRACE <<
"VoIP Sender initialize: stage " << stage << endl;
34 cSimpleModule::initialize(stage);
53 NodeStatus *nodeStatus = node ? check_and_cast_nullable<NodeStatus *>(node->getSubmodule(
"status")) : nullptr;
54 bool isOperational = (!nodeStatus) || nodeStatus->getState() ==
NodeStatus::UP;
56 throw cRuntimeError(
"This module doesn't support starting in node DOWN state");
61 EV_INFO <<
"VoIPSender::initialize - binding to port: local:" <<
localPort <<
" , dest:" <<
destPort << endl;
64 simtime_t startTime(par(
"startTime"));
67 throw cRuntimeError(
"Invalid startTime/stopTime settings: startTime %g s greater than stopTime %g s", SIMTIME_DBL(startTime), SIMTIME_DBL(
stopTime));
70 EV_INFO <<
"\t starting traffic in " << startTime <<
" s" << endl;
◆ numInitStages()
| virtual int inet::SimpleVoipSender::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ selectTalkOrSilenceInterval()
| void inet::SimpleVoipSender::selectTalkOrSilenceInterval |
( |
| ) |
|
|
protected |
◆ sendVoIPPacket()
| void inet::SimpleVoipSender::sendVoIPPacket |
( |
| ) |
|
|
protected |
138 destAddress = L3AddressResolver().resolve(par(
"destAddress"));
140 Packet *packet =
new Packet(
"VoIP");
141 const auto& voice = makeShared<SimpleVoipPacket>();
149 packet->insertAtBack(voice);
Referenced by handleMessage().
◆ talkspurt()
| void inet::SimpleVoipSender::talkspurt |
( |
simtime_t |
dur | ) |
|
|
protected |
88 simtime_t curTime = simTime();
89 simtime_t startTime = curTime;
92 simtime_t delta =
selfSender->getArrivalTime() - curTime;
94 dur -= SIMTIME_DBL(delta);
Referenced by selectTalkOrSilenceInterval().
◆ destAddress
| L3Address inet::SimpleVoipSender::destAddress |
|
private |
◆ destPort
| int inet::SimpleVoipSender::destPort = -1 |
|
private |
◆ isTalk
| bool inet::SimpleVoipSender::isTalk = false |
|
private |
◆ localPort
| int inet::SimpleVoipSender::localPort = -1 |
|
private |
◆ packetID
| int inet::SimpleVoipSender::packetID = -1 |
|
private |
◆ packetizationInterval
| simtime_t inet::SimpleVoipSender::packetizationInterval |
|
private |
◆ selfSender
| cMessage* inet::SimpleVoipSender::selfSender = nullptr |
|
private |
◆ selfSource
| cMessage* inet::SimpleVoipSender::selfSource = nullptr |
|
private |
◆ silenceDuration
| simtime_t inet::SimpleVoipSender::silenceDuration |
|
private |
◆ socket
◆ stopTime
| simtime_t inet::SimpleVoipSender::stopTime |
|
private |
◆ talkPacketSize
| int inet::SimpleVoipSender::talkPacketSize = 0 |
|
private |
◆ talkspurtDuration
| simtime_t inet::SimpleVoipSender::talkspurtDuration |
|
private |
◆ talkspurtID
| int inet::SimpleVoipSender::talkspurtID = -1 |
|
private |
◆ talkspurtNumPackets
| int inet::SimpleVoipSender::talkspurtNumPackets = 0 |
|
private |
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
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:31
int destPort
Definition: SimpleVoipSender.h:31
int packetID
Definition: SimpleVoipSender.h:40
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
int localPort
Definition: SimpleVoipSender.h:30
void sendTo(Packet *msg, L3Address destAddr, int destPort)
Sends a data packet to the given address and port.
Definition: UdpSocket.cc:69
cMessage * selfSender
Definition: SimpleVoipSender.h:36
int talkspurtNumPackets
Definition: SimpleVoipSender.h:42
simtime_t stopTime
Definition: SimpleVoipSender.h:28
cMessage * selfSource
Definition: SimpleVoipSender.h:37
bool isUnspecified() const
Definition: L3Address.cc:138
simtime_t packetizationInterval
Definition: SimpleVoipSender.h:29
bool isTalk
Definition: SimpleVoipSender.h:43
intscale< b, 1, 8 > B
Definition: Units.h:1168
int talkPacketSize
Definition: SimpleVoipSender.h:32
int talkspurtID
Definition: SimpleVoipSender.h:41
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
void talkspurt(simtime_t dur)
Definition: SimpleVoipSender.cc:86
simtime_t talkspurtDuration
Definition: SimpleVoipSender.h:39
simtime_t silenceDuration
Definition: SimpleVoipSender.h:38
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
UdpSocket socket
Definition: SimpleVoipSender.h:25
INET_API InitStage INITSTAGE_APPLICATION_LAYER
Initialization of applications.
void sendVoIPPacket()
Definition: SimpleVoipSender.cc:135
@ UP
Definition: NodeStatus.h:28
L3Address destAddress
Definition: SimpleVoipSender.h:33
void selectTalkOrSilenceInterval()
Definition: SimpleVoipSender.cc:106