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
ip-l4-protocol.cc
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
#include "
ip-l4-protocol.h
"
25
#include "ns3/uinteger.h"
26
#include "ns3/log.h"
27
28
NS_LOG_COMPONENT_DEFINE
(
"IpL4Protocol"
);
29
30
namespace
ns3 {
31
32
NS_OBJECT_ENSURE_REGISTERED
(IpL4Protocol)
33
;
34
35
TypeId
36
IpL4Protocol::GetTypeId
(
void
)
37
{
38
static
TypeId
tid =
TypeId
(
"ns3::IpL4Protocol"
)
39
.
SetParent
<
Object
> ()
40
.AddAttribute (
"ProtocolNumber"
,
"The Ip protocol number."
,
41
UintegerValue
(0),
42
MakeUintegerAccessor (&
IpL4Protocol::GetProtocolNumber
),
43
MakeUintegerChecker<int> ())
44
;
45
return
tid;
46
}
47
48
IpL4Protocol::~IpL4Protocol
()
49
{
50
NS_LOG_FUNCTION
(
this
);
51
}
52
53
void
54
IpL4Protocol::ReceiveIcmp
(
Ipv4Address
icmpSource, uint8_t icmpTtl,
55
uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
56
Ipv4Address
payloadSource,
Ipv4Address
payloadDestination,
57
const
uint8_t payload[8])
58
{
59
NS_LOG_FUNCTION
(
this
<< icmpSource << static_cast<uint32_t> (icmpTtl) << static_cast<uint32_t> (icmpType) << static_cast<uint32_t> (icmpCode) << icmpInfo << payloadSource << payloadDestination << payload);
60
}
61
void
62
IpL4Protocol::ReceiveIcmp
(
Ipv6Address
icmpSource, uint8_t icmpTtl,
63
uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
64
Ipv6Address
payloadSource,
Ipv6Address
payloadDestination,
65
const
uint8_t payload[8])
66
{
67
NS_LOG_FUNCTION
(
this
<< icmpSource << static_cast<uint32_t> (icmpTtl) << static_cast<uint32_t> (icmpType) << static_cast<uint32_t> (icmpCode) << icmpInfo << payloadSource << payloadDestination << payload);
68
}
69
70
}
//namespace ns3
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
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:54
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
ns3::IpL4Protocol::GetProtocolNumber
virtual int GetProtocolNumber(void) const =0
ns3::UintegerValue
Hold an unsigned integer type.
Definition:
uinteger.h:46
ns3::IpL4Protocol::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
ip-l4-protocol.cc:36
ip-l4-protocol.h
ns3::Ipv6Address
Describes an IPv6 address.
Definition:
ipv6-address.h:46
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:38
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("IpL4Protocol")
ns3::IpL4Protocol::~IpL4Protocol
virtual ~IpL4Protocol()
Definition:
ip-l4-protocol.cc:48
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:611
src
internet
model
ip-l4-protocol.cc
Generated on Sat Apr 19 2014 14:06:56 for ns-3 by
1.8.6