ns-3 Direct Code Execution
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ns3::UnixSocketFd Class Reference

#include <unix-socket-fd.h>

+ Inheritance diagram for ns3::UnixSocketFd:
+ Collaboration diagram for ns3::UnixSocketFd:

Public Member Functions

virtual ~UnixSocketFd ()
virtual int Bind (const struct sockaddr *my_addr, socklen_t addrlen)
virtual bool CanRecv (void) const =0
virtual bool CanSend (void) const =0
virtual int Close (void)
virtual int Connect (const struct sockaddr *my_addr, socklen_t addrlen)
virtual int Ftruncate (off_t length)
virtual int Fxstat (int ver, struct stat *buf)
virtual int Fxstat64 (int ver, struct stat64 *buf)
virtual int Getpeername (struct sockaddr *name, socklen_t *namelen)
virtual int Getsockname (struct sockaddr *name, socklen_t *namelen)
virtual int Getsockopt (int level, int optname, void *optval, socklen_t *optlen)
virtual int Gettime (struct itimerspec *cur_value) const
virtual int Ioctl (int request, char *argp)
virtual bool Isatty (void) const
virtual off64_t Lseek (off64_t offset, int whence)
virtual void * Mmap (void *start, size_t length, int prot, int flags, off64_t offset)
virtual ssize_t Read (void *buf, size_t count)
virtual ssize_t Recvmsg (struct msghdr *msg, int flags)
virtual ssize_t Sendmsg (const struct msghdr *msg, int flags)
virtual int Setsockopt (int level, int optname, const void *optval, socklen_t optlen)
virtual int Settime (int flags, const struct itimerspec *new_value, struct itimerspec *old_value)
virtual ssize_t Write (const void *buf, size_t count)
- Public Member Functions inherited from ns3::UnixFd
virtual int Accept (struct sockaddr *my_addr, socklen_t *addrlen)=0
void DecFdCount (void)
virtual int Fcntl (int cmd, unsigned long arg)
virtual int Fxstat (int ver, struct::stat *buf)=0
virtual int Fxstat64 (int ver, struct::stat64 *buf)=0
int GetFdCount (void) const
virtual int GetRealFd (void) const
virtual bool HangupReceived (void) const =0
void IncFdCount (void)
virtual int Listen (int backlog)=0
virtual int Poll (PollTable *ptable)=0
virtual int Shutdown (int how)=0
virtual char * Ttyname (void)

Protected Member Functions

 UnixSocketFd (Ptr< Socket > sock)
void AddPeekedData (const uint8_t *buf, uint32_t count, Address from)
void AddPeekedData (Ptr< Packet > p)
void ChangeSocket (Ptr< Socket > socket)
void ClearSocket (void)
int ErrnoToSimuErrno (void) const
Address GetPeekedFrom (void)
Time GetRecvTimeout (void)
Time GetSendTimeout (void)
bool isPeekedData (void)
bool IsRecvErr (void) const
bool IsRecvTtl (void) const
int Ns3AddressToDeviceIndependantPhysicalLayerAddress (const Address &nsaddr, const Packet &pac, struct sockaddr_ll *addr, socklen_t *addrlen) const
int Ns3AddressToPosixAddress (const Address &nsaddr, struct sockaddr *addr, socklen_t *addrlen) const
Address PosixAddressToNs3Address (const struct sockaddr *my_addr, socklen_t addrlen) const
bool WaitRecvDoSignal (bool blocking)
- Protected Member Functions inherited from ns3::UnixFd
 UnixFd ()
void AddWaitQueue (WaitQueueEntry *, bool andRegister)
void RemoveWaitQueue (WaitQueueEntry *, bool andUnregister)
void WakeWaiters (void *key)

Protected Attributes

Address m_peekedAddress
Ptr< Packet > m_peekedData
Ptr< Socket > m_socket
- Protected Attributes inherited from ns3::UnixFd
int m_fdFlags
int m_statusFlags

Private Member Functions

virtual ssize_t DoRecvmsg (struct msghdr *msg, int flags)=0
virtual ssize_t DoSendmsg (const struct msghdr *msg, int flags)=0
void MainClose (int *r)
void MainConnect (int *r, Address adr)
void RecvSocketData (Ptr< Socket > socket)
void SendSocketData (Ptr< Socket > socket, uint32_t available)

Private Attributes

int m_recverr
Time m_recvTimeout
int m_recvttl
Time m_sendTimeout

Additional Inherited Members

- Static Public Member Functions inherited from ns3::UnixFd
static TypeId GetTypeId (void)

Detailed Description

Definition at line 42 of file unix-socket-fd.h.

Constructor & Destructor Documentation

ns3::UnixSocketFd::~UnixSocketFd ( )
virtual

Definition at line 65 of file unix-socket-fd.cc.

References ClearSocket().

+ Here is the call graph for this function:

ns3::UnixSocketFd::UnixSocketFd ( Ptr< Socket >  sock)
protected

Definition at line 54 of file unix-socket-fd.cc.

References m_socket, RecvSocketData(), and SendSocketData().

+ Here is the call graph for this function:

Member Function Documentation

void ns3::UnixSocketFd::AddPeekedData ( const uint8_t *  buf,
uint32_t  count,
Address  from 
)
protected

Definition at line 1037 of file unix-socket-fd.cc.

References m_peekedAddress, and m_peekedData.

Referenced by ns3::UnixStreamSocketFd::DoRecvmsg().

+ Here is the caller graph for this function:

void ns3::UnixSocketFd::AddPeekedData ( Ptr< Packet >  p)
protected

Definition at line 1052 of file unix-socket-fd.cc.

References m_peekedData.

int ns3::UnixSocketFd::Bind ( const struct sockaddr *  my_addr,
socklen_t  addrlen 
)
virtual

Implements ns3::UnixFd.

Definition at line 788 of file unix-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, ErrnoToSimuErrno(), m_socket, and PosixAddressToNs3Address().

+ Here is the call graph for this function:

virtual bool ns3::UnixSocketFd::CanRecv ( void  ) const
pure virtual

Referenced by WaitRecvDoSignal().

+ Here is the caller graph for this function:

virtual bool ns3::UnixSocketFd::CanSend ( void  ) const
pure virtual
void ns3::UnixSocketFd::ChangeSocket ( Ptr< Socket >  socket)
protected

Definition at line 957 of file unix-socket-fd.cc.

References ClearSocket(), m_socket, RecvSocketData(), and SendSocketData().

Referenced by ns3::UnixStreamSocketFd::Connect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UnixSocketFd::ClearSocket ( void  )
protected

Definition at line 936 of file unix-socket-fd.cc.

References m_socket.

Referenced by ChangeSocket(), Close(), ~UnixSocketFd(), and ns3::UnixStreamSocketFd::~UnixStreamSocketFd().

+ Here is the caller graph for this function:

int ns3::UnixSocketFd::Close ( void  )
virtual

Closing a socket while another thread is doing blocking IO on it at the same time is valid behavior according to POSIX. The traditional UNIX semantics are to not wakeup the blocked IO if it was a read but to wakeup blocked IO if it was a write. So, m_readWaiter might well be != 0 here but we don't care. Instead, we check wakeup writers

Implements ns3::UnixFd.

Definition at line 158 of file unix-socket-fd.cc.

References ClearSocket(), ns3::Current(), ns3::Thread::err, ErrnoToSimuErrno(), ns3::TaskManager::ExecOnMain(), m_socket, MainClose(), and ns3::UnixFd::WakeWaiters().

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Connect ( const struct sockaddr *  my_addr,
socklen_t  addrlen 
)
virtual

Implements ns3::UnixFd.

Definition at line 808 of file unix-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, ErrnoToSimuErrno(), ns3::TaskManager::ExecOnMain(), MainConnect(), and PosixAddressToNs3Address().

+ Here is the call graph for this function:

virtual ssize_t ns3::UnixSocketFd::DoRecvmsg ( struct msghdr *  msg,
int  flags 
)
privatepure virtual

Referenced by Recvmsg().

+ Here is the caller graph for this function:

virtual ssize_t ns3::UnixSocketFd::DoSendmsg ( const struct msghdr *  msg,
int  flags 
)
privatepure virtual

Referenced by Sendmsg().

+ Here is the caller graph for this function:

int ns3::UnixSocketFd::ErrnoToSimuErrno ( void  ) const
protected
int ns3::UnixSocketFd::Ftruncate ( off_t  length)
virtual

Implements ns3::UnixFd.

Definition at line 1026 of file unix-socket-fd.cc.

References ns3::Current(), and ns3::Thread::err.

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Fxstat ( int  ver,
struct stat *  buf 
)
virtual

Definition at line 80 of file unix-socket-fd.cc.

References ns3::Current().

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Fxstat64 ( int  ver,
struct stat64 *  buf 
)
virtual

Definition at line 90 of file unix-socket-fd.cc.

References ns3::Current().

+ Here is the call graph for this function:

Address ns3::UnixSocketFd::GetPeekedFrom ( void  )
protected

Definition at line 1069 of file unix-socket-fd.cc.

References m_peekedAddress.

Referenced by ns3::UnixStreamSocketFd::DoRecvmsg().

+ Here is the caller graph for this function:

int ns3::UnixSocketFd::Getpeername ( struct sockaddr *  name,
socklen_t *  namelen 
)
virtual

Implements ns3::UnixFd.

Definition at line 667 of file unix-socket-fd.cc.

Time ns3::UnixSocketFd::GetRecvTimeout ( void  )
protected

Definition at line 904 of file unix-socket-fd.cc.

References m_recvTimeout.

Referenced by ns3::UnixStreamSocketFd::Accept(), and ns3::UnixStreamSocketFd::Connect().

+ Here is the caller graph for this function:

Time ns3::UnixSocketFd::GetSendTimeout ( void  )
protected

Definition at line 909 of file unix-socket-fd.cc.

References m_sendTimeout.

Referenced by ns3::UnixStreamSocketFd::DoSendmsg().

+ Here is the caller graph for this function:

int ns3::UnixSocketFd::Getsockname ( struct sockaddr *  name,
socklen_t *  namelen 
)
virtual

Implements ns3::UnixFd.

Definition at line 647 of file unix-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, ErrnoToSimuErrno(), m_socket, and Ns3AddressToPosixAddress().

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Getsockopt ( int  level,
int  optname,
void *  optval,
socklen_t *  optlen 
)
virtual

Implements ns3::UnixFd.

Definition at line 479 of file unix-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, m_recverr, m_recvTimeout, m_recvttl, m_sendTimeout, m_socket, and ns3::UtilsTimeToTimeval().

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Gettime ( struct itimerspec *  cur_value) const
virtual

Implements ns3::UnixFd.

Definition at line 926 of file unix-socket-fd.cc.

References ns3::Current(), and ns3::Thread::err.

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Ioctl ( int  request,
char *  argp 
)
virtual

Implements ns3::UnixFd.

Definition at line 673 of file unix-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, and ns3::UnixFd::m_statusFlags.

+ Here is the call graph for this function:

bool ns3::UnixSocketFd::Isatty ( void  ) const
virtual

Implements ns3::UnixFd.

Definition at line 237 of file unix-socket-fd.cc.

bool ns3::UnixSocketFd::isPeekedData ( void  )
protected

Definition at line 1064 of file unix-socket-fd.cc.

References m_peekedData.

Referenced by ns3::UnixStreamSocketFd::DoRecvmsg().

+ Here is the caller graph for this function:

bool ns3::UnixSocketFd::IsRecvErr ( void  ) const
protected

Definition at line 827 of file unix-socket-fd.cc.

References m_recverr.

Referenced by ns3::UnixDatagramSocketFd::DoRecvmsg(), and ns3::UnixDatagramSocketFd::QueueErr().

+ Here is the caller graph for this function:

bool ns3::UnixSocketFd::IsRecvTtl ( void  ) const
protected

Definition at line 832 of file unix-socket-fd.cc.

References m_recvttl.

Referenced by ns3::UnixDatagramSocketFd::DoRecvmsg().

+ Here is the caller graph for this function:

off64_t ns3::UnixSocketFd::Lseek ( off64_t  offset,
int  whence 
)
virtual

Implements ns3::UnixFd.

Definition at line 852 of file unix-socket-fd.cc.

References ns3::Current(), and ns3::Thread::err.

+ Here is the call graph for this function:

void ns3::UnixSocketFd::MainClose ( int *  r)
private

Definition at line 153 of file unix-socket-fd.cc.

References m_socket.

Referenced by Close().

+ Here is the caller graph for this function:

void ns3::UnixSocketFd::MainConnect ( int *  r,
Address  adr 
)
private

Definition at line 803 of file unix-socket-fd.cc.

References m_socket.

Referenced by Connect().

+ Here is the caller graph for this function:

void * ns3::UnixSocketFd::Mmap ( void *  start,
size_t  length,
int  prot,
int  flags,
off64_t  offset 
)
virtual

Implements ns3::UnixFd.

Definition at line 71 of file unix-socket-fd.cc.

References ns3::Current(), and ns3::Thread::err.

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Ns3AddressToDeviceIndependantPhysicalLayerAddress ( const Address &  nsaddr,
const Packet &  pac,
struct sockaddr_ll *  addr,
socklen_t *  addrlen 
) const
protected

Definition at line 967 of file unix-socket-fd.cc.

Referenced by ns3::UnixDatagramSocketFd::DoRecvmsg().

+ Here is the caller graph for this function:

int ns3::UnixSocketFd::Ns3AddressToPosixAddress ( const Address &  nsaddr,
struct sockaddr *  addr,
socklen_t *  addrlen 
) const
protected
Address ns3::UnixSocketFd::PosixAddressToNs3Address ( const struct sockaddr *  my_addr,
socklen_t  addrlen 
) const
protected

Definition at line 700 of file unix-socket-fd.cc.

Referenced by Bind(), ns3::UnixStreamSocketFd::Connect(), Connect(), and ns3::UnixDatagramSocketFd::DoSendmsg().

+ Here is the caller graph for this function:

ssize_t ns3::UnixSocketFd::Read ( void *  buf,
size_t  count 
)
virtual

Implements ns3::UnixFd.

Definition at line 205 of file unix-socket-fd.cc.

References Recvmsg().

+ Here is the call graph for this function:

ssize_t ns3::UnixSocketFd::Recvmsg ( struct msghdr *  msg,
int  flags 
)
virtual

Implements ns3::UnixFd.

Definition at line 222 of file unix-socket-fd.cc.

References DoRecvmsg(), and ns3::UnixFd::m_statusFlags.

Referenced by Read().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UnixSocketFd::RecvSocketData ( Ptr< Socket >  socket)
private

Definition at line 137 of file unix-socket-fd.cc.

References m_socket, and ns3::UnixFd::WakeWaiters().

Referenced by ChangeSocket(), and UnixSocketFd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t ns3::UnixSocketFd::Sendmsg ( const struct msghdr *  msg,
int  flags 
)
virtual

Implements ns3::UnixFd.

Definition at line 229 of file unix-socket-fd.cc.

References DoSendmsg(), and ns3::UnixFd::m_statusFlags.

Referenced by Write().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UnixSocketFd::SendSocketData ( Ptr< Socket >  socket,
uint32_t  available 
)
private

Definition at line 145 of file unix-socket-fd.cc.

References m_socket, and ns3::UnixFd::WakeWaiters().

Referenced by ChangeSocket(), and UnixSocketFd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::UnixSocketFd::Setsockopt ( int  level,
int  optname,
const void *  optval,
socklen_t  optlen 
)
virtual

Implements ns3::UnixFd.

Definition at line 243 of file unix-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, m_recverr, m_recvTimeout, m_recvttl, m_sendTimeout, m_socket, and ns3::UtilsTimevalToTime().

+ Here is the call graph for this function:

int ns3::UnixSocketFd::Settime ( int  flags,
const struct itimerspec *  new_value,
struct itimerspec *  old_value 
)
virtual

Implements ns3::UnixFd.

Definition at line 915 of file unix-socket-fd.cc.

References ns3::Current(), and ns3::Thread::err.

+ Here is the call graph for this function:

bool ns3::UnixSocketFd::WaitRecvDoSignal ( bool  blocking)
protected
ssize_t ns3::UnixSocketFd::Write ( const void *  buf,
size_t  count 
)
virtual

Implements ns3::UnixFd.

Definition at line 188 of file unix-socket-fd.cc.

References Sendmsg().

+ Here is the call graph for this function:

Member Data Documentation

Address ns3::UnixSocketFd::m_peekedAddress
protected

Definition at line 101 of file unix-socket-fd.h.

Referenced by AddPeekedData(), and GetPeekedFrom().

Ptr<Packet> ns3::UnixSocketFd::m_peekedData
protected
int ns3::UnixSocketFd::m_recverr
private

Definition at line 118 of file unix-socket-fd.h.

Referenced by Getsockopt(), IsRecvErr(), and Setsockopt().

Time ns3::UnixSocketFd::m_recvTimeout
private

Definition at line 116 of file unix-socket-fd.h.

Referenced by GetRecvTimeout(), Getsockopt(), Setsockopt(), and WaitRecvDoSignal().

int ns3::UnixSocketFd::m_recvttl
private

Definition at line 117 of file unix-socket-fd.h.

Referenced by Getsockopt(), IsRecvTtl(), and Setsockopt().

Time ns3::UnixSocketFd::m_sendTimeout
private

Definition at line 115 of file unix-socket-fd.h.

Referenced by GetSendTimeout(), Getsockopt(), and Setsockopt().


The documentation for this class was generated from the following files: