A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
internet
model
ipv6-extension-demux.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007-2009 Strasbourg University
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: David Gross <gdavid.devel@gmail.com>
19
*/
20
21
#include <sstream>
22
#include "ns3/node.h"
23
#include "ns3/ptr.h"
24
#include "ns3/object-vector.h"
25
#include "
ipv6-extension-demux.h
"
26
#include "
ipv6-extension.h
"
27
28
namespace
ns3
29
{
30
31
NS_OBJECT_ENSURE_REGISTERED
(Ipv6ExtensionDemux);
32
33
TypeId
Ipv6ExtensionDemux::GetTypeId
()
34
{
35
static
TypeId
tid =
TypeId
(
"ns3::Ipv6ExtensionDemux"
)
36
.
SetParent
<
Object
> ()
37
.SetGroupName (
"Internet"
)
38
.AddAttribute (
"Extensions"
,
"The set of IPv6 extensions registered with this demux."
,
39
ObjectVectorValue
(),
40
MakeObjectVectorAccessor
(&
Ipv6ExtensionDemux::m_extensions
),
41
MakeObjectVectorChecker<Ipv6Extension> ())
42
;
43
return
tid;
44
}
45
46
Ipv6ExtensionDemux::Ipv6ExtensionDemux
()
47
{
48
}
49
50
Ipv6ExtensionDemux::~Ipv6ExtensionDemux
()
51
{
52
}
53
54
void
Ipv6ExtensionDemux::DoDispose
()
55
{
56
for
(Ipv6ExtensionList_t::iterator it =
m_extensions
.begin (); it !=
m_extensions
.end (); it++)
57
{
58
(*it)->Dispose ();
59
*it = 0;
60
}
61
m_extensions
.clear ();
62
m_node
= 0;
63
Object::DoDispose
();
64
}
65
66
void
Ipv6ExtensionDemux::SetNode
(
Ptr<Node>
node)
67
{
68
m_node
= node;
69
}
70
71
void
Ipv6ExtensionDemux::Insert
(
Ptr<Ipv6Extension>
extension)
72
{
73
m_extensions
.push_back (extension);
74
}
75
76
Ptr<Ipv6Extension>
Ipv6ExtensionDemux::GetExtension
(uint8_t extensionNumber)
77
{
78
for
(Ipv6ExtensionList_t::iterator i =
m_extensions
.begin (); i !=
m_extensions
.end (); ++i)
79
{
80
if
((*i)->GetExtensionNumber () == extensionNumber)
81
{
82
return
*i;
83
}
84
}
85
return
0;
86
}
87
88
void
Ipv6ExtensionDemux::Remove
(
Ptr<Ipv6Extension>
extension)
89
{
90
m_extensions
.remove (extension);
91
}
92
93
}
/* namespace ns3 */
94
ns3::Ptr< Node >
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::Ipv6ExtensionDemux::DoDispose
virtual void DoDispose()
Dispose object.
Definition:
ipv6-extension-demux.cc:54
ns3::MakeObjectVectorAccessor
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition:
object-vector.h:81
ipv6-extension.h
ns3::Object::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
object.cc:346
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ipv6ExtensionDemux::Remove
void Remove(Ptr< Ipv6Extension > extension)
Remove an extension from this demux.
Definition:
ipv6-extension-demux.cc:88
ns3::Ipv6ExtensionDemux::SetNode
void SetNode(Ptr< Node > node)
Set the node.
Definition:
ipv6-extension-demux.cc:66
ns3::Ipv6ExtensionDemux::GetTypeId
static TypeId GetTypeId(void)
The interface ID.
Definition:
ipv6-extension-demux.cc:33
ns3::Ipv6ExtensionDemux::~Ipv6ExtensionDemux
virtual ~Ipv6ExtensionDemux()
Destructor.
Definition:
ipv6-extension-demux.cc:50
ipv6-extension-demux.h
ns3::Ipv6ExtensionDemux::Insert
void Insert(Ptr< Ipv6Extension > extension)
Insert a new IPv6 Extension.
Definition:
ipv6-extension-demux.cc:71
ns3::Ipv6ExtensionDemux::GetExtension
Ptr< Ipv6Extension > GetExtension(uint8_t extensionNumber)
Get the extension corresponding to extensionNumber.
Definition:
ipv6-extension-demux.cc:76
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
ns3::ObjectPtrContainerValue
Container for a set of ns3::Object pointers.
Definition:
object-ptr-container.h:45
ns3::Ipv6ExtensionDemux::Ipv6ExtensionDemux
Ipv6ExtensionDemux()
Constructor.
Definition:
ipv6-extension-demux.cc:46
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::Ipv6ExtensionDemux::m_extensions
Ipv6ExtensionList_t m_extensions
List of IPv6 Extensions supported.
Definition:
ipv6-extension-demux.h:99
ns3::Ipv6ExtensionDemux::m_node
Ptr< Node > m_node
The node.
Definition:
ipv6-extension-demux.h:104
Generated on Wed Nov 7 2018 10:01:55 for ns-3 by
1.8.14