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"
53 .AddConstructor<Radvd> ()
54 .AddAttribute (
"AdvertisementJitter",
55 "Uniform variable to provide jitter between min and max values of AdvInterval",
58 MakePointerChecker<UniformRandomVariable> ());
141 NS_LOG_FUNCTION (
this << dt << config << &eventId << dst << reschedule);
159 std::list<Ptr<RadvdPrefix> > prefixes = config->
GetPrefixes ();
192 prefixHdr.
SetPrefix ((*jt)->GetNetwork ());
197 if ((*jt)->IsOnLinkFlag ())
202 if ((*jt)->IsAutonomousFlag ())
207 if ((*jt)->IsRouterAddrFlag ())
225 raHdr.CalculatePseudoHeaderChecksum (src, dst, p->
GetSize () + raHdr.GetSerializedSize (), 58 );
243 Time t = MilliSeconds (delay);
254 while ((packet = socket->
RecvFrom (from)))
266 packet->
CopyData (&type,
sizeof(type));
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
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.
Doxygen introspection did not find any typical Config paths.
virtual void StartApplication()
Start the application.
RadvdInterfaceList m_configurations
List of configuration for interface.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
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
Container Const Iterator: Ptr to RadvdInterface.
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
Add a packet tag.
Doxygen introspection did not find any typical Config paths.
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
std::list< Ptr< RadvdInterface > >::iterator RadvdInterfaceListI
Container Iterator: Ptr to RadvdInterface.
uint32_t GetRetransTimer() const
Get retransmission timer.
uint32_t GetSize(void) const
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Callback< R > MakeNullCallback(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
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)
Assign a fixed random variable stream number to the random variables used by this model...
virtual ~Radvd()
Destructor.
EventIdMap m_eventIds
Event ID map.
The base class for all ns3 applications.
void SetTtl(uint8_t ttl)
Set the tag's TTL.
bool IsOtherConfigFlag() const
Is "other config" flag enabled ?
Hold an unsigned integer type.
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)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
#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)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
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.
Doxygen introspection did not find any typical Config paths.
std::map< uint32_t, EventId >::iterator EventIdMapI
Container Iterator: interface number, EventId.
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
int64_t GetTimeStep(void) const
static Time Now(void)
Return the "current simulation time".
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.
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
Copy the packet contents to a byte buffer.
uint32_t GetMaxRtrAdvInterval() const
Get maximum RA interval.
Doxygen introspection did not find any typical Config paths.
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)
Add header to this packet.
uint32_t GetReachableTime() const
Get reachable time.
bool IsHomeAgentFlag() const
Is "home agent" flag enabled ?
static TypeId LookupByName(std::string name)