A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
34 {
35  static TypeId tid = TypeId ("ns3::Ipv6ExtensionDemux")
36  .SetParent<Object> ()
37  .AddAttribute ("Extensions", "The set of IPv6 extensions registered with this demux.",
40  MakeObjectVectorChecker<Ipv6Extension> ())
41  ;
42  return tid;
43 }
44 
46 {
47 }
48 
50 {
51 }
52 
54 {
55  for (Ipv6ExtensionList_t::iterator it = m_extensions.begin (); it != m_extensions.end (); it++)
56  {
57  (*it)->Dispose ();
58  *it = 0;
59  }
60  m_extensions.clear ();
61  m_node = 0;
63 }
64 
66 {
67  m_node = node;
68 }
69 
71 {
72  m_extensions.push_back (extension);
73 }
74 
76 {
77  for (Ipv6ExtensionList_t::iterator i = m_extensions.begin (); i != m_extensions.end (); ++i)
78  {
79  if ((*i)->GetExtensionNumber () == extensionNumber)
80  {
81  return *i;
82  }
83  }
84  return 0;
85 }
86 
88 {
89  m_extensions.remove (extension);
90 }
91 
92 } /* namespace ns3 */
93 
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberContainer)
Definition: object-vector.h:51
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
virtual void DoDispose()
Dispose object.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: object.cc:335
void Remove(Ptr< Ipv6Extension > extension)
Remove an extension from this demux.
void SetNode(Ptr< Node > node)
Set the node.
static TypeId GetTypeId(void)
The interface ID.
virtual ~Ipv6ExtensionDemux()
Destructor.
void Insert(Ptr< Ipv6Extension > extension)
Insert a new IPv6 Extension.
Ptr< Ipv6Extension > GetExtension(uint8_t extensionNumber)
Get the extension corresponding to extensionNumber.
a base class which provides memory management and object aggregation
Definition: object.h:64
contain a set of ns3::Object pointers.
a unique identifier for an interface.
Definition: type-id.h:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
Ipv6ExtensionList_t m_extensions
List of IPv6 Extensions supported.
Ptr< Node > m_node
The node.