21 #include <netinet/in.h>
22 #include <sys/socket.h>
23 #include <sys/types.h>
24 #include "ns3/inet6-socket-address.h"
26 #include "ns3/packet.h"
27 #include "ns3/uinteger.h"
29 #include "ns3/ipv6-route.h"
30 #include "ns3/ipv6-routing-protocol.h"
31 #include "ns3/ipv6-packet-info-tag.h"
52 .AddAttribute (
"Protocol",
"Protocol number to match.",
55 MakeUintegerChecker<uint16_t> ())
146 ipv6->DeleteRawSocket (
this);
191 return SendTo (p, flags, to);
213 if (ipv6->GetRoutingProtocol ())
223 int32_t index = ipv6->GetInterfaceForAddress (
m_src);
225 oif = ipv6->GetNetDevice (index);
228 route = ipv6->GetRoutingProtocol ()->RouteOutput (p, hdr, oif, err);
251 ipv6->Send (p, route->GetSource (), dst,
m_protocol, route);
272 return RecvFrom (maxSize, flags, tmp);
291 if (!(flags & MSG_PEEK))
313 for (std::list<Data>::const_iterator it =
m_data.begin (); it !=
m_data.end (); ++it)
315 rx+= (it->packet)->GetSize ();
333 if (boundNetDevice != device)
350 uint8_t type = icmpHeader.
GetType ();
void SetNode(Ptr< Node > node)
Set the node associated with this socket.
bool IsAny() const
If the IPv6 address is the "Any" address.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Ipv6Address GetIpv6(void) const
Get the IPv6 address.
#define NS_LOG_FUNCTION(parameters)
virtual void DoDispose()
Dispose object.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
void NotifyDataRecv(void)
Notify through the callback (if set) that some data have been received.
virtual uint32_t GetSerializedSize() const
Get the serialized size.
Ipv6Address fromIp
Source address.
uint32_t icmpv6Filt[8]
ICMPv6 filter specification.
Ipv6Address m_src
Source address.
Ptr< Packet > Recv(void)
Read a single packet from the socket.
IPv6 layer implementation.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
bool m_shutdownSend
Flag to shutdown send capability.
#define NS_ASSERT(condition)
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
uint32_t GetSize(void) const
virtual int ShutdownSend()
uint16_t fromProtocol
Protocol used.
Ptr< Packet > packet
Packet data.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
static TypeId GetTypeId()
Get the type ID of this class.
bool ForwardUp(Ptr< const Packet > p, Ipv6Header hdr, Ptr< NetDevice > device)
Forward up to receive method.
virtual enum Socket::SocketType GetSocketType() const
Get socket type (NS3_SOCK_RAW)
SocketErrno
Enumeration of the possible errors returned by a socket.
virtual enum Socket::SocketErrno GetErrno() const
Get last error number.
bool IsRecvPktInfo() const
Get status indicating whether enable/disable packet information to socket.
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host.
a polymophic address class
virtual int Bind()
Allocate a local IPv4 endpoint for this socket.
bool m_shutdownRecv
Flag to shutdown receive capability.
Ptr< NetDevice > GetBoundNetDevice()
Returns socket's bound netdevice, if any.
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
A low-level Socket API based loosely on the BSD Socket API.
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
std::list< struct Data > m_data
Packet waiting to be processed.
Hold an unsigned integer type.
virtual int GetSockName(Address &address) const
Get socket address.
void Icmpv6FilterSetBlock(uint8_t type)
Set the filter to block one ICMPv6 type.
virtual int Bind6()
Allocate a local IPv6 endpoint for this socket.
#define NS_LOG_LOGIC(msg)
virtual Ptr< Node > GetNode() const
Return the node this socket is associated with.
IPv6 raw data and additional information.
Struct to hold the ICMPv6 filter.
virtual int Listen()
Listen for incoming connections.
Ptr< Packet > Copy(void) const
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
static uint16_t GetStaticProtocolNumber()
Get ICMPv6 protocol number.
bool Icmpv6FilterWillBlock(uint8_t type)
Ask the filter about the status of one ICMPv6 type.
void Icmpv6FilterSetPass(uint8_t type)
Set the filter to pass one ICMPv6 type.
virtual ~Ipv6RawSocketImpl()
icmpv6Filter m_icmpFilter
ICMPv6 filter.
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)
Read a single packet from the socket and retrieve the sender address.
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Doxygen introspection did not find any typical Config paths.
virtual uint32_t GetRxAvailable() const
Return number of bytes which can be returned from one or multiple calls to Recv.
Describes an IPv6 address.
virtual uint32_t GetTxAvailable() const
Returns the number of bytes which can be sent in a single call to Send.
enum Socket::SocketErrno m_err
Last error number.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)
Send data to a specified peer.
virtual int Close()
Close a socket.
Ipv6Address m_dst
Destination address.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
#define NS_LOG_DEBUG(msg)
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
bool Icmpv6FilterWillPass(uint8_t type)
Ask the filter about the status of one ICMPv6 type.
void Icmpv6FilterSetPassAll()
Clean the ICMPv6 filter structure.
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.
This class implements a tag that carries socket ancillary data to the socket interface.
virtual int ShutdownRecv()
Ptr< T > GetObject(void) const
virtual bool GetAllowBroadcast() const
Query whether broadcast datagram transmissions are allowed.
SocketType
Enumeration of the possible socket types.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void SetRecvIf(uint32_t ifindex)
Set the tag's receiving interface.
void AddHeader(const Header &header)
Add header to this packet.
uint16_t m_protocol
Protocol.
void Icmpv6FilterSetBlockAll()
Set the filter to block all the ICMPv6 types.