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

P2PPhyLayer.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        P2PPhyLayer.h
00003  *
00004  * author:      Marc Loebbers, 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: a very simple physical layer implementation
00019  ***************************************************************************/
00020 
00021 
00022 #ifndef  P2P_PHYLAYER_H
00023 #define  P2P_PHYLAYER_H
00024 
00025 #include "ChannelAccess.h"
00026 #include "AirFrame_m.h"
00027 #include "NicControlType.h"
00028 #include "ActiveChannel.h"
00029 
00043 class P2PPhyLayer : public ChannelAccess
00044 {
00045   protected:
00047     double bitrate;
00048 
00055     int headerLength;
00056   
00061     double pBit;
00062 
00064     double transmitterPower;
00065   
00068     int uppergateOut;
00069     int uppergateIn;
00070     int upperControlOut;
00074     cMessage *txOverTimer;
00075 
00077     ActiveChannel channel;
00079     int catActiveChannel;
00080 
00086     enum P2PPhyKinds {
00087         RECEPTION_COMPLETE = 1350101811
00088     };
00089     
00090     
00091   public:
00092     Module_Class_Members( P2PPhyLayer, ChannelAccess, 0 );
00093   
00095     virtual void initialize(int);
00096     virtual void finish();
00097   
00099     void handleMessage(cMessage*);
00100 
00102     virtual void receiveBBItem(int category, const BBItem *details, int scopeModuleId);
00103     
00104   protected:
00116 
00123     virtual void handleSelfMsg(cMessage* msg){
00124         error("deleting msg");
00125         delete msg;
00126     };
00127     
00129     virtual void handleUpperMsg(AirFrame*, int);
00130     
00132     virtual void handleLowerMsg(AirFrame*);
00133     
00149 
00151     AirFrame* encapsMsg(cMessage*);
00152   
00154     void bufferMsg(AirFrame*);
00155   
00157     AirFrame* unbufferMsg(cMessage*);
00158   
00161     void sendP2P(AirFrame*, int);
00162   
00165     void sendDown(AirFrame*, int);
00166 
00169     void sendUp(AirFrame*);
00170 
00172     void sendDelayedP2P(AirFrame*, double, int);
00173   
00175     void sendDelayedDown(AirFrame*, double, int);
00176 
00178     void sendDelayedUp(AirFrame*, double);
00179 
00181     void sendControlUp(cMessage *);
00182 
00186     virtual double calcDuration(cMessage*);
00187     
00201 
00203     virtual AirFrame* createCapsulePkt() {
00204         return new AirFrame();
00205     };
00208 };
00209 #endif

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