Public Member Functions | |
MMac () | |
virtual | ~MMac () |
void | recv (Packet *p) |
virtual int | recvSyncClMsg (ClMessage *m) |
virtual int | command (int argc, const char *const *argv) |
Protected Member Functions | |
virtual void | Phy2MacEndTx (const Packet *p) |
virtual void | Phy2MacStartRx (const Packet *p) |
virtual void | Phy2MacEndRx (Packet *p) |
virtual void | recvFromUpperLayers (Packet *p) |
virtual void | Phy2MacCCA (bool cca) |
void | Mac2PhyStartTx (Packet *p) |
void | Mac2PhyStartTx (int moduleId, Packet *p) |
double | Mac2PhyTxDuration (Packet *p) |
double | Mac2PhyTxDuration (int moduleId, Packet *p) |
void | Mac2PhyTurnOn () |
void | Mac2PhyTurnOn (int moduleId) |
void | Mac2PhyTurnOff () |
void | Mac2PhyTurnOff (int moduleId) |
bool | Mac2PhyOnOffSwitchStatus () |
bool | Mac2PhyOnOffSwitchStatus (int moduleId) |
Protected Attributes | |
double | mac2phy_delay_ |
int | addr |
Definition at line 49 of file mmac.h.
void MMac::recv | ( | Packet * | p | ) | [virtual] |
Abstract method which has to be filled with the ad-hoc operations that the module has to do to the packet received
p | pointer to the packet will be received |
Implements Module.
Definition at line 101 of file mmac.cc.
References Phy2MacEndRx(), recvFromUpperLayers(), and UP.
Here is the call graph for this function:
int MMac::recvSyncClMsg | ( | ClMessage * | m | ) | [virtual] |
Cross-Layer messages synchronous interpreter. It has to be properly extended in order to interpret custom cross-layer messages used by this particular plug-in. This type of communication need to be directly answered in the message exchanged in order to be synchronous with the source.
m | an instance of ClMessage that represent the message received and used for the answer |
Reimplemented from PlugIn.
Definition at line 75 of file mmac.cc.
References addr, CLMSG_PHY2MAC_CCA, CLMSG_PHY2MAC_ENDTX, CLMSG_PHY2MAC_STARTRX, Phy2MacCCA(), Phy2MacEndTx(), Phy2MacStartRx(), PlugIn::recvSyncClMsg(), and ClMessage::type().
Here is the call graph for this function:
int MMac::command | ( | int | argc, | |
const char *const * | argv | |||
) | [virtual] |
TCL command interpreter. It implements the following OTcl methods:
Moreover it inherits all the OTcl method of PlugIn
argc | number of arguments in argv | |
argv | array of strings which are the comand parameters (Note that argv[0] is the name of the object) |
Reimplemented from Module.
Definition at line 60 of file mmac.cc.
References addr, and Module::command().
Here is the call graph for this function:
void MMac::Phy2MacEndTx | ( | const Packet * | p | ) | [protected, virtual] |
Handle the end-of-PHY-transmission event
This method is expected to be re- implemented by a class inheriting from MMac in order to perform the necessary MAC operations.
p | pointer to the packet whose transmission has ended. Note that the Packet is not any more under control of the MAC at the time this event occurs, hence the 'const' declaration. |
Reimplemented in MMacAloha, and MMacCsma.
Definition at line 127 of file mmac.cc.
Referenced by recvSyncClMsg().
void MMac::Phy2MacStartRx | ( | const Packet * | p | ) | [protected, virtual] |
Handle the detected-start-of-PHY-reception event (e.g., PHY preamble successfully detected, so we expect to receive a new packet, possibly with errors)
This method is expected to be re- implemented by a class inheriting from MMac in order to perform the necessary MAC operations.
p | pointer to the packet whose reception has begun. Note that the Packet is not yet under control of the MAC at the time this event occurs, hence the 'const' declaration. |
Reimplemented in MMacAloha, and MMacCsma.
Definition at line 131 of file mmac.cc.
Referenced by recvSyncClMsg().
void MMac::Phy2MacEndRx | ( | Packet * | p | ) | [protected, virtual] |
Handle the end-of-PHY-reception event
This method is expected to be re- implemented by a class inheriting from MMac in order to perform the necessary MAC operations.
p | pointer to the packet whose reception has ended. The receiving MAC can modify it at will (changing header fields, deleting it...) |
Reimplemented in MMacAloha, and MMacCsma.
Definition at line 135 of file mmac.cc.
Referenced by recv().
void MMac::recvFromUpperLayers | ( | Packet * | p | ) | [protected, virtual] |
void MMac::Mac2PhyStartTx | ( | Packet * | p | ) | [protected] |
This method must be called by the MAC to instruct the PHY to start the transmission of a packet
p | the packet to be transmitted |
Definition at line 116 of file mmac.cc.
References mac2phy_delay_, and Module::sendDown().
Referenced by MMacCsma::enterState_TX_ACK(), MMacCsma::enterState_TX_DATA(), MMacAloha::Phy2MacEndTx(), and MMacAloha::recvFromUpperLayers().
Here is the call graph for this function:
void MMac::Mac2PhyStartTx | ( | int | moduleId, | |
Packet * | p | |||
) | [protected] |
This method must be called by the MAC to instruct the id-specific PHY to start the transmission of a packet
p | the packet to be transmitted | |
moduleId | module's unique id number |
Definition at line 121 of file mmac.cc.
References mac2phy_delay_, and Module::sendDown().
Here is the call graph for this function:
double MMac::Mac2PhyTxDuration | ( | Packet * | p | ) | [protected] |
This method sends a synchr. clmessage to PHY asking for the tx duration of a packet
p | the packet to be transmitted |
Definition at line 147 of file mmac.cc.
References ClMsgMac2PhyGetTxDuration::getDuration(), and Module::sendSyncClMsgDown().
Here is the call graph for this function:
double MMac::Mac2PhyTxDuration | ( | int | moduleId, | |
Packet * | p | |||
) | [protected] |
This method sends a synchr. clmessage to PHY asking for the tx duration of a packet
p | the packet to be transmitted | |
moduleId | module's unique id number |
Definition at line 154 of file mmac.cc.
References ClMsgMac2PhyGetTxDuration::getDuration(), and Module::sendSyncClMsgDown().
Here is the call graph for this function:
void MMac::Mac2PhyTurnOn | ( | ) | [protected] |
This method sends a synchr. clmessage to turn the PHY on
Definition at line 161 of file mmac.cc.
References Module::sendSyncClMsgDown(), and ClMsgPhyOnOffSwitch::setOn().
Here is the call graph for this function:
void MMac::Mac2PhyTurnOn | ( | int | moduleId | ) | [protected] |
This method sends a synchr. clmessage to turn on the id-specific PHY
moduleId | module's unique id number |
Definition at line 168 of file mmac.cc.
References Module::sendSyncClMsgDown(), and ClMsgPhyOnOffSwitch::setOn().
Here is the call graph for this function:
void MMac::Mac2PhyTurnOff | ( | ) | [protected] |
This method sends a synchr. clmessage to turn the PHY off
Definition at line 175 of file mmac.cc.
References Module::sendSyncClMsgDown(), and ClMsgPhyOnOffSwitch::setOff().
Here is the call graph for this function:
void MMac::Mac2PhyTurnOff | ( | int | moduleId | ) | [protected] |
This method sends a synchr. clmessage to turn off the id-specific PHY
moduleId | module's unique id number |
Definition at line 182 of file mmac.cc.
References Module::sendSyncClMsgDown(), and ClMsgPhyOnOffSwitch::setOff().
Here is the call graph for this function:
bool MMac::Mac2PhyOnOffSwitchStatus | ( | ) | [protected] |
This method sends a synchr. clmessage to get PHY interrupt status returns a bool == true if PHY is on, false otherwise.
Definition at line 189 of file mmac.cc.
References ClMsgPhyOnOffSwitchStatus::getStatus(), and Module::sendSyncClMsgDown().
Here is the call graph for this function:
bool MMac::Mac2PhyOnOffSwitchStatus | ( | int | moduleId | ) | [protected] |
This method sends a synchr. clmessage to get the id-specific PHY interrupt status returns a bool == true if PHY is on, false otherwise.
moduleId | module's unique id number |
Definition at line 196 of file mmac.cc.
References ClMsgPhyOnOffSwitchStatus::getStatus(), and Module::sendSyncClMsgDown().
Here is the call graph for this function:
double MMac::mac2phy_delay_ [protected] |
Delay when sending packets from MAC to PHY. Remember that setting this to zero might give strange results due to the possible generation of simultaneous events and how these might be scheduled by the simulator. If you want to avoid this effect, set the value to a very small value if you want to simulate 'zero' delay.
Definition at line 198 of file mmac.h.
Referenced by Mac2PhyStartTx().
int MMac::addr [protected] |
MAC address of this MAC instance. Automatically generated.
Definition at line 205 of file mmac.h.
Referenced by command(), MMacCsma::enterState_TX_ACK(), MMacCsma::Phy2MacEndRx(), recvSyncClMsg(), and MMacCsma::setState().