OLD | NEW |
(Empty) | |
| 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 UANNETDEVICE_H |
| 22 #define UANNETDEVICE_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 |
| 37 /** |
| 38 * \class UanNetDevice |
| 39 * |
| 40 * \brief Net device for UAN models |
| 41 */ |
| 42 class UanNetDevice : public NetDevice |
| 43 { |
| 44 public: |
| 45 typedef std::list<Ptr<UanPhy> > UanPhyList; |
| 46 typedef std::list<Ptr<UanTransducer> > UanTransducerList; |
| 47 |
| 48 static TypeId GetTypeId (void); |
| 49 |
| 50 UanNetDevice (); |
| 51 virtual ~UanNetDevice (); |
| 52 |
| 53 /** |
| 54 * \param mac Set MAC layer for this device |
| 55 */ |
| 56 void SetMac (Ptr<UanMac> mac); |
| 57 |
| 58 /** |
| 59 * \param phy Set PHY layer for this device |
| 60 */ |
| 61 void SetPhy (Ptr<UanPhy> phy); |
| 62 |
| 63 /** |
| 64 * \param channel The channel this device is attached to |
| 65 */ |
| 66 void SetChannel (Ptr<UanChannel> channel); |
| 67 |
| 68 /** |
| 69 * \returns MAC this device is using |
| 70 */ |
| 71 Ptr<UanMac> GetMac (void) const; |
| 72 |
| 73 /** |
| 74 * \returns PHY this device is using |
| 75 */ |
| 76 Ptr<UanPhy> GetPhy (void) const; |
| 77 |
| 78 /** |
| 79 * \returns Transducer in net device |
| 80 */ |
| 81 Ptr<UanTransducer> GetTransducer (void) const; |
| 82 /** |
| 83 * \param trans Transducer to use in this net device |
| 84 */ |
| 85 void SetTransducer (Ptr<UanTransducer> trans); |
| 86 |
| 87 // Purely virtual functions from base class |
| 88 virtual void SetName (const std::string name); |
| 89 virtual std::string GetName (void) const; |
| 90 virtual void SetIfIndex (const uint32_t index); |
| 91 virtual uint32_t GetIfIndex (void) const; |
| 92 virtual Ptr<Channel> GetChannel (void) const; |
| 93 virtual Address GetAddress (void) const; |
| 94 virtual bool SetMtu (const uint16_t mtu); |
| 95 virtual uint16_t GetMtu (void) const; |
| 96 virtual bool IsLinkUp (void) const; |
| 97 virtual bool IsBroadcast (void) const; |
| 98 virtual Address GetBroadcast (void) const; |
| 99 virtual bool IsMulticast (void) const; |
| 100 virtual Address GetMulticast (Ipv4Address multicastGroup) const; |
| 101 virtual Address GetMulticast (Ipv6Address addr) const; |
| 102 virtual bool IsBridge (void) const ; |
| 103 virtual bool IsPointToPoint (void) const; |
| 104 virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolN
umber); |
| 105 virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Addres
s& dest, uint16_t protocolNumber); |
| 106 virtual Ptr<Node> GetNode (void) const; |
| 107 virtual void SetNode (Ptr<Node> node); |
| 108 virtual bool NeedsArp (void) const; |
| 109 virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); |
| 110 virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb); |
| 111 virtual bool SupportsSendFrom (void) const; |
| 112 virtual void AddLinkChangeCallback (Callback<void> callback); |
| 113 virtual void SetAddress (Address address); |
| 114 private: |
| 115 virtual void ForwardUp (Ptr<Packet> pkt, const UanAddress &src); |
| 116 Ptr<UanChannel> DoGetChannel (void) const; |
| 117 |
| 118 Ptr<UanTransducer> m_trans; |
| 119 Ptr<Node> m_node; |
| 120 Ptr<UanChannel> m_channel; |
| 121 Ptr<UanMac> m_mac; |
| 122 Ptr<UanPhy> m_phy; |
| 123 |
| 124 std::string m_name; |
| 125 uint32_t m_ifIndex; |
| 126 uint16_t m_mtu; |
| 127 bool m_linkup; |
| 128 TracedCallback<> m_linkChanges; |
| 129 ReceiveCallback m_forwardUp; |
| 130 |
| 131 TracedCallback<Ptr<const Packet>, UanAddress> m_rxLogger; |
| 132 TracedCallback<Ptr<const Packet>, UanAddress> m_txLogger; |
| 133 protected: |
| 134 virtual void DoDispose (); |
| 135 }; |
| 136 |
| 137 } // namespace ns3 |
| 138 |
| 139 #endif // UANNETDEVICE_H· |
OLD | NEW |