21 #ifndef PACKET_SOCKET_H
22 #define PACKET_SOCKET_H
26 #include "ns3/callback.h"
27 #include "ns3/traced-callback.h"
29 #include "ns3/socket.h"
30 #include "ns3/net-device.h"
37 class PacketSocketAddress;
81 static TypeId GetTypeId (
void);
88 virtual enum SocketErrno
GetErrno (
void)
const;
91 virtual int Bind (
void);
92 virtual int Bind6 (
void);
94 virtual int Close (
void);
125 enum SocketErrno m_errno;
130 bool m_isSingleDevice;
135 uint32_t m_rxAvailable;
140 uint32_t m_rcvBufSize;
176 static TypeId GetTypeId (
void);
181 virtual void Print (std::ostream &os)
const;
184 std::string m_deviceName;
209 static TypeId GetTypeId (
void);
214 virtual void Print (std::ostream &os)
const;
217 std::string m_deviceName;
virtual enum SocketErrno GetErrno(void) const
Address GetDestAddress(void) const
Ptr< Packet > Recv(void)
Read a single packet from the socket.
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
std::queue< Ptr< Packet > > m_deliveryQueue
Default destination address.
an address for a packet socket
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 void DoDispose(void)
A PacketSocket is a link between an application and a net device.
virtual uint32_t GetSerializedSize(void) const
void SetPacketType(NetDevice::PacketType t)
virtual int Bind(void)
Allocate a local IPv4 endpoint for this socket.
virtual void Print(std::ostream &os) const
virtual int GetSockName(Address &address) const
a polymophic address class
virtual TypeId GetInstanceTypeId(void) const
virtual void Serialize(TagBuffer i) const
A low-level Socket API based loosely on the BSD Socket API.A few things to keep in mind about this ty...
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed.
void SetDestAddress(Address a)
virtual int ShutdownRecv(void)
virtual void Deserialize(TagBuffer i)
virtual uint32_t GetSerializedSize(void) const
virtual Ptr< Node > GetNode(void) const
virtual int Listen(void)
Listen for incoming connections.
virtual uint32_t GetRxAvailable(void) const
tag a set of bytes in a packet
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)
Send data to a specified peer.
This class implements a tag that carries the ns3 device name from where a packet is coming...
virtual bool GetAllowBroadcast() const
Query whether broadcast datagram transmissions are allowed.
virtual void Deserialize(TagBuffer i)
virtual int Close(void)
Close a socket.
virtual uint32_t GetTxAvailable(void) const
Returns the number of bytes which can be sent in a single call to Send.
virtual void Serialize(TagBuffer i) const
NetDevice::PacketType GetPacketType(void) const
virtual void Print(std::ostream &os) const
virtual TypeId GetInstanceTypeId(void) const
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
virtual int Bind6(void)
Allocate a local IPv6 endpoint for this socket.
std::string GetDeviceName(void) const
This class implements a tag that carries the dest address of a packet and the packet type...
virtual int ShutdownSend(void)
a unique identifier for an interface.
virtual enum SocketType GetSocketType(void) const
void SetDeviceName(std::string n)