A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "ns3/application.h"
29 #include "ns3/socket.h"
30 #include "ns3/random-variable-stream.h"
31 
32 #include "radvd-interface.h"
33 
34 namespace ns3
35 {
36 
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;
70 
75  void AddConfiguration (Ptr<RadvdInterface> routerInterface);
76 
85  int64_t AssignStreams (int64_t stream);
86 
87 protected:
91  virtual void DoDispose ();
92 
93 private:
95  typedef std::list<Ptr<RadvdInterface> > RadvdInterfaceList;
97  typedef std::list<Ptr<RadvdInterface> >::iterator RadvdInterfaceListI;
99  typedef std::list<Ptr<RadvdInterface> >::const_iterator RadvdInterfaceListCI;
100 
102  typedef std::map<uint32_t, EventId> EventIdMap;
104  typedef std::map<uint32_t, EventId>::iterator EventIdMapI;
106  typedef std::map<uint32_t, EventId>::const_iterator EventIdMapCI;
107 
111  virtual void StartApplication ();
112 
116  virtual void StopApplication ();
117 
126  void ScheduleTransmit (Time dt, Ptr<RadvdInterface> config, EventId& eventId, Ipv6Address dst = Ipv6Address::GetAllNodesMulticast (), bool reschedule = false);
127 
134  void Send (Ptr<RadvdInterface> config, Ipv6Address dst = Ipv6Address::GetAllNodesMulticast (), bool reschedule = false);
135 
140  void HandleRead (Ptr<Socket> socket);
141 
146 
151 
156 
161 };
162 
163 } /* namespace ns3 */
164 
165 #endif /* RADVD_H */
166 
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
std::map< uint32_t, EventId > EventIdMap
Container: interface number, EventId.
Definition: radvd.h:102
virtual void StartApplication()
Start the application.
Definition: radvd.cc:83
RadvdInterfaceList m_configurations
List of configuration for interface.
Definition: radvd.h:150
Router advertisement daemon.
Definition: radvd.h:47
std::list< Ptr< RadvdInterface > >::const_iterator RadvdInterfaceListCI
Container Const Iterator: Ptr to RadvdInterface.
Definition: radvd.h:99
void ScheduleTransmit(Time dt, Ptr< RadvdInterface > config, EventId &eventId, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false)
Schedule sending a packet.
Definition: radvd.cc:137
std::list< Ptr< RadvdInterface > >::iterator RadvdInterfaceListI
Container Iterator: Ptr to RadvdInterface.
Definition: radvd.h:97
std::map< uint32_t, EventId >::const_iterator EventIdMapCI
Container Const Iterator: interface number, EventId.
Definition: radvd.h:106
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: radvd.cc:130
virtual ~Radvd()
Destructor.
Definition: radvd.cc:66
EventIdMap m_eventIds
Event ID map.
Definition: radvd.h:155
The base class for all ns3 applications.
Definition: application.h:60
virtual void DoDispose()
Dispose the instance.
Definition: radvd.cc:77
Ptr< Socket > m_socket
Raw socket to send RA.
Definition: radvd.h:145
void HandleRead(Ptr< Socket > socket)
Handle received packet, especially router solicitation.
Definition: radvd.cc:246
static const uint32_t MAX_RA_DELAY_TIME
Default value for maximum delay of RA (ms)
Definition: radvd.h:69
std::map< uint32_t, EventId >::iterator EventIdMapI
Container Iterator: interface number, EventId.
Definition: radvd.h:104
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:143
virtual void StopApplication()
Stop the application.
Definition: radvd.cc:107
Describes an IPv6 address.
Definition: ipv6-address.h:46
Radvd()
Constructor.
Definition: radvd.cc:61
void AddConfiguration(Ptr< RadvdInterface > routerInterface)
Add configuration for an interface;.
Definition: radvd.cc:123
an identifier for simulation events.
Definition: event-id.h:46
Ptr< UniformRandomVariable > m_jitter
Variable to provide jitter in advertisement interval.
Definition: radvd.h:160
static TypeId GetTypeId(void)
Get the type ID.
Definition: radvd.cc:47
std::list< Ptr< RadvdInterface > > RadvdInterfaceList
Container: Ptr to RadvdInterface.
Definition: radvd.h:95
a unique identifier for an interface.
Definition: type-id.h:49