00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef BASE_MAC_LAYER_H
00024 #define BASE_MAC_LAYER_H
00025
00026 #include <omnetpp.h>
00027 #include "BaseLayer.h"
00028
00029 #include <MacPkt_m.h>
00030 #include <MacToPhyInterface.h>
00031 #include <BaseConnectionManager.h>
00032
00043 class BaseMacLayer : public BaseLayer
00044 {
00045 public:
00047 enum BaseMacMessageKinds {
00050 LAST_BASE_MAC_MESSAGE_KIND = 23000,
00051 };
00053 enum BaseMacControlKinds {
00055 TX_OVER = 23500,
00057 PACKET_DROPPED,
00060 LAST_BASE_MAC_CONTROL_KIND,
00061 };
00062 protected:
00063
00065 MacToPhyInterface* phy;
00066
00068
00069
00073 int headerLength;
00074
00078 int myMacAddr;
00079
00081 bool coreDebug;
00082
00090 int phyHeaderLength;
00091
00092 public:
00093
00094
00096 virtual void initialize(int);
00097
00098 protected:
00099
00110 virtual void handleUpperMsg(cMessage *msg);
00111
00116 virtual void handleLowerMsg(cMessage *msg);
00117
00118 virtual void handleSelfMsg(cMessage* msg){
00119 error("BaseMacLayer does not handle self messages");
00120 };
00121 virtual void handleLowerControl(cMessage* msg);
00122
00123 virtual void handleUpperControl(cMessage* msg){
00124 error("BaseMacLayer does not handle control messages from upper layers");
00125 };
00126
00127
00129 virtual cPacket* decapsMsg(MacPkt*);
00130
00132 virtual MacPkt* encapsMsg(cPacket*);
00133
00149 virtual Signal* createSignal(simtime_t start, simtime_t length, double power, double bitrate);
00150
00157 Mapping* createConstantMapping(simtime_t start, simtime_t end, double value);
00158
00165 Mapping* createRectangleMapping(simtime_t start, simtime_t end, double value);
00166
00171 ConstMapping* createSingleFrequencyMapping(simtime_t start, simtime_t end, double centerFreq, double bandWith, double value);
00172
00177 BaseConnectionManager* getConnectionManager();
00178 };
00179
00180 #endif