A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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) 2005,2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Modified by Emmanuelle Laprise to remove dependence on LLC headers
20  */
21 #ifndef NET_DEVICE_H
22 #define NET_DEVICE_H
23 
24 #include <string>
25 #include <stdint.h>
26 #include "ns3/callback.h"
27 #include "ns3/object.h"
28 #include "ns3/ptr.h"
29 #include "address.h"
30 #include "ns3/ipv4-address.h"
31 #include "ns3/ipv6-address.h"
32 
33 namespace ns3 {
34 
35 class Node;
36 class Channel;
37 class Packet;
38 
75 class NetDevice : public Object
76 {
77 public:
78  static TypeId GetTypeId (void);
79  virtual ~NetDevice();
80 
84  virtual void SetIfIndex (const uint32_t index) = 0;
88  virtual uint32_t GetIfIndex (void) const = 0;
89 
90 
98  virtual Ptr<Channel> GetChannel (void) const = 0;
99 
104  virtual void SetAddress (Address address) = 0;
105 
109  virtual Address GetAddress (void) const = 0;
110 
117  virtual bool SetMtu (const uint16_t mtu) = 0;
124  virtual uint16_t GetMtu (void) const = 0;
128  virtual bool IsLinkUp (void) const = 0;
137  virtual void AddLinkChangeCallback (Callback<void> callback) = 0;
142  virtual bool IsBroadcast (void) const = 0;
150  virtual Address GetBroadcast (void) const = 0;
151 
155  virtual bool IsMulticast (void) const = 0;
156 
186  virtual Address GetMulticast (Ipv4Address multicastGroup) const = 0;
187 
195  virtual Address GetMulticast (Ipv6Address addr) const = 0;
196 
202  virtual bool IsBridge (void) const = 0;
203 
209  virtual bool IsPointToPoint (void) const = 0;
222  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) = 0;
236  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) = 0;
245  virtual Ptr<Node> GetNode (void) const = 0;
246 
252  virtual void SetNode (Ptr<Node> node) = 0;
253 
260  virtual bool NeedsArp (void) const = 0;
261 
262 
271  {
280  };
281 
293 
299  virtual void SetReceiveCallback (ReceiveCallback cb) = 0;
300 
301 
316 
328 
332  virtual bool SupportsSendFrom (void) const = 0;
333 
334 };
335 
336 } // namespace ns3
337 
338 #endif /* NET_DEVICE_H */