24 #include "ns3/ipv6-address.h"
25 #include "ns3/nstime.h"
26 #include "ns3/simulator.h"
27 #include "ns3/packet.h"
28 #include "ns3/net-device.h"
29 #include "ns3/uinteger.h"
30 #include "ns3/inet6-socket-address.h"
32 #include "ns3/ipv6-raw-socket-factory.h"
33 #include "ns3/ipv6-header.h"
34 #include "ns3/icmpv6-header.h"
35 #include "ns3/string.h"
36 #include "ns3/pointer.h"
51 .AddConstructor<Radvd> ()
52 .AddAttribute (
"AdvertisementJitter",
53 "Uniform variable to provide jitter between min and max values of AdvInterval",
56 MakePointerChecker<UniformRandomVariable> ());
139 NS_LOG_FUNCTION (
this << dt << config << &eventId << dst << reschedule);
157 std::list<Ptr<RadvdPrefix> > prefixes = config->
GetPrefixes ();
190 prefixHdr.
SetPrefix ((*jt)->GetNetwork ());
195 if ((*jt)->IsOnLinkFlag ())
200 if ((*jt)->IsAutonomousFlag ())
205 if ((*jt)->IsRouterAddrFlag ())
223 raHdr.CalculatePseudoHeaderChecksum (src, dst, p->
GetSize () + raHdr.GetSerializedSize (), 58 );
241 Time t = MilliSeconds (delay);
252 while ((packet = socket->
RecvFrom (from)))
264 packet->
CopyData (&type,
sizeof(type));
uint32_t RemoveHeader(Header &header)
RadvdPrefixList GetPrefixes() const
Get list of prefixes advertised for this interface.
Ipv6Address GetIpv6(void) const
Get the IPv6 address.
keep track of time values and allow control of global simulation resolution
uint32_t GetMinRtrAdvInterval() const
Get minimum RA interval.
#define NS_LOG_FUNCTION(parameters)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
uint32_t GetLinkMtu() const
Get link MTU.
ICMPv6 Router Advertisement header.
virtual void StartApplication()
Start the application.
RadvdInterfaceList m_configurations
List of configuration for interface.
Access to the IPv6 forwarding table, interfaces, and configuration.
hold variables of type string
uint32_t GetInterface() const
Get interface index for this configuration.
std::list< Ptr< RadvdInterface > >::const_iterator RadvdInterfaceListCI
void ScheduleTransmit(Time dt, Ptr< RadvdInterface > config, EventId &eventId, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false)
Schedule sending a packet.
void AddPacketTag(const Tag &tag) const
ICMPv6 Router Solicitation header.
#define NS_ASSERT(condition)
std::list< Ptr< RadvdInterface > >::iterator RadvdInterfaceListI
uint32_t GetRetransTimer() const
Get retransmission timer.
uint32_t GetSize(void) const
static void Cancel(const EventId &id)
Callback< R > MakeNullCallback(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
uint8_t GetCurHopLimit() const
Get current hop limit.
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
a polymophic address class
bool IsManagedFlag() const
Is managed flag enabled ?
int64_t AssignStreams(int64_t stream)
virtual ~Radvd()
Destructor.
EventIdMap m_eventIds
Event ID map.
The base class for all ns3 applications.
bool IsOtherConfigFlag() const
Is "other config" flag enabled ?
Hold an unsigned integer type.
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
Ptr< Node > GetNode() const
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
#define NS_LOG_LOGIC(msg)
virtual void DoDispose()
Dispose the instance.
Ptr< Socket > m_socket
Raw socket to send RA.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
void HandleRead(Ptr< Socket > socket)
Handle received packet, especially router solicitation.
virtual void DoDispose(void)
static const uint32_t MAX_RA_DELAY_TIME
Default value for maximum delay of RA (ms)
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
std::map< uint32_t, EventId >::iterator EventIdMapI
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
int64_t GetTimeStep(void) const
void Send(Ptr< RadvdInterface > config, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false)
Send a packet.
virtual void StopApplication()
Stop the application.
Describes an IPv6 address.
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
void AddConfiguration(Ptr< RadvdInterface > routerInterface)
Add configuration for an interface;.
an identifier for simulation events.
Ptr< UniformRandomVariable > m_jitter
Variable to provide jitter in advertisement interval.
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
static bool IsMatchingType(const Address &addr)
If the address match.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
uint32_t GetMaxRtrAdvInterval() const
Get maximum RA interval.
ICMPv6 link-layer address option.
uint32_t GetDefaultLifeTime() const
Get default lifetime.
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
bool IsSourceLLAddress() const
Is source LLA option should be included in RA ?
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
static TypeId GetTypeId(void)
Get the type ID.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void AddHeader(const Header &header)
uint32_t GetReachableTime() const
Get reachable time.
bool IsHomeAgentFlag() const
Is "home agent" flag enabled ?
static TypeId LookupByName(std::string name)