#include <unix-socket-fd.h>
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) |
![]() | |
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) |
![]() | |
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 |
![]() | |
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 TypeId | GetTypeId (void) |
Definition at line 42 of file unix-socket-fd.h.
|
virtual |
Definition at line 65 of file unix-socket-fd.cc.
References ClearSocket().
|
protected |
Definition at line 54 of file unix-socket-fd.cc.
References m_socket, RecvSocketData(), and SendSocketData().
|
protected |
Definition at line 1037 of file unix-socket-fd.cc.
References m_peekedAddress, and m_peekedData.
Referenced by ns3::UnixStreamSocketFd::DoRecvmsg().
|
protected |
Definition at line 1052 of file unix-socket-fd.cc.
References m_peekedData.
|
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().
|
pure virtual |
|
pure virtual |
|
protected |
Definition at line 957 of file unix-socket-fd.cc.
References ClearSocket(), m_socket, RecvSocketData(), and SendSocketData().
Referenced by ns3::UnixStreamSocketFd::Connect().
|
protected |
Definition at line 936 of file unix-socket-fd.cc.
References m_socket.
Referenced by ChangeSocket(), Close(), ~UnixSocketFd(), and ns3::UnixStreamSocketFd::~UnixStreamSocketFd().
|
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().
|
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().
|
privatepure virtual |
|
privatepure virtual |
|
protected |
Definition at line 100 of file unix-socket-fd.cc.
References m_socket.
Referenced by Bind(), Close(), Connect(), ns3::UnixDatagramSocketFd::DoRecvmsg(), ns3::UnixStreamSocketFd::DoRecvmsg(), ns3::UnixDatagramSocketFd::DoSendmsg(), ns3::UnixStreamSocketFd::DoSendmsg(), Getsockname(), ns3::UnixStreamSocketFd::Listen(), and ns3::UnixStreamSocketFd::Shutdown().
|
virtual |
Implements ns3::UnixFd.
Definition at line 1026 of file unix-socket-fd.cc.
References ns3::Current(), and ns3::Thread::err.
|
virtual |
Definition at line 80 of file unix-socket-fd.cc.
References ns3::Current().
|
virtual |
Definition at line 90 of file unix-socket-fd.cc.
References ns3::Current().
|
protected |
Definition at line 1069 of file unix-socket-fd.cc.
References m_peekedAddress.
Referenced by ns3::UnixStreamSocketFd::DoRecvmsg().
|
virtual |
Implements ns3::UnixFd.
Definition at line 667 of file unix-socket-fd.cc.
|
protected |
Definition at line 904 of file unix-socket-fd.cc.
References m_recvTimeout.
Referenced by ns3::UnixStreamSocketFd::Accept(), and ns3::UnixStreamSocketFd::Connect().
|
protected |
Definition at line 909 of file unix-socket-fd.cc.
References m_sendTimeout.
Referenced by ns3::UnixStreamSocketFd::DoSendmsg().
|
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().
|
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().
|
virtual |
Implements ns3::UnixFd.
Definition at line 926 of file unix-socket-fd.cc.
References ns3::Current(), and ns3::Thread::err.
|
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.
|
virtual |
Implements ns3::UnixFd.
Definition at line 237 of file unix-socket-fd.cc.
|
protected |
Definition at line 1064 of file unix-socket-fd.cc.
References m_peekedData.
Referenced by ns3::UnixStreamSocketFd::DoRecvmsg().
|
protected |
Definition at line 827 of file unix-socket-fd.cc.
References m_recverr.
Referenced by ns3::UnixDatagramSocketFd::DoRecvmsg(), and ns3::UnixDatagramSocketFd::QueueErr().
|
protected |
Definition at line 832 of file unix-socket-fd.cc.
References m_recvttl.
Referenced by ns3::UnixDatagramSocketFd::DoRecvmsg().
|
virtual |
Implements ns3::UnixFd.
Definition at line 852 of file unix-socket-fd.cc.
References ns3::Current(), and ns3::Thread::err.
|
private |
Definition at line 153 of file unix-socket-fd.cc.
References m_socket.
Referenced by Close().
|
private |
Definition at line 803 of file unix-socket-fd.cc.
References m_socket.
Referenced by Connect().
|
virtual |
Implements ns3::UnixFd.
Definition at line 71 of file unix-socket-fd.cc.
References ns3::Current(), and ns3::Thread::err.
|
protected |
Definition at line 967 of file unix-socket-fd.cc.
Referenced by ns3::UnixDatagramSocketFd::DoRecvmsg().
|
protected |
Definition at line 736 of file unix-socket-fd.cc.
Referenced by ns3::UnixStreamSocketFd::Accept(), ns3::UnixDatagramSocketFd::DoRecvmsg(), ns3::UnixStreamSocketFd::DoRecvmsg(), ns3::UnixStreamSocketFd::Getpeername(), and Getsockname().
|
protected |
Definition at line 700 of file unix-socket-fd.cc.
Referenced by Bind(), ns3::UnixStreamSocketFd::Connect(), Connect(), and ns3::UnixDatagramSocketFd::DoSendmsg().
|
virtual |
Implements ns3::UnixFd.
Definition at line 205 of file unix-socket-fd.cc.
References Recvmsg().
|
virtual |
Implements ns3::UnixFd.
Definition at line 222 of file unix-socket-fd.cc.
References DoRecvmsg(), and ns3::UnixFd::m_statusFlags.
Referenced by Read().
|
private |
Definition at line 137 of file unix-socket-fd.cc.
References m_socket, and ns3::UnixFd::WakeWaiters().
Referenced by ChangeSocket(), and UnixSocketFd().
|
virtual |
Implements ns3::UnixFd.
Definition at line 229 of file unix-socket-fd.cc.
References DoSendmsg(), and ns3::UnixFd::m_statusFlags.
Referenced by Write().
|
private |
Definition at line 145 of file unix-socket-fd.cc.
References m_socket, and ns3::UnixFd::WakeWaiters().
Referenced by ChangeSocket(), and UnixSocketFd().
|
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().
|
virtual |
Implements ns3::UnixFd.
Definition at line 915 of file unix-socket-fd.cc.
References ns3::Current(), and ns3::Thread::err.
|
protected |
Definition at line 861 of file unix-socket-fd.cc.
References ns3::UnixFd::AddWaitQueue(), CanRecv(), ns3::Current(), ns3::Thread::err, ns3::WaitPoint::INTERRUPTED, m_recvTimeout, ns3::WaitPoint::OK, ns3::UnixFd::RemoveWaitQueue(), ns3::UtilsDoSignal(), and ns3::WaitQueueEntryTimeout::Wait().
Referenced by ns3::UnixDatagramSocketFd::DoRecvmsg(), and ns3::UnixStreamSocketFd::DoRecvmsg().
|
virtual |
Implements ns3::UnixFd.
Definition at line 188 of file unix-socket-fd.cc.
References Sendmsg().
|
protected |
Definition at line 101 of file unix-socket-fd.h.
Referenced by AddPeekedData(), and GetPeekedFrom().
|
protected |
Definition at line 100 of file unix-socket-fd.h.
Referenced by AddPeekedData(), ns3::UnixStreamSocketFd::DoRecvmsg(), and isPeekedData().
|
private |
Definition at line 118 of file unix-socket-fd.h.
Referenced by Getsockopt(), IsRecvErr(), and Setsockopt().
|
private |
Definition at line 116 of file unix-socket-fd.h.
Referenced by GetRecvTimeout(), Getsockopt(), Setsockopt(), and WaitRecvDoSignal().
|
private |
Definition at line 117 of file unix-socket-fd.h.
Referenced by Getsockopt(), IsRecvTtl(), and Setsockopt().
|
private |
Definition at line 115 of file unix-socket-fd.h.
Referenced by GetSendTimeout(), Getsockopt(), and Setsockopt().
|
protected |
Definition at line 96 of file unix-socket-fd.h.
Referenced by Bind(), ns3::UnixDatagramSocketFd::CanRecv(), ns3::UnixStreamSocketFd::CanRecv(), ns3::UnixDatagramSocketFd::CanSend(), ns3::UnixStreamSocketFd::CanSend(), ChangeSocket(), ClearSocket(), Close(), ns3::UnixDatagramSocketFd::DoRecvmsg(), ns3::UnixStreamSocketFd::DoRecvmsg(), ns3::UnixDatagramSocketFd::DoSendmsg(), ns3::UnixStreamSocketFd::DoSendmsg(), ErrnoToSimuErrno(), Getsockname(), Getsockopt(), ns3::UnixStreamSocketFd::Listen(), MainClose(), MainConnect(), ns3::UnixStreamSocketFd::MainSend(), ns3::UnixDatagramSocketFd::MainSendTo(), RecvSocketData(), SendSocketData(), Setsockopt(), ns3::UnixStreamSocketFd::Shutdown(), ns3::UnixDatagramSocketFd::UnixDatagramSocketFd(), UnixSocketFd(), and ns3::UnixStreamSocketFd::UnixStreamSocketFd().