|
INET Framework for OMNeT++/OMNEST
|
PPP implementation.
More...
#include <Ppp.h>
◆ ~Ppp()
◆ configureNetworkInterface()
| void inet::Ppp::configureNetworkInterface |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ decapsulate()
| void inet::Ppp::decapsulate |
( |
Packet * |
packet | ) |
|
|
protectedvirtual |
343 const auto& pppHeader = packet->popAtFront<PppHeader>();
345 if (pppHeader ==
nullptr || pppTrailer ==
nullptr)
346 throw cRuntimeError(
"Invalid PPP packet: PPP header or Trailer is missing");
348 packet->addTagIfAbsent<InterfaceInd>()->setInterfaceId(
networkInterface->getInterfaceId());
Referenced by handleLowerPacket().
◆ encapsulate()
| void inet::Ppp::encapsulate |
( |
Packet * |
msg | ) |
|
|
protectedvirtual |
333 auto pppHeader = makeShared<PppHeader>();
335 packet->insertAtFront(pppHeader);
336 auto pppTrailer = makeShared<PppTrailer>();
337 packet->insertAtBack(pppTrailer);
Referenced by startTransmitting().
◆ getProvider()
Returns the passive packet source from where packets are pulled or nullptr if the connected module doesn't implement the interface.
The gate parameter must be a valid gate of this module.
Implements inet::queueing::IActivePacketSink.
◆ handleCanPullPacketChanged()
| void inet::Ppp::handleCanPullPacketChanged |
( |
cGate * |
gate | ) |
|
|
overridevirtual |
Notifies about a change in the possibility of pulling some packet from the passive packet source at the given gate.
This method is called, for example, when a new packet is inserted into a queue. It allows the sink to pull a new packet from the queue.
The gate parameter must be a valid gate of this module.
Implements inet::queueing::IActivePacketSink.
◆ handleLowerPacket()
| void inet::Ppp::handleLowerPacket |
( |
Packet * |
packet | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::LayeredProtocolBase.
249 EV_INFO <<
"Received " << packet <<
" from network.\n";
253 if (packet->hasBitError()) {
254 EV_WARN <<
"Bit error in " << packet << endl;
255 PacketDropDetails details;
263 const auto& pppHeader = packet->peekAtFront<PppHeader>();
265 if (pppHeader ==
nullptr || pppTrailer ==
nullptr)
266 throw cRuntimeError(
"Invalid PPP packet: PPP header or Trailer is missing");
271 EV_INFO <<
"Sending " << packet <<
" to upper layer.\n";
272 send(packet,
"upperLayerOut");
◆ handleMessageWhenUp()
| void inet::Ppp::handleMessageWhenUp |
( |
cMessage * |
message | ) |
|
|
overrideprotectedvirtual |
◆ handlePullPacketProcessed()
| void inet::Ppp::handlePullPacketProcessed |
( |
Packet * |
packet, |
|
|
cGate * |
gate, |
|
|
bool |
successful |
|
) |
| |
|
overridevirtual |
Notifies about the completion of the packet processing for a packet that was pulled earlier independently whether the packet is passed or streamed.
This method is called, for example, when a previously pulled packet is failed to be processed successfully. It allows the sink to retry the operation.
The gate parameter must be a valid gate of this module. The packet must not be nullptr.
Implements inet::queueing::IActivePacketSink.
383 throw cRuntimeError(
"Not supported callback");
◆ handleSelfMessage()
| void inet::Ppp::handleSelfMessage |
( |
cMessage * |
message | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::LayeredProtocolBase.
218 EV_INFO <<
"Transmission successfully completed.\n";
224 throw cRuntimeError(
"Unknown self message");
◆ handleStopOperation()
◆ handleUpperPacket()
| void inet::Ppp::handleUpperPacket |
( |
Packet * |
packet | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::LayeredProtocolBase.
229 EV_INFO <<
"Received " << packet <<
" from upper layer.\n";
231 EV_WARN <<
"Interface is not connected, dropping packet " << packet << endl;
233 PacketDropDetails details;
240 throw cRuntimeError(
"PPP already in transmit state when packet arrived from upper layer");
Referenced by processUpperPacket().
◆ initialize()
| void inet::Ppp::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::MacProtocolBase.
49 setTxUpdateSupport(
true);
51 bool connected =
physOutGate->getPathEndGate()->getType() == cGate::INPUT;
61 subscribe(PRE_MODEL_CHANGE,
this);
62 subscribe(POST_MODEL_CHANGE,
this);
◆ numInitStages()
| virtual int inet::Ppp::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ processUpperPacket()
| void inet::Ppp::processUpperPacket |
( |
| ) |
|
|
protectedvirtual |
◆ receiveSignal()
| void inet::Ppp::receiveSignal |
( |
cComponent * |
source, |
|
|
simsignal_t |
signalID, |
|
|
cObject * |
obj, |
|
|
cObject * |
details |
|
) |
| |
|
overrideprotectedvirtual |
Reimplemented from inet::MacProtocolBase.
96 if (getSimulation()->getSimulationStage() == CTX_CLEANUP)
99 if (signalID == POST_MODEL_CHANGE) {
100 if (
auto gcobj =
dynamic_cast<cPostPathCreateNotification *
>(obj)) {
104 else if (
auto gcobj =
dynamic_cast<cPostPathCutNotification *
>(obj)) {
108 else if (
datarateChannel &&
dynamic_cast<cPostParameterChangeNotification *
>(obj)) {
109 cPostParameterChangeNotification *gcobj =
static_cast<cPostParameterChangeNotification *
>(obj);
110 if (
datarateChannel == gcobj->par->getOwner() && !strcmp(
"datarate", gcobj->par->getName()))
114 else if (signalID == PRE_MODEL_CHANGE) {
115 if (
auto gcobj =
dynamic_cast<cPrePathCutNotification *
>(obj)) {
◆ refreshDisplay()
| void inet::Ppp::refreshDisplay |
( |
| ) |
const |
|
overrideprotectedvirtual |
282 static std::string result;
285 result = std::to_string(
numSent);
294 result = std::to_string(
txQueue->getNumPackets());
298 result =
"not connected";
300 char datarateText[40];
303 sprintf(datarateText,
"%gGbps", datarate / 1e9);
304 else if (datarate >= 1e6)
305 sprintf(datarateText,
"%gMbps", datarate / 1e6);
306 else if (datarate >= 1e3)
307 sprintf(datarateText,
"%gkbps", datarate / 1e3);
309 sprintf(datarateText,
"%gbps", datarate);
310 result = datarateText;
314 throw cRuntimeError(
"Unknown directive: %c", directive);
316 return result.c_str();
318 getDisplayString().setTagArg(
"t", 0, text);
321 const char *color =
"";
324 color =
txQueue->getNumPackets() >= 3 ?
"red" :
"yellow";
328 getDisplayString().setTagArg(
"i", 1, color);
◆ refreshOutGateConnection()
| void inet::Ppp::refreshOutGateConnection |
( |
bool |
connected | ) |
|
|
protectedvirtual |
128 ASSERT(
physOutGate->getPathEndGate()->getType() == cGate::INPUT);
134 simtime_t sentDuration = simTime() - startTransmissionTime;
135 double sentPart = sentDuration / (
endTransmissionEvent->getArrivalTime() - startTransmissionTime);
144 PacketDropDetails details;
152 double datarate = connected ?
datarateChannel->getNominalDatarate() : 0;
Referenced by receiveSignal().
◆ startTransmitting()
| void inet::Ppp::startTransmitting |
( |
| ) |
|
|
protectedvirtual |
176 EV_INFO <<
"Transmission of " << pppFrame <<
" started.\n";
180 pppFrame->clearTags();
182 *newPacketProtocolTag = *oldPacketProtocolTag;
184 auto bytes = pppFrame->peekDataAsBytes();
185 pppFrame->eraseAll();
186 pppFrame->insertAtFront(bytes);
194 simtime_t endTransmissionTime =
datarateChannel->getTransmissionFinishTime();
Referenced by handleUpperPacket().
◆ curTxPacket
| Packet* inet::Ppp::curTxPacket = nullptr |
|
protected |
◆ datarateChannel
| cChannel* inet::Ppp::datarateChannel = nullptr |
|
protected |
◆ displayStringTextFormat
| const char* inet::Ppp::displayStringTextFormat = nullptr |
|
protected |
◆ endTransmissionEvent
| cMessage* inet::Ppp::endTransmissionEvent = nullptr |
|
protected |
◆ numDroppedBitErr
| long inet::Ppp::numDroppedBitErr = 0 |
|
protected |
◆ numDroppedIfaceDown
| long inet::Ppp::numDroppedIfaceDown = 0 |
|
protected |
◆ numRcvdOK
| long inet::Ppp::numRcvdOK = 0 |
|
protected |
◆ numSent
| long inet::Ppp::numSent = 0 |
|
protected |
◆ oldConnColor
| std::string inet::Ppp::oldConnColor |
|
protected |
◆ physOutGate
| cGate* inet::Ppp::physOutGate = nullptr |
|
protected |
◆ rxPkOkSignal
| simsignal_t inet::Ppp::rxPkOkSignal = registerSignal("rxPkOk") |
|
staticprotected |
◆ sendRawBytes
| bool inet::Ppp::sendRawBytes = false |
|
protected |
◆ transmissionStateChangedSignal
| simsignal_t inet::Ppp::transmissionStateChangedSignal = registerSignal("transmissionStateChanged") |
|
staticprotected |
The documentation for this class was generated from the following files:
opp_component_ptr< NetworkInterface > networkInterface
Definition: MacProtocolBase.h:30
virtual void handleMessageWhenUp(cMessage *message) override
Definition: LayeredProtocolBase.cc:14
virtual void startTransmitting()
Definition: Ppp.cc:169
Packet * curTxPacket
Definition: Ppp.h:35
State operationalState
Definition: OperationalMixin.h:23
long numRcvdOK
Definition: Ppp.h:41
virtual void flushQueue(PacketDropDetails &details)
should clear queue and emit signal "packetDropped" with entire packets
Definition: MacProtocolBase.cc:106
b getDataLength() const
Returns the current length of the data part of the packet.
Definition: Packet.h:206
@ INCORRECTLY_RECEIVED
Definition: Simsignals_m.h:71
virtual void processUpperPacket()
Definition: Ppp.cc:386
bool sendRawBytes
Definition: Ppp.h:28
const char * displayStringTextFormat
Definition: Ppp.h:27
long numDroppedIfaceDown
Definition: Ppp.h:43
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
cChannel * datarateChannel
Definition: Ppp.h:30
simsignal_t packetDroppedSignal
Definition: Simsignals.cc:85
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
int lowerLayerInGateId
Definition: MacProtocolBase.h:26
static const Protocol ppp
Definition: Protocol.h:104
cGate * physOutGate
Definition: Ppp.h:29
virtual void refreshOutGateConnection(bool connected)
Definition: Ppp.cc:122
virtual Packet * dup() const override
Definition: Packet.h:171
const Ptr< Chunk > removeAtBack(b length=b(-1), int flags=0)
Removes the designated part from the end of the data part of the packet and returns it as a mutable c...
Definition: Packet.h:665
Packet * currentTxFrame
Currently transmitted frame if any.
Definition: MacProtocolBase.h:35
int upperLayerInGateId
Gate ids.
Definition: MacProtocolBase.h:24
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
virtual void receiveSignal(cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
Definition: MacProtocolBase.cc:151
value< int64_t, units::b > b
Definition: Units.h:1241
const B PPP_TRAILER_LENGTH
Definition: PppFrame_m.h:47
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
static simsignal_t rxPkOkSignal
Definition: Ppp.h:46
virtual int64_t getBitLength() const override
Returns the length in bits between the front and back offsets.
Definition: Packet.h:199
virtual void deleteCurrentTxFrame()
Definition: MacProtocolBase.cc:93
virtual void initialize(int stage) override
Definition: MacProtocolBase.cc:37
long numSent
Definition: Ppp.h:40
static simsignal_t transmissionStateChangedSignal
Definition: Ppp.h:45
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
virtual void decapsulate(Packet *packet)
Definition: Ppp.cc:341
@ INTERFACE_DOWN
Definition: Simsignals_m.h:72
queueing::IPacketQueue * getQueue(cGate *gate) const
Definition: MacProtocolBase.cc:157
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
#define Enter_Method(...)
Definition: SelfDoc.h:71
int lowerLayerOutGateId
Definition: MacProtocolBase.h:27
virtual Packet * dequeuePacket()
Definition: MacProtocolBase.cc:175
simsignal_t packetSentToUpperSignal
Definition: Simsignals.cc:87
const Protocol * getProtocol(int protocolNumber) const
Definition: ProtocolGroup.cc:31
opp_component_ptr< queueing::IPacketQueue > txQueue
Messages received from upper layer and to be transmitted later.
Definition: MacProtocolBase.h:38
virtual void encapsulate(Packet *msg)
Definition: Ppp.cc:331
long numDroppedBitErr
Definition: Ppp.h:42
virtual void refreshDisplay() const override
Definition: OperationalMixinImpl.h:200
virtual bool canDequeuePacket() const
Definition: MacProtocolBase.cc:170
virtual void handleUpperPacket(Packet *packet) override
Definition: Ppp.cc:227
static ProtocolGroup pppprotocol
Definition: ProtocolGroup.h:43
cMessage * endTransmissionEvent
Definition: Ppp.h:32
simsignal_t packetSentToLowerSignal
Definition: Simsignals.cc:90