A Discrete-Event Network Simulator
API
radvd.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 Telecom Bretagne
4  * Copyright (c) 2009 Strasbourg University
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
20  * Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
21  */
22 
23 #ifndef RADVD_H
24 #define RADVD_H
25 
26 #include <map>
27 
28 #include "radvd-interface.h"
29 #include "ns3/application.h"
30 
31 
32 namespace ns3
33 {
34 
35 class UniformRandomVariable;
36 class Socket;
37 
47 class Radvd : public Application
48 {
49 public:
54  static TypeId GetTypeId (void);
55 
59  Radvd ();
60 
64  virtual ~Radvd ();
65 
69  static const uint32_t MAX_RA_DELAY_TIME = 500;
73  static const uint32_t MAX_INITIAL_RTR_ADVERTISEMENTS = 3;
77  static const uint32_t MAX_INITIAL_RTR_ADVERT_INTERVAL = 16000;
81  static const uint32_t MIN_DELAY_BETWEEN_RAS = 3000;
82 
87  void AddConfiguration (Ptr<RadvdInterface> routerInterface);
88 
97  int64_t AssignStreams (int64_t stream);
98 
99 protected:
103  virtual void DoDispose ();
104 
105 private:
107  typedef std::list<Ptr<RadvdInterface> > RadvdInterfaceList;
109  typedef std::list<Ptr<RadvdInterface> >::iterator RadvdInterfaceListI;
111  typedef std::list<Ptr<RadvdInterface> >::const_iterator RadvdInterfaceListCI;
112 
114  typedef std::map<uint32_t, EventId> EventIdMap;
116  typedef std::map<uint32_t, EventId>::iterator EventIdMapI;
118  typedef std::map<uint32_t, EventId>::const_iterator EventIdMapCI;
119 
121  typedef std::map<uint32_t, Ptr<Socket> > SocketMap;
123  typedef std::map<uint32_t, Ptr<Socket> >::iterator SocketMapI;
125  typedef std::map<uint32_t, Ptr<Socket> >::const_iterator SocketMapCI;
126 
130  virtual void StartApplication ();
131 
135  virtual void StopApplication ();
136 
143  void Send (Ptr<RadvdInterface> config, Ipv6Address dst = Ipv6Address::GetAllNodesMulticast (), bool reschedule = false);
144 
149  void HandleRead (Ptr<Socket> socket);
150 
155 
160 
165 
170 
175 
180 };
181 
182 } /* namespace ns3 */
183 
184 #endif /* RADVD_H */
185 
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Radvd::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: radvd.cc:169
ns3::Ipv6Address
Describes an IPv6 address.
Definition: ipv6-address.h:50
ns3::Radvd
Router advertisement daemon.
Definition: radvd.h:48
ns3::Radvd::m_sendSockets
SocketMap m_sendSockets
Raw socket to send RA.
Definition: radvd.h:159
ns3::Radvd::AddConfiguration
void AddConfiguration(Ptr< RadvdInterface > routerInterface)
Add configuration for an interface;.
Definition: radvd.cc:162
ns3::Radvd::MAX_INITIAL_RTR_ADVERTISEMENTS
static const uint32_t MAX_INITIAL_RTR_ADVERTISEMENTS
Default value for maximum initial RA advertisements.
Definition: radvd.h:73
ns3::Radvd::MAX_INITIAL_RTR_ADVERT_INTERVAL
static const uint32_t MAX_INITIAL_RTR_ADVERT_INTERVAL
Default value for maximum initial RA advertisements interval (ms)
Definition: radvd.h:77
ns3::Radvd::HandleRead
void HandleRead(Ptr< Socket > socket)
Handle received packet, especially router solicitation.
Definition: radvd.cc:285
ns3::Ptr< RadvdInterface >
ns3::Radvd::~Radvd
virtual ~Radvd()
Destructor.
Definition: radvd.cc:73
ns3::Radvd::m_configurations
RadvdInterfaceList m_configurations
List of configuration for interface.
Definition: radvd.h:164
ns3::Radvd::MAX_RA_DELAY_TIME
static const uint32_t MAX_RA_DELAY_TIME
Default value for maximum delay of RA (ms)
Definition: radvd.h:69
ns3::Radvd::RadvdInterfaceListI
std::list< Ptr< RadvdInterface > >::iterator RadvdInterfaceListI
Container Iterator: Ptr to RadvdInterface.
Definition: radvd.h:109
ns3::Radvd::EventIdMapCI
std::map< uint32_t, EventId >::const_iterator EventIdMapCI
Container Const Iterator: interface number, EventId.
Definition: radvd.h:118
ns3::Radvd::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: radvd.cc:53
ns3::Radvd::m_unsolicitedEventIds
EventIdMap m_unsolicitedEventIds
Event ID map for unsolicited RAs.
Definition: radvd.h:169
ns3::Radvd::m_solicitedEventIds
EventIdMap m_solicitedEventIds
Event ID map for solicited RAs.
Definition: radvd.h:174
ns3::Radvd::SocketMap
std::map< uint32_t, Ptr< Socket > > SocketMap
Container: interface number, Socket.
Definition: radvd.h:121
ns3::Radvd::MIN_DELAY_BETWEEN_RAS
static const uint32_t MIN_DELAY_BETWEEN_RAS
Default value for minimum delay between RA advertisements (ms)
Definition: radvd.h:81
ns3::Radvd::RadvdInterfaceList
std::list< Ptr< RadvdInterface > > RadvdInterfaceList
Container: Ptr to RadvdInterface.
Definition: radvd.h:107
ns3::Radvd::Send
void Send(Ptr< RadvdInterface > config, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false)
Send a packet.
Definition: radvd.cc:176
ns3::Radvd::StopApplication
virtual void StopApplication()
Stop the application.
Definition: radvd.cc:140
ns3::Radvd::m_jitter
Ptr< UniformRandomVariable > m_jitter
Variable to provide jitter in advertisement interval.
Definition: radvd.h:179
ns3::Ipv6Address::GetAllNodesMulticast
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
Definition: ipv6-address.cc:862
ns3::Radvd::Radvd
Radvd()
Constructor.
Definition: radvd.cc:68
ns3::Radvd::DoDispose
virtual void DoDispose()
Dispose the instance.
Definition: radvd.cc:84
radvd-interface.h
ns3::Radvd::EventIdMapI
std::map< uint32_t, EventId >::iterator EventIdMapI
Container Iterator: interface number, EventId.
Definition: radvd.h:116
ns3::Radvd::m_recvSocket
Ptr< Socket > m_recvSocket
Raw socket to receive RS.
Definition: radvd.h:154
ns3::Radvd::StartApplication
virtual void StartApplication()
Start the application.
Definition: radvd.cc:100
ns3::Radvd::SocketMapI
std::map< uint32_t, Ptr< Socket > >::iterator SocketMapI
Container Iterator: interface number, Socket.
Definition: radvd.h:123
ns3::Application
The base class for all ns3 applications.
Definition: application.h:61
ns3::Radvd::SocketMapCI
std::map< uint32_t, Ptr< Socket > >::const_iterator SocketMapCI
Container Const Iterator: interface number, Socket.
Definition: radvd.h:125
ns3::Radvd::EventIdMap
std::map< uint32_t, EventId > EventIdMap
Container: interface number, EventId.
Definition: radvd.h:114
ns3::Radvd::RadvdInterfaceListCI
std::list< Ptr< RadvdInterface > >::const_iterator RadvdInterfaceListCI
Container Const Iterator: Ptr to RadvdInterface.
Definition: radvd.h:111