author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 01 Feb 2010 08:09:11 +0100 | |
changeset 5937 | aa754f49d2f3 |
parent 5227 | ecb08c1fc273 |
child 6189 | 450a3f4d9906 |
permissions | -rw-r--r-- |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
728
diff
changeset
|
19 |
* Modified by Emmanuelle Laprise to remove dependance on LLC headers |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
*/ |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#ifndef NET_DEVICE_H |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
#define NET_DEVICE_H |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
|
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include <string> |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include <stdint.h> |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include "ns3/callback.h" |
710
2a9c061219a7
port code from Interface to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
27 |
#include "ns3/object.h" |
582
b10ef84683a5
NetDevice and Channel now derive from Interface rather than Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
28 |
#include "ns3/ptr.h" |
1161
bb72baff8b26
replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
728
diff
changeset
|
29 |
#include "address.h" |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
30 |
#include "ipv4-address.h" |
3852 | 31 |
#include "ipv6-address.h" |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
|
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
namespace ns3 { |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
|
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
710
diff
changeset
|
35 |
class Node; |
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
36 |
class Channel; |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
37 |
class Packet; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
|
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
/** |
3183 | 40 |
* \ingroup node |
41 |
* \defgroup netdevice NetDevice |
|
42 |
*/ |
|
43 |
/** |
|
3222
f61c17b62fd1
bug 202: classes disappeared from doxygen output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3183
diff
changeset
|
44 |
* \ingroup netdevice |
3183 | 45 |
* |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
* \brief Network layer to device interface |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
* This interface defines the API which the IP and ARP |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
* layers need to access to manage an instance of a network device |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
* layer. It currently does not support MAC-level |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
* multicast but this should not be too hard to add by adding |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
* extra methods to register MAC multicast addresses to |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
* filter out unwanted packets before handing them to the |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
* higher layers. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
* In Linux, this interface is analogous to the interface |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
* just above dev_queue_xmit() (i.e., IP packet is fully |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
* constructed with destination MAC address already selected). |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
* If you want to write a new MAC layer, you need to subclass |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
345
diff
changeset
|
61 |
* this base class and implement your own version of the |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
62 |
* NetDevice::SendTo method. |
4420
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
63 |
* |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
64 |
* This class was designed to hide as many MAC-level details as |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
65 |
* possible from the perspective of layer 3 to allow a single layer 3 |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
66 |
* to work with any kind of MAC layer. Specifically, this class |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
67 |
* encapsulates the specific format of MAC addresses used by a |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
68 |
* device such that the layer 3 does not need any modification |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
69 |
* to handle new address formats. This means obviously that the |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
70 |
* NetDevice class must know about the address format of all potential |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
71 |
* layer 3 protocols through its GetMulticast methods: the current |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
72 |
* API has been optimized to make it easy to add new MAC protocols, |
7d85d92cf64f
explain rationale for current GetMulticast methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4322
diff
changeset
|
73 |
* not to add new layer 3 protocols. |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
74 |
*/ |
710
2a9c061219a7
port code from Interface to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
75 |
class NetDevice : public Object |
469
676b647fc960
derive from Object for proper refcounting
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
465
diff
changeset
|
76 |
{ |
676b647fc960
derive from Object for proper refcounting
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
465
diff
changeset
|
77 |
public: |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
78 |
static TypeId GetTypeId (void); |
487
04c5878c0a61
apply ref/unref rules consistently for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
469
diff
changeset
|
79 |
virtual ~NetDevice(); |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
247
diff
changeset
|
80 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
81 |
/** |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
82 |
* \param index ifIndex of the device |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
83 |
*/ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
84 |
virtual void SetIfIndex(const uint32_t index) = 0; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
85 |
/** |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
86 |
* \return index ifIndex of the device |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
87 |
*/ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
88 |
virtual uint32_t GetIfIndex(void) const = 0; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
89 |
|
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
247
diff
changeset
|
90 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
/** |
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
92 |
* \return the channel this NetDevice is connected to. The value |
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
93 |
* returned can be zero if the NetDevice is not yet connected |
4489
b322b179c5f6
bug 550: NetDevice::GetChannel method need clarification
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4420
diff
changeset
|
94 |
* to any channel or if the underlying NetDevice has no |
b322b179c5f6
bug 550: NetDevice::GetChannel method need clarification
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4420
diff
changeset
|
95 |
* concept of a channel. i.e., callers _must_ check for zero |
b322b179c5f6
bug 550: NetDevice::GetChannel method need clarification
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4420
diff
changeset
|
96 |
* and be ready to handle it. |
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
97 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
98 |
virtual Ptr<Channel> GetChannel (void) const = 0; |
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
99 |
|
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
100 |
/** |
4578
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4489
diff
changeset
|
101 |
* Set the address of this interface |
5227
ecb08c1fc273
Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4764
diff
changeset
|
102 |
* \param address address to set |
4578
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4489
diff
changeset
|
103 |
*/ |
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4489
diff
changeset
|
104 |
virtual void SetAddress (Address address) = 0; |
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4489
diff
changeset
|
105 |
|
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4489
diff
changeset
|
106 |
/** |
1161
bb72baff8b26
replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
728
diff
changeset
|
107 |
* \return the current Address of this interface. |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
109 |
virtual Address GetAddress (void) const = 0; |
4578
88434ff8f0a5
Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4489
diff
changeset
|
110 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
112 |
* \param mtu MTU value, in bytes, to set for the device |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
* \return whether the MTU value was within legal bounds |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
115 |
* Override for default MTU defined on a per-type basis. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
117 |
virtual bool SetMtu (const uint16_t mtu) = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
118 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
119 |
* \return the link-level MTU in bytes for this interface. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
120 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
121 |
* This value is typically used by the IP layer to perform |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
122 |
* IP fragmentation when needed. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
123 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
124 |
virtual uint16_t GetMtu (void) const = 0; |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
125 |
/** |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
* \return true if link is up; false otherwise |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
128 |
virtual bool IsLinkUp (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
129 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
* \param callback the callback to invoke |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
* |
4764
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
132 |
* Add a callback invoked whenever the link |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
* status changes to UP. This callback is typically used |
4764
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
134 |
* by the IP/ARP layer to flush the ARP cache and by IPv6 stack |
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
135 |
* to flush NDISC cache whenever the link goes up. |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
136 |
*/ |
4764
e90e1ef585b0
[Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
4578
diff
changeset
|
137 |
virtual void AddLinkChangeCallback (Callback<void> callback) = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
* \return true if this interface supports a broadcast address, |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
140 |
* false otherwise. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
141 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
142 |
virtual bool IsBroadcast (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
143 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
144 |
* \return the broadcast address supported by |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
145 |
* this netdevice. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
146 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
147 |
* Calling this method is invalid if IsBroadcast returns |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
148 |
* not true. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
150 |
virtual Address GetBroadcast (void) const = 0; |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
151 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
152 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
153 |
* \return value of m_isMulticast flag |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
154 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
155 |
virtual bool IsMulticast (void) const = 0; |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
156 |
|
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
157 |
/** |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
158 |
* \brief Make and return a MAC multicast address using the provided |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
159 |
* multicast group |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
160 |
* |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
161 |
* RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
162 |
* multicast address by placing the low-order 23-bits of the IP address into |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
163 |
* the low-order 23 bits of the Ethernet multicast address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
164 |
* 01-00-5E-00-00-00 (hex). Similar RFCs exist for Ipv6 and Eui64 mappings. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
165 |
* This method performs the multicast address creation function appropriate |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
166 |
* to the underlying MAC address of the device. This MAC address is |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
167 |
* encapsulated in an abstract Address to avoid dependencies on the exact |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
168 |
* MAC address format. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
169 |
* |
3841
1e7abf5fca79
Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents:
3827
diff
changeset
|
170 |
* A default imlementation of GetMulticast is provided, but this |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
171 |
* method simply NS_ASSERTS. In the case of net devices that do not support |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
172 |
* multicast, clients are expected to test NetDevice::IsMulticast and avoid |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
173 |
* attempting to map multicast packets. Subclasses of NetDevice that do |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
174 |
* support multicasting are expected to override this method and provide an |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
175 |
* implementation appropriate to the particular device. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
176 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
177 |
* \param multicastGroup The IP address for the multicast group destination |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
178 |
* of the packet. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
179 |
* \return The MAC multicast Address used to send packets to the provided |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
180 |
* multicast group. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
181 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
182 |
* \warning Calling this method is invalid if IsMulticast returns not true. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
183 |
* \see Ipv4Address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
184 |
* \see Address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
185 |
* \see NetDevice::IsMulticast |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
186 |
*/ |
3841
1e7abf5fca79
Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents:
3827
diff
changeset
|
187 |
virtual Address GetMulticast (Ipv4Address multicastGroup) const = 0; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
188 |
|
3852 | 189 |
/** |
190 |
* \brief Get the MAC multicast address corresponding |
|
191 |
* to the IPv6 address provided. |
|
192 |
* \param addr IPv6 address |
|
193 |
* \return the MAC multicast address |
|
194 |
* \warning Calling this method is invalid if IsMulticast returns not true. |
|
195 |
*/ |
|
196 |
virtual Address GetMulticast (Ipv6Address addr) const = 0; |
|
197 |
||
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
198 |
/** |
3936
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
199 |
* \brief Return true if the net device is acting as a bridge. |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
200 |
* |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
201 |
* \return value of m_isBridge flag |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
202 |
*/ |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
203 |
virtual bool IsBridge (void) const = 0; |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
204 |
|
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
205 |
/** |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
206 |
* \brief Return true if the net device is on a point-to-point link. |
e525995ce5dc
implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents:
3852
diff
changeset
|
207 |
* |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
208 |
* \return value of m_isPointToPoint flag |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
209 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
210 |
virtual bool IsPointToPoint (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
/** |
2191 | 212 |
* \param packet packet sent from above down to Network Device |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
213 |
* \param dest mac address of the destination (already resolved) |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
214 |
* \param protocolNumber identifies the type of payload contained in |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
215 |
* this packet. Used to call the right L3Protocol when the packet |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
216 |
* is received. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
217 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
218 |
* Called from higher layer to send packet into Network Device |
1161
bb72baff8b26
replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
728
diff
changeset
|
219 |
* to the specified destination Address |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
220 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
221 |
* \return whether the Send operation succeeded |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
222 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
223 |
virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) = 0; |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
224 |
/** |
3442
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
225 |
* \param packet packet sent from above down to Network Device |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
226 |
* \param source source mac address (so called "MAC spoofing") |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
227 |
* \param dest mac address of the destination (already resolved) |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
228 |
* \param protocolNumber identifies the type of payload contained in |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
229 |
* this packet. Used to call the right L3Protocol when the packet |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
230 |
* is received. |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
231 |
* |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
232 |
* Called from higher layer to send packet into Network Device |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
233 |
* with the specified source and destination Addresses. |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
234 |
* |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
235 |
* \return whether the Send operation succeeded |
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
236 |
*/ |
3480
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3464
diff
changeset
|
237 |
virtual bool SendFrom(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) = 0; |
3442
8eef02250bc9
Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3437
diff
changeset
|
238 |
/** |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
239 |
* \returns the node base class which contains this network |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
240 |
* interface. |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
241 |
* |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
242 |
* When a subclass needs to get access to the underlying node |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
243 |
* base class to print the nodeid for example, it can invoke |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
244 |
* this method. |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
245 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
246 |
virtual Ptr<Node> GetNode (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
247 |
|
3310
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
248 |
/** |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
249 |
* \param node the node associated to this netdevice. |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
250 |
* |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
251 |
* This method is called from ns3::Node::AddDevice. |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
252 |
*/ |
2600
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
253 |
virtual void SetNode (Ptr<Node> node) = 0; |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
254 |
|
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
255 |
/** |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
256 |
* \returns true if ARP is needed, false otherwise. |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
257 |
* |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
258 |
* Called by higher-layers to check if this NetDevice requires |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
259 |
* ARP to be used. |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
260 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
261 |
virtual bool NeedsArp (void) const = 0; |
445
10cd9049a0ad
add NetDevice::NeedsArp method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
262 |
|
3448
0bd851bb1225
Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3446
diff
changeset
|
263 |
|
3827
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
264 |
/** |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
265 |
* Packet types are used as they are in Linux. GCC name resolution on |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
266 |
* typedef enum {} PacketType is broken for the foreseeable future, so |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
267 |
* if you need to use ns-3 PacketType in a driver that also uses the |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
268 |
* Linux packet types you're hosed unless we define a shadow type, |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
269 |
* which we do here. |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
270 |
*/ |
3448
0bd851bb1225
Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3446
diff
changeset
|
271 |
enum PacketType |
0bd851bb1225
Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3446
diff
changeset
|
272 |
{ |
3827
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
273 |
PACKET_HOST = 1, /**< Packet addressed oo us */ |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
274 |
NS3_PACKET_HOST = PACKET_HOST, |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
275 |
PACKET_BROADCAST, /**< Packet addressed to all */ |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
276 |
NS3_PACKET_BROADCAST = PACKET_BROADCAST, |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
277 |
PACKET_MULTICAST, /**< Packet addressed to multicast group */ |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
278 |
NS3_PACKET_MULTICAST = PACKET_MULTICAST, |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
279 |
PACKET_OTHERHOST, /**< Packet addressed to someone else */ |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
280 |
NS3_PACKET_OTHERHOST = PACKET_OTHERHOST, |
3448
0bd851bb1225
Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3446
diff
changeset
|
281 |
}; |
0bd851bb1225
Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3446
diff
changeset
|
282 |
|
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
283 |
/** |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
284 |
* \param device a pointer to the net device which is calling this callback |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
285 |
* \param packet the packet received |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
286 |
* \param protocol the 16 bit protocol number associated with this packet. |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
287 |
* This protocol number is expected to be the same protocol number |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
288 |
* given to the Send method by the user on the sender side. |
3448
0bd851bb1225
Simplify promiscuous mode API: NetDevices always operate in promiscuous mode, normal receive callbacks receive extra destination address and packet type.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3446
diff
changeset
|
289 |
* \param sender the address of the sender |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
290 |
* \returns true if the callback could handle the packet successfully, false |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
291 |
* otherwise. |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
292 |
*/ |
3548
e5ab96db540e
bug 273: constify packet pointers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
293 |
typedef Callback<bool,Ptr<NetDevice>,Ptr<const Packet>,uint16_t,const Address &> ReceiveCallback; |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
294 |
|
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
295 |
/** |
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
296 |
* \param cb callback to invoke whenever a packet has been received and must |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
297 |
* be forwarded to the higher layers. |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
298 |
* |
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
299 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
300 |
virtual void SetReceiveCallback (ReceiveCallback cb) = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
301 |
|
3460
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
302 |
|
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
303 |
/** |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
304 |
* \param device a pointer to the net device which is calling this callback |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
305 |
* \param packet the packet received |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
306 |
* \param protocol the 16 bit protocol number associated with this packet. |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
307 |
* This protocol number is expected to be the same protocol number |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
308 |
* given to the Send method by the user on the sender side. |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
309 |
* \param sender the address of the sender |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
310 |
* \param receiver the address of the receiver |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
311 |
* \param packetType type of packet received (broadcast/multicast/unicast/otherhost) |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
312 |
* \returns true if the callback could handle the packet successfully, false |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
313 |
* otherwise. |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
314 |
*/ |
3548
e5ab96db540e
bug 273: constify packet pointers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
315 |
typedef Callback< bool, Ptr<NetDevice>, Ptr<const Packet>, uint16_t, |
3550
42988e5cce5e
repeat enum keyword.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3548
diff
changeset
|
316 |
const Address &, const Address &, enum PacketType > PromiscReceiveCallback; |
3460
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
317 |
|
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
318 |
/** |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
319 |
* \param cb callback to invoke whenever a packet has been received in promiscuous mode and must |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
320 |
* be forwarded to the higher layers. |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
321 |
* |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
322 |
* Enables netdevice promiscuous mode and sets the callback that |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
323 |
* will handle promiscuous mode packets. Note, promiscuous mode |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
324 |
* packets means _all_ packets, including those packets that can be |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
325 |
* sensed by the netdevice but which are intended to be received by |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
326 |
* other hosts. |
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
327 |
*/ |
3480
a920df6b9f02
Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3464
diff
changeset
|
328 |
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb) = 0; |
3460
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
329 |
|
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
330 |
/** |
3698 | 331 |
* \return true if this interface supports a bridging mode, false otherwise. |
3460
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
332 |
*/ |
3584
4eb48239b4dc
bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3550
diff
changeset
|
333 |
virtual bool SupportsSendFrom (void) const = 0; |
3460
99698bc858e8
New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3448
diff
changeset
|
334 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
335 |
}; |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
336 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
337 |
} // namespace ns3 |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
338 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
339 |
#endif /* NET_DEVICE_H */ |