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 #include "ns3/socket.h"
31 #include "ns3/random-variable-stream.h"
32 
33 
34 namespace ns3
35 {
36 
46 class Radvd : public Application
47 {
48 public:
53  static TypeId GetTypeId (void);
54 
58  Radvd ();
59 
63  virtual ~Radvd ();
64 
68  static const uint32_t MAX_RA_DELAY_TIME = 500;
72  static const uint32_t MAX_INITIAL_RTR_ADVERTISEMENTS = 3;
76  static const uint32_t MAX_INITIAL_RTR_ADVERT_INTERVAL = 16000;
80  static const uint32_t MIN_DELAY_BETWEEN_RAS = 3000;
81 
86  void AddConfiguration (Ptr<RadvdInterface> routerInterface);
87 
96  int64_t AssignStreams (int64_t stream);
97 
98 protected:
102  virtual void DoDispose ();
103 
104 private:
106  typedef std::list<Ptr<RadvdInterface> > RadvdInterfaceList;
108  typedef std::list<Ptr<RadvdInterface> >::iterator RadvdInterfaceListI;
110  typedef std::list<Ptr<RadvdInterface> >::const_iterator RadvdInterfaceListCI;
111 
113  typedef std::map<uint32_t, EventId> EventIdMap;
115  typedef std::map<uint32_t, EventId>::iterator EventIdMapI;
117  typedef std::map<uint32_t, EventId>::const_iterator EventIdMapCI;
118 
120  typedef std::map<uint32_t, Ptr<Socket> > SocketMap;
122  typedef std::map<uint32_t, Ptr<Socket> >::iterator SocketMapI;
124  typedef std::map<uint32_t, Ptr<Socket> >::const_iterator SocketMapCI;
125 
129  virtual void StartApplication ();
130 
134  virtual void StopApplication ();
135 
142  void Send (Ptr<RadvdInterface> config, Ipv6Address dst = Ipv6Address::GetAllNodesMulticast (), bool reschedule = false);
143 
148  void HandleRead (Ptr<Socket> socket);
149 
154 
158  SocketMap m_sendSockets;
159 
163  RadvdInterfaceList m_configurations;
164 
169 
174 
179 };
180 
181 } /* namespace ns3 */
182 
183 #endif /* RADVD_H */
184 
std::map< uint32_t, EventId > EventIdMap
Container: interface number, EventId.
Definition: radvd.h:113
virtual void StartApplication()
Start the application.
Definition: radvd.cc:98
RadvdInterfaceList m_configurations
List of configuration for interface.
Definition: radvd.h:163
Router advertisement daemon.
Definition: radvd.h:46
std::list< Ptr< RadvdInterface > >::const_iterator RadvdInterfaceListCI
Container Const Iterator: Ptr to RadvdInterface.
Definition: radvd.h:110
static const uint32_t MAX_INITIAL_RTR_ADVERTISEMENTS
Default value for maximum initial RA advertisements.
Definition: radvd.h:72
std::list< Ptr< RadvdInterface > >::iterator RadvdInterfaceListI
Container Iterator: Ptr to RadvdInterface.
Definition: radvd.h:108
std::map< uint32_t, Ptr< Socket > >::iterator SocketMapI
Container Iterator: interface number, Socket.
Definition: radvd.h:122
std::map< uint32_t, EventId >::const_iterator EventIdMapCI
Container Const Iterator: interface number, EventId.
Definition: radvd.h:117
SocketMap m_sendSockets
Raw socket to send RA.
Definition: radvd.h:158
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: radvd.cc:167
virtual ~Radvd()
Destructor.
Definition: radvd.cc:71
The base class for all ns3 applications.
Definition: application.h:60
EventIdMap m_unsolicitedEventIds
Event ID map for unsolicited RAs.
Definition: radvd.h:168
static const uint32_t MIN_DELAY_BETWEEN_RAS
Default value for minimum delay between RA advertisements (ms)
Definition: radvd.h:80
virtual void DoDispose()
Dispose the instance.
Definition: radvd.cc:82
void HandleRead(Ptr< Socket > socket)
Handle received packet, especially router solicitation.
Definition: radvd.cc:283
std::map< uint32_t, Ptr< Socket > > SocketMap
Container: interface number, Socket.
Definition: radvd.h:120
static const uint32_t MAX_RA_DELAY_TIME
Default value for maximum delay of RA (ms)
Definition: radvd.h:68
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::map< uint32_t, EventId >::iterator EventIdMapI
Container Iterator: interface number, EventId.
Definition: radvd.h:115
EventIdMap m_solicitedEventIds
Event ID map for solicited RAs.
Definition: radvd.h:173
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
void Send(Ptr< RadvdInterface > config, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false)
Send a packet.
Definition: radvd.cc:174
virtual void StopApplication()
Stop the application.
Definition: radvd.cc:138
Describes an IPv6 address.
Definition: ipv6-address.h:48
Radvd()
Constructor.
Definition: radvd.cc:66
void AddConfiguration(Ptr< RadvdInterface > routerInterface)
Add configuration for an interface;.
Definition: radvd.cc:160
Ptr< UniformRandomVariable > m_jitter
Variable to provide jitter in advertisement interval.
Definition: radvd.h:178
Ptr< Socket > m_recvSocket
Raw socket to receive RS.
Definition: radvd.h:153
static TypeId GetTypeId(void)
Get the type ID.
Definition: radvd.cc:51
static const uint32_t MAX_INITIAL_RTR_ADVERT_INTERVAL
Default value for maximum initial RA advertisements interval (ms)
Definition: radvd.h:76
std::list< Ptr< RadvdInterface > > RadvdInterfaceList
Container: Ptr to RadvdInterface.
Definition: radvd.h:106
a unique identifier for an interface.
Definition: type-id.h:58
std::map< uint32_t, Ptr< Socket > >::const_iterator SocketMapCI
Container Const Iterator: interface number, Socket.
Definition: radvd.h:124