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 
The base class for all ns3 applications.
Definition: application.h:61
Describes an IPv6 address.
Definition: ipv6-address.h:50
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
Router advertisement daemon.
Definition: radvd.h:48
std::map< uint32_t, EventId > EventIdMap
Container: interface number, EventId.
Definition: radvd.h:114
EventIdMap m_solicitedEventIds
Event ID map for solicited RAs.
Definition: radvd.h:174
Ptr< UniformRandomVariable > m_jitter
Variable to provide jitter in advertisement interval.
Definition: radvd.h:179
std::map< uint32_t, EventId >::const_iterator EventIdMapCI
Container Const Iterator: interface number, EventId.
Definition: radvd.h:118
void Send(Ptr< RadvdInterface > config, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false)
Send a packet.
Definition: radvd.cc:176
static TypeId GetTypeId(void)
Get the type ID.
Definition: radvd.cc:53
std::map< uint32_t, Ptr< Socket > > SocketMap
Container: interface number, Socket.
Definition: radvd.h:121
Ptr< Socket > m_recvSocket
Raw socket to receive RS.
Definition: radvd.h:154
static const uint32_t MAX_INITIAL_RTR_ADVERTISEMENTS
Default value for maximum initial RA advertisements.
Definition: radvd.h:73
void HandleRead(Ptr< Socket > socket)
Handle received packet, especially router solicitation.
Definition: radvd.cc:285
std::map< uint32_t, Ptr< Socket > >::iterator SocketMapI
Container Iterator: interface number, Socket.
Definition: radvd.h:123
std::list< Ptr< RadvdInterface > > RadvdInterfaceList
Container: Ptr to RadvdInterface.
Definition: radvd.h:107
virtual void StopApplication()
Stop the application.
Definition: radvd.cc:140
static const uint32_t MAX_RA_DELAY_TIME
Default value for maximum delay of RA (ms)
Definition: radvd.h:69
static const uint32_t MAX_INITIAL_RTR_ADVERT_INTERVAL
Default value for maximum initial RA advertisements interval (ms)
Definition: radvd.h:77
static const uint32_t MIN_DELAY_BETWEEN_RAS
Default value for minimum delay between RA advertisements (ms)
Definition: radvd.h:81
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
EventIdMap m_unsolicitedEventIds
Event ID map for unsolicited RAs.
Definition: radvd.h:169
std::list< Ptr< RadvdInterface > >::iterator RadvdInterfaceListI
Container Iterator: Ptr to RadvdInterface.
Definition: radvd.h:109
std::map< uint32_t, Ptr< Socket > >::const_iterator SocketMapCI
Container Const Iterator: interface number, Socket.
Definition: radvd.h:125
SocketMap m_sendSockets
Raw socket to send RA.
Definition: radvd.h:159
virtual void StartApplication()
Start the application.
Definition: radvd.cc:100
void AddConfiguration(Ptr< RadvdInterface > routerInterface)
Add configuration for an interface;.
Definition: radvd.cc:162
RadvdInterfaceList m_configurations
List of configuration for interface.
Definition: radvd.h:164
std::map< uint32_t, EventId >::iterator EventIdMapI
Container Iterator: interface number, EventId.
Definition: radvd.h:116
std::list< Ptr< RadvdInterface > >::const_iterator RadvdInterfaceListCI
Container Const Iterator: Ptr to RadvdInterface.
Definition: radvd.h:111
virtual ~Radvd()
Destructor.
Definition: radvd.cc:73
virtual void DoDispose()
Dispose the instance.
Definition: radvd.cc:84
Radvd()
Constructor.
Definition: radvd.cc:68
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.