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
ipv4.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 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 IPV4_H
21
#define IPV4_H
22
23
#include <stdint.h>
24
#include "ns3/object.h"
25
#include "ns3/socket.h"
26
#include "ns3/callback.h"
27
#include "ns3/ip-l4-protocol.h"
28
#include "ns3/ipv4-address.h"
29
#include "
ipv4-route.h
"
30
#include "
ipv4-interface-address.h
"
31
32
namespace
ns3 {
33
34
class
Node;
35
class
NetDevice;
36
class
Packet;
37
class
Ipv4RoutingProtocol;
38
75
class
Ipv4
:
public
Object
76
{
77
public
:
78
static
TypeId
GetTypeId
(
void
);
79
Ipv4
();
80
virtual
~Ipv4
();
81
91
virtual
void
SetRoutingProtocol
(
Ptr<Ipv4RoutingProtocol>
routingProtocol) = 0;
92
98
virtual
Ptr<Ipv4RoutingProtocol>
GetRoutingProtocol
(
void
)
const
= 0;
99
109
virtual
uint32_t
AddInterface
(
Ptr<NetDevice>
device) = 0;
110
114
virtual
uint32_t
GetNInterfaces
(
void
)
const
= 0;
115
131
virtual
int32_t
GetInterfaceForAddress
(
Ipv4Address
address
)
const
= 0;
132
143
virtual
void
Send
(
Ptr<Packet>
packet,
Ipv4Address
source,
144
Ipv4Address
destination, uint8_t protocol,
Ptr<Ipv4Route>
route) = 0;
145
154
virtual
void
SendWithHeader
(
Ptr<Packet>
packet,
Ipv4Header
ipHeader,
Ptr<Ipv4Route>
route) = 0;
155
162
virtual
void
Insert
(
Ptr<IpL4Protocol>
protocol) = 0;
163
183
virtual
bool
IsDestinationAddress
(
Ipv4Address
address, uint32_t iif)
const
= 0;
184
201
virtual
int32_t
GetInterfaceForPrefix
(
Ipv4Address
address,
202
Ipv4Mask
mask)
const
= 0;
203
208
virtual
Ptr<NetDevice>
GetNetDevice
(uint32_t interface) = 0;
209
214
virtual
int32_t
GetInterfaceForDevice
(
Ptr<const NetDevice>
device)
const
= 0;
215
221
virtual
bool
AddAddress
(uint32_t interface,
Ipv4InterfaceAddress
address) = 0;
222
227
virtual
uint32_t
GetNAddresses
(uint32_t interface)
const
= 0;
228
237
virtual
Ipv4InterfaceAddress
GetAddress
(uint32_t interface, uint32_t addressIndex)
const
= 0;
238
249
virtual
bool
RemoveAddress
(uint32_t interface, uint32_t addressIndex) = 0;
250
258
virtual
bool
RemoveAddress
(uint32_t interface,
Ipv4Address
address) = 0;
259
295
virtual
Ipv4Address
SelectSourceAddress
(
Ptr<const NetDevice>
device,
296
Ipv4Address
dst,
Ipv4InterfaceAddress::InterfaceAddressScope_e
scope) = 0;
297
303
virtual
void
SetMetric
(uint32_t interface, uint16_t metric) = 0;
304
310
virtual
uint16_t
GetMetric
(uint32_t interface)
const
= 0;
311
317
virtual
uint16_t
GetMtu
(uint32_t interface)
const
= 0;
318
324
virtual
bool
IsUp
(uint32_t interface)
const
= 0;
325
332
virtual
void
SetUp
(uint32_t interface) = 0;
333
340
virtual
void
SetDown
(uint32_t interface) = 0;
341
346
virtual
bool
IsForwarding
(uint32_t interface)
const
= 0;
347
354
virtual
void
SetForwarding
(uint32_t interface,
bool
val) = 0;
355
364
virtual
Ptr<IpL4Protocol>
GetProtocol
(
int
protocolNumber)
const
= 0;
365
371
virtual
Ptr<Socket>
CreateRawSocket
(
void
) = 0;
372
378
virtual
void
DeleteRawSocket
(
Ptr<Socket>
socket) = 0;
379
380
381
static
const
uint32_t
IF_ANY
= 0xffffffff;
382
383
private
:
384
// Indirect the Ipv4 attributes through private pure virtual methods
385
virtual
void
SetIpForward
(
bool
forward) = 0;
386
virtual
bool
GetIpForward
(
void
)
const
= 0;
387
virtual
void
SetWeakEsModel
(
bool
model) = 0;
388
virtual
bool
GetWeakEsModel
(
void
)
const
= 0;
389
};
390
391
}
// namespace ns3
392
393
#endif
/* IPV4_H */
src
internet
model
ipv4.h
Generated on Fri Aug 30 2013 01:42:51 for ns-3 by
1.8.1.2