The Pedigree Project 0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
NetworkSyscalls Class Referenceabstract
+ Inheritance diagram for NetworkSyscalls:
+ Collaboration diagram for NetworkSyscalls:

Public Member Functions

 NetworkSyscalls (int domain, int type, int protocol)
 
virtual MqueueNetlinkSocket * asMqueueNetlink ()
 
virtual bool create ()
 
virtual int connect (const struct sockaddr_storage *address, socklen_t addrlen)=0
 
virtual ssize_t sendto_msg (const struct msghdr *msghdr, const SharedPointer< SocketRights > &rights)=0
 
virtual ssize_t recvfrom_msg (struct msghdr *msghdr, SharedPointer< SocketRights > *rights)=0
 
virtual ssize_t sendto (const void *buffer, size_t bufferlen, int flags, const struct sockaddr_storage *address, socklen_t addrlen)
 
virtual ssize_t recvfrom (void *buffer, size_t bufferlen, int flags, struct sockaddr_storage *address, socklen_t *addrlen)
 
virtual int listen (int backlog)=0
 
virtual int bind (const struct sockaddr_storage *address, socklen_t addrlen)=0
 
virtual int accept (struct sockaddr_storage *address, socklen_t *addrlen, int flags, DescriptorLease *accepted=nullptr)=0
 
virtual int shutdown (int how)
 
virtual int getpeername (struct sockaddr_storage *address, socklen_t *address_len)=0
 
virtual int getsockname (struct sockaddr_storage *address, socklen_t *address_len)=0
 
virtual int setsockopt (int level, int optname, const void *optvalue, socklen_t optlen)=0
 
virtual int getsockopt (int level, int optname, void *optvalue, socklen_t *optlen)=0
 
virtual bool canPoll () const
 
virtual bool poll (bool &read, bool &write, bool &error, Semaphore *waiter)
 
virtual void unPoll (Semaphore *waiter)
 
virtual ReadyMask queryReady (bool reading, bool writing)
 
ReadinessGenerations readinessGenerations () override
 
MUST_USE_RESULT bool addDescriptorOwner ()
 
void removeDescriptorOwner ()
 
void retainDescriptorLifetime (const SharedPointer< NetworkSyscalls > &lifetime)
 
virtual void lastDescriptorClosed ()
 
virtual bool monitor (Thread *pThread, Event *pEvent)
 
virtual bool unmonitor (Event *pEvent)
 
void associate (FileDescriptor *fd)
 
int getDomain () const
 
int getType () const
 
int getProtocol () const
 
const NetworkNamespaceRef & networkNamespace () const
 
bool isBlocking () const
 
virtual void setBlocking (bool blocking)
 
int takeReceiveError ()
 
void deferReceiveError (int error)
 
- Public Member Functions inherited from ReadinessSource
MUST_USE_RESULT bool subscribeReadiness (ReadyMask interest, const SharedPointer< ReadinessObserver > &observer, ReadinessSubscription &subscription)
 

Protected Member Functions

virtual bool usesLocalEndpointLifetime () const
 
ReadyMask pendingReceiveReadiness () const
 
ReadinessGenerations withReceiveErrorGeneration (ReadinessGenerations generations) const
 
bool beginDescriptorClose ()
 
bool hasLastDescriptorClosed () const
 
SharedPointer< NetworkSyscalls > acquireDescriptorLifetime () const
 
SharedPointer< NetworkSyscalls > releaseDescriptorLifetime ()
 
- Protected Member Functions inherited from ReadinessSource
void notifyReadiness (ReadyMask mask)
 
void closeReadiness (ReadyMask mask=ReadyInvalid|ReadyHangup)
 

Protected Attributes

int m_Domain
 
int m_Type
 
int m_Protocol
 
NetworkNamespaceRef m_NetworkNamespace
 
Atomic< bool > m_Blocking
 
Mutex m_ReceiveErrorLock
 
int m_ReceiveError = 0
 
uint64_t m_ReceiveErrorGeneration = 0
 
OperationBarrier m_ReadinessNotifications
 

Private Attributes

Mutex m_LifecycleLock
 
size_t m_DescriptorOwners
 
bool m_DescriptorAdmissionOpen
 
bool m_LastDescriptorClosed
 
SharedPointer< NetworkSyscalls > m_DescriptorLifetime
 

Detailed Description

Definition at line 85 of file net-syscalls.h.

Constructor & Destructor Documentation

◆ NetworkSyscalls()

NetworkSyscalls::NetworkSyscalls ( int  domain,
int  type,
int  protocol 
)

Definition at line 1472 of file net-syscalls.cc.

◆ ~NetworkSyscalls()

NetworkSyscalls::~NetworkSyscalls ( )
virtual

Definition at line 1526 of file net-syscalls.cc.

Member Function Documentation

◆ accept()

virtual int NetworkSyscalls::accept ( struct sockaddr_storage *  address,
socklen_t *  addrlen,
int  flags,
DescriptorLease *  accepted = nullptr 
)
pure virtual

Implemented in LwipSocketSyscalls.

◆ acquireDescriptorLifetime()

SharedPointer< NetworkSyscalls > NetworkSyscalls::acquireDescriptorLifetime ( ) const
protected

Definition at line 1644 of file net-syscalls.cc.

◆ addDescriptorOwner()

bool NetworkSyscalls::addDescriptorOwner ( )

Track descriptor owners independently of in-flight syscall leases.

Definition at line 1602 of file net-syscalls.cc.

Referenced by FileDescriptor::FileDescriptor(), and FileDescriptor::FileDescriptor().

+ Here is the caller graph for this function:

◆ asMqueueNetlink()

virtual MqueueNetlinkSocket * NetworkSyscalls::asMqueueNetlink ( )
inlinevirtual

Implementation-specific final socket creation logic, implementations must set a SYSCALL_ERROR on failure.

Reimplemented in MqueueNetlinkSocket.

Definition at line 92 of file net-syscalls.h.

◆ associate()

void NetworkSyscalls::associate ( FileDescriptor *  fd)

Definition at line 1675 of file net-syscalls.cc.

◆ beginDescriptorClose()

bool NetworkSyscalls::beginDescriptorClose ( )
protected

Wins the one transition into lastDescriptorClosed().

Definition at line 1687 of file net-syscalls.cc.

Referenced by lastDescriptorClosed(), LwipSocketSyscalls::lastDescriptorClosed(), UnixSocketSyscalls::lastDescriptorClosed(), and MqueueNetlinkSocket::lastDescriptorClosed().

+ Here is the caller graph for this function:

◆ bind()

virtual int NetworkSyscalls::bind ( const struct sockaddr_storage *  address,
socklen_t  addrlen 
)
pure virtual

Implemented in UnixSocketSyscalls.

◆ canPoll()

bool NetworkSyscalls::canPoll ( ) const
virtual

Definition at line 1583 of file net-syscalls.cc.

◆ connect()

virtual int NetworkSyscalls::connect ( const struct sockaddr_storage *  address,
socklen_t  addrlen 
)
pure virtual

Implemented in LwipSocketSyscalls.

◆ create()

bool NetworkSyscalls::create ( )
virtual

Reimplemented in LwipSocketSyscalls, and UnixSocketSyscalls.

Definition at line 1530 of file net-syscalls.cc.

◆ deferReceiveError()

void NetworkSyscalls::deferReceiveError ( int  error)

Definition at line 1499 of file net-syscalls.cc.

◆ getDomain()

int NetworkSyscalls::getDomain ( ) const
inline

Definition at line 148 of file net-syscalls.h.

◆ getpeername()

virtual int NetworkSyscalls::getpeername ( struct sockaddr_storage *  address,
socklen_t *  address_len 
)
pure virtual

Implemented in LwipSocketSyscalls.

◆ getProtocol()

int NetworkSyscalls::getProtocol ( ) const
inline

Definition at line 156 of file net-syscalls.h.

◆ getsockname()

virtual int NetworkSyscalls::getsockname ( struct sockaddr_storage *  address,
socklen_t *  address_len 
)
pure virtual

Implemented in LwipSocketSyscalls.

◆ getType()

int NetworkSyscalls::getType ( ) const
inline

Definition at line 152 of file net-syscalls.h.

◆ hasLastDescriptorClosed()

bool NetworkSyscalls::hasLastDescriptorClosed ( ) const
protected

Definition at line 1698 of file net-syscalls.cc.

◆ isBlocking()

bool NetworkSyscalls::isBlocking ( ) const

Definition at line 1679 of file net-syscalls.cc.

◆ lastDescriptorClosed()

void NetworkSyscalls::lastDescriptorClosed ( )
virtual

Retire the transport after the final descriptor alias closes.

Readiness users may retain this wrapper after the transport is gone, so implementations leave queryReady() returning a stable terminal state.

Reimplemented in LwipSocketSyscalls, UnixSocketSyscalls, and MqueueNetlinkSocket.

Definition at line 1658 of file net-syscalls.cc.

References beginDescriptorClose(), OperationBarrier::closeAndWait(), ReadinessSource::closeReadiness(), and m_ReadinessNotifications.

◆ listen()

virtual int NetworkSyscalls::listen ( int  backlog)
pure virtual

Implemented in UnixSocketSyscalls.

◆ monitor()

bool NetworkSyscalls::monitor ( Thread *  pThread,
Event *  pEvent 
)
virtual

Definition at line 1667 of file net-syscalls.cc.

◆ networkNamespace()

const NetworkNamespaceRef & NetworkSyscalls::networkNamespace ( ) const
inline

Definition at line 160 of file net-syscalls.h.

◆ pendingReceiveReadiness()

ReadyMask NetworkSyscalls::pendingReceiveReadiness ( ) const
protected

Definition at line 1509 of file net-syscalls.cc.

◆ poll()

bool NetworkSyscalls::poll ( bool &  read,
bool &  write,
bool &  error,
Semaphore *  waiter 
)
virtual

Reimplemented in LwipSocketSyscalls.

Definition at line 1587 of file net-syscalls.cc.

◆ queryReady()

ReadyMask NetworkSyscalls::queryReady ( bool  reading,
bool  writing 
)
virtual

Return a level-triggered snapshot for the requested I/O directions.

Reimplemented in LwipSocketSyscalls, UnixSocketSyscalls, and MqueueNetlinkSocket.

Definition at line 1596 of file net-syscalls.cc.

◆ readinessGenerations()

ReadinessGenerations NetworkSyscalls::readinessGenerations ( )
overridevirtual

Return source-serialized rising-edge sequences where available.

A source increments the corresponding sequence while holding the same lock which changes its readiness predicate. Consumers can then recover a drain/refill transition even if the two callback deliveries are reordered.

Reimplemented from ReadinessSource.

Reimplemented in UnixSocketSyscalls.

Definition at line 1522 of file net-syscalls.cc.

◆ recvfrom()

ssize_t NetworkSyscalls::recvfrom ( void *  buffer,
size_t  bufferlen,
int  flags,
struct sockaddr_storage *  address,
socklen_t *  addrlen 
)
virtual

Definition at line 1553 of file net-syscalls.cc.

◆ releaseDescriptorLifetime()

SharedPointer< NetworkSyscalls > NetworkSyscalls::releaseDescriptorLifetime ( )
protected

Definition at line 1649 of file net-syscalls.cc.

◆ removeDescriptorOwner()

void NetworkSyscalls::removeDescriptorOwner ( )

Definition at line 1612 of file net-syscalls.cc.

◆ retainDescriptorLifetime()

void NetworkSyscalls::retainDescriptorLifetime ( const SharedPointer< NetworkSyscalls > &  lifetime)

Keep an AF_UNIX wrapper alive while deferred final-close work drains.

Definition at line 1633 of file net-syscalls.cc.

◆ sendto()

ssize_t NetworkSyscalls::sendto ( const void *  buffer,
size_t  bufferlen,
int  flags,
const struct sockaddr_storage *  address,
socklen_t  addrlen 
)
virtual

Definition at line 1534 of file net-syscalls.cc.

◆ setBlocking()

void NetworkSyscalls::setBlocking ( bool  blocking)
virtual

Definition at line 1683 of file net-syscalls.cc.

◆ shutdown()

int NetworkSyscalls::shutdown ( int  how)
virtual

Definition at line 1579 of file net-syscalls.cc.

◆ takeReceiveError()

int NetworkSyscalls::takeReceiveError ( )

Definition at line 1487 of file net-syscalls.cc.

◆ unmonitor()

bool NetworkSyscalls::unmonitor ( Event *  pEvent)
virtual

Definition at line 1671 of file net-syscalls.cc.

◆ unPoll()

void NetworkSyscalls::unPoll ( Semaphore *  waiter)
virtual

Definition at line 1594 of file net-syscalls.cc.

◆ usesLocalEndpointLifetime()

virtual bool NetworkSyscalls::usesLocalEndpointLifetime ( ) const
inlineprotectedvirtual

Definition at line 172 of file net-syscalls.h.

◆ withReceiveErrorGeneration()

ReadinessGenerations NetworkSyscalls::withReceiveErrorGeneration ( ReadinessGenerations  generations) const
protected

Definition at line 1514 of file net-syscalls.cc.

Member Data Documentation

◆ m_Blocking

Atomic<bool> NetworkSyscalls::m_Blocking
protected

Definition at line 191 of file net-syscalls.h.

◆ m_DescriptorAdmissionOpen

bool NetworkSyscalls::m_DescriptorAdmissionOpen
private

Definition at line 202 of file net-syscalls.h.

◆ m_DescriptorLifetime

SharedPointer<NetworkSyscalls> NetworkSyscalls::m_DescriptorLifetime
private

Definition at line 204 of file net-syscalls.h.

◆ m_DescriptorOwners

size_t NetworkSyscalls::m_DescriptorOwners
private

Definition at line 201 of file net-syscalls.h.

◆ m_Domain

int NetworkSyscalls::m_Domain
protected

Definition at line 186 of file net-syscalls.h.

◆ m_LastDescriptorClosed

bool NetworkSyscalls::m_LastDescriptorClosed
private

Definition at line 203 of file net-syscalls.h.

◆ m_LifecycleLock

Mutex NetworkSyscalls::m_LifecycleLock
mutableprivate

Definition at line 200 of file net-syscalls.h.

◆ m_NetworkNamespace

NetworkNamespaceRef NetworkSyscalls::m_NetworkNamespace
protected

Definition at line 189 of file net-syscalls.h.

◆ m_Protocol

int NetworkSyscalls::m_Protocol
protected

Definition at line 188 of file net-syscalls.h.

◆ m_ReadinessNotifications

OperationBarrier NetworkSyscalls::m_ReadinessNotifications
protected

◆ m_ReceiveError

int NetworkSyscalls::m_ReceiveError = 0
protected

Definition at line 193 of file net-syscalls.h.

◆ m_ReceiveErrorGeneration

uint64_t NetworkSyscalls::m_ReceiveErrorGeneration = 0
protected

Definition at line 194 of file net-syscalls.h.

◆ m_ReceiveErrorLock

Mutex NetworkSyscalls::m_ReceiveErrorLock
mutableprotected

Definition at line 192 of file net-syscalls.h.

◆ m_Type

int NetworkSyscalls::m_Type
protected

Definition at line 187 of file net-syscalls.h.


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