author | Craig Dowell <craigdo@ee.washington.edu> |
Wed, 05 Nov 2008 14:33:20 -0800 | |
changeset 3841 | 1e7abf5fca79 |
parent 3827 | 4b603cd4ee42 |
child 3852 | 9cf7ad0cac85 |
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" |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
|
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
namespace ns3 { |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
710
diff
changeset
|
34 |
class Node; |
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
35 |
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
|
36 |
class Packet; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
|
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
/** |
3183 | 39 |
* \ingroup node |
40 |
* \defgroup netdevice NetDevice |
|
41 |
*/ |
|
42 |
/** |
|
3222
f61c17b62fd1
bug 202: classes disappeared from doxygen output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3183
diff
changeset
|
43 |
* \ingroup netdevice |
3183 | 44 |
* |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
* \brief Network layer to device interface |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
* 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
|
48 |
* 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
|
49 |
* layer. It currently does not support MAC-level |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
* 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
|
51 |
* extra methods to register MAC multicast addresses to |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
* filter out unwanted packets before handing them to the |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
* higher layers. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
* In Linux, this interface is analogous to the interface |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
* 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
|
57 |
* constructed with destination MAC address already selected). |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
* 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
|
60 |
* 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
|
61 |
* NetDevice::SendTo method. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
62 |
*/ |
710
2a9c061219a7
port code from Interface to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
63 |
class NetDevice : public Object |
469
676b647fc960
derive from Object for proper refcounting
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
465
diff
changeset
|
64 |
{ |
676b647fc960
derive from Object for proper refcounting
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
465
diff
changeset
|
65 |
public: |
2251
04963d8cca51
iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2250
diff
changeset
|
66 |
static TypeId GetTypeId (void); |
487
04c5878c0a61
apply ref/unref rules consistently for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
469
diff
changeset
|
67 |
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
|
68 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
69 |
/** |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
70 |
* \param name name of the device (e.g. "eth0") |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
71 |
*/ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
72 |
virtual void SetName(const std::string name) = 0; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
73 |
/** |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
74 |
* \return name name of the device (e.g. "eth0") |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
75 |
*/ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
76 |
virtual std::string GetName(void) const = 0; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
77 |
/** |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
78 |
* \param index ifIndex of the device |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
79 |
*/ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
80 |
virtual void SetIfIndex(const uint32_t index) = 0; |
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 |
* \return 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 uint32_t GetIfIndex(void) const = 0; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
85 |
|
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
|
86 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
/** |
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
88 |
* \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
|
89 |
* returned can be zero if the NetDevice is not yet connected |
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
90 |
* to any channel. |
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
91 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
92 |
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
|
93 |
|
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
401
diff
changeset
|
94 |
/** |
1161
bb72baff8b26
replace MacAddress by Address
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
728
diff
changeset
|
95 |
* \return the current Address of this interface. |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
97 |
virtual Address GetAddress (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
* \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
|
100 |
* \return whether the MTU value was within legal bounds |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
* 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
|
103 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
104 |
virtual bool SetMtu (const uint16_t mtu) = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
* \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
|
107 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
* 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
|
109 |
* IP fragmentation when needed. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
110 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
111 |
virtual uint16_t GetMtu (void) const = 0; |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
112 |
/** |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
* \return true if link is up; false otherwise |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
115 |
virtual bool IsLinkUp (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
117 |
* \param callback the callback to invoke |
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 |
* Register a callback invoked whenever the link |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
120 |
* status changes to UP. This callback is typically used |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
121 |
* by the IP/ARP layer to flush the ARP cache |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
122 |
* whenever the link goes up. |
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 void SetLinkChangeCallback (Callback<void> callback) = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
125 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
* \return true if this interface supports a broadcast address, |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
* false otherwise. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
129 |
virtual bool IsBroadcast (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
* \return the broadcast address supported by |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
132 |
* this netdevice. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
* Calling this method is invalid if IsBroadcast returns |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
135 |
* not true. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
136 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
137 |
virtual Address GetBroadcast (void) const = 0; |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
138 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
140 |
* \return value of m_isMulticast flag |
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 IsMulticast (void) const = 0; |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
143 |
|
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
144 |
/** |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
145 |
* \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
|
146 |
* multicast group |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
147 |
* |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
148 |
* 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
|
149 |
* 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
|
150 |
* 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
|
151 |
* 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
|
152 |
* This method performs the multicast address creation function appropriate |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
153 |
* 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
|
154 |
* 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
|
155 |
* MAC address format. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
156 |
* |
3841
1e7abf5fca79
Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents:
3827
diff
changeset
|
157 |
* 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
|
158 |
* 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
|
159 |
* 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
|
160 |
* 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
|
161 |
* 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
|
162 |
* implementation appropriate to the particular device. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
163 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
164 |
* \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
|
165 |
* of the packet. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
166 |
* \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
|
167 |
* multicast group. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
168 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
169 |
* \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
|
170 |
* \see Ipv4Address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
171 |
* \see Address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
172 |
* \see NetDevice::IsMulticast |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1292
diff
changeset
|
173 |
*/ |
3841
1e7abf5fca79
Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents:
3827
diff
changeset
|
174 |
virtual Address GetMulticast (Ipv4Address multicastGroup) const = 0; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
175 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
176 |
/** |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
177 |
* \return value of m_isPointToPoint flag |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
178 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
179 |
virtual bool IsPointToPoint (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
180 |
/** |
2191 | 181 |
* \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
|
182 |
* \param dest mac address of the destination (already resolved) |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
183 |
* \param protocolNumber identifies the type of payload contained in |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
184 |
* 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
|
185 |
* is received. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
186 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
187 |
* 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
|
188 |
* to the specified destination Address |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
189 |
* |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
190 |
* \return whether the Send operation succeeded |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
191 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
192 |
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
|
193 |
/** |
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
|
194 |
* \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
|
195 |
* \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
|
196 |
* \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
|
197 |
* \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
|
198 |
* 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
|
199 |
* 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
|
200 |
* |
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
|
201 |
* 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
|
202 |
* 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
|
203 |
* |
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
|
204 |
* \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
|
205 |
*/ |
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
|
206 |
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
|
207 |
/** |
535
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
208 |
* \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
|
209 |
* interface. |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
210 |
* |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
211 |
* 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
|
212 |
* 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
|
213 |
* this method. |
fb6735f93868
Enable both ascii and pcap tracing
Tom Henderson <tomh@tomh.org>
parents:
517
diff
changeset
|
214 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
215 |
virtual Ptr<Node> GetNode (void) const = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
216 |
|
3310
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
217 |
/** |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
218 |
* \param node the node associated to this netdevice. |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
219 |
* |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
220 |
* This method is called from ns3::Node::AddDevice. |
c16ec3c11045
dox missing SetNode method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3222
diff
changeset
|
221 |
*/ |
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
|
222 |
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
|
223 |
|
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
224 |
/** |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
225 |
* \returns true if ARP is needed, false otherwise. |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
226 |
* |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
227 |
* 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
|
228 |
* ARP to be used. |
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
229 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
230 |
virtual bool NeedsArp (void) const = 0; |
445
10cd9049a0ad
add NetDevice::NeedsArp method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
231 |
|
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
|
232 |
|
3827
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
233 |
/** |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
234 |
* 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
|
235 |
* 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
|
236 |
* 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
|
237 |
* 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
|
238 |
* which we do here. |
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
239 |
*/ |
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
|
240 |
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
|
241 |
{ |
3827
4b603cd4ee42
give up on merging tap and emulated, break apart
Craig Dowell <craigdo@ee.washington.edu>
parents:
3698
diff
changeset
|
242 |
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
|
243 |
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
|
244 |
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
|
245 |
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
|
246 |
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
|
247 |
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
|
248 |
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
|
249 |
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
|
250 |
}; |
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
|
251 |
|
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
252 |
/** |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
253 |
* \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
|
254 |
* \param packet the packet received |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
255 |
* \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
|
256 |
* 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
|
257 |
* 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
|
258 |
* \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
|
259 |
* \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
|
260 |
* otherwise. |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
261 |
*/ |
3548
e5ab96db540e
bug 273: constify packet pointers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
262 |
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
|
263 |
|
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
264 |
/** |
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
265 |
* \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
|
266 |
* be forwarded to the higher layers. |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
267 |
* |
597
4c8f1400f629
complete dox doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
592
diff
changeset
|
268 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
269 |
virtual void SetReceiveCallback (ReceiveCallback cb) = 0; |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
270 |
|
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
|
271 |
|
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
|
272 |
/** |
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
|
273 |
* \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
|
274 |
* \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
|
275 |
* \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
|
276 |
* 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
|
277 |
* 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
|
278 |
* \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
|
279 |
* \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
|
280 |
* \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
|
281 |
* \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
|
282 |
* 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
|
283 |
*/ |
3548
e5ab96db540e
bug 273: constify packet pointers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3480
diff
changeset
|
284 |
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
|
285 |
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
|
286 |
|
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
|
287 |
/** |
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
|
288 |
* \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
|
289 |
* 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
|
290 |
* |
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
|
291 |
* 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
|
292 |
* 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
|
293 |
* 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
|
294 |
* 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
|
295 |
* 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
|
296 |
*/ |
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
|
297 |
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
|
298 |
|
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
|
299 |
/** |
3698 | 300 |
* \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
|
301 |
*/ |
3584
4eb48239b4dc
bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3550
diff
changeset
|
302 |
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
|
303 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
304 |
}; |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
305 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
306 |
} // namespace ns3 |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
307 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2251
diff
changeset
|
308 |
#endif /* NET_DEVICE_H */ |