A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
uan-net-device.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 #ifndef UAN_NET_DEVICE_H
22 #define UAN_NET_DEVICE_H
23 
24 #include "ns3/net-device.h"
25 #include "ns3/pointer.h"
26 #include "ns3/traced-callback.h"
27 #include "uan-address.h"
28 #include <list>
29 
30 namespace ns3 {
31 
32 class UanChannel;
33 class UanPhy;
34 class UanMac;
35 class UanTransducer;
36 
48 class UanNetDevice : public NetDevice
49 {
50 public:
54  typedef std::list<Ptr<UanPhy> > UanPhyList;
58  typedef std::list<Ptr<UanTransducer> > UanTransducerList;
59 
60  static TypeId GetTypeId (void);
61 
62  UanNetDevice ();
63  virtual ~UanNetDevice ();
64 
68  void SetMac (Ptr<UanMac> mac);
69 
73  void SetPhy (Ptr<UanPhy> phy);
74 
78  void SetChannel (Ptr<UanChannel> channel);
79 
83  Ptr<UanMac> GetMac (void) const;
84 
88  Ptr<UanPhy> GetPhy (void) const;
89 
93  Ptr<UanTransducer> GetTransducer (void) const;
97  void SetTransducer (Ptr<UanTransducer> trans);
98 
102  void Clear (void);
103 
104  void SetSleepMode (bool sleep);
105 
106  // Purely virtual functions from base class
107  virtual void SetIfIndex (const uint32_t index);
108  virtual uint32_t GetIfIndex (void) const;
109  virtual Ptr<Channel> GetChannel (void) const;
110  virtual Address GetAddress (void) const;
111  virtual bool SetMtu (const uint16_t mtu);
112  virtual uint16_t GetMtu (void) const;
113  virtual bool IsLinkUp (void) const;
114  virtual bool IsBroadcast (void) const;
115  virtual Address GetBroadcast (void) const;
116  virtual bool IsMulticast (void) const;
117  virtual Address GetMulticast (Ipv4Address multicastGroup) const;
118  virtual Address GetMulticast (Ipv6Address addr) const;
119  virtual bool IsBridge (void) const;
120  virtual bool IsPointToPoint (void) const;
121  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
122  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
123  virtual Ptr<Node> GetNode (void) const;
124  virtual void SetNode (Ptr<Node> node);
125  virtual bool NeedsArp (void) const;
128  virtual bool SupportsSendFrom (void) const;
129  virtual void AddLinkChangeCallback (Callback<void> callback);
130  virtual void SetAddress (Address address);
131 private:
132  virtual void ForwardUp (Ptr<Packet> pkt, const UanAddress &src);
133  Ptr<UanChannel> DoGetChannel (void) const;
134 
140 
141  std::string m_name;
142  uint32_t m_ifIndex;
143  uint16_t m_mtu;
144  bool m_linkup;
147 
150 
151  bool m_cleared;
152 
153 protected:
154  virtual void DoDispose ();
155 };
156 
157 } // namespace ns3
158 
159 #endif /* UAN_NET_DEVICE_H */