26 #include "ns3/callback.h"
29 #include "ns3/object.h"
30 #include "ns3/net-device.h"
33 #include "ns3/inet-socket-address.h"
34 #include "ns3/inet6-socket-address.h"
69 static TypeId GetTypeId (
void);
114 virtual enum Socket::SocketErrno
GetErrno (
void)
const = 0;
118 virtual enum Socket::SocketType
GetSocketType (
void)
const = 0;
172 const Address &> connectionRequest,
174 const Address&> newConnectionCreated);
219 virtual int Bind () = 0;
226 virtual int Bind6 () = 0;
235 virtual int Close (
void) = 0;
263 virtual int Listen (
void) = 0;
450 int Send (
const uint8_t* buf, uint32_t size, uint32_t flags);
469 int SendTo (
const uint8_t* buf, uint32_t size, uint32_t flags,
497 int Recv (uint8_t* buf, uint32_t size, uint32_t flags);
531 int RecvFrom (uint8_t* buf, uint32_t size, uint32_t flags,
627 void SetIpTos (uint8_t ipTos);
637 uint8_t GetIpTos (
void)
const;
672 void SetIpv6Tclass (
int ipTclass);
682 uint8_t GetIpv6Tclass (
void)
const;
715 virtual void SetIpTtl (uint8_t ipTtl);
725 virtual uint8_t GetIpTtl (
void)
const;
758 virtual void SetIpv6HopLimit (uint8_t ipHopLimit);
768 virtual uint8_t GetIpv6HopLimit (
void)
const;
794 void NotifyConnectionSucceeded (
void);
795 void NotifyConnectionFailed (
void);
796 void NotifyNormalClose (
void);
797 void NotifyErrorClose (
void);
798 bool NotifyConnectionRequest (
const Address &from);
800 void NotifyDataSent (uint32_t size);
801 void NotifySend (uint32_t spaceAvailable);
802 void NotifyDataRecv (
void);
805 bool IsManualIpTos (
void)
const;
806 bool IsManualIpv6Tclass (
void)
const;
807 bool IsManualIpTtl (
void)
const;
808 bool IsManualIpv6HopLimit (
void)
const;
834 bool m_manualIpv6Tclass;
835 bool m_manualIpv6HopLimit;
836 bool m_ipv6RecvTclass;
837 bool m_ipv6RecvHopLimit;
839 uint8_t m_ipv6Tclass;
840 uint8_t m_ipv6HopLimit;
851 void SetAddress (
Address addr);
852 Address GetAddress (
void)
const;
854 static TypeId GetTypeId (
void);
859 virtual void Print (std::ostream &os)
const;
873 void SetTtl (uint8_t ttl);
874 uint8_t GetTtl (
void)
const;
876 static TypeId GetTypeId (
void);
881 virtual void Print (std::ostream &os)
const;
895 void SetHopLimit (uint8_t hopLimit);
896 uint8_t GetHopLimit (
void)
const;
898 static TypeId GetTypeId (
void);
903 virtual void Print (std::ostream &os)
const;
919 bool IsEnabled (
void)
const;
921 static TypeId GetTypeId (
void);
926 virtual void Print (std::ostream &os)
const;
939 void SetTos (uint8_t tos);
940 uint8_t GetTos (
void)
const;
942 static TypeId GetTypeId (
void);
947 virtual void Print (std::ostream &os)
const;
960 void SetTclass (uint8_t tclass);
961 uint8_t GetTclass (
void)
const;
963 static TypeId GetTypeId (
void);
968 virtual void Print (std::ostream &os)
const;
970 uint8_t m_ipv6Tclass;
virtual void Serialize(TagBuffer i) const
virtual void Print(std::ostream &os) const
virtual void Print(std::ostream &os) const
bool IsIpv6RecvHopLimit(void) const
Ask if the socket is currently passing information about IPv6 Hop Limit up the stack.
virtual void Deserialize(TagBuffer i)
void SetIpv6RecvTclass(bool ipv6RecvTclass)
Tells a socket to pass information about IPv6 Traffic Class up the stack.
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer...
virtual int Bind6()=0
Allocate a local IPv6 endpoint for this socket.
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
virtual uint32_t GetSerializedSize(void) const
virtual int ShutdownSend(void)=0
Ptr< Packet > Recv(void)
Read a single packet from the socket.
virtual void Serialize(TagBuffer i) const
virtual void Deserialize(TagBuffer i)
virtual int GetSockName(Address &address) const =0
virtual int ShutdownRecv(void)=0
void SetIpRecvTos(bool ipv4RecvTos)
Tells a socket to pass information about IP Type of Service up the stack.
virtual TypeId GetInstanceTypeId(void) const
virtual TypeId GetInstanceTypeId(void) const
void SetCloseCallbacks(Callback< void, Ptr< Socket > > normalClose, Callback< void, Ptr< Socket > > errorClose)
Detect socket recv() events such as graceful shutdown or error.
virtual void Serialize(TagBuffer i) const
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
virtual void Print(std::ostream &os) const
bool IsRecvPktInfo() const
Get status indicating whether enable/disable packet information to socket.
virtual enum Socket::SocketErrno GetErrno(void) const =0
a polymophic address class
virtual int Listen(void)=0
Listen for incoming connections.
bool IsIpRecvTos(void) const
Ask if the socket is currently passing information about IP Type of Service up the stack...
void SetRecvPktInfo(bool flag)
Enable/Disable receive packet information to socket.
Ptr< NetDevice > GetBoundNetDevice()
Returns socket's bound netdevice, if any.
A low-level Socket API based loosely on the BSD Socket API.A few things to keep in mind about this ty...
virtual int Bind()=0
Allocate a local IPv4 endpoint for this socket.
This class implements a tag that carries an address of a packet across the socket interface...
virtual bool GetAllowBroadcast() const =0
Query whether broadcast datagram transmissions are allowed.
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)
virtual void Print(std::ostream &os) const
virtual enum Socket::SocketType GetSocketType(void) const =0
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual uint32_t GetSerializedSize(void) const
tag a set of bytes in a packet
virtual void Serialize(TagBuffer i) const
virtual uint32_t GetSerializedSize(void) const
virtual TypeId GetInstanceTypeId(void) const
virtual void Deserialize(TagBuffer i)
bool IsIpv6RecvTclass(void) const
Ask if the socket is currently passing information about IPv6 Traffic Class up the stack...
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added.
void SetAcceptCallback(Callback< bool, Ptr< Socket >, const Address & > connectionRequest, Callback< void, Ptr< Socket >, const Address & > newConnectionCreated)
Accept connection requests from remote hosts.
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
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 void DoDispose(void)
bool IsIpRecvTtl(void) const
Ask if the socket is currently passing information about IP_TTL up the stack.
void SetIpv6RecvHopLimit(bool ipv6RecvHopLimit)
Tells a socket to pass information about IPv6 Hop Limit up the stack.
virtual uint32_t GetSerializedSize(void) const
virtual TypeId GetInstanceTypeId(void) const
virtual void Serialize(TagBuffer i) const
virtual Ptr< Node > GetNode(void) const =0
virtual void Print(std::ostream &os) const
virtual void Deserialize(TagBuffer i)
indicated whether packets should be sent out with the DF flag set.
virtual void Serialize(TagBuffer i) const
void SetIpRecvTtl(bool ipv4RecvTtl)
Tells a socket to pass information about IP_TTL up the stack.
virtual void Deserialize(TagBuffer i)
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
virtual void Deserialize(TagBuffer i)
virtual void Print(std::ostream &os) const
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.
a base class which provides memory management and object aggregation
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.
virtual uint32_t GetSerializedSize(void) const
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual TypeId GetInstanceTypeId(void) const
virtual int Close(void)=0
Close a socket.
virtual uint32_t GetTxAvailable(void) const =0
Returns the number of bytes which can be sent in a single call to Send.
virtual uint32_t GetSerializedSize(void) const
virtual TypeId GetInstanceTypeId(void) const
a unique identifier for an interface.
virtual uint32_t GetRxAvailable(void) const =0