|
INET Framework for OMNeT++/OMNEST
|
#include <Ieee8022Llc.h>
◆ ~Ieee8022Llc()
| inet::Ieee8022Llc::~Ieee8022Llc |
( |
| ) |
|
|
virtual |
◆ clearSockets()
| void inet::Ieee8022Llc::clearSockets |
( |
| ) |
|
|
protected |
◆ decapsulate()
| void inet::Ieee8022Llc::decapsulate |
( |
Packet * |
frame | ) |
|
|
protectedvirtual |
210 const auto& llcHeader = frame->popAtFront<Ieee8022LlcHeader>();
212 auto sapInd = frame->addTagIfAbsent<Ieee802SapInd>();
213 sapInd->setSsap(llcHeader->getSsap());
214 sapInd->setDsap(llcHeader->getDsap());
217 if (llcHeader->getSsap() == 0xAA && llcHeader->getDsap() == 0xAA && llcHeader->getControl() == 0x03) {
218 const auto& snapHeader = dynamicPtrCast<const Ieee8022LlcSnapHeader>(llcHeader);
219 if (snapHeader ==
nullptr)
220 throw cRuntimeError(
"LLC header indicates SNAP header, but SNAP header is missing");
223 if (payloadProtocol) {
Referenced by processPacketFromMac().
◆ deliverCopyToSockets()
| bool inet::Ieee8022Llc::deliverCopyToSockets |
( |
Packet * |
packet | ) |
|
|
protectedvirtual |
119 if (
auto sap = packet->findTag<Ieee802SapInd>()) {
120 int localSap = sap->getDsap();
121 int remoteSap = sap->getSsap();
123 if ((elem.second->localSap == localSap || elem.second->localSap == -1)
124 && (elem.second->remoteSap == remoteSap || elem.second->remoteSap == -1))
126 auto *packetCopy = packet->dup();
127 packetCopy->addTagIfAbsent<SocketInd>()->setSocketId(elem.second->socketId);
128 EV_INFO <<
"Passing up to socket " << elem.second->socketId <<
"\n";
130 send(packetCopy,
"upperLayerOut");
Referenced by processPacketFromMac().
◆ encapsulate()
| void inet::Ieee8022Llc::encapsulate |
( |
Packet * |
frame | ) |
|
|
protectedvirtual |
Reimplemented in inet::ieee80211::Ieee80211LlcLpd.
165 const auto& sapReq = frame->findTag<Ieee802SapReq>();
167 const Protocol *
protocol = protocolTag ? protocolTag->getProtocol() :
nullptr;
170 if (sapReq ==
nullptr &&
protocol !=
nullptr) {
175 if (ethType != -1 || snapOui != -1) {
176 const auto& snapHeader = makeShared<Ieee8022LlcSnapHeader>();
178 snapHeader->setOui(0);
179 snapHeader->setProtocolId(ethType);
182 snapHeader->setOui(snapOui);
183 snapHeader->setProtocolId(-1);
185 frame->insertAtFront(snapHeader);
188 const auto& llcHeader = makeShared<Ieee8022LlcHeader>();
190 if (sapReq ==
nullptr && sapData != -1) {
191 llcHeader->setSsap((sapData >> 8) & 0xFF);
192 llcHeader->setDsap(sapData & 0xFF);
193 llcHeader->setControl(3);
195 else if (sapReq !=
nullptr) {
196 llcHeader->setSsap(sapReq->getSsap());
197 llcHeader->setDsap(sapReq->getDsap());
198 llcHeader->setControl(3);
201 throw cRuntimeError(
"Missing the required Ieee802SapReq for LLC header, or protocol number for SNAP header.");
202 frame->insertAtFront(llcHeader);
Referenced by inet::ieee80211::Ieee80211LlcLpd::encapsulate(), and processPacketFromHigherLayer().
◆ getProtocol()
235 const Protocol *payloadProtocol =
nullptr;
236 if (llcHeader->getSsap() == 0xAA && llcHeader->getDsap() == 0xAA && llcHeader->getControl() == 0x03) {
237 const auto& snapHeader = dynamicPtrCast<const Ieee8022LlcSnapHeader>(llcHeader);
238 if (snapHeader ==
nullptr)
239 throw cRuntimeError(
"LLC header indicates SNAP header, but SNAP header is missing");
240 if (snapHeader->getOui() == 0)
246 int32_t sapData = ((llcHeader->getSsap() & 0xFF) << 8) | (llcHeader->getDsap() & 0xFF);
249 return payloadProtocol;
Referenced by decapsulate(), and inet::Ieee802LlcDissector::dissect().
◆ handleCrashOperation()
◆ handleMessageWhenUp()
| void inet::Ieee8022Llc::handleMessageWhenUp |
( |
cMessage * |
message | ) |
|
|
overrideprotectedvirtual |
Implements inet::OperationalMixin< cSimpleModule >.
55 if (msg->arrivedOn(
"upperLayerIn")) {
57 EV_INFO <<
"Received " << msg <<
" from upper layer." << endl;
63 else if (msg->arrivedOn(
"lowerLayerIn")) {
64 EV_INFO <<
"Received " << msg <<
" from lower layer." << endl;
68 throw cRuntimeError(
"Unknown gate");
◆ handleRegisterProtocol()
| void inet::Ieee8022Llc::handleRegisterProtocol |
( |
const Protocol & |
protocol, |
|
|
cGate * |
gate, |
|
|
ServicePrimitive |
servicePrimitive |
|
) |
| |
|
overrideprotectedvirtual |
◆ handleRegisterService()
| void inet::Ieee8022Llc::handleRegisterService |
( |
const Protocol & |
protocol, |
|
|
cGate * |
gate, |
|
|
ServicePrimitive |
servicePrimitive |
|
) |
| |
|
overrideprotectedvirtual |
◆ handleStartOperation()
◆ handleStopOperation()
◆ initialize()
| void inet::Ieee8022Llc::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ isDeliverableToUpperLayer()
| bool inet::Ieee8022Llc::isDeliverableToUpperLayer |
( |
Packet * |
packet | ) |
|
|
protectedvirtual |
◆ isInitializeStage()
| virtual bool inet::Ieee8022Llc::isInitializeStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ isModuleStartStage()
| virtual bool inet::Ieee8022Llc::isModuleStartStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ isModuleStopStage()
| virtual bool inet::Ieee8022Llc::isModuleStopStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ numInitStages()
| virtual int inet::Ieee8022Llc::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ processCommandFromHigherLayer()
| void inet::Ieee8022Llc::processCommandFromHigherLayer |
( |
Request * |
request | ) |
|
|
protectedvirtual |
79 auto ctrl = request->getControlInfo();
81 throw cRuntimeError(
"Request '%s' arrived without controlinfo", request->getName());
82 else if (
auto command =
dynamic_cast<Ieee8022LlcSocketOpenCommand *
>(
ctrl)) {
83 int socketId = request->getTag<SocketReq>()->getSocketId();
84 SocketDescriptor *descriptor =
new SocketDescriptor(socketId, command->getLocalSap());
88 else if (
dynamic_cast<SocketCloseCommand *
>(
ctrl) !=
nullptr) {
89 int socketId = request->getTag<SocketReq>()->getSocketId();
97 auto ctrl =
new SocketClosedIndication();
98 indication->setControlInfo(
ctrl);
99 indication->addTag<SocketInd>()->setSocketId(socketId);
100 send(indication,
"upperLayerOut");
103 else if (
dynamic_cast<SocketDestroyCommand *
>(
ctrl) !=
nullptr) {
104 int socketId = request->getTag<SocketReq>()->getSocketId();
113 throw cRuntimeError(
"Unknown command: '%s' with %s", request->getName(),
ctrl->getClassName());
Referenced by handleMessageWhenUp().
◆ processPacketFromHigherLayer()
| void inet::Ieee8022Llc::processPacketFromHigherLayer |
( |
Packet * |
msg | ) |
|
|
protectedvirtual |
◆ processPacketFromMac()
| void inet::Ieee8022Llc::processPacketFromMac |
( |
Packet * |
packet | ) |
|
|
protectedvirtual |
150 send(packet,
"upperLayerOut");
154 EV_WARN <<
"Unknown protocol, dropping packet\n";
155 PacketDropDetails details;
Referenced by handleMessageWhenUp().
◆ registerMyProtocol()
| void inet::Ieee8022Llc::registerMyProtocol |
( |
| ) |
|
|
protectedvirtual |
◆ operator<<
267 o <<
"(id:" << t.socketId <<
",lsap:" << t.localSap <<
",rsap" << t.remoteSap <<
")";
◆ socketIdToSocketDescriptor
◆ upperProtocols
| std::set<const Protocol *> inet::Ieee8022Llc::upperProtocols |
|
protected |
The documentation for this class was generated from the following files:
virtual void processCommandFromHigherLayer(Request *request)
Definition: Ieee8022Llc.cc:77
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
virtual void decapsulate(Packet *frame)
Definition: Ieee8022Llc.cc:208
static ProtocolGroup ieee8022protocol
Definition: ProtocolGroup.h:41
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
std::map< int, SocketDescriptor * > socketIdToSocketDescriptor
Definition: Ieee8022Llc.h:37
const Protocol * findProtocol(int protocolNumber) const
Definition: ProtocolGroup.cc:25
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
static ProtocolGroup snapOui
Definition: ProtocolGroup.h:44
void registerService(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a service primitive (SDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:14
simsignal_t packetDroppedSignal
Definition: Simsignals.cc:85
static const Protocol ieee8022llc
Definition: Protocol.h:88
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
removed ctrl
Definition: IUdp-gates.txt:7
virtual void processPacketFromMac(Packet *packet)
Definition: Ieee8022Llc.cc:144
virtual void processPacketFromHigherLayer(Packet *msg)
Definition: Ieee8022Llc.cc:71
bool contains(const std::vector< T > &v, const Tk &a)
Definition: stlutils.h:65
virtual void registerMyProtocol()
Definition: Ieee8022Llc.cc:48
static const Protocol ethernetMac
Definition: Protocol.h:65
@ SOCKET_I_DATA
Definition: SocketCommand_m.h:85
@ STAGE_LINK_LAYER
Definition: ModuleOperations.h:54
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
int findProtocolNumber(const Protocol *protocol) const
Definition: ProtocolGroup.cc:40
virtual bool deliverCopyToSockets(Packet *packet)
Definition: Ieee8022Llc.cc:116
@ NO_PROTOCOL_FOUND
Definition: Simsignals_m.h:81
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
@ SOCKET_I_CLOSED
Definition: SocketCommand_m.h:86
std::set< const Protocol * > upperProtocols
Definition: Ieee8022Llc.h:36
#define Enter_Method(...)
Definition: SelfDoc.h:71
void clearSockets()
Definition: Ieee8022Llc.cc:271
static const Protocol * getProtocol(const Ptr< const Ieee8022LlcHeader > &header)
Definition: Ieee8022Llc.cc:233
virtual void encapsulate(Packet *frame)
Definition: Ieee8022Llc.cc:163
virtual bool isDeliverableToUpperLayer(Packet *packet)
Definition: Ieee8022Llc.cc:138
@ STAGE_LINK_LAYER
Definition: ModuleOperations.h:28
void registerProtocol(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a protocol primitive (PDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:83
INET_API InitStage INITSTAGE_LINK_LAYER
Initialization of link-layer protocols.
static ProtocolGroup ethertype
Definition: ProtocolGroup.h:40