18#include "ns3/callback.h"
19#include "ns3/inet-socket-address.h"
20#include "ns3/inet6-socket-address.h"
21#include "ns3/object.h"
869 virtual void SetIpTtl(uint8_t ipTtl);
964 std::vector<Ipv6Address> sourceAddresses);
1122 void SetTtl(uint8_t ttl);
1150 void Print(std::ostream& os)
const override;
1198 void Print(std::ostream& os)
const override;
1249 void Print(std::ostream& os)
const override;
1269 void SetTos(uint8_t tos);
1297 void Print(std::ostream& os)
const override;
1344 void Print(std::ostream& os)
const override;
1392 void Print(std::ostream& os)
const override;
a polymophic address class
Describes an IPv6 address.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
A low-level Socket API based loosely on the BSD Socket API.
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
Ptr< NetDevice > GetBoundNetDevice()
Returns socket's bound NetDevice, if any.
bool IsIpRecvTtl() const
Ask if the socket is currently passing information about IP_TTL up the stack.
virtual void SetIpTtl(uint8_t ipTtl)
Manually set IP Time to Live field.
virtual Socket::SocketType GetSocketType() const =0
Ptr< Packet > Recv()
Read a single packet from the socket.
Callback< void, Ptr< Socket > > m_normalClose
connection closed callback
virtual void Ipv6LeaveGroup()
Leaves IPv6 multicast group this socket is joined to.
bool m_ipv6RecvHopLimit
socket forwards IPv6 Hop Limit tag to L4
uint8_t m_ipTos
the socket IPv4 TOS
void SetConnectCallback(Callback< void, Ptr< Socket > > connectionSucceeded, Callback< void, Ptr< Socket > > connectionFailed)
Specify callbacks to allow the caller to determine if the connection succeeds of fails.
uint8_t m_priority
the socket priority
virtual Socket::SocketErrno GetErrno() const =0
Get last error number.
bool IsManualIpTtl() const
Checks if the socket has a specific IPv4 TTL set.
void SetIpTos(uint8_t ipTos)
Manually set IP Type of Service field.
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 m_manualIpv6HopLimit
socket has IPv6 Hop Limit set
Callback< bool, Ptr< Socket >, const Address & > m_connectionRequest
connection request callback
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
void SetRecvPktInfo(bool flag)
Enable/Disable receive packet information to socket.
void NotifySend(uint32_t spaceAvailable)
Notify through the callback (if set) that some data have been sent.
void NotifyNewConnectionCreated(Ptr< Socket > socket, const Address &from)
Notify through the callback (if set) that a new connection has been created.
virtual uint8_t GetIpTtl() const
Query the value of IP Time to Live field of this socket.
Callback< void, Ptr< Socket > > m_connectionFailed
connection failed callback
static TypeId GetTypeId()
Get the type ID.
void SetAcceptCallback(Callback< bool, Ptr< Socket >, const Address & > connectionRequest, Callback< void, Ptr< Socket >, const Address & > newConnectionCreated)
Accept connection requests from remote hosts.
bool IsRecvPktInfo() const
Get status indicating whether enable/disable packet information to socket.
bool NotifyConnectionRequest(const Address &from)
Notify through the callback (if set) that an incoming connection is being requested by a remote host.
uint8_t m_ipTtl
the socket IPv4 TTL
uint8_t m_ipv6HopLimit
the socket IPv6 Hop Limit
uint8_t GetIpTos() const
Query the value of IP Type of Service of this socket.
virtual uint32_t GetRxAvailable() const =0
Return number of bytes which can be returned from one or multiple calls to Recv.
void SetIpRecvTos(bool ipv4RecvTos)
Tells a socket to pass information about IP Type of Service up the stack.
Ipv6Address m_ipv6MulticastGroupAddress
IPv6 multicast group address.
virtual int ShutdownRecv()=0
bool m_ipRecvTos
socket forwards IPv4 TOS tag to L4
virtual int Bind()=0
Allocate a local IPv4 endpoint for this socket.
virtual int Bind6()=0
Allocate a local IPv6 endpoint for this socket.
SocketType
Enumeration of the possible socket types.
virtual void SetIpv6HopLimit(uint8_t ipHopLimit)
Manually set IPv6 Hop Limit.
uint8_t m_ipv6Tclass
the socket IPv6 Tclass
bool m_recvPktInfo
if the socket should add packet info tags to the packet forwarded to L4.
Callback< void, Ptr< Socket > > m_connectionSucceeded
connection succeeded callback
void SetDataSentCallback(Callback< void, Ptr< Socket >, uint32_t > dataSent)
Notify application when a packet has been sent from transport protocol (non-standard socket call)
virtual int GetPeerName(Address &address) const =0
Get the peer address of a connected socket.
virtual int ShutdownSend()=0
static uint8_t IpTos2Priority(uint8_t ipTos)
Return the priority corresponding to a given TOS value.
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added.
void NotifyErrorClose()
Notify through the callback (if set) that the connection has been closed due to an error.
void NotifyDataRecv()
Notify through the callback (if set) that some data have been received.
void SetPriority(uint8_t priority)
Manually set the socket priority.
bool m_ipv6RecvTclass
socket forwards IPv6 Tclass tag to L4
virtual bool GetAllowBroadcast() const =0
Query whether broadcast datagram transmissions are allowed.
Ipv6MulticastFilterMode
Enumeration of the possible filter of a socket.
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
SocketPriority
Enumeration of the possible socket priorities.
@ NS3_PRIO_INTERACTIVE_BULK
bool m_ipRecvTtl
socket forwards IPv4 TTL tag to L4
virtual int GetSockName(Address &address) const =0
Get socket address.
virtual void Ipv6JoinGroup(Ipv6Address address, Ipv6MulticastFilterMode filterMode, std::vector< Ipv6Address > sourceAddresses)
Joins a IPv6 multicast group.
Callback< void, Ptr< Socket > > m_receivedData
data received callback
void NotifyNormalClose()
Notify through the callback (if set) that the connection has been closed.
bool IsIpv6RecvTclass() const
Ask if the socket is currently passing information about IPv6 Traffic Class up the stack.
bool IsIpv6RecvHopLimit() const
Ask if the socket is currently passing information about IPv6 Hop Limit up the stack.
virtual uint8_t GetIpv6HopLimit() const
Query the value of IP Hop Limit field of this socket.
void SetCloseCallbacks(Callback< void, Ptr< Socket > > normalClose, Callback< void, Ptr< Socket > > errorClose)
Detect socket recv() events such as graceful shutdown or error.
bool m_manualIpv6Tclass
socket has IPv6 Tclass set
Callback< void, Ptr< Socket >, const Address & > m_newConnectionCreated
connection created callback
bool m_manualIpTtl
socket has IPv4 TTL set
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
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...
Callback< void, Ptr< Socket >, uint32_t > m_dataSent
data sent callback
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
virtual int Close()=0
Close a socket.
SocketErrno
Enumeration of the possible errors returned by a socket.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
bool IsIpRecvTos() const
Ask if the socket is currently passing information about IP Type of Service up the stack.
Callback< void, Ptr< Socket >, uint32_t > m_sendCb
packet sent callback
void SetIpv6RecvHopLimit(bool ipv6RecvHopLimit)
Tells a socket to pass information about IPv6 Hop Limit up the stack.
virtual Ptr< Node > GetNode() const =0
Return the node this socket is associated with.
void SetIpv6Tclass(int ipTclass)
Manually set IPv6 Traffic Class field.
virtual int Listen()=0
Listen for incoming connections.
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
void NotifyConnectionSucceeded()
Notify through the callback (if set) that the connection has been established.
virtual uint32_t GetTxAvailable() const =0
Returns the number of bytes which can be sent in a single call to Send.
void SetIpRecvTtl(bool ipv4RecvTtl)
Tells a socket to pass information about IP_TTL up the stack.
uint8_t GetPriority() const
Query the priority value of this socket.
void SetIpv6RecvTclass(bool ipv6RecvTclass)
Tells a socket to pass information about IPv6 Traffic Class up the stack.
void DoDispose() override
Destructor implementation.
uint8_t GetIpv6Tclass() const
Query the value of IPv6 Traffic Class field of this socket.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
bool IsManualIpv6HopLimit() const
Checks if the socket has a specific IPv6 Hop Limit set.
Callback< void, Ptr< Socket > > m_errorClose
connection closed due to errors callback
bool IsManualIpv6Tclass() const
Checks if the socket has a specific IPv6 Tclass set.
void NotifyConnectionFailed()
Notify through the callback (if set) that the connection has not been established due to an error.
indicates whether the socket has IP_TOS set.
uint8_t m_ipTos
the TOS carried by the tag
void Serialize(TagBuffer i) const override
static TypeId GetTypeId()
Get the type ID.
uint32_t GetSerializedSize() const override
void SetTos(uint8_t tos)
Set the tag's TOS.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t GetTos() const
Get the tag's TOS.
void Print(std::ostream &os) const override
void Deserialize(TagBuffer i) override
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer.
void SetTtl(uint8_t ttl)
Set the tag's TTL.
void Deserialize(TagBuffer i) override
uint32_t GetSerializedSize() const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Serialize(TagBuffer i) const override
uint8_t GetTtl() const
Get the tag's TTL.
uint8_t m_ttl
the ttl carried by the tag
static TypeId GetTypeId()
Get the type ID.
void Print(std::ostream &os) const override
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
uint32_t GetSerializedSize() const override
uint8_t GetHopLimit() const
Get the tag's Hop Limit.
static TypeId GetTypeId()
Get the type ID.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Serialize(TagBuffer i) const override
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
void Print(std::ostream &os) const override
uint8_t m_hopLimit
the Hop Limit carried by the tag
void Deserialize(TagBuffer i) override
indicates whether the socket has IPV6_TCLASS set.
void Serialize(TagBuffer i) const override
void Print(std::ostream &os) const override
uint8_t GetTclass() const
Get the tag's Tclass.
uint32_t GetSerializedSize() const override
static TypeId GetTypeId()
Get the type ID.
uint8_t m_ipv6Tclass
the Tclass carried by the tag
void Deserialize(TagBuffer i) override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
indicates whether the socket has a priority set.
uint8_t m_priority
the priority carried by the tag
void Print(std::ostream &os) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetSerializedSize() const override
void Deserialize(TagBuffer i) override
static TypeId GetTypeId()
Get the type ID.
uint8_t GetPriority() const
Get the tag's priority.
void SetPriority(uint8_t priority)
Set the tag's priority.
void Serialize(TagBuffer i) const override
indicates whether packets should be sent out with the DF (Don't Fragment) flag set.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
static TypeId GetTypeId()
Get the type ID.
void Enable()
Enables the DF (Don't Fragment) flag.
void Deserialize(TagBuffer i) override
uint32_t GetSerializedSize() const override
void Print(std::ostream &os) const override
SocketSetDontFragmentTag()
void Serialize(TagBuffer i) const override
bool m_dontFragment
DF bit value for outgoing packets.
bool IsEnabled() const
Checks if the DF (Don't Fragment) flag is set.
void Disable()
Disables the DF (Don't Fragment) flag.
tag a set of bytes in a packet
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.