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
virtual-net-device.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008,2009 INESC Porto
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
19
*/
20
21
#ifndef VIRTUAL_NET_DEVICE_H
22
#define VIRTUAL_NET_DEVICE_H
23
24
#include "ns3/address.h"
25
#include "ns3/node.h"
26
#include "ns3/net-device.h"
27
#include "ns3/callback.h"
28
#include "ns3/packet.h"
29
#include "ns3/ptr.h"
30
#include "ns3/traced-callback.h"
31
32
namespace
ns3 {
33
34
58
class
VirtualNetDevice
:
public
NetDevice
59
{
60
public
:
65
typedef
Callback<bool, Ptr<Packet>
,
const
Address
&,
const
Address
&, uint16_t>
SendCallback
;
66
67
static
TypeId
GetTypeId
(
void
);
68
VirtualNetDevice
();
69
70
virtual
~VirtualNetDevice
();
71
76
void
SetSendCallback
(
SendCallback
transmitCb);
77
85
void
SetNeedsArp
(
bool
needsArp);
86
93
void
SetIsPointToPoint
(
bool
isPointToPoint);
94
98
void
SetSupportsSendFrom
(
bool
supportsSendFrom);
99
105
bool
SetMtu
(
const
uint16_t mtu);
106
107
119
bool
Receive
(
Ptr<Packet>
packet, uint16_t protocol,
120
const
Address
&source,
const
Address
&destination,
121
PacketType
packetType);
122
123
124
// inherited from NetDevice base class.
125
virtual
void
SetIfIndex
(
const
uint32_t index);
126
virtual
uint32_t
GetIfIndex
(
void
)
const
;
127
virtual
Ptr<Channel>
GetChannel
(
void
)
const
;
128
virtual
void
SetAddress
(
Address
address);
129
virtual
Address
GetAddress
(
void
)
const
;
130
virtual
uint16_t
GetMtu
(
void
)
const
;
131
virtual
bool
IsLinkUp
(
void
)
const
;
132
virtual
void
AddLinkChangeCallback
(
Callback<void>
callback);
133
virtual
bool
IsBroadcast
(
void
)
const
;
134
virtual
Address
GetBroadcast
(
void
)
const
;
135
virtual
bool
IsMulticast
(
void
)
const
;
136
virtual
Address
GetMulticast
(
Ipv4Address
multicastGroup)
const
;
137
virtual
Address
GetMulticast
(
Ipv6Address
addr)
const
;
138
virtual
bool
IsPointToPoint
(
void
)
const
;
139
virtual
bool
Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber);
140
virtual
bool
SendFrom
(
Ptr<Packet>
packet,
const
Address
& source,
const
Address
& dest, uint16_t protocolNumber);
141
virtual
Ptr<Node>
GetNode
(
void
)
const
;
142
virtual
void
SetNode
(
Ptr<Node>
node);
143
virtual
bool
NeedsArp
(
void
)
const
;
144
virtual
void
SetReceiveCallback
(
NetDevice::ReceiveCallback
cb);
145
virtual
void
SetPromiscReceiveCallback
(
NetDevice::PromiscReceiveCallback
cb);
146
virtual
bool
SupportsSendFrom
()
const
;
147
virtual
bool
IsBridge
(
void
)
const
;
148
149
protected
:
150
151
virtual
void
DoDispose
(
void
);
152
153
private
:
154
155
Address
m_myAddress
;
156
SendCallback
m_sendCb
;
157
TracedCallback<Ptr<const Packet>
>
m_macRxTrace
;
158
TracedCallback<Ptr<const Packet>
>
m_macTxTrace
;
159
TracedCallback<Ptr<const Packet>
>
m_macPromiscRxTrace
;
160
TracedCallback<Ptr<const Packet>
>
m_snifferTrace
;
161
TracedCallback<Ptr<const Packet>
>
m_promiscSnifferTrace
;
162
Ptr<Node>
m_node
;
163
ReceiveCallback
m_rxCallback
;
164
PromiscReceiveCallback
m_promiscRxCallback
;
165
std::string
m_name
;
166
uint32_t
m_index
;
167
uint16_t
m_mtu
;
168
bool
m_needsArp
;
169
bool
m_supportsSendFrom
;
170
bool
m_isPointToPoint
;
171
};
172
173
}
// namespace ns3
174
175
#endif
176
src
virtual-net-device
model
virtual-net-device.h
Generated on Tue May 14 2013 11:08:34 for ns-3 by
1.8.1.2