00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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