BaseMacLayer.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        BaseMacLayer.h
00003  *
00004  * author:      Daniel Willkomm
00005  *
00006  * copyright:   (C) 2004 Telecommunication Networks Group (TKN) at
00007  *              Technische Universitaet Berlin, Germany.
00008  *
00009  *              This program is free software; you can redistribute it
00010  *              and/or modify it under the terms of the GNU General Public
00011  *              License as published by the Free Software Foundation; either
00012  *              version 2 of the License, or (at your option) any later
00013  *              version.
00014  *              For further information see file COPYING
00015  *              in the top level directory
00016  ***************************************************************************
00017  * part of:     framework implementation developed by tkn
00018  * description: basic MAC layer class
00019  *              subclass to create your own MAC layer
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 //#include "BaseArp.h"
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     //BaseArp* arp;
00069 
00073     int headerLength;
00074 
00078     int myMacAddr;
00079 
00081     bool coreDebug;
00082 
00090     int phyHeaderLength;
00091 
00092 public:
00093     //Module_Class_Members( BaseMacLayer, BaseLayer, 0 );
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