1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2008 INRIA
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;
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.
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
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20 #ifndef SIMPLE_NET_DEVICE_H
21 #define SIMPLE_NET_DEVICE_H
23 #include "net-device.h"
24 #include "mac48-address.h"
36 * \brief simple net device for simple things and testing
38 class SimpleNetDevice : public NetDevice
41 static TypeId GetTypeId (void);
44 void Receive (Ptr<Packet> packet, uint16_t protocol, Mac48Address to, Mac48Address from);
45 void SetChannel (Ptr<SimpleChannel> channel);
46 void SetAddress (Mac48Address address);
48 // inherited from NetDevice base class.
49 virtual void SetName(const std::string name);
50 virtual std::string GetName(void) const;
51 virtual void SetIfIndex(const uint32_t index);
52 virtual uint32_t GetIfIndex(void) const;
53 virtual Ptr<Channel> GetChannel (void) const;
54 virtual Address GetAddress (void) const;
55 virtual bool SetMtu (const uint16_t mtu);
56 virtual uint16_t GetMtu (void) const;
57 virtual bool IsLinkUp (void) const;
58 virtual void SetLinkChangeCallback (Callback<void> callback);
59 virtual bool IsBroadcast (void) const;
60 virtual Address GetBroadcast (void) const;
61 virtual bool IsMulticast (void) const;
62 virtual Address GetMulticast (Ipv4Address multicastGroup) const;
63 virtual bool IsPointToPoint (void) const;
64 virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
65 virtual bool SendFrom(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
66 virtual Ptr<Node> GetNode (void) const;
67 virtual void SetNode (Ptr<Node> node);
68 virtual bool NeedsArp (void) const;
69 virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
71 virtual Address GetMulticast (Ipv6Address addr) const;
73 virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
74 virtual bool SupportsSendFrom (void) const;
77 virtual void DoDispose (void);
79 Ptr<SimpleChannel> m_channel;
80 NetDevice::ReceiveCallback m_rxCallback;
81 NetDevice::PromiscReceiveCallback m_promiscCallback;
86 Mac48Address m_address;
91 #endif /* SIMPLE_NET_DEVICE_H */