µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::posix::socket Class Reference

Network socket. More...

#include <cmsis-plus/posix-io/socket.h>

+ Inheritance diagram for os::posix::socket:

Public Types

Types & Constants
enum class  type : type_t {
  unknown = 0 ,
  not_set = 1 << 0 ,
  char_device = 1 << 1 ,
  block_device = 1 << 2 ,
  tty = 1 << 3 ,
  file = 1 << 4 ,
  socket = 1 << 5
}
 
using type_t = unsigned int
 

Public Member Functions

Constructors & Destructor
 socket (socket_impl &impl, net_stack &ns)
 
virtual ~socket () override
 
Public Member Functions
virtual socketaccept (sockaddr *address, socklen_t *address_len)
 
virtual int bind (const sockaddr *address, socklen_t address_len)
 
virtual int connect (const sockaddr *address, socklen_t address_len)
 
virtual int getpeername (sockaddr *address, socklen_t *address_len)
 
virtual int getsockname (sockaddr *address, socklen_t *address_len)
 
virtual int getsockopt (int level, int option_name, void *option_value, socklen_t *option_len)
 
virtual int listen (int backlog)
 
virtual ssize_t recv (void *buffer, size_t length, int flags)
 
virtual ssize_t recvfrom (void *buffer, size_t length, int flags, sockaddr *address, socklen_t *address_len)
 
virtual ssize_t recvmsg (msghdr *message, int flags)
 
virtual ssize_t send (const void *buffer, size_t length, int flags)
 
virtual ssize_t sendmsg (const msghdr *message, int flags)
 
virtual ssize_t sendto (const void *message, size_t length, int flags, const sockaddr *dest_addr, socklen_t dest_len)
 
virtual int setsockopt (int level, int option_name, const void *option_value, socklen_t option_len)
 
virtual int shutdown (int how)
 
virtual int sockatmark (void)
 
class net_stacknet_stack (void)
 
socket_implimpl (void) const
 
Public Member Functions
virtual int close (void)
 
virtual ssize_t read (void *buf, std::size_t nbyte)
 
virtual ssize_t write (const void *buf, std::size_t nbyte)
 
virtual ssize_t writev (const iovec *iov, int iovcnt)
 
int fcntl (int cmd,...)
 
virtual int vfcntl (int cmd, std::va_list args)
 
int isatty (void)
 
virtual int fstat (struct stat *buf)
 
virtual off_t lseek (off_t offset, int whence)
 
type_t get_type (void) const
 
file_descriptor_t file_descriptor (void) const
 
bool is_opened (void)
 

Protected Member Functions

Private Member Functions
void file_descriptor (file_descriptor_t fildes)
 
void clear_file_descriptor (void)
 
ioalloc_file_descriptor (void)
 

Detailed Description

Network socket.

Definition at line 63 of file posix-io/socket.h.

Member Typedef Documentation

◆ type_t

using os::posix::io::type_t = unsigned int
inherited

Definition at line 127 of file io.h.

Member Enumeration Documentation

◆ type

enum class os::posix::io::type : type_t
stronginherited
Enumerator
unknown 
not_set 
char_device 
block_device 
tty 
file 
socket 

Definition at line 128 of file io.h.

Constructor & Destructor Documentation

◆ socket()

os::posix::socket::socket ( socket_impl impl,
net_stack ns 
)

Definition at line 38 of file socket.cpp.

◆ ~socket()

os::posix::socket::~socket ( )
overridevirtual

Definition at line 48 of file socket.cpp.

Member Function Documentation

◆ accept()

class socket * os::posix::socket::accept ( sockaddr address,
socklen_t address_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 60 of file socket.cpp.

◆ alloc_file_descriptor()

io * os::posix::io::alloc_file_descriptor ( void  )
protectedinherited

Definition at line 190 of file io.cpp.

◆ bind()

int os::posix::socket::bind ( const sockaddr address,
socklen_t  address_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 75 of file socket.cpp.

◆ clear_file_descriptor()

void os::posix::io::clear_file_descriptor ( void  )
inlineprotectedinherited

Definition at line 450 of file io.h.

◆ close()

int os::posix::io::close ( void  )
virtualinherited

◆ connect()

int os::posix::socket::connect ( const sockaddr address,
socklen_t  address_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 84 of file socket.cpp.

◆ fcntl()

int os::posix::io::fcntl ( int  cmd,
  ... 
)
inherited

Definition at line 364 of file io.cpp.

◆ file_descriptor() [1/2]

void os::posix::io::file_descriptor ( file_descriptor_t  fildes)
inlineprotectedinherited

Definition at line 444 of file io.h.

◆ file_descriptor() [2/2]

file_descriptor_t os::posix::io::file_descriptor ( void  ) const
inlineinherited

Definition at line 456 of file io.h.

◆ fstat()

int os::posix::io::fstat ( struct stat buf)
virtualinherited

Reimplemented in os::posix::file_lockable< T, L >.

Definition at line 417 of file io.cpp.

◆ get_type()

io::type_t os::posix::io::get_type ( void  ) const
inlineinherited

Definition at line 438 of file io.h.

◆ getpeername()

int os::posix::socket::getpeername ( sockaddr address,
socklen_t address_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 93 of file socket.cpp.

◆ getsockname()

int os::posix::socket::getsockname ( sockaddr address,
socklen_t address_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 102 of file socket.cpp.

◆ getsockopt()

int os::posix::socket::getsockopt ( int  level,
int  option_name,
void *  option_value,
socklen_t option_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 111 of file socket.cpp.

◆ impl()

socket_impl & os::posix::socket::impl ( void  ) const
inline

Definition at line 555 of file posix-io/socket.h.

◆ is_opened()

bool os::posix::io::is_opened ( void  )
inlineinherited

Definition at line 462 of file io.h.

◆ isatty()

int os::posix::io::isatty ( void  )
inherited

Definition at line 407 of file io.cpp.

◆ listen()

int os::posix::socket::listen ( int  backlog)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 122 of file socket.cpp.

◆ lseek()

off_t os::posix::io::lseek ( off_t  offset,
int  whence 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 448 of file io.cpp.

◆ net_stack()

net_stack * os::posix::socket::net_stack ( void  )
inline

Definition at line 549 of file posix-io/socket.h.

◆ read()

ssize_t os::posix::io::read ( void *  buf,
std::size_t  nbyte 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 218 of file io.cpp.

◆ recv()

ssize_t os::posix::socket::recv ( void *  buffer,
size_t  length,
int  flags 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 131 of file socket.cpp.

◆ recvfrom()

ssize_t os::posix::socket::recvfrom ( void *  buffer,
size_t  length,
int  flags,
sockaddr address,
socklen_t address_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 140 of file socket.cpp.

◆ recvmsg()

ssize_t os::posix::socket::recvmsg ( msghdr *  message,
int  flags 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 150 of file socket.cpp.

◆ send()

ssize_t os::posix::socket::send ( const void *  buffer,
size_t  length,
int  flags 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 159 of file socket.cpp.

◆ sendmsg()

ssize_t os::posix::socket::sendmsg ( const msghdr *  message,
int  flags 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 168 of file socket.cpp.

◆ sendto()

ssize_t os::posix::socket::sendto ( const void *  message,
size_t  length,
int  flags,
const sockaddr dest_addr,
socklen_t  dest_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 177 of file socket.cpp.

◆ setsockopt()

int os::posix::socket::setsockopt ( int  level,
int  option_name,
const void *  option_value,
socklen_t  option_len 
)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 187 of file socket.cpp.

◆ shutdown()

int os::posix::socket::shutdown ( int  how)
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 198 of file socket.cpp.

◆ sockatmark()

int os::posix::socket::sockatmark ( void  )
virtual

Reimplemented in os::posix::socket_lockable< T, L >.

Definition at line 207 of file socket.cpp.

◆ vfcntl()

int os::posix::io::vfcntl ( int  cmd,
std::va_list  args 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 381 of file io.cpp.

◆ write()

ssize_t os::posix::io::write ( const void *  buf,
std::size_t  nbyte 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 269 of file io.cpp.

◆ writev()

ssize_t os::posix::io::writev ( const iovec iov,
int  iovcnt 
)
virtualinherited

Reimplemented in os::posix::block_device_lockable< T, L >, and os::posix::file_lockable< T, L >.

Definition at line 322 of file io.cpp.


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