A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
30namespace ns3
31{
32
33NS_OBJECT_ENSURE_REGISTERED(Ipv6OptionDemux);
34
35TypeId
37{
38 static TypeId tid = TypeId("ns3::Ipv6OptionDemux")
40 .SetGroupName("Internet")
41 .AddAttribute("Options",
42 "The set of IPv6 options registered with this demux.",
45 MakeObjectVectorChecker<Ipv6Option>());
46 return tid;
47}
48
50{
51}
52
54{
55}
56
57void
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;
68}
69
70void
72{
73 m_node = node;
74}
75
76void
78{
79 m_options.push_back(option);
80}
81
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
95void
97{
98 m_options.remove(option);
99}
100
101} /* namespace ns3 */
Ipv6OptionDemux()
Constructor.
void Insert(Ptr< Ipv6Option > option)
Insert a new IPv6 Option.
Ptr< Node > m_node
The node.
void SetNode(Ptr< Node > node)
Set the node.
static TypeId GetTypeId()
The interface ID.
~Ipv6OptionDemux() override
Destructor.
void Remove(Ptr< Ipv6Option > option)
Remove an option from this demux.
Ipv6OptionList_t m_options
List of IPv6 Options supported.
void DoDispose() override
Dispose this object.
Ptr< Ipv6Option > GetOption(int optionNumber)
Get the option corresponding to optionNumber.
A base class which provides memory management and object aggregation.
Definition: object.h:89
virtual void DoDispose()
Destructor implementation.
Definition: object.cc:444
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Definition: object-vector.h:40
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-vector.h:76
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.