00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2006,2007 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage, <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 #ifndef YANS_WIFI_CHANNEL_H 00021 #define YANS_WIFI_CHANNEL_H 00022 00023 #include <vector> 00024 #include <stdint.h> 00025 #include "ns3/packet.h" 00026 #include "wifi-channel.h" 00027 #include "wifi-mode.h" 00028 #include "wifi-preamble.h" 00029 00030 namespace ns3 { 00031 00032 class NetDevice; 00033 class PropagationLossModel; 00034 class PropagationDelayModel; 00035 class YansWifiPhy; 00036 00037 /** 00038 * \brief A Yans wifi channel 00039 * 00040 * This wifi channel implements the propagation model described in 00041 * "Yet Another Network Simulator", (http://cutebugs.net/files/wns2-yans.pdf). 00042 * 00043 * This class is expected to be used in tandem with the ns3::YansWifiPhy 00044 * class and contains a ns3::PropagationLossModel and a ns3::PropagationDelayModel. 00045 * By default, no propagation models are set so, it is the caller's responsability 00046 * to set them before using the channel. 00047 */ 00048 class YansWifiChannel : public WifiChannel 00049 { 00050 public: 00051 static TypeId GetTypeId (void); 00052 00053 YansWifiChannel (); 00054 virtual ~YansWifiChannel (); 00055 00056 // inherited from Channel. 00057 virtual uint32_t GetNDevices (void) const; 00058 virtual Ptr<NetDevice> GetDevice (uint32_t i) const; 00059 00060 void Add (Ptr<YansWifiPhy> phy); 00061 00062 /** 00063 * \param loss the new propagation loss model. 00064 */ 00065 void SetPropagationLossModel (Ptr<PropagationLossModel> loss); 00066 /** 00067 * \param delay the new propagation delay model. 00068 */ 00069 void SetPropagationDelayModel (Ptr<PropagationDelayModel> delay); 00070 00071 /** 00072 * \param sender the device from which the packet is originating. 00073 * \param packet the packet to send 00074 * \param txPowerDbm the tx power associated to the packet 00075 * \param wifiMode the tx mode associated to the packet 00076 * \param preamble the preamble associated to the packet 00077 * 00078 * This method should not be invoked by normal users. It is 00079 * currently invoked only from WifiPhy::Send. 00080 */ 00081 void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm, 00082 WifiMode wifiMode, WifiPreamble preamble) const; 00083 00084 private: 00085 typedef std::vector<Ptr<YansWifiPhy> > PhyList; 00086 void Receive (uint32_t i, Ptr<Packet> packet, double rxPowerDbm, 00087 WifiMode txMode, WifiPreamble preamble) const; 00088 00089 00090 PhyList m_phyList; 00091 Ptr<PropagationLossModel> m_loss; 00092 Ptr<PropagationDelayModel> m_delay; 00093 }; 00094 00095 } // namespace ns3 00096 00097 00098 #endif /* YANS_WIFI_CHANNEL_H */