00001 /* -*- mode:c++ -*- ******************************************************** 00002 * file: AlohaMacLayer.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 ALOHAMAC_LAYER_H 00022 #define ALOHAMAC_LAYER_H 00023 00024 #include <list> 00025 #include <ActiveChannel.h> 00026 #include <BasicMacLayer.h> 00027 00028 #include "RadioState.h" 00029 #include "SingleChannelRadio.h" 00030 00031 00049 class AlohaMacLayer : public BasicMacLayer 00050 { 00051 public: 00052 Module_Class_Members(AlohaMacLayer, BasicMacLayer, 0); 00053 00055 virtual void initialize(int); 00056 00058 virtual void finish(); 00059 00061 virtual void handleUpperMsg(cMessage*); 00062 00064 virtual void handleSelfMsg(cMessage*); 00065 00067 virtual void handleLowerControl(cMessage *msg); 00068 00070 virtual void receiveBBItem(int category, const BBItem *details, int scopeModuleId); 00071 00072 protected: 00073 typedef std::list<MacPkt*> MacQueue; 00074 00083 enum States { 00084 RX, 00085 TX, 00086 }; 00087 00089 States macState; 00090 00092 RadioState::States radioState; 00094 int catRadioState; 00095 00097 SingleChannelRadio* radio; 00098 00101 MacQueue macQueue; 00102 00104 unsigned int queueLength; 00105 00107 void prepareSend(); 00108 00109 }; 00110 00111 #endif 00112