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
mesh-point-device.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008,2009 IITP RAS
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: Kirill Andreev <andreev@iitp.ru>
19
* Pavel Boyko <boyko@iitp.ru>
20
*/
21
22
#ifndef L2ROUTING_NET_DEVICE_H
23
#define L2ROUTING_NET_DEVICE_H
24
25
#include "ns3/net-device.h"
26
#include "ns3/mac48-address.h"
27
#include "ns3/bridge-channel.h"
28
#include "ns3/mesh-l2-routing-protocol.h"
29
30
namespace
ns3 {
31
32
class
Node;
49
class
MeshPointDevice
:
public
NetDevice
50
{
51
public
:
53
static
TypeId
GetTypeId
();
55
MeshPointDevice
();
57
virtual
~MeshPointDevice
();
58
60
//\{
66
void
AddInterface
(
Ptr<NetDevice>
port
);
70
uint32_t
GetNInterfaces
()
const
;
75
Ptr<NetDevice>
GetInterface
(uint32_t
id
)
const
;
79
std::vector<Ptr<NetDevice> >
GetInterfaces
()
const
;
80
//\}
81
83
//\{
85
void
SetRoutingProtocol
(
Ptr<MeshL2RoutingProtocol>
protocol);
87
Ptr<MeshL2RoutingProtocol>
GetRoutingProtocol
()
const
;
88
//\}
89
91
//\{
92
virtual
void
SetIfIndex
(
const
uint32_t index);
93
virtual
uint32_t
GetIfIndex
()
const
;
94
virtual
Ptr<Channel>
GetChannel
()
const
;
95
virtual
Address
GetAddress
()
const
;
96
virtual
void
SetAddress
(
Address
a);
97
virtual
bool
SetMtu
(
const
uint16_t mtu);
98
virtual
uint16_t
GetMtu
()
const
;
99
virtual
bool
IsLinkUp
()
const
;
100
virtual
void
AddLinkChangeCallback
(
Callback<void>
callback);
101
virtual
bool
IsBroadcast
()
const
;
102
virtual
Address
GetBroadcast
()
const
;
103
virtual
bool
IsMulticast
()
const
;
104
virtual
Address
GetMulticast
(
Ipv4Address
multicastGroup)
const
;
105
virtual
bool
IsPointToPoint
()
const
;
106
virtual
bool
IsBridge
()
const
;
107
virtual
bool
Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber);
108
virtual
bool
SendFrom
(
Ptr<Packet>
packet,
const
Address
& source,
const
Address
& dest, uint16_t protocolNumber);
109
virtual
Ptr<Node>
GetNode
()
const
;
110
virtual
void
SetNode
(
Ptr<Node>
node);
111
virtual
bool
NeedsArp
()
const
;
112
virtual
void
SetReceiveCallback
(
NetDevice::ReceiveCallback
cb);
113
virtual
void
SetPromiscReceiveCallback
(
NetDevice::PromiscReceiveCallback
cb);
114
virtual
bool
SupportsSendFrom
()
const
;
115
virtual
Address
GetMulticast
(
Ipv6Address
addr)
const
;
116
virtual
void
DoDispose
();
117
//\}
118
120
//\{
122
void
Report
(std::ostream & os)
const
;
124
void
ResetStats
();
125
//\}
126
127
private
:
129
void
ReceiveFromDevice
(
Ptr<NetDevice>
device,
Ptr<const Packet>
packet, uint16_t protocol,
130
Address
const
&source,
Address
const
&destination,
PacketType
packetType);
132
void
Forward
(
Ptr<NetDevice>
incomingPort,
Ptr<const Packet>
packet,
133
uint16_t protocol,
const
Mac48Address
src,
134
const
Mac48Address
dst);
145
void
146
DoSend
(
bool
success,
Ptr<Packet>
packet,
Mac48Address
src,
Mac48Address
dst, uint16_t protocol,
147
uint32_t iface);
148
149
private
:
151
NetDevice::ReceiveCallback
m_rxCallback
;
153
NetDevice::PromiscReceiveCallback
m_promiscRxCallback
;
155
Mac48Address
m_address
;
157
Ptr<Node>
m_node
;
159
std::vector< Ptr<NetDevice> >
m_ifaces
;
161
uint32_t
m_ifIndex
;
163
uint16_t
m_mtu
;
165
Ptr<BridgeChannel>
m_channel
;
167
Ptr<MeshL2RoutingProtocol>
m_routingProtocol
;
168
171
struct
Statistics
172
{
173
uint32_t
unicastData
;
174
uint32_t
unicastDataBytes
;
175
uint32_t
broadcastData
;
176
uint32_t
broadcastDataBytes
;
177
178
Statistics
();
179
};
181
Statistics
m_rxStats
,
m_txStats
,
m_fwdStats
;
183
};
184
}
// namespace ns3
185
#endif
src
mesh
model
mesh-point-device.h
Generated on Tue May 14 2013 11:08:29 for ns-3 by
1.8.1.2