A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
ip-l4-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
//
20
21
// NS3 - Layer 4 Protocol base class
22
// George F. Riley, Georgia Tech, Spring 2007
23
24
#ifndef IP_L4_PROTOCOL_H
25
#define IP_L4_PROTOCOL_H
26
27
#include "ns3/object.h"
28
#include "ns3/callback.h"
29
#include "
ipv4-header.h
"
30
#include "
ipv6-header.h
"
31
32
namespace
ns3
{
33
34
class
Packet;
35
class
Ipv4Address;
36
class
Ipv4Interface;
37
class
Ipv6Address;
38
class
Ipv6Interface;
39
class
Ipv4Route;
40
class
Ipv6Route;
41
50
class
IpL4Protocol
:
public
Object
51
{
52
public
:
56
enum
RxStatus
{
57
RX_OK
,
58
RX_CSUM_FAILED
,
59
RX_ENDPOINT_CLOSED
,
60
RX_ENDPOINT_UNREACH
61
};
62
67
static
TypeId
GetTypeId
(
void
);
68
69
virtual
~IpL4Protocol
();
70
75
virtual
int
GetProtocolNumber
(
void
)
const
= 0;
76
84
virtual
enum
RxStatus
Receive
(
Ptr<Packet>
p,
85
Ipv4Header
const
&header,
86
Ptr<Ipv4Interface>
incomingInterface) = 0;
87
95
virtual
enum
RxStatus
Receive
(
Ptr<Packet>
p,
96
Ipv6Header
const
&header,
97
Ptr<Ipv6Interface>
incomingInterface) = 0;
98
114
virtual
void
ReceiveIcmp
(
Ipv4Address
icmpSource, uint8_t icmpTtl,
115
uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
116
Ipv4Address
payloadSource,
Ipv4Address
payloadDestination,
117
const
uint8_t payload[8]);
118
119
135
virtual
void
ReceiveIcmp
(
Ipv6Address
icmpSource, uint8_t icmpTtl,
136
uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
137
Ipv6Address
payloadSource,
Ipv6Address
payloadDestination,
138
const
uint8_t payload[8]);
139
143
typedef
Callback<void,Ptr<Packet>
,
Ipv4Address
,
Ipv4Address
, uint8_t,
Ptr<Ipv4Route>
>
DownTargetCallback
;
147
typedef
Callback<void,Ptr<Packet>
,
Ipv6Address
,
Ipv6Address
, uint8_t,
Ptr<Ipv6Route>
>
DownTargetCallback6
;
148
155
virtual
void
SetDownTarget
(
DownTargetCallback
cb) = 0;
156
163
virtual
void
SetDownTarget6
(
DownTargetCallback6
cb) = 0;
164
171
virtual
DownTargetCallback
GetDownTarget
(
void
)
const
= 0;
172
179
virtual
DownTargetCallback6
GetDownTarget6
(
void
)
const
= 0;
180
};
181
182
}
// Namespace ns3
183
184
#endif
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::Ipv4Header
Packet header for IPv4.
Definition:
ipv4-header.h:34
ns3::IpL4Protocol::DownTargetCallback
Callback< void, Ptr< Packet >, Ipv4Address, Ipv4Address, uint8_t, Ptr< Ipv4Route > > DownTargetCallback
callback to send packets over IPv4
Definition:
ip-l4-protocol.h:143
ns3::IpL4Protocol::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
ip-l4-protocol.cc:35
ns3::IpL4Protocol::Receive
virtual enum RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)=0
Called from lower-level layers to send the packet up in the stack.
ns3::Callback
Callback template class.
Definition:
callback.h:1279
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::IpL4Protocol::SetDownTarget
virtual void SetDownTarget(DownTargetCallback cb)=0
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:41
ns3::Ipv6Address
Describes an IPv6 address.
Definition:
ipv6-address.h:50
ns3::Ipv6Header
Packet header for IPv6.
Definition:
ipv6-header.h:36
ipv6-header.h
ns3::Ptr< Packet >
ns3::IpL4Protocol::DownTargetCallback6
Callback< void, Ptr< Packet >, Ipv6Address, Ipv6Address, uint8_t, Ptr< Ipv6Route > > DownTargetCallback6
callback to send packets over IPv6
Definition:
ip-l4-protocol.h:147
ns3::IpL4Protocol::RX_OK
@ RX_OK
Definition:
ip-l4-protocol.h:57
ns3::IpL4Protocol::~IpL4Protocol
virtual ~IpL4Protocol()
Definition:
ip-l4-protocol.cc:49
ns3::IpL4Protocol::RxStatus
RxStatus
Rx status codes.
Definition:
ip-l4-protocol.h:56
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
ns3::IpL4Protocol::RX_ENDPOINT_UNREACH
@ RX_ENDPOINT_UNREACH
Definition:
ip-l4-protocol.h:60
ns3::IpL4Protocol::ReceiveIcmp
virtual void ReceiveIcmp(Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv4Address payloadSource, Ipv4Address payloadDestination, const uint8_t payload[8])
Called from lower-level layers to send the ICMP packet up in the stack.
Definition:
ip-l4-protocol.cc:55
ns3::IpL4Protocol
L4 Protocol abstract base class.
Definition:
ip-l4-protocol.h:51
ns3::IpL4Protocol::SetDownTarget6
virtual void SetDownTarget6(DownTargetCallback6 cb)=0
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
ns3::IpL4Protocol::RX_CSUM_FAILED
@ RX_CSUM_FAILED
Definition:
ip-l4-protocol.h:58
ns3::IpL4Protocol::GetProtocolNumber
virtual int GetProtocolNumber(void) const =0
Returns the protocol number of this protocol.
ns3::IpL4Protocol::GetDownTarget6
virtual DownTargetCallback6 GetDownTarget6(void) const =0
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
ipv4-header.h
ns3::IpL4Protocol::RX_ENDPOINT_CLOSED
@ RX_ENDPOINT_CLOSED
Definition:
ip-l4-protocol.h:59
ns3::IpL4Protocol::GetDownTarget
virtual DownTargetCallback GetDownTarget(void) const =0
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
src
internet
model
ip-l4-protocol.h
Generated on Fri Oct 1 2021 17:03:06 for ns-3 by
1.8.20