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
simple-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 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
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#ifndef SIMPLE_NET_DEVICE_H
21
#define SIMPLE_NET_DEVICE_H
22
23
#include "ns3/net-device.h"
24
#include "
mac48-address.h
"
25
#include <stdint.h>
26
#include <string>
27
#include "ns3/traced-callback.h"
28
29
namespace
ns3 {
30
31
class
SimpleChannel;
32
class
Node;
33
class
ErrorModel;
34
45
class
SimpleNetDevice
:
public
NetDevice
46
{
47
public
:
48
static
TypeId
GetTypeId
(
void
);
49
SimpleNetDevice
();
50
51
void
Receive
(
Ptr<Packet>
packet, uint16_t protocol,
Mac48Address
to,
Mac48Address
from);
52
void
SetChannel
(
Ptr<SimpleChannel>
channel);
53
63
void
SetReceiveErrorModel
(
Ptr<ErrorModel>
em);
64
65
// inherited from NetDevice base class.
66
virtual
void
SetIfIndex
(
const
uint32_t index);
67
virtual
uint32_t
GetIfIndex
(
void
)
const
;
68
virtual
Ptr<Channel>
GetChannel
(
void
)
const
;
69
virtual
void
SetAddress
(
Address
address);
70
virtual
Address
GetAddress
(
void
)
const
;
71
virtual
bool
SetMtu
(
const
uint16_t mtu);
72
virtual
uint16_t
GetMtu
(
void
)
const
;
73
virtual
bool
IsLinkUp
(
void
)
const
;
74
virtual
void
AddLinkChangeCallback
(
Callback<void>
callback);
75
virtual
bool
IsBroadcast
(
void
)
const
;
76
virtual
Address
GetBroadcast
(
void
)
const
;
77
virtual
bool
IsMulticast
(
void
)
const
;
78
virtual
Address
GetMulticast
(
Ipv4Address
multicastGroup)
const
;
79
virtual
bool
IsPointToPoint
(
void
)
const
;
80
virtual
bool
IsBridge
(
void
)
const
;
81
virtual
bool
Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber);
82
virtual
bool
SendFrom
(
Ptr<Packet>
packet,
const
Address
& source,
const
Address
& dest, uint16_t protocolNumber);
83
virtual
Ptr<Node>
GetNode
(
void
)
const
;
84
virtual
void
SetNode
(
Ptr<Node>
node);
85
virtual
bool
NeedsArp
(
void
)
const
;
86
virtual
void
SetReceiveCallback
(
NetDevice::ReceiveCallback
cb);
87
88
virtual
Address
GetMulticast
(
Ipv6Address
addr)
const
;
89
90
virtual
void
SetPromiscReceiveCallback
(
PromiscReceiveCallback
cb);
91
virtual
bool
SupportsSendFrom
(
void
)
const
;
92
93
protected
:
94
virtual
void
DoDispose
(
void
);
95
private
:
96
Ptr<SimpleChannel>
m_channel
;
97
NetDevice::ReceiveCallback
m_rxCallback
;
98
NetDevice::PromiscReceiveCallback
m_promiscCallback
;
99
Ptr<Node>
m_node
;
100
uint16_t
m_mtu
;
101
uint32_t
m_ifIndex
;
102
Mac48Address
m_address
;
103
Ptr<ErrorModel>
m_receiveErrorModel
;
112
TracedCallback<Ptr<const Packet>
>
m_phyRxDropTrace
;
113
};
114
115
}
// namespace ns3
116
117
#endif
/* SIMPLE_NET_DEVICE_H */
src
network
utils
simple-net-device.h
Generated on Fri Dec 21 2012 19:00:44 for ns-3 by
1.8.1.2