A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
ipv6-option-demux.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007-2009 Strasbourg University
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: David Gross <gdavid.devel@gmail.com>
18
*/
19
20
#include "
ipv6-option-demux.h
"
21
22
#include "
ipv6-option.h
"
23
24
#include "ns3/node.h"
25
#include "ns3/object-vector.h"
26
#include "ns3/ptr.h"
27
28
#include <sstream>
29
30
namespace
ns3
31
{
32
33
NS_OBJECT_ENSURE_REGISTERED
(Ipv6OptionDemux);
34
35
TypeId
36
Ipv6OptionDemux::GetTypeId
()
37
{
38
static
TypeId
tid =
TypeId
(
"ns3::Ipv6OptionDemux"
)
39
.
SetParent
<
Object
>()
40
.SetGroupName(
"Internet"
)
41
.AddAttribute(
"Options"
,
42
"The set of IPv6 options registered with this demux."
,
43
ObjectVectorValue
(),
44
MakeObjectVectorAccessor
(&
Ipv6OptionDemux::m_options
),
45
MakeObjectVectorChecker<Ipv6Option>());
46
return
tid;
47
}
48
49
Ipv6OptionDemux::Ipv6OptionDemux
()
50
{
51
}
52
53
Ipv6OptionDemux::~Ipv6OptionDemux
()
54
{
55
}
56
57
void
58
Ipv6OptionDemux::DoDispose
()
59
{
60
for
(
auto
it =
m_options
.begin(); it !=
m_options
.end(); it++)
61
{
62
(*it)->Dispose();
63
*it =
nullptr
;
64
}
65
m_options
.clear();
66
m_node
=
nullptr
;
67
Object::DoDispose
();
68
}
69
70
void
71
Ipv6OptionDemux::SetNode
(
Ptr<Node>
node)
72
{
73
m_node
= node;
74
}
75
76
void
77
Ipv6OptionDemux::Insert
(
Ptr<Ipv6Option>
option)
78
{
79
m_options
.push_back(option);
80
}
81
82
Ptr<Ipv6Option>
83
Ipv6OptionDemux::GetOption
(
int
optionNumber)
84
{
85
for
(
auto
i =
m_options
.begin(); i !=
m_options
.end(); ++i)
86
{
87
if
((*i)->GetOptionNumber() == optionNumber)
88
{
89
return
*i;
90
}
91
}
92
return
nullptr
;
93
}
94
95
void
96
Ipv6OptionDemux::Remove
(
Ptr<Ipv6Option>
option)
97
{
98
m_options
.remove(option);
99
}
100
101
}
/* namespace ns3 */
ns3::Ipv6OptionDemux::Ipv6OptionDemux
Ipv6OptionDemux()
Constructor.
Definition:
ipv6-option-demux.cc:49
ns3::Ipv6OptionDemux::Insert
void Insert(Ptr< Ipv6Option > option)
Insert a new IPv6 Option.
Definition:
ipv6-option-demux.cc:77
ns3::Ipv6OptionDemux::m_node
Ptr< Node > m_node
The node.
Definition:
ipv6-option-demux.h:103
ns3::Ipv6OptionDemux::SetNode
void SetNode(Ptr< Node > node)
Set the node.
Definition:
ipv6-option-demux.cc:71
ns3::Ipv6OptionDemux::GetTypeId
static TypeId GetTypeId()
The interface ID.
Definition:
ipv6-option-demux.cc:36
ns3::Ipv6OptionDemux::~Ipv6OptionDemux
~Ipv6OptionDemux() override
Destructor.
Definition:
ipv6-option-demux.cc:53
ns3::Ipv6OptionDemux::Remove
void Remove(Ptr< Ipv6Option > option)
Remove an option from this demux.
Definition:
ipv6-option-demux.cc:96
ns3::Ipv6OptionDemux::m_options
Ipv6OptionList_t m_options
List of IPv6 Options supported.
Definition:
ipv6-option-demux.h:98
ns3::Ipv6OptionDemux::DoDispose
void DoDispose() override
Dispose this object.
Definition:
ipv6-option-demux.cc:58
ns3::Ipv6OptionDemux::GetOption
Ptr< Ipv6Option > GetOption(int optionNumber)
Get the option corresponding to optionNumber.
Definition:
ipv6-option-demux.cc:83
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Object::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition:
object.cc:352
ns3::Ptr< Node >
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:931
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ipv6-option-demux.h
ipv6-option.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ObjectVectorValue
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Definition:
object-vector.h:40
ns3::MakeObjectVectorAccessor
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition:
object-vector.h:76
src
internet
model
ipv6-option-demux.cc
Generated on Sun Mar 3 2024 17:10:58 for ns-3 by
1.9.1