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

#include <linux-socket-impl.h>

+ Collaboration diagram for ns3::LinuxSocketImpl:

Public Types

typedef Callback< int, const
Address &, struct sockaddr
*, socklen_t * > 
Ns3ToPosixConverter
typedef Callback< Address,
const struct sockaddr
*, socklen_t > 
PosixToNs3Converter

Public Member Functions

 LinuxSocketImpl ()
virtual ~LinuxSocketImpl ()
virtual int Bind (void)
virtual int Bind (const Address &address)
virtual int Bind6 (void)
virtual void BindToNetDevice (Ptr< NetDevice > netdevice)
virtual int Close (void)
virtual int Connect (const Address &address)
void CreateSocket ()
virtual bool GetAllowBroadcast () const
virtual enum SocketErrno GetErrno (void) const
virtual Ptr< Node > GetNode (void) const
virtual uint32_t GetRxAvailable (void) const
virtual enum SocketType GetSocketType (void) const
virtual int GetSockName (Address &address) const
virtual uint32_t GetTxAvailable (void) const
virtual int Listen (void)
virtual int MulticastJoinGroup (uint32_t interfaceIndex, const Address &groupAddress)
virtual int MulticastLeaveGroup (uint32_t interfaceIndex, const Address &groupAddress)
int Ns3AddressToPosixAddress (const Address &nsaddr, struct sockaddr *addr, socklen_t *addrlen)
void Poll ()
Address PosixAddressToNs3Address (const struct sockaddr *my_addr, socklen_t addrlen)
virtual Ptr< Packet > Recv (uint32_t maxSize, uint32_t flags)
virtual Ptr< Packet > RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)
virtual int Send (Ptr< Packet > p, uint32_t flags)
virtual int SendTo (Ptr< Packet > p, uint32_t flags, const Address &address)
virtual bool SetAllowBroadcast (bool allowBroadcast)
virtual void SetNode (Ptr< Node > node)
void SetNs3ToPosixConverter (LinuxSocketImpl::Ns3ToPosixConverter cb)
void SetPosixToNs3Converter (LinuxSocketImpl::PosixToNs3Converter cb)
virtual int ShutdownRecv (void)
virtual int ShutdownSend (void)

Static Public Member Functions

static TypeId GetTypeId (void)

Public Attributes

LinuxSocketFdm_kernsock
Ns3ToPosixConverter m_ns3toposix
PosixToNs3Converter m_posixtons3
Taskm_task

Private Member Functions

uint16_t EnterFakeTask ()
virtual int32_t GetIpMulticastIf (void) const
virtual bool GetIpMulticastLoop (void) const
virtual uint8_t GetIpMulticastTtl (void) const
virtual uint8_t GetIpTtl (void) const
virtual bool GetMtuDiscover (void) const
virtual uint32_t GetRcvBufSize (void) const
void LeaveFakeTask (uint16_t pid)
void ScheduleTask (EventImpl *event)
virtual void SetIpMulticastIf (int32_t ipIf)
virtual void SetIpMulticastLoop (bool loop)
virtual void SetIpMulticastTtl (uint8_t ipTtl)
virtual void SetIpTtl (uint8_t ipTtl)
virtual void SetMtuDiscover (bool discover)
virtual void SetRcvBufSize (uint32_t size)

Static Private Member Functions

static void ScheduleTaskTrampoline (void *context)

Private Attributes

bool m_conn_inprogress
enum SocketErrno m_errno
uint16_t m_family
bool m_listening
Ptr< Node > m_node
uint16_t m_pid
EventId m_poll
uint16_t m_protocol
uint16_t m_socktype

Detailed Description

Definition at line 34 of file linux-socket-impl.h.

Member Typedef Documentation

typedef Callback<int,const Address&,struct sockaddr *,socklen_t *> ns3::LinuxSocketImpl::Ns3ToPosixConverter

Definition at line 76 of file linux-socket-impl.h.

typedef Callback<Address,const struct sockaddr *,socklen_t> ns3::LinuxSocketImpl::PosixToNs3Converter

Definition at line 77 of file linux-socket-impl.h.

Constructor & Destructor Documentation

ns3::LinuxSocketImpl::LinuxSocketImpl ( )

Create an unbound udp socket.

Definition at line 141 of file linux-socket-impl.cc.

References m_conn_inprogress, m_listening, m_pid, Ns3AddressToPosixAddress(), PosixAddressToNs3Address(), SetNs3ToPosixConverter(), and SetPosixToNs3Converter().

+ Here is the call graph for this function:

ns3::LinuxSocketImpl::~LinuxSocketImpl ( )
virtual

Definition at line 151 of file linux-socket-impl.cc.

References GetNode(), and m_poll.

+ Here is the call graph for this function:

Member Function Documentation

int ns3::LinuxSocketImpl::Bind ( void  )
virtual

Definition at line 252 of file linux-socket-impl.cc.

References ns3::LinuxSocketFd::Bind(), EnterFakeTask(), LeaveFakeTask(), and m_kernsock.

+ Here is the call graph for this function:

int ns3::LinuxSocketImpl::Bind ( const Address &  address)
virtual

Definition at line 272 of file linux-socket-impl.cc.

References ns3::LinuxSocketFd::Bind(), EnterFakeTask(), LeaveFakeTask(), m_kernsock, and m_ns3toposix.

+ Here is the call graph for this function:

int ns3::LinuxSocketImpl::Bind6 ( void  )
virtual

Definition at line 262 of file linux-socket-impl.cc.

References ns3::LinuxSocketFd::Bind(), EnterFakeTask(), LeaveFakeTask(), and m_kernsock.

+ Here is the call graph for this function:

void ns3::LinuxSocketImpl::BindToNetDevice ( Ptr< NetDevice >  netdevice)
virtual

Definition at line 500 of file linux-socket-impl.cc.

References ns3::Current(), EnterFakeTask(), LeaveFakeTask(), m_kernsock, and ns3::LinuxSocketFd::Setsockopt().

+ Here is the call graph for this function:

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

Definition at line 300 of file linux-socket-impl.cc.

References ns3::LinuxSocketFd::Close(), EnterFakeTask(), LeaveFakeTask(), and m_kernsock.

+ Here is the call graph for this function:

int ns3::LinuxSocketImpl::Connect ( const Address &  address)
virtual

Definition at line 310 of file linux-socket-impl.cc.

References ns3::LinuxSocketFd::Connect(), ns3::Current(), EnterFakeTask(), LeaveFakeTask(), m_conn_inprogress, m_kernsock, and m_ns3toposix.

+ Here is the call graph for this function:

void ns3::LinuxSocketImpl::CreateSocket ( void  )

Definition at line 659 of file linux-socket-impl.cc.

References EnterFakeTask(), LeaveFakeTask(), m_family, m_kernsock, m_node, m_protocol, m_socktype, Poll(), and ScheduleTask().

+ Here is the call graph for this function:

uint16_t ns3::LinuxSocketImpl::EnterFakeTask ( )
private

Definition at line 224 of file linux-socket-impl.cc.

References GetNode(), and m_pid.

Referenced by Bind(), Bind6(), BindToNetDevice(), Close(), Connect(), CreateSocket(), Listen(), Poll(), RecvFrom(), Send(), and SendTo().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::LinuxSocketImpl::GetAllowBroadcast ( ) const
virtual

Definition at line 755 of file linux-socket-impl.cc.

enum Socket::SocketErrno ns3::LinuxSocketImpl::GetErrno ( void  ) const
virtual

Definition at line 191 of file linux-socket-impl.cc.

References m_errno.

int32_t ns3::LinuxSocketImpl::GetIpMulticastIf ( void  ) const
privatevirtual

Definition at line 721 of file linux-socket-impl.cc.

bool ns3::LinuxSocketImpl::GetIpMulticastLoop ( void  ) const
privatevirtual

Definition at line 732 of file linux-socket-impl.cc.

uint8_t ns3::LinuxSocketImpl::GetIpMulticastTtl ( void  ) const
privatevirtual

Definition at line 710 of file linux-socket-impl.cc.

uint8_t ns3::LinuxSocketImpl::GetIpTtl ( void  ) const
privatevirtual

Definition at line 699 of file linux-socket-impl.cc.

bool ns3::LinuxSocketImpl::GetMtuDiscover ( void  ) const
privatevirtual

Definition at line 743 of file linux-socket-impl.cc.

Ptr< Node > ns3::LinuxSocketImpl::GetNode ( void  ) const
virtual

Definition at line 637 of file linux-socket-impl.cc.

References m_node.

Referenced by EnterFakeTask(), LeaveFakeTask(), Poll(), ScheduleTask(), and ~LinuxSocketImpl().

+ Here is the caller graph for this function:

uint32_t ns3::LinuxSocketImpl::GetRcvBufSize ( void  ) const
privatevirtual

Definition at line 688 of file linux-socket-impl.cc.

uint32_t ns3::LinuxSocketImpl::GetRxAvailable ( void  ) const
virtual

Definition at line 407 of file linux-socket-impl.cc.

enum Socket::SocketType ns3::LinuxSocketImpl::GetSocketType ( void  ) const
virtual

Definition at line 198 of file linux-socket-impl.cc.

References m_socktype.

int ns3::LinuxSocketImpl::GetSockName ( Address &  address) const
virtual

Definition at line 465 of file linux-socket-impl.cc.

uint32_t ns3::LinuxSocketImpl::GetTxAvailable ( void  ) const
virtual

Definition at line 366 of file linux-socket-impl.cc.

TypeId ns3::LinuxSocketImpl::GetTypeId ( void  )
static

Definition at line 120 of file linux-socket-impl.cc.

References m_family, m_protocol, and m_socktype.

void ns3::LinuxSocketImpl::LeaveFakeTask ( uint16_t  pid)
private

Definition at line 241 of file linux-socket-impl.cc.

References GetNode(), m_pid, and ns3::DceManager::SuspendTemporaryTask().

Referenced by Bind(), Bind6(), BindToNetDevice(), Close(), Connect(), CreateSocket(), Listen(), Poll(), RecvFrom(), Send(), and SendTo().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::LinuxSocketImpl::Listen ( void  )
virtual

Definition at line 329 of file linux-socket-impl.cc.

References ns3::Current(), EnterFakeTask(), LeaveFakeTask(), ns3::LinuxSocketFd::Listen(), m_kernsock, and m_listening.

+ Here is the call graph for this function:

int ns3::LinuxSocketImpl::MulticastJoinGroup ( uint32_t  interfaceIndex,
const Address &  groupAddress 
)
virtual

Definition at line 472 of file linux-socket-impl.cc.

int ns3::LinuxSocketImpl::MulticastLeaveGroup ( uint32_t  interfaceIndex,
const Address &  groupAddress 
)
virtual

Definition at line 486 of file linux-socket-impl.cc.

int ns3::LinuxSocketImpl::Ns3AddressToPosixAddress ( const Address &  nsaddr,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

Definition at line 77 of file linux-socket-impl.cc.

Referenced by LinuxSocketImpl().

+ Here is the caller graph for this function:

Address ns3::LinuxSocketImpl::PosixAddressToNs3Address ( const struct sockaddr *  my_addr,
socklen_t  addrlen 
)

Definition at line 49 of file linux-socket-impl.cc.

Referenced by LinuxSocketImpl().

+ Here is the caller graph for this function:

Ptr< Packet > ns3::LinuxSocketImpl::Recv ( uint32_t  maxSize,
uint32_t  flags 
)
virtual

Definition at line 416 of file linux-socket-impl.cc.

Ptr< Packet > ns3::LinuxSocketImpl::RecvFrom ( uint32_t  maxSize,
uint32_t  flags,
Address &  fromAddress 
)
virtual

Definition at line 423 of file linux-socket-impl.cc.

References ns3::Current(), EnterFakeTask(), ns3::LinuxSocketFd::Getpeername(), LeaveFakeTask(), m_kernsock, m_posixtons3, and ns3::LinuxSocketFd::Recvmsg().

+ Here is the call graph for this function:

void ns3::LinuxSocketImpl::ScheduleTask ( EventImpl *  event)
private

Definition at line 174 of file linux-socket-impl.cc.

References ns3::Current(), GetNode(), ScheduleTaskTrampoline(), ns3::Task::SetContext(), ns3::Task::SetExtraContext(), and ns3::Thread::task.

Referenced by CreateSocket(), and Poll().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LinuxSocketImpl::ScheduleTaskTrampoline ( void *  context)
staticprivate

Definition at line 162 of file linux-socket-impl.cc.

References ns3::Current(), ns3::Task::GetExtraContext(), and ns3::Task::SetExtraContext().

Referenced by ScheduleTask().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ns3::LinuxSocketImpl::Send ( Ptr< Packet >  p,
uint32_t  flags 
)
virtual

Definition at line 344 of file linux-socket-impl.cc.

References ns3::Current(), EnterFakeTask(), LeaveFakeTask(), m_kernsock, and ns3::LinuxSocketFd::Write().

+ Here is the call graph for this function:

int ns3::LinuxSocketImpl::SendTo ( Ptr< Packet >  p,
uint32_t  flags,
const Address &  address 
)
virtual

Definition at line 375 of file linux-socket-impl.cc.

References ns3::Current(), EnterFakeTask(), LeaveFakeTask(), m_kernsock, m_ns3toposix, and ns3::LinuxSocketFd::Sendmsg().

+ Here is the call graph for this function:

bool ns3::LinuxSocketImpl::SetAllowBroadcast ( bool  allowBroadcast)
virtual

Definition at line 749 of file linux-socket-impl.cc.

void ns3::LinuxSocketImpl::SetIpMulticastIf ( int32_t  ipIf)
privatevirtual

Definition at line 716 of file linux-socket-impl.cc.

void ns3::LinuxSocketImpl::SetIpMulticastLoop ( bool  loop)
privatevirtual

Definition at line 727 of file linux-socket-impl.cc.

void ns3::LinuxSocketImpl::SetIpMulticastTtl ( uint8_t  ipTtl)
privatevirtual

Definition at line 705 of file linux-socket-impl.cc.

void ns3::LinuxSocketImpl::SetIpTtl ( uint8_t  ipTtl)
privatevirtual

Definition at line 694 of file linux-socket-impl.cc.

void ns3::LinuxSocketImpl::SetMtuDiscover ( bool  discover)
privatevirtual

Definition at line 738 of file linux-socket-impl.cc.

void ns3::LinuxSocketImpl::SetNode ( Ptr< Node >  node)
virtual

Definition at line 629 of file linux-socket-impl.cc.

References m_node.

void ns3::LinuxSocketImpl::SetNs3ToPosixConverter ( LinuxSocketImpl::Ns3ToPosixConverter  cb)

Definition at line 643 of file linux-socket-impl.cc.

References m_ns3toposix.

Referenced by LinuxSocketImpl().

+ Here is the caller graph for this function:

void ns3::LinuxSocketImpl::SetPosixToNs3Converter ( LinuxSocketImpl::PosixToNs3Converter  cb)

Definition at line 651 of file linux-socket-impl.cc.

References m_posixtons3.

Referenced by LinuxSocketImpl().

+ Here is the caller graph for this function:

void ns3::LinuxSocketImpl::SetRcvBufSize ( uint32_t  size)
privatevirtual

Definition at line 683 of file linux-socket-impl.cc.

int ns3::LinuxSocketImpl::ShutdownRecv ( void  )
virtual

Definition at line 293 of file linux-socket-impl.cc.

int ns3::LinuxSocketImpl::ShutdownSend ( void  )
virtual

Definition at line 286 of file linux-socket-impl.cc.

Member Data Documentation

bool ns3::LinuxSocketImpl::m_conn_inprogress
private

Definition at line 112 of file linux-socket-impl.h.

Referenced by Connect(), LinuxSocketImpl(), and Poll().

enum SocketErrno ns3::LinuxSocketImpl::m_errno
private

Definition at line 106 of file linux-socket-impl.h.

Referenced by GetErrno().

uint16_t ns3::LinuxSocketImpl::m_family
private

Definition at line 108 of file linux-socket-impl.h.

Referenced by CreateSocket(), GetTypeId(), and Poll().

LinuxSocketFd* ns3::LinuxSocketImpl::m_kernsock
bool ns3::LinuxSocketImpl::m_listening
private

Definition at line 111 of file linux-socket-impl.h.

Referenced by LinuxSocketImpl(), Listen(), and Poll().

Ptr<Node> ns3::LinuxSocketImpl::m_node
private

Definition at line 107 of file linux-socket-impl.h.

Referenced by CreateSocket(), GetNode(), Poll(), and SetNode().

Ns3ToPosixConverter ns3::LinuxSocketImpl::m_ns3toposix

Definition at line 84 of file linux-socket-impl.h.

Referenced by Bind(), Connect(), SendTo(), and SetNs3ToPosixConverter().

uint16_t ns3::LinuxSocketImpl::m_pid
private

Definition at line 113 of file linux-socket-impl.h.

Referenced by EnterFakeTask(), LeaveFakeTask(), and LinuxSocketImpl().

EventId ns3::LinuxSocketImpl::m_poll
private

Definition at line 114 of file linux-socket-impl.h.

Referenced by ~LinuxSocketImpl().

PosixToNs3Converter ns3::LinuxSocketImpl::m_posixtons3

Definition at line 85 of file linux-socket-impl.h.

Referenced by Poll(), RecvFrom(), and SetPosixToNs3Converter().

uint16_t ns3::LinuxSocketImpl::m_protocol
private

Definition at line 110 of file linux-socket-impl.h.

Referenced by CreateSocket(), GetTypeId(), and Poll().

uint16_t ns3::LinuxSocketImpl::m_socktype
private

Definition at line 109 of file linux-socket-impl.h.

Referenced by CreateSocket(), GetSocketType(), GetTypeId(), and Poll().

Task* ns3::LinuxSocketImpl::m_task

Definition at line 83 of file linux-socket-impl.h.


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