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
loopback-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 LOOPBACK_NET_DEVICE_H
21
#define LOOPBACK_NET_DEVICE_H
22
23
#include "ns3/net-device.h"
24
#include "ns3/mac48-address.h"
25
#include <stdint.h>
26
#include <string>
27
28
namespace
ns3 {
29
30
class
Node;
31
38
class
LoopbackNetDevice
:
public
NetDevice
39
{
40
public
:
41
static
TypeId
GetTypeId
(
void
);
42
LoopbackNetDevice
();
43
44
// inherited from NetDevice base class.
45
virtual
void
SetIfIndex
(
const
uint32_t index);
46
virtual
uint32_t
GetIfIndex
(
void
)
const
;
47
virtual
Ptr<Channel>
GetChannel
(
void
)
const
;
48
virtual
void
SetAddress
(
Address
address);
49
virtual
Address
GetAddress
(
void
)
const
;
50
virtual
bool
SetMtu
(
const
uint16_t mtu);
51
virtual
uint16_t
GetMtu
(
void
)
const
;
52
virtual
bool
IsLinkUp
(
void
)
const
;
53
virtual
void
AddLinkChangeCallback
(
Callback<void>
callback);
54
virtual
bool
IsBroadcast
(
void
)
const
;
55
virtual
Address
GetBroadcast
(
void
)
const
;
56
virtual
bool
IsMulticast
(
void
)
const
;
57
virtual
Address
GetMulticast
(
Ipv4Address
multicastGroup)
const
;
58
virtual
bool
IsPointToPoint
(
void
)
const
;
59
virtual
bool
IsBridge
(
void
)
const
;
60
virtual
bool
Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber);
61
virtual
bool
SendFrom
(
Ptr<Packet>
packet,
const
Address
& source,
const
Address
& dest, uint16_t protocolNumber);
62
virtual
Ptr<Node>
GetNode
(
void
)
const
;
63
virtual
void
SetNode
(
Ptr<Node>
node);
64
virtual
bool
NeedsArp
(
void
)
const
;
65
virtual
void
SetReceiveCallback
(
NetDevice::ReceiveCallback
cb);
66
67
virtual
Address
GetMulticast
(
Ipv6Address
addr)
const
;
68
69
virtual
void
SetPromiscReceiveCallback
(
PromiscReceiveCallback
cb);
70
virtual
bool
SupportsSendFrom
(
void
)
const
;
71
72
protected
:
73
virtual
void
DoDispose
(
void
);
74
private
:
75
void
Receive
(
Ptr<Packet>
packet, uint16_t protocol,
Mac48Address
to,
Mac48Address
from);
76
NetDevice::ReceiveCallback
m_rxCallback
;
77
NetDevice::PromiscReceiveCallback
m_promiscCallback
;
78
Ptr<Node>
m_node
;
79
uint16_t
m_mtu
;
80
uint32_t
m_ifIndex
;
81
Mac48Address
m_address
;
82
};
83
84
}
// namespace ns3
85
86
#endif
/* LOOPBACK_NET_DEVICE_H */
src
internet
model
loopback-net-device.h
Generated on Tue May 14 2013 11:08:23 for ns-3 by
1.8.1.2