src/devices/wifi/wifi-net-device.h
changeset 2470 254581fb9e9c
parent 2284 14b682d28918
child 2503 e667dc0f350e
equal deleted inserted replaced
2469:181c6a5b14c1 2470:254581fb9e9c
    96   /**
    96   /**
    97    * \returns the ssid of this 802.11 interface.
    97    * \returns the ssid of this 802.11 interface.
    98    */
    98    */
    99   virtual Ssid GetSsid (void) const = 0;
    99   virtual Ssid GetSsid (void) const = 0;
   100 
   100 
       
   101   // inherited from NetDevice base class.
       
   102   virtual void SetName(const std::string name);
       
   103   virtual std::string GetName(void) const;
       
   104   virtual void SetIfIndex(const uint32_t index);
       
   105   virtual uint32_t GetIfIndex(void) const;
       
   106   virtual Ptr<Channel> GetChannel (void) const;
       
   107   virtual Address GetAddress (void) const;
       
   108   virtual bool SetMtu (const uint16_t mtu);
       
   109   virtual uint16_t GetMtu (void) const;
       
   110   virtual bool IsLinkUp (void) const;
       
   111   virtual void SetLinkChangeCallback (Callback<void> callback);
       
   112   virtual bool IsBroadcast (void) const;
       
   113   virtual Address GetBroadcast (void) const;
       
   114   virtual bool IsMulticast (void) const;
       
   115   virtual Address GetMulticast (void) const;
       
   116   virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const;
       
   117   virtual bool IsPointToPoint (void) const;
       
   118   virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
       
   119   virtual Ptr<Node> GetNode (void) const;
       
   120   virtual bool NeedsArp (void) const;
       
   121   virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
       
   122 
   101 private:
   123 private:
   102   class PhyListener;
   124   class PhyListener;
   103   class NavListener;
   125   class NavListener;
   104 
   126 
   105   // inherited from NetDevice
       
   106   virtual bool DoNeedsArp (void) const;
       
   107   virtual Ptr<Channel> DoGetChannel (void) const;
       
   108   virtual bool SendTo (Ptr<Packet> packet, const Address &to, uint16_t protocolNumber);
       
   109   // inherited from Object
   127   // inherited from Object
   110   virtual Ptr<TraceResolver> GetTraceResolver (void) const;
   128   virtual Ptr<TraceResolver> GetTraceResolver (void) const;
   111   // defined for children
   129   // defined for children
   112   virtual void NotifyAttached (void) = 0;
   130   virtual void NotifyAttached (void) = 0;
   113   virtual bool DoSendTo (Ptr<const Packet> packet, const Mac48Address &to) = 0;
   131   virtual bool DoSendTo (Ptr<const Packet> packet, const Mac48Address &to) = 0;
   115   void Construct (void);
   133   void Construct (void);
   116 
   134 
   117   CallbackTraceSource<Ptr<const Packet>, Mac48Address> m_rxLogger;
   135   CallbackTraceSource<Ptr<const Packet>, Mac48Address> m_rxLogger;
   118   CallbackTraceSource<Ptr<const Packet>, Mac48Address> m_txLogger;
   136   CallbackTraceSource<Ptr<const Packet>, Mac48Address> m_txLogger;
   119 protected:
   137 protected:
   120   WifiNetDevice (Ptr<Node> node);
       
   121   WifiNetDevice (Ptr<Node> node, Mac48Address self);
   138   WifiNetDevice (Ptr<Node> node, Mac48Address self);
   122   void DoForwardUp (Ptr<Packet> packet, const Mac48Address &from);
   139   void DoForwardUp (Ptr<Packet> packet, const Mac48Address &from);
   123   DcaTxop *CreateDca (uint32_t minCw, uint32_t maxCw, uint32_t aifsn) const;
   140   DcaTxop *CreateDca (uint32_t minCw, uint32_t maxCw, uint32_t aifsn) const;
       
   141   void NotifyLinkUp (void);
       
   142   void NotifyLinkDown (void);
   124   // inherited from Object
   143   // inherited from Object
   125   virtual void DoDispose (void);
   144   virtual void DoDispose (void);
   126 
   145 
   127   Ptr<WifiChannel> m_channel;
   146   Ptr<WifiChannel> m_channel;
   128   Ptr<WifiPhy> m_phy;
   147   Ptr<WifiPhy> m_phy;
   132   MacTxMiddle *m_txMiddle;
   151   MacTxMiddle *m_txMiddle;
   133   MacParameters *m_parameters;
   152   MacParameters *m_parameters;
   134   DcfManager *m_manager;
   153   DcfManager *m_manager;
   135   PhyListener *m_phyListener;
   154   PhyListener *m_phyListener;
   136   NavListener *m_navListener;
   155   NavListener *m_navListener;
       
   156 
       
   157   Ptr<Node> m_node;
       
   158   Mac48Address m_address;
       
   159   NetDevice::ReceiveCallback m_rxCallback;
       
   160   uint32_t m_ifIndex;
       
   161   std::string m_name;
       
   162   bool m_linkUp;
       
   163   Callback<void> m_linkChangeCallback;
       
   164   uint16_t m_mtu;
   137 };
   165 };
   138 
   166 
   139 /**
   167 /**
   140  * \brief a 802.11 adhoc network interface
   168  * \brief a 802.11 adhoc network interface
   141  *
   169  *
   142  * This network interface is a very simple pass-through 
   170  * This network interface is a very simple pass-through 
   143  * from the higher layers down to the MAC DCF layer.
   171  * from the higher layers down to the MAC DCF layer.
   144  */
   172  */
   145 class AdhocWifiNetDevice : public WifiNetDevice {
   173 class AdhocWifiNetDevice : public WifiNetDevice {
   146 public:
   174 public:
   147   AdhocWifiNetDevice (Ptr<Node> node);
       
   148   AdhocWifiNetDevice (Ptr<Node> node, Mac48Address self);
   175   AdhocWifiNetDevice (Ptr<Node> node, Mac48Address self);
   149   virtual ~AdhocWifiNetDevice ();
   176   virtual ~AdhocWifiNetDevice ();
   150 
   177 
   151   virtual Mac48Address GetBssid (void) const;
   178   virtual Mac48Address GetBssid (void) const;
   152   virtual Ssid GetSsid (void) const;
   179   virtual Ssid GetSsid (void) const;
   181 {
   208 {
   182 public:
   209 public:
   183   /**
   210   /**
   184    * The ssid is initialized from \valueref{WifiSsid}.
   211    * The ssid is initialized from \valueref{WifiSsid}.
   185    */
   212    */
   186   NqstaWifiNetDevice (Ptr<Node> node);
       
   187   NqstaWifiNetDevice (Ptr<Node> node, Mac48Address self);
   213   NqstaWifiNetDevice (Ptr<Node> node, Mac48Address self);
   188   virtual ~NqstaWifiNetDevice ();
   214   virtual ~NqstaWifiNetDevice ();
   189 
   215 
   190   virtual Mac48Address GetBssid (void) const;
   216   virtual Mac48Address GetBssid (void) const;
   191   virtual Ssid GetSsid (void) const;
   217   virtual Ssid GetSsid (void) const;