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-l3-click-protocol.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
//
3
// Copyright (c) 2006 Georgia Tech Research Corporation
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: George F. Riley <riley@ece.gatech.edu>
19
// Author: Lalith Suresh <suresh.lalith@gmail.com>
20
//
21
22
#ifndef IPV4_L3_CLICK_PROTOCOL_H
23
#define IPV4_L3_CLICK_PROTOCOL_H
24
25
#include "ns3/ipv4.h"
26
#include "ns3/net-device.h"
27
#include "ns3/packet.h"
28
#include "ns3/ipv4-routing-protocol.h"
29
#include "ns3/traced-callback.h"
30
#include "ns3/ipv4-interface.h"
31
#include "ns3/log.h"
32
33
namespace
ns3 {
34
35
class
Packet;
36
class
NetDevice;
37
class
Ipv4Interface;
38
class
Ipv4Address;
39
class
Ipv4Header;
40
class
Ipv4RoutingTableEntry;
41
class
Ipv4Route;
42
class
Node;
43
class
Socket;
44
class
Ipv4RawSocketImpl;
45
class
IpL4Protocol;
46
class
Icmpv4L4Protocol;
47
61
class
Ipv4L3ClickProtocol
:
public
Ipv4
62
{
63
#ifdef NS3_CLICK
64
public
:
65
static
TypeId
GetTypeId
(
void
);
66
70
static
const
uint16_t PROT_NUMBER;
71
72
Ipv4L3ClickProtocol
();
73
virtual
~
Ipv4L3ClickProtocol
();
74
85
void
Insert
(
Ptr<IpL4Protocol>
protocol);
86
95
Ptr<IpL4Protocol>
GetProtocol
(
int
protocolNumber)
const
;
96
103
void
SetDefaultTtl (uint8_t ttl);
104
115
void
Send
(
Ptr<Packet>
packet,
Ipv4Address
source,
116
Ipv4Address
destination, uint8_t protocol,
Ptr<Ipv4Route>
route);
117
126
void
SendWithHeader
(
Ptr<Packet>
packet,
Ipv4Header
ipHeader,
Ptr<Ipv4Route>
route);
127
135
void
SendDown (
Ptr<Packet>
packet,
int
ifid);
136
146
void
Receive (
Ptr<NetDevice>
device,
Ptr<const Packet>
p, uint16_t protocol,
const
Address
&from,
147
const
Address
&to,
NetDevice::PacketType
packetType);
148
155
void
LocalDeliver (
Ptr<const Packet>
p,
Ipv4Header
const
&ip, uint32_t iif);
156
162
Ptr<Ipv4Interface>
GetInterface (uint32_t i)
const
;
163
169
uint32_t AddIpv4Interface (
Ptr<Ipv4Interface>
interface);
170
175
void
SetNode (
Ptr<Node>
node);
176
181
Ptr<Icmpv4L4Protocol>
GetIcmp (
void
)
const
;
182
186
void
SetupLoopback (
void
);
187
192
Ptr<Socket>
CreateRawSocket
(
void
);
193
198
void
DeleteRawSocket
(
Ptr<Socket>
socket);
199
200
// functions defined in base class Ipv4
201
void
SetRoutingProtocol
(
Ptr<Ipv4RoutingProtocol>
routingProtocol);
202
Ptr<Ipv4RoutingProtocol>
GetRoutingProtocol
(
void
)
const
;
203
204
Ptr<NetDevice>
GetNetDevice
(uint32_t i);
205
206
uint32_t
AddInterface
(
Ptr<NetDevice>
device);
207
uint32_t
GetNInterfaces
(
void
)
const
;
208
209
int32_t
GetInterfaceForAddress
(
Ipv4Address
addr)
const
;
210
int32_t
GetInterfaceForPrefix
(
Ipv4Address
addr,
Ipv4Mask
mask)
const
;
211
int32_t
GetInterfaceForDevice
(
Ptr<const NetDevice>
device)
const
;
212
bool
IsDestinationAddress
(
Ipv4Address
address
, uint32_t iif)
const
;
213
214
bool
AddAddress
(uint32_t i,
Ipv4InterfaceAddress
address);
215
Ipv4InterfaceAddress
GetAddress
(uint32_t interfaceIndex, uint32_t addressIndex)
const
;
216
uint32_t
GetNAddresses
(uint32_t interface)
const
;
217
bool
RemoveAddress
(uint32_t interfaceIndex, uint32_t addressIndex);
218
bool
RemoveAddress
(uint32_t interfaceIndex,
Ipv4Address
address);
219
Ipv4Address
SelectSourceAddress
(
Ptr<const NetDevice>
device,
220
Ipv4Address
dst,
Ipv4InterfaceAddress::InterfaceAddressScope_e
scope);
221
222
void
SetMetric
(uint32_t i, uint16_t metric);
223
uint16_t
GetMetric
(uint32_t i)
const
;
224
uint16_t
GetMtu
(uint32_t i)
const
;
225
bool
IsUp
(uint32_t i)
const
;
226
void
SetUp
(uint32_t i);
227
void
SetDown
(uint32_t i);
228
bool
IsForwarding
(uint32_t i)
const
;
229
void
SetForwarding
(uint32_t i,
bool
val);
230
void
SetPromisc (uint32_t i);
231
protected
:
232
virtual
void
DoDispose
(
void
);
237
virtual
void
NotifyNewAggregate
();
238
239
private
:
240
Ipv4Header
BuildHeader (
241
Ipv4Address
source,
242
Ipv4Address
destination,
243
uint8_t protocol,
244
uint16_t payloadSize,
245
uint8_t ttl,
246
bool
mayFragment);
247
248
virtual
void
SetIpForward
(
bool
forward);
249
virtual
bool
GetIpForward
(
void
)
const
;
250
virtual
void
SetWeakEsModel
(
bool
model);
251
virtual
bool
GetWeakEsModel
(
void
)
const
;
252
253
typedef
std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
254
typedef
std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
255
typedef
std::list<Ptr<IpL4Protocol> > L4List_t;
256
257
Ptr<Ipv4RoutingProtocol>
m_routingProtocol;
258
bool
m_ipForward;
259
bool
m_weakEsModel;
260
L4List_t m_protocols;
261
Ipv4InterfaceList m_interfaces;
262
uint8_t m_defaultTtl;
263
uint16_t m_identification;
264
265
Ptr<Node>
m_node;
266
267
TracedCallback<const Ipv4Header &, Ptr<const Packet>
, uint32_t> m_sendOutgoingTrace;
268
TracedCallback<const Ipv4Header &, Ptr<const Packet>
, uint32_t> m_unicastForwardTrace;
269
TracedCallback<const Ipv4Header &, Ptr<const Packet>
, uint32_t> m_localDeliverTrace;
270
271
SocketList m_sockets;
272
273
std::vector<bool> m_promiscDeviceList;
274
275
#endif
/* NS3_CLICK */
276
};
277
278
}
// namespace ns3
279
280
#endif
/* IPV4_L3_CLICK_ROUTING_H */
src
click
model
ipv4-l3-click-protocol.h
Generated on Fri Aug 30 2013 01:42:46 for ns-3 by
1.8.1.2