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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: David Gross <gdavid.devel@gmail.com>
7 */
8
9#include "ipv6-option-demux.h"
10
11#include "ipv6-option.h"
12
13#include "ns3/node.h"
14#include "ns3/object-vector.h"
15#include "ns3/ptr.h"
16
17#include <sstream>
18
19namespace ns3
20{
21
22NS_OBJECT_ENSURE_REGISTERED(Ipv6OptionDemux);
23
24TypeId
26{
27 static TypeId tid = TypeId("ns3::Ipv6OptionDemux")
29 .SetGroupName("Internet")
30 .AddAttribute("Options",
31 "The set of IPv6 options registered with this demux.",
35 return tid;
36}
37
41
45
46void
48{
49 for (auto it = m_options.begin(); it != m_options.end(); it++)
50 {
51 (*it)->Dispose();
52 *it = nullptr;
53 }
54 m_options.clear();
55 m_node = nullptr;
57}
58
59void
61{
62 m_node = node;
63}
64
65void
67{
68 m_options.push_back(option);
69}
70
73{
74 for (auto i = m_options.begin(); i != m_options.end(); ++i)
75 {
76 if ((*i)->GetOptionNumber() == optionNumber)
77 {
78 return *i;
79 }
80 }
81 return nullptr;
82}
83
84void
86{
87 m_options.remove(option);
88}
89
90} /* 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:78
virtual void DoDispose()
Destructor implementation.
Definition object.cc:433
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeObjectVectorChecker()
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.