A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-extension-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
10
11#include "ipv6-extension.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(Ipv6ExtensionDemux);
23
24TypeId
26{
27 static TypeId tid =
28 TypeId("ns3::Ipv6ExtensionDemux")
30 .SetGroupName("Internet")
31 .AddAttribute("Extensions",
32 "The set of IPv6 extensions registered with this demux.",
36 return tid;
37}
38
42
46
47void
49{
50 for (auto it = m_extensions.begin(); it != m_extensions.end(); it++)
51 {
52 (*it)->Dispose();
53 *it = nullptr;
54 }
55 m_extensions.clear();
56 m_node = nullptr;
58}
59
60void
65
66void
68{
69 m_extensions.push_back(extension);
70}
71
73Ipv6ExtensionDemux::GetExtension(uint8_t extensionNumber)
74{
75 for (auto i = m_extensions.begin(); i != m_extensions.end(); ++i)
76 {
77 if ((*i)->GetExtensionNumber() == extensionNumber)
78 {
79 return *i;
80 }
81 }
82 return nullptr;
83}
84
85void
87{
88 m_extensions.remove(extension);
89}
90
91} /* namespace ns3 */
Ipv6ExtensionList_t m_extensions
List of IPv6 Extensions supported.
void SetNode(Ptr< Node > node)
Set the node.
void DoDispose() override
Dispose object.
static TypeId GetTypeId()
The interface ID.
~Ipv6ExtensionDemux() override
Destructor.
Ptr< Node > m_node
The node.
void Remove(Ptr< Ipv6Extension > extension)
Remove an extension from this demux.
Ptr< Ipv6Extension > GetExtension(uint8_t extensionNumber)
Get the extension corresponding to extensionNumber.
void Insert(Ptr< Ipv6Extension > extension)
Insert a new IPv6 Extension.
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.