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

#include <unix-stream-socket-fd.h>

+ Inheritance diagram for ns3::UnixStreamSocketFd:
+ Collaboration diagram for ns3::UnixStreamSocketFd:

Public Member Functions

 UnixStreamSocketFd (Ptr< Socket > sock, bool connected=0)
virtual ~UnixStreamSocketFd (void)
- Public Member Functions inherited from ns3::UnixSocketFd
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)

Private Types

enum  State {
  CREATED, LISTENING, CONNECTING, CONNECTED,
  REMOTECLOSED, CLOSING, CLOSED
}

Private Member Functions

virtual int Accept (struct sockaddr *my_addr, socklen_t *addrlen)
virtual bool CanRecv (void) const
virtual bool CanSend (void) const
virtual int Close (void)
void CloseError (Ptr< Socket > sock)
void CloseSuccess (Ptr< Socket > sock)
virtual int Connect (const struct sockaddr *my_addr, socklen_t addrlen)
void ConnectionCreated (Ptr< Socket > sock, const Address &from)
void ConnectionError (Ptr< Socket > sock)
bool ConnectionRequest (Ptr< Socket > sock, const Address &from)
void ConnectionSuccess (Ptr< Socket > sock)
virtual ssize_t DoRecvmsg (struct msghdr *msg, int flags)
virtual ssize_t DoSendmsg (const struct msghdr *msg, int flags)
virtual int Getpeername (struct sockaddr *name, socklen_t *namelen)
virtual bool HangupReceived (void) const
virtual int Listen (int backlog)
void MainSend (int *r, Ptr< Packet > p)
virtual int Poll (PollTable *ptable)
void SetPeerAddress (Address *a)
virtual int Shutdown (int how)

Private Attributes

int m_backlog
std::list< std::pair< Ptr
< Socket >, Address > > 
m_connectionQueue
Address * m_peerAddress
bool m_shutWrite
State m_state

Additional Inherited Members

- Static Public Member Functions inherited from ns3::UnixFd
static TypeId GetTypeId (void)
- Protected Member Functions inherited from ns3::UnixSocketFd
 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 Attributes inherited from ns3::UnixSocketFd
Address m_peekedAddress
Ptr< Packet > m_peekedData
Ptr< Socket > m_socket

Detailed Description

Definition at line 9 of file unix-stream-socket-fd.h.

Member Enumeration Documentation

Enumerator:
CREATED 
LISTENING 
CONNECTING 
CONNECTED 
REMOTECLOSED 
CLOSING 
CLOSED 

Definition at line 15 of file unix-stream-socket-fd.h.

Constructor & Destructor Documentation

ns3::UnixStreamSocketFd::UnixStreamSocketFd ( Ptr< Socket >  sock,
bool  connected = 0 
)

Definition at line 19 of file unix-stream-socket-fd.cc.

References CloseError(), CloseSuccess(), CONNECTED, ConnectionCreated(), ConnectionError(), ConnectionRequest(), ConnectionSuccess(), CREATED, ns3::UnixSocketFd::m_socket, and m_state.

Referenced by Accept().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ns3::UnixStreamSocketFd::~UnixStreamSocketFd ( void  )
virtual

Definition at line 35 of file unix-stream-socket-fd.cc.

References ns3::UnixSocketFd::ClearSocket(), and SetPeerAddress().

+ Here is the call graph for this function:

Member Function Documentation

bool ns3::UnixStreamSocketFd::CanRecv ( void  ) const
privatevirtual

Definition at line 356 of file unix-stream-socket-fd.cc.

References CLOSED, CLOSING, CONNECTED, CONNECTING, CREATED, LISTENING, m_connectionQueue, ns3::UnixSocketFd::m_socket, m_state, and REMOTECLOSED.

Referenced by Poll().

+ Here is the caller graph for this function:

bool ns3::UnixStreamSocketFd::CanSend ( void  ) const
privatevirtual

Definition at line 399 of file unix-stream-socket-fd.cc.

References ns3::UnixSocketFd::m_socket.

Referenced by Poll().

+ Here is the caller graph for this function:

int ns3::UnixStreamSocketFd::Close ( void  )
privatevirtual

Definition at line 651 of file unix-stream-socket-fd.cc.

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

+ Here is the call graph for this function:

void ns3::UnixStreamSocketFd::CloseError ( Ptr< Socket >  sock)
private

Definition at line 504 of file unix-stream-socket-fd.cc.

References m_state.

Referenced by Connect(), and UnixStreamSocketFd().

+ Here is the caller graph for this function:

void ns3::UnixStreamSocketFd::CloseSuccess ( Ptr< Socket >  sock)
private

Definition at line 488 of file unix-stream-socket-fd.cc.

References CLOSED, CLOSING, m_state, REMOTECLOSED, SetPeerAddress(), and ns3::UnixFd::WakeWaiters().

Referenced by Connect(), and UnixStreamSocketFd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UnixStreamSocketFd::ConnectionCreated ( Ptr< Socket >  sock,
const Address &  from 
)
private

Definition at line 416 of file unix-stream-socket-fd.cc.

References m_backlog, m_connectionQueue, and ns3::UnixFd::WakeWaiters().

Referenced by Connect(), and UnixStreamSocketFd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UnixStreamSocketFd::ConnectionError ( Ptr< Socket >  sock)
private

Definition at line 477 of file unix-stream-socket-fd.cc.

References CONNECTING, CREATED, m_state, and ns3::UnixFd::WakeWaiters().

Referenced by Connect(), and UnixStreamSocketFd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::UnixStreamSocketFd::ConnectionRequest ( Ptr< Socket >  sock,
const Address &  from 
)
private

Definition at line 409 of file unix-stream-socket-fd.cc.

References m_backlog, and m_connectionQueue.

Referenced by Connect(), and UnixStreamSocketFd().

+ Here is the caller graph for this function:

void ns3::UnixStreamSocketFd::ConnectionSuccess ( Ptr< Socket >  sock)
private

Definition at line 461 of file unix-stream-socket-fd.cc.

References CONNECTED, CONNECTING, m_state, SetPeerAddress(), and ns3::UnixFd::WakeWaiters().

Referenced by Connect(), and UnixStreamSocketFd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::UnixStreamSocketFd::Getpeername ( struct sockaddr *  name,
socklen_t *  namelen 
)
privatevirtual

Definition at line 598 of file unix-stream-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, m_peerAddress, and ns3::UnixSocketFd::Ns3AddressToPosixAddress().

+ Here is the call graph for this function:

bool ns3::UnixStreamSocketFd::HangupReceived ( void  ) const
privatevirtual

Definition at line 404 of file unix-stream-socket-fd.cc.

Referenced by Poll().

+ Here is the caller graph for this function:

int ns3::UnixStreamSocketFd::Listen ( int  backlog)
privatevirtual

Definition at line 275 of file unix-stream-socket-fd.cc.

References ns3::Current(), ns3::Thread::err, ns3::UnixSocketFd::ErrnoToSimuErrno(), LISTENING, m_backlog, ns3::UnixSocketFd::m_socket, and m_state.

+ Here is the call graph for this function:

void ns3::UnixStreamSocketFd::MainSend ( int *  r,
Ptr< Packet >  p 
)
private

Callback used to call the socket send using the main thread.

Definition at line 146 of file unix-stream-socket-fd.cc.

References ns3::UnixSocketFd::m_socket.

Referenced by DoSendmsg().

+ Here is the caller graph for this function:

int ns3::UnixStreamSocketFd::Poll ( PollTable ptable)
privatevirtual

Definition at line 616 of file unix-stream-socket-fd.cc.

References CanRecv(), CanSend(), HangupReceived(), and ns3::PollTable::PollWait().

+ Here is the call graph for this function:

void ns3::UnixStreamSocketFd::SetPeerAddress ( Address *  a)
private

Definition at line 641 of file unix-stream-socket-fd.cc.

References m_peerAddress.

Referenced by Accept(), CloseSuccess(), Connect(), ConnectionSuccess(), and ~UnixStreamSocketFd().

+ Here is the caller graph for this function:

int ns3::UnixStreamSocketFd::Shutdown ( int  how)
privatevirtual

Definition at line 426 of file unix-stream-socket-fd.cc.

References CLOSED, ns3::Current(), ns3::Thread::err, ns3::UnixSocketFd::ErrnoToSimuErrno(), m_shutWrite, ns3::UnixSocketFd::m_socket, and m_state.

+ Here is the call graph for this function:

Member Data Documentation

int ns3::UnixStreamSocketFd::m_backlog
private

Definition at line 54 of file unix-stream-socket-fd.h.

Referenced by ConnectionCreated(), ConnectionRequest(), and Listen().

std::list<std::pair<Ptr<Socket>,Address> > ns3::UnixStreamSocketFd::m_connectionQueue
private

Definition at line 53 of file unix-stream-socket-fd.h.

Referenced by Accept(), CanRecv(), ConnectionCreated(), and ConnectionRequest().

Address* ns3::UnixStreamSocketFd::m_peerAddress
private

Definition at line 56 of file unix-stream-socket-fd.h.

Referenced by Getpeername(), and SetPeerAddress().

bool ns3::UnixStreamSocketFd::m_shutWrite
private

Definition at line 57 of file unix-stream-socket-fd.h.

Referenced by DoSendmsg(), and Shutdown().


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