Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

CSMAMacLayer.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        CSMAMacLayer.h
00003  *
00004  * author:      Marc Loebbers, Yosia Hadisusanto
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  ***************************************************************************/
00019 
00020 
00021 #ifndef CSMAMAC_LAYER_H
00022 #define CSMAMAC_LAYER_H
00023 
00024 #include <list>
00025 #include <ActiveChannel.h>
00026 #include <RadioState.h>
00027 #include <RSSI.h>
00028 #include <Bitrate.h>
00029 #include <DroppedPacket.h>
00030 #include <BasicMacLayer.h>
00031 #include <Blackboard.h>
00032 #include <MacPkt_m.h>
00033 #include <SingleChannelRadio.h>
00034 #include <SimpleAddress.h>
00035 
00036 
00076 class  CSMAMacLayer : public BasicMacLayer
00077 {
00078   public:
00079     Module_Class_Members(CSMAMacLayer, BasicMacLayer, 0);
00080 
00082     virtual void initialize(int);
00083 
00085     virtual void finish();
00086 
00088     virtual void handleLowerMsg(cMessage*);
00089 
00091     virtual void handleUpperMsg(cMessage*);
00092 
00094     virtual void handleSelfMsg(cMessage*);
00095 
00097     virtual void handleLowerControl(cMessage *msg);
00098 
00100     virtual void receiveBBItem(int category, const BBItem *details, int scopeModuleId);
00101 
00102   protected:
00103     typedef std::list<MacPkt*> MacQueue;
00104     
00116     enum States {
00117         RX, 
00118         CCA,
00119         TX,
00120     };
00121 
00123     States macState;
00124     
00126     RadioState::States radioState;
00128     int catRadioState;
00129     
00131     double rssi;
00133     int catRSSI;
00134 
00136     double busyRSSI;
00137 
00146     double slotDuration;
00147 
00153     double difs;
00154 
00156     SingleChannelRadio* radio;
00157     
00160     MacQueue macQueue;
00161     
00163     unsigned queueLength;
00164     
00166     cMessage* backoffTimer;
00167 
00173     cMessage* minorMsg;
00174     
00181     unsigned txAttempts;
00182     
00187     unsigned maxTxAttempts;
00188 
00190     double bitrate;
00191 
00193     unsigned initialCW;
00194 
00196     DroppedPacket droppedPacket;
00197     
00199     int catDroppedPacket;
00200     
00202     int nicId;
00203     
00204 protected:
00214     virtual void scheduleBackoff();
00215 };
00216 
00217 #endif
00218 

Generated on Fri Jan 12 08:29:32 2007 for Mobility Framework by  doxygen 1.4.4