ns-3 Direct Code Execution
Home
Tutorials ▼
Docs ▼
Wiki
Manual
Develop ▼
API
Bugs
API
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
ipv4-linux.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2012 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: Frédéric Urbani
19
*/
20
21
#ifndef IPV4_LINUX_H
22
#define IPV4_LINUX_H
23
24
#include "ns3/ipv4.h"
25
#include "ns3/ipv4-routing-protocol.h"
26
27
namespace
ns3 {
28
class
Ipv4Interface;
29
39
class
Ipv4Linux
:
public
Ipv4
40
{
41
public
:
42
static
TypeId
GetTypeId
(
void
);
43
Ipv4Linux
();
44
virtual
~Ipv4Linux
();
45
55
virtual
void
SetRoutingProtocol
(Ptr<Ipv4RoutingProtocol> routingProtocol);
56
62
virtual
Ptr<Ipv4RoutingProtocol>
GetRoutingProtocol
(
void
)
const
;
63
73
virtual
uint32_t
AddInterface
(Ptr<NetDevice> device);
74
78
virtual
uint32_t
GetNInterfaces
(
void
)
const
;
79
95
virtual
int32_t
GetInterfaceForAddress
(Ipv4Address address)
const
;
96
100
virtual
void
Send
(Ptr<Packet> packet, Ipv4Address source,
101
Ipv4Address destination, uint8_t protocol, Ptr<Ipv4Route> route);
102
106
virtual
void
SendWithHeader
(Ptr<Packet> packet, Ipv4Header ipHeader, Ptr<Ipv4Route> route);
107
111
virtual
void
Insert
(Ptr<IpL4Protocol> protocol);
112
132
virtual
bool
IsDestinationAddress
(Ipv4Address address, uint32_t iif)
const
;
133
150
virtual
int32_t
GetInterfaceForPrefix
(Ipv4Address address,
151
Ipv4Mask mask)
const
;
152
157
virtual
Ptr<NetDevice>
GetNetDevice
(uint32_t interface);
158
163
virtual
int32_t
GetInterfaceForDevice
(Ptr<const NetDevice> device)
const
;
164
170
virtual
bool
AddAddress
(uint32_t interface, Ipv4InterfaceAddress address);
171
176
virtual
uint32_t
GetNAddresses
(uint32_t interface)
const
;
177
186
virtual
Ipv4InterfaceAddress
GetAddress
(uint32_t interface, uint32_t addressIndex)
const
;
187
198
virtual
bool
RemoveAddress
(uint32_t interface, uint32_t addressIndex);
199
207
virtual
bool
RemoveAddress
(uint32_t interface, Ipv4Address address);
208
244
virtual
Ipv4Address
SelectSourceAddress
(Ptr<const NetDevice> device,
245
Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope);
246
252
virtual
void
SetMetric
(uint32_t interface, uint16_t metric);
253
259
virtual
uint16_t
GetMetric
(uint32_t interface)
const
;
260
266
virtual
uint16_t
GetMtu
(uint32_t interface)
const
;
267
273
virtual
bool
IsUp
(uint32_t interface)
const
;
274
281
virtual
void
SetUp
(uint32_t interface);
282
289
virtual
void
SetDown
(uint32_t interface);
290
295
virtual
bool
IsForwarding
(uint32_t interface)
const
;
296
303
virtual
void
SetForwarding
(uint32_t interface,
bool
val);
304
308
virtual
Ptr<IpL4Protocol>
GetProtocol
(
int
protocolNumber)
const
;
309
313
virtual
Ptr<Socket>
CreateRawSocket
(
void
);
314
318
virtual
void
DeleteRawSocket
(Ptr<Socket> socket);
319
320
static
void
InstallNode
(Ptr<Node> node);
321
void
PopulateRoutingTable
();
322
323
private
:
324
// Indirect the Ipv4 attributes through private pure virtual methods
325
virtual
void
SetIpForward
(
bool
forward);
326
virtual
bool
GetIpForward
(
void
)
const
;
327
virtual
void
SetWeakEsModel
(
bool
model);
328
virtual
bool
GetWeakEsModel
(
void
)
const
;
329
uint32_t
AddIpv4Interface
(Ptr<Ipv4Interface> interface);
330
Ptr<Ipv4Interface>
GetInterface
(uint32_t i)
const
;
331
332
typedef
std::vector<Ptr<Ipv4Interface> >
Ipv4InterfaceList
;
333
Ptr<Ipv4RoutingProtocol>
m_routingProtocol
;
334
bool
m_ipForward
;
335
bool
m_weakEsModel
;
336
Ipv4InterfaceList
m_interfaces
;
337
uint64_t
m_nanoSec
;
338
};
339
}
340
#endif // IPV4_LINUX_H
model
linux
ipv4-linux.h
Generated on Fri Aug 30 2013 13:57:55 for ns-3-dce by
1.8.1.2