A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
node.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2006 Georgia Tech Research Corporation, INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Authors: George F. Riley<riley@ece.gatech.edu>
19
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
*/
21
#ifndef NODE_H
22
#define NODE_H
23
24
#include <vector>
25
26
#include "ns3/object.h"
27
#include "ns3/callback.h"
28
#include "ns3/ptr.h"
29
#include "ns3/net-device.h"
30
31
namespace
ns3 {
32
33
class
Application;
34
class
Packet;
35
class
Address;
36
37
55
class
Node
:
public
Object
56
{
57
public
:
58
static
TypeId
GetTypeId
(
void
);
59
60
Node
();
64
Node
(uint32_t systemId);
65
66
virtual
~Node
();
67
74
uint32_t
GetId
(
void
)
const
;
75
80
uint32_t
GetSystemId
(
void
)
const
;
81
89
uint32_t
AddDevice
(
Ptr<NetDevice>
device);
97
Ptr<NetDevice>
GetDevice
(uint32_t index)
const
;
102
uint32_t
GetNDevices
(
void
)
const
;
103
111
uint32_t
AddApplication
(
Ptr<Application>
application);
117
Ptr<Application>
GetApplication
(uint32_t index)
const
;
118
122
uint32_t
GetNApplications
(
void
)
const
;
123
143
typedef
Callback<void,Ptr<NetDevice>
,
Ptr<const Packet>
,uint16_t,
const
Address
&,
144
const
Address
&,
NetDevice::PacketType
>
ProtocolHandler
;
158
void
RegisterProtocolHandler
(
ProtocolHandler
handler,
159
uint16_t protocolType,
160
Ptr<NetDevice>
device,
161
bool
promiscuous=
false
);
168
void
UnregisterProtocolHandler
(
ProtocolHandler
handler);
169
173
typedef
Callback<void,Ptr<NetDevice>
>
DeviceAdditionListener
;
181
void
RegisterDeviceAdditionListener
(
DeviceAdditionListener
listener);
188
void
UnregisterDeviceAdditionListener
(
DeviceAdditionListener
listener);
189
190
191
195
static
bool
ChecksumEnabled
(
void
);
196
197
198
protected
:
204
virtual
void
DoDispose
(
void
);
205
virtual
void
DoStart
(
void
);
206
private
:
207
void
NotifyDeviceAdded
(
Ptr<NetDevice>
device);
208
bool
NonPromiscReceiveFromDevice
(
Ptr<NetDevice>
device,
Ptr<const Packet>
, uint16_t protocol,
const
Address
&from);
209
bool
PromiscReceiveFromDevice
(
Ptr<NetDevice>
device,
Ptr<const Packet>
, uint16_t protocol,
210
const
Address
&from,
const
Address
&to,
NetDevice::PacketType
packetType);
211
bool
ReceiveFromDevice
(
Ptr<NetDevice>
device,
Ptr<const Packet>
, uint16_t protocol,
212
const
Address
&from,
const
Address
&to,
NetDevice::PacketType
packetType,
bool
promisc);
213
214
void
Construct
(
void
);
215
216
struct
ProtocolHandlerEntry
{
217
ProtocolHandler
handler
;
218
Ptr<NetDevice>
device
;
219
uint16_t
protocol
;
220
bool
promiscuous
;
221
};
222
typedef
std::vector<struct Node::ProtocolHandlerEntry>
ProtocolHandlerList
;
223
typedef
std::vector<DeviceAdditionListener>
DeviceAdditionListenerList
;
224
225
uint32_t
m_id
;
// Node id for this node
226
uint32_t
m_sid
;
// System id for this node
227
std::vector<Ptr<NetDevice> >
m_devices
;
228
std::vector<Ptr<Application> >
m_applications
;
229
ProtocolHandlerList
m_handlers
;
230
DeviceAdditionListenerList
m_deviceAdditionListeners
;
231
};
232
233
}
// namespace ns3
234
235
#endif
/* NODE_H */
src
network
model
node.h
Generated on Tue Nov 13 2012 10:32:20 for ns-3 by
1.8.1.2