|
INET Framework for OMNeT++/OMNEST
|
Implementation of L-MAC (Lightweight Medium Access Protocol for Wireless Sensor Networks [van Hoesel 04] ).
More...
#include <LMac.h>
Implementation of L-MAC (Lightweight Medium Access Protocol for Wireless Sensor Networks [van Hoesel 04] ).
Each node has its own unique timeslot. Nodes can use their timeslots to transfer data without having to contend for the medium or having to deal with energy wasting collisions or retransmissions.
During the first 5 full frames nodes will be waking up every controlDuration to setup the network first by assigning a different timeslot to each node. Normal packets will be queued, but will be send only after the setup phase.
During its timeslot a node wakes up, checks the channel for a short random period (CCA) to check for possible collision in the slot and, if the channel is free, sends a control packet. If there is a collision it tries to change its timeslot to an empty one. After the transmission of the control packet it checks its packet queue and if its non-empty it sends a data packet.
During a foreign timeslot a node wakes up, checks the channel for 2*controlDuration period for an incoming control packet and if there in nothing it goes back to sleep and conserves energy for the rest of the timeslot. If it receives a control packet addressed for itself it stays awake for the rest of the timeslot to receive the incoming data packet.
The finite state machine of the protocol is given in the below figure:
State chart for LMAC layer
A paper describing the protocol is:
L. van Hoesel and P. Havinga. A lightweight medium access protocol (LMAC) for wireless sensor networks. In Proceedings of the 3rd International Symposium on Information Processing in Sensor Networks (IPSN), pages 55-60, Berkeley, CA, February 2004. April.
◆ States
MAC states.
The MAC states help to keep track what the MAC is actually trying to do – this is esp. useful when radio switching takes some time. SLEEP – the node sleeps but accepts packets from the network layer RX – MAC accepts packets from PHY layer TX – MAC transmits a packet CCA – Clear Channel Assessment - MAC checks whether medium is busy
| Enumerator |
|---|
| INIT | |
| SLEEP | |
| CCA | |
| WAIT_CONTROL | |
| WAIT_DATA | |
| SEND_CONTROL | |
| SEND_DATA | |
◆ LMac() [1/2]
| inet::LMac::LMac |
( |
const LMac & |
| ) |
|
|
private |
Copy constructor is not allowed.
◆ LMac() [2/2]
◆ ~LMac()
◆ attachSignal()
| void inet::LMac::attachSignal |
( |
Packet * |
macPkt | ) |
|
|
protected |
Internal function to attach a signal to the packet.
645 simtime_t duration = macPkt->getBitLength() /
bitrate;
647 macPkt->setDuration(duration);
◆ configureNetworkInterface()
| void inet::LMac::configureNetworkInterface |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ decapsulate()
| void inet::LMac::decapsulate |
( |
Packet * |
packet | ) |
|
|
virtual |
604 const auto& lmacHeader = packet->popAtFront<LMacDataFrameHeader>();
605 packet->addTagIfAbsent<MacAddressInd>()->setSrcAddress(lmacHeader->getSrcAddr());
606 packet->addTagIfAbsent<InterfaceInd>()->setInterfaceId(
networkInterface->getInterfaceId());
611 EV_DETAIL <<
" message decapsulated " << endl;
◆ encapsulate()
| void inet::LMac::encapsulate |
( |
Packet * |
netwPkt | ) |
|
|
virtual |
Encapsulate the NetwPkt into an MacPkt.
Encapsulates the received network-layer packet into a MacPkt and set all needed header fields.
621 auto pkt = makeShared<LMacDataFrameHeader>();
626 auto dest = netwPkt->getTag<MacAddressReq>()->getDestAddress();
627 EV_DETAIL <<
"CInfo removed, mac addr=" << dest << endl;
628 pkt->setDestAddr(dest);
632 delete netwPkt->removeControlInfo();
638 netwPkt->insertAtFront(pkt);
639 EV_DETAIL <<
"pkt encapsulated\n";
◆ findNewSlot()
| void inet::LMac::findNewSlot |
( |
| ) |
|
|
protected |
find a new slot
Try to find a new slot after collision.
If not possible, set own slot to -1 (not able to send anything)
592 EV <<
"ERROR: I cannot find a free slot. Cannot send data.\n";
596 EV <<
"ERROR: My new slot is : " <<
mySlot << endl;
598 EV <<
"ERROR: I needed to find new slot\n";
◆ 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::LMac::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.
◆ handleCommand()
| virtual void inet::LMac::handleCommand |
( |
cMessage * |
msg | ) |
|
|
inlineprotectedvirtual |
◆ handleLowerPacket()
| void inet::LMac::handleLowerPacket |
( |
Packet * |
packet | ) |
|
|
overridevirtual |
Handle messages from lower layer.
Handle LMAC control packets and data packets.
Recognize collisions, change own slot if necessary and remember who is using which slot.
Reimplemented from inet::LayeredProtocolBase.
527 if (packet->hasBitError()) {
528 EV <<
"Received " << packet <<
" contains bit errors or collision, dropping it\n";
529 PacketDropDetails details;
536 const auto& hdr = packet->peekAtFront<LMacHeaderBase>();
537 packet->setKind(hdr->getType());
◆ handlePullPacketProcessed()
| void inet::LMac::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.
664 throw cRuntimeError(
"Not supported callback");
◆ handleSelfMessage()
| void inet::LMac::handleSelfMessage |
( |
cMessage * |
msg | ) |
|
|
overridevirtual |
Handle self messages such as timers.
Handle self messages: LMAC_SETUP_PHASE_END: end of setup phase.
Change slot duration to normal and start sending data packets. The slots of the nodes should be stable now. LMAC_SEND_DATA: send the data packet. LMAC_CHECK_CHANNEL: check the channel in own slot. If busy, change the slot. If not, send a control packet. LMAC_WAKEUP: wake up the node and either check the channel before sending a control packet or wait for control packets. LMAC_TIMEOUT: go back to sleep after nothing happened.
Reimplemented from inet::LayeredProtocolBase.
144 EV_DETAIL <<
"Scheduling the first wakeup at : " <<
slotDuration << endl;
148 for (
int i = 0; i <
numSlots; i++) {
164 EV_DETAIL <<
"Old state: INIT, New state: SLEEP" << endl;
168 EV <<
"Unknown packet" << msg->getKind() <<
"in state" <<
macState << endl;
176 EV_DETAIL <<
"New slot starting - No. " <<
currSlot <<
", my slot is " <<
mySlot << endl;
179 EV_DETAIL <<
"Waking up in my slot. Switch to RECV first to check the channel.\n";
182 EV_DETAIL <<
"Old state: SLEEP, New state: CCA" << endl;
186 EV_DETAIL <<
"Checking for channel for " << small_delay <<
" time.\n";
189 EV_DETAIL <<
"Waking up in a foreign slot. Ready to receive control packet.\n";
192 EV_DETAIL <<
"Old state: SLEEP, New state: WAIT_CONTROL" << endl;
204 EV_DETAIL <<
"Setup phase end. Start normal work at the next slot.\n";
209 EV <<
"Unknown packet" << msg->getKind() <<
"in state" <<
macState << endl;
216 EV <<
"Channel is free, so let's prepare for sending.\n";
220 EV_DETAIL <<
"Old state: CCA, New state: SEND_CONTROL" << endl;
223 auto packet = check_and_cast<Packet *>(msg);
224 const auto& lmacHeader = packet->peekAtFront<LMacControlFrame>();
225 const MacAddress& dest = lmacHeader->getDestAddr();
226 EV_DETAIL <<
" I have received a control packet from src " << lmacHeader->getSrcAddr() <<
" and dest " << dest <<
".\n";
227 bool collision =
false;
236 EV_DETAIL <<
"Occupied slot " <<
s <<
": " <<
occSlotsAway[
s] << endl;
237 EV_DETAIL <<
"Occupied direct slot " <<
s <<
": " <<
occSlotsDirect[
s] << endl;
240 if (lmacHeader->getMySlot() > -1) {
242 for (
int i = 0; i <
numSlots; i++) {
248 occSlotsAway[lmacHeader->getMySlot()] = lmacHeader->getSrcAddr();
249 occSlotsDirect[lmacHeader->getMySlot()] = lmacHeader->getSrcAddr();
251 collision = collision || (lmacHeader->getMySlot() ==
mySlot);
253 EV_DETAIL <<
"My slot is taken by " << lmacHeader->getOccupiedSlots(
mySlot) <<
". I need to change it.\n";
255 EV_DETAIL <<
"My new slot is " <<
mySlot << endl;
258 EV_DETAIL <<
"I don;t have a slot - try to find one.\n";
262 if (dest == address || dest.isBroadcast()) {
263 EV_DETAIL <<
"I need to stay awake.\n";
267 EV_DETAIL <<
"Old state: CCA, New state: WAIT_DATA" << endl;
270 EV_DETAIL <<
"Incoming data packet not for me. Going back to sleep.\n";
272 EV_DETAIL <<
"Old state: CCA, New state: SLEEP" << endl;
281 auto packet = check_and_cast<Packet *>(msg);
282 const MacAddress& dest = packet->peekAtFront<LMacDataFrameHeader>()->getDestAddr();
289 EV_DETAIL <<
" I have received a data packet.\n";
290 if (dest == address || dest.isBroadcast()) {
291 EV_DETAIL <<
"sending pkt to upper...\n";
296 EV_DETAIL <<
"packet not for me, deleting...\n";
297 PacketDropDetails details;
304 EV_DETAIL <<
"Old state: CCA, New state: SLEEP" << endl;
308 EV_DETAIL <<
"Setup phase end. Start normal work at the next slot.\n";
313 EV <<
"Unknown packet" << msg->getKind() <<
"in state" <<
macState << endl;
319 EV_DETAIL <<
"Control timeout. Go back to sleep.\n";
321 EV_DETAIL <<
"Old state: WAIT_CONTROL, New state: SLEEP" << endl;
325 auto packet = check_and_cast<Packet *>(msg);
326 const auto& lmacHeader = packet->peekAtFront<LMacControlFrame>();
327 const MacAddress& dest = lmacHeader->getDestAddr();
328 EV_DETAIL <<
" I have received a control packet from src " << lmacHeader->getSrcAddr() <<
" and dest " << dest <<
".\n";
330 bool collision =
false;
337 EV_DETAIL <<
"Occupied slot " <<
s <<
": " <<
occSlotsAway[
s] << endl;
338 EV_DETAIL <<
"Occupied direct slot " <<
s <<
": " <<
occSlotsDirect[
s] << endl;
341 if (lmacHeader->getMySlot() > -1) {
343 for (
int i = 0; i <
numSlots; i++) {
349 occSlotsAway[lmacHeader->getMySlot()] = lmacHeader->getSrcAddr();
350 occSlotsDirect[lmacHeader->getMySlot()] = lmacHeader->getSrcAddr();
353 collision = collision || (lmacHeader->getMySlot() ==
mySlot);
355 EV_DETAIL <<
"My slot is taken by " << lmacHeader->getOccupiedSlots(
mySlot) <<
". I need to change it.\n";
357 EV_DETAIL <<
"My new slot is " <<
mySlot << endl;
360 EV_DETAIL <<
"I don;t have a slot - try to find one.\n";
364 if (dest == address || dest.isBroadcast()) {
365 EV_DETAIL <<
"I need to stay awake.\n";
367 EV_DETAIL <<
"Old state: WAIT_CONTROL, New state: WAIT_DATA" << endl;
372 EV_DETAIL <<
"Incoming data packet not for me. Going back to sleep.\n";
374 EV_DETAIL <<
"Old state: WAIT_CONTROL, New state: SLEEP" << endl;
383 EV_DETAIL <<
"End of setup-phase slot" << endl;
385 EV_DETAIL <<
"Very unlikely transition";
388 EV_DETAIL <<
"Old state: WAIT_DATA, New state: SLEEP" << endl;
389 scheduleAfter(SIMTIME_ZERO,
wakeup);
392 EV_DETAIL <<
"Setup phase end. Start normal work at the next slot.\n";
402 EV <<
"Unknown packet" << msg->getKind() <<
"in state" <<
macState << endl;
414 EV <<
"Sending a control packet.\n";
415 auto control = makeShared<LMacControlFrame>();
421 control->setSrcAddr(address);
422 control->setMySlot(
mySlot);
424 control->setOccupiedSlotsArraySize(
numSlots);
428 Packet *packet =
new Packet(
"Control");
430 packet->insertAtFront(control);
439 EV_DETAIL <<
"ERROR: Send data message received, but we are not in our slot!!! Repair.\n";
445 Packet *data =
new Packet(
"Data");
449 lmacHeader->setMySlot(
mySlot);
450 lmacHeader->setOccupiedSlotsArraySize(
numSlots);
454 data->insertAtFront(lmacHeader);
456 EV <<
"Sending down data packet\n";
460 EV_DETAIL <<
"Old state: SEND_CONTROL, New state: SEND_DATA" << endl;
463 EV_DETAIL <<
"Setup phase end. Start normal work at the next slot.\n";
468 EV <<
"Unknown packet" << msg->getKind() <<
"in state" <<
macState << endl;
474 throw cRuntimeError(
"I am still sending a message, while a new slot is starting!\n");
477 EV <<
"Unknown packet" << msg->getKind() <<
"in state" <<
macState << endl;
483 auto packet = check_and_cast<Packet *>(msg);
484 const MacAddress& dest = packet->peekAtFront<LMacDataFrameHeader>()->getDestAddr();
486 EV_DETAIL <<
" I have received a data packet.\n";
487 if (dest == address || dest.isBroadcast()) {
488 EV_DETAIL <<
"sending pkt to upper...\n";
493 EV_DETAIL <<
"packet not for me, deleting...\n";
494 PacketDropDetails details;
501 EV_DETAIL <<
"Old state: WAIT_DATA, New state: SLEEP" << endl;
508 EV_DETAIL <<
"Unlikely transition. Old state: WAIT_DATA, New state: SLEEP" << endl;
509 scheduleAfter(SIMTIME_ZERO,
wakeup);
512 EV <<
"Unknown packet" << msg->getKind() <<
"in state" <<
macState << endl;
517 throw cRuntimeError(
"Unknown mac state: %d",
macState);
◆ handleUpperPacket()
| void inet::LMac::handleUpperPacket |
( |
Packet * |
packet | ) |
|
|
overridevirtual |
Handle messages from upper layer.
Check whether the queue is not full: if yes, print a warning and drop the packet.
Sending of messages is automatic.
Reimplemented from inet::LayeredProtocolBase.
121 throw cRuntimeError(
"Model error: this module should pull packet from upper queue, direct incoming packet not accepted");
◆ initialize()
| void inet::LMac::initialize |
( |
int |
stage | ) |
|
|
overridevirtual |
Initialization of the module and some variables.
Reimplemented from inet::MacProtocolBase.
48 myId = node->isVector() ? node->getIndex() : getId() %
numSlots;
56 EV <<
"Control packets take : " <<
controlDuration <<
" seconds to transmit\n";
61 radio.reference(
this,
"radioModule",
true);
62 cModule *radioModule = check_and_cast<cModule *>(
radio.get());
71 <<
" bitrate = " <<
bitrate << endl;
82 EV_DETAIL <<
"My Mac address is" <<
networkInterface->getMacAddress() <<
" and my Id is " <<
myId << endl;
◆ operator=()
| LMac& inet::LMac::operator= |
( |
const LMac & |
| ) |
|
|
private |
Assignment operator is not allowed.
◆ receiveSignal()
| void inet::LMac::receiveSignal |
( |
cComponent * |
source, |
|
|
simsignal_t |
signalID, |
|
|
intval_t |
value, |
|
|
cObject * |
details |
|
) |
| |
|
overridevirtual |
Handle control messages from lower layer.
Handle transmission over messages: send the data packet or don;t do anyhting.
546 Enter_Method(
"%s", cComponent::getSignalName(signalID));
553 EV_DETAIL <<
" transmission of control packet over. data transfer will start soon." << endl;
556 EV_DETAIL <<
" transmission over. nothing else is scheduled, get back to sleep." << endl;
558 EV_DETAIL <<
"Old state: ?, New state: SLEEP" << endl;
◆ bitrate
| double inet::LMac::bitrate |
|
protected |
the bit rate at which we transmit
◆ checkChannel
| cMessage* inet::LMac::checkChannel |
|
protected |
◆ controlDuration
| double inet::LMac::controlDuration |
|
protected |
Duration of teh control time in each slot.
◆ ctrlFrameLength
| b inet::LMac::ctrlFrameLength |
|
protected |
Length of the control frames.
◆ currSlot
The current slot of the simulation.
◆ headerLength
| b inet::LMac::headerLength |
|
protected |
◆ initChecker
| cMessage* inet::LMac::initChecker |
|
protected |
◆ LMAC_FREE_SLOT
◆ LMAC_NO_RECEIVER
dummy receiver address to indicate no pending packets in the control packet
◆ macState
◆ myId
◆ mySlot
◆ numSlots
◆ occSlotsAway
Occupied slots of two-hop neighbors.
◆ occSlotsDirect
Occupied slots from nodes, from which I hear directly.
◆ radio
◆ reservedMobileSlots
| int inet::LMac::reservedMobileSlots |
|
protected |
The first couple of slots are reserved for nodes with special needs to avoid changing slots for them (mobile nodes)
◆ send_control
| cMessage* inet::LMac::send_control |
|
protected |
◆ sendData
| cMessage* inet::LMac::sendData |
|
protected |
◆ SETUP_PHASE
| bool inet::LMac::SETUP_PHASE |
|
protected |
the setup phase is the beginning of the simulation, where only control packets at very small slot durations are exchanged.
◆ slotChange
| cOutVector* inet::LMac::slotChange |
|
protected |
indicate how often the node needs to change its slot because of collisions
◆ slotDuration
| double inet::LMac::slotDuration |
|
protected |
◆ start_lmac
| cMessage* inet::LMac::start_lmac |
|
protected |
◆ timeout
| cMessage* inet::LMac::timeout |
|
protected |
◆ transmissionState
◆ wakeup
| cMessage* inet::LMac::wakeup |
|
protected |
The documentation for this class was generated from the following files:
opp_component_ptr< NetworkInterface > networkInterface
Definition: MacProtocolBase.h:30
const Ptr< Chunk > removeAtFront(b length=b(-1), int flags=0)
Removes the designated part from the beginning of the data part of the packet and returns it as a mut...
Definition: Packet.h:653
MacAddress occSlotsAway[64]
Occupied slots of two-hop neighbors.
Definition: LMac.h:178
@ LMAC_TIMEOUT
Definition: LMacHeader_m.h:69
@ SLEEP
Definition: LMac.h:143
virtual void sendUp(cMessage *message)
Definition: MacProtocolBase.cc:59
cMessage * checkChannel
Definition: LMac.h:190
@ WAIT_CONTROL
Definition: LMac.h:143
@ LMAC_WAKEUP
Definition: LMacHeader_m.h:70
cMessage * sendData
Definition: LMac.h:188
@ LMAC_CONTROL
Definition: LMacHeader_m.h:68
@ INIT
Definition: LMac.h:143
@ INCORRECTLY_RECEIVED
Definition: Simsignals_m.h:71
double bitrate
the bit rate at which we transmit
Definition: LMac.h:195
const Ptr< const Chunk > peekAtFront(b length=b(-1), int flags=0) const
Returns the designated part from the beginning of the data part of the packet as an immutable chunk i...
Definition: Packet.h:245
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
b ctrlFrameLength
Length of the control frames.
Definition: LMac.h:164
@ RADIO_MODE_SLEEP
The radio is sleeping, frame reception or transmission is not possible, power consumption is minimal,...
Definition: IRadio.h:90
static const MacAddress LMAC_NO_RECEIVER
dummy receiver address to indicate no pending packets in the control packet
Definition: LMac.h:147
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
static const Protocol lmac
Definition: Protocol.h:98
b headerLength
Length of the header.
Definition: LMac.h:162
cOutVector * slotChange
indicate how often the node needs to change its slot because of collisions
Definition: LMac.h:154
virtual void decapsulate(Packet *)
Definition: LMac.cc:602
States macState
keep track of MAC state
Definition: LMac.h:157
static simsignal_t transmissionStateChangedSignal
This signal is emitted when the radio transmission state of the radio is changed.
Definition: IRadio.h:60
double slotDuration
Duration of a slot.
Definition: LMac.h:160
cMessage * timeout
Definition: LMac.h:187
@ RADIO_MODE_TRANSMITTER
The radio is prepared for frame transmission, frame reception is not possible, power consumption is l...
Definition: IRadio.h:104
simsignal_t packetDroppedSignal
Definition: Simsignals.cc:85
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
MacProtocolBase()
Definition: MacProtocolBase.cc:15
@ WAIT_DATA
Definition: LMac.h:143
@ SEND_CONTROL
Definition: LMac.h:143
@ LMAC_SEND_CONTROL
Definition: LMacHeader_m.h:77
value< double, units::s > s
Definition: Units.h:1235
cMessage * initChecker
Definition: LMac.h:189
@ RADIO_MODE_RECEIVER
The radio is prepared for frame reception, frame transmission is not possible, power consumption is l...
Definition: IRadio.h:97
static cModule * findHost(cModule *m)
Returns a pointer to the host module of the passed module.
Definition: FindModule.h:57
int currSlot
The current slot of the simulation.
Definition: LMac.h:174
Packet * currentTxFrame
Currently transmitted frame if any.
Definition: MacProtocolBase.h:35
@ LMAC_START_LMAC
Definition: LMacHeader_m.h:76
virtual void sendDown(cMessage *message)
Definition: MacProtocolBase.cc:66
ModuleRefByPar< physicallayer::IRadio > radio
The radio.
Definition: LMac.h:183
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:
@ TRANSMISSION_STATE_TRANSMITTING
The radio medium is busy, the radio is currently transmitting a signal.
Definition: IRadio.h:171
@ LMAC_SETUP_PHASE_END
Definition: LMacHeader_m.h:72
bool SETUP_PHASE
the setup phase is the beginning of the simulation, where only control packets at very small slot dur...
Definition: LMac.h:151
@ SEND_DATA
Definition: LMac.h:143
value< int64_t, units::b > b
Definition: Units.h:1241
const Ptr< const Chunk > peekData(int flags=0) const
Returns the whole data part (excluding front and back popped parts) in the current representation.
Definition: Packet.h:266
physicallayer::IRadio::TransmissionState transmissionState
Definition: LMac.h:184
@ LMAC_DATA
Definition: LMacHeader_m.h:75
virtual void deleteCurrentTxFrame()
Definition: MacProtocolBase.cc:93
virtual void initialize(int stage) override
Definition: MacProtocolBase.cc:37
@ LMAC_CHECK_CHANNEL
Definition: LMacHeader_m.h:73
cMessage * wakeup
Definition: LMac.h:186
static const MacAddress LMAC_FREE_SLOT
Definition: LMac.h:148
queueing::IPacketQueue * getQueue(cGate *gate) const
Definition: MacProtocolBase.cc:157
#define Enter_Method(...)
Definition: SelfDoc.h:71
TransmissionState
This enumeration specifies the transmission state of the radio.
Definition: IRadio.h:155
virtual void encapsulate(Packet *)
Encapsulate the NetwPkt into an MacPkt.
Definition: LMac.cc:619
virtual Packet * dequeuePacket()
Definition: MacProtocolBase.cc:175
RadioMode
This enumeration specifies the requested operational mode of the radio.
Definition: IRadio.h:79
@ CCA
Definition: LMac.h:143
MacAddress occSlotsDirect[64]
Occupied slots from nodes, from which I hear directly.
Definition: LMac.h:176
virtual MacAddress parseMacAddressParameter(const char *addrstr)
Definition: MacProtocolBase.cc:24
int mySlot
my slot ID
Definition: LMac.h:170
int numSlots
how many slots are there
Definition: LMac.h:172
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
@ TRANSMISSION_STATE_UNDEFINED
The transmission state is undefined or meaningless.
Definition: IRadio.h:160
@ LMAC_SEND_DATA
Definition: LMacHeader_m.h:71
int reservedMobileSlots
The first couple of slots are reserved for nodes with special needs to avoid changing slots for them ...
Definition: LMac.h:180
@ TRANSMISSION_STATE_IDLE
The radio is not transmitting a signal on the radio medium.
Definition: IRadio.h:166
cMessage * send_control
Definition: LMac.h:192
void findNewSlot()
find a new slot
Definition: LMac.cc:578
virtual bool canDequeuePacket() const
Definition: MacProtocolBase.cc:170
@ NOT_ADDRESSED_TO_US
Definition: Simsignals_m.h:76
double controlDuration
Duration of teh control time in each slot.
Definition: LMac.h:166
INET_API InitStage INITSTAGE_LINK_LAYER
Initialization of link-layer protocols.
static ProtocolGroup ethertype
Definition: ProtocolGroup.h:40
static simsignal_t radioModeChangedSignal
This signal is emitted when the radio mode of the radio is changed.
Definition: IRadio.h:42
int myId
my ID
Definition: LMac.h:168
virtual void handleSelfMessage(cMessage *) override
Handle self messages such as timers.
Definition: LMac.cc:132
cMessage * start_lmac
Definition: LMac.h:191