libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::socket::glibc::server::wrapper< LkT > Class Template Reference

A simple server wrapper. More...

#include <socket_wrapper_glibc.hpp>

Inheritance diagram for jmmcg::socket::glibc::server::wrapper< LkT >:
[legend]
Collaboration diagram for jmmcg::socket::glibc::server::wrapper< LkT >:
[legend]

Classes

class  recv_msg_ops_t
 

Public Types

enum  : int { max_backlog_connections =1 }
 
using base_t = basic::wrapper< LkT >
 
using domain_t = typename base_t::domain_t
 
using exception_t = typename base_t::exception_t
 
using socket_t = base_t
 
using type_t = typename base_t::type_t
 
using socket_type = typename base_t::socket_type
 
- Public Types inherited from jmmcg::socket::glibc::basic::wrapper< LkT >
enum  domain_t : int { ip_v4 =AF_INET }
 
enum  type_t : int { stream =SOCK_STREAM }
 
using exception_t = crt_exception< ppd::platform_api, ppd::heavyweight_threading >
 
using thread_traits = exception_t::thread_traits
 
using write_lock_t = LkT
 The lock-type to use to ensure that the underlying ::write()s occur atomically. More...
 
using atomic_t = typename write_lock_t::atomic_t
 
using socket_priority = jmmcg::socket::socket_priority
 
using socket_type = int
 

Public Member Functions

 wrapper (char const *addr, uint16_t port, std::size_t min_message_size, std::size_t max_message_size, unsigned short timeout, socket_priority priority, std::size_t incoming_cpu, type_t type=type_t::stream, domain_t domain=domain_t::ip_v4) noexcept(false)
 Wrap a TCP socket using the TCP/IP protocol. More...
 
 ~wrapper () noexcept(false)
 
void run () noexcept(false)
 
void stop () noexcept(false)
 
bool stopped () const noexcept(true)
 
template<class RecvProcMsgs >
void async_accept (RecvProcMsgs &&f) noexcept(false)
 
void set_options (base_t &skt) const noexcept(false)
 
- Public Member Functions inherited from jmmcg::socket::glibc::basic::wrapper< LkT >
 wrapper (socket_type opened_skt) noexcept(false)
 Wrap a TCP socket using the TCP/IP protocol. More...
 
 wrapper (type_t type=type_t::stream, domain_t domain=domain_t::ip_v4) noexcept(false)
 Wrap a TCP socket using the TCP/IP protocol. More...
 
 ~wrapper () noexcept(true)
 
template<class MsgT >
void write (MsgT const &message) noexcept(true)
 Write the whole message to the socket in one go. More...
 
template<class V , std::size_t N>
void write (std::array< V, N > const &message) noexcept(true)
 Write the whole message to the socket in one go. More...
 
template<class MsgT >
bool read (MsgT &dest) noexcept(true)
 Read the whole message from the socket in one go. More...
 
template<class V , std::size_t SrcSz>
bool read (V(&dest)[SrcSz]) noexcept(true)
 Read the whole message from the socket in one go. More...
 
template<class MsgDetails , class V , std::size_t N>
bool read (std::array< V, N > &buff) noexcept(false)
 
void close () noexcept(true)
 
bool is_open () const noexcept(true)
 
void set_options (std::size_t min_message_size, std::size_t max_message_size, unsigned short timeout, socket_priority priority, std::size_t incoming_cpu) noexcept(false)
 Set various options on the created socket to ensure more optimal behaviour. More...
 
std::string to_string () const noexcept(false)
 

Additional Inherited Members

- Protected Member Functions inherited from jmmcg::socket::glibc::basic::wrapper< LkT >
bool read_msg (std::uint8_t *dest, std::size_t msg_size) noexcept(true)
 
- Protected Attributes inherited from jmmcg::socket::glibc::basic::wrapper< LkT >
atomic_t mutex_
 
socket_type socket_
 

Detailed Description

template<class LkT>
class jmmcg::socket::glibc::server::wrapper< LkT >

A simple server wrapper.

Definition at line 221 of file socket_wrapper_glibc.hpp.

Member Typedef Documentation

◆ base_t

template<class LkT>
using jmmcg::socket::glibc::server::wrapper< LkT >::base_t = basic::wrapper<LkT>

Definition at line 223 of file socket_wrapper_glibc.hpp.

◆ domain_t

template<class LkT>
using jmmcg::socket::glibc::server::wrapper< LkT >::domain_t = typename base_t::domain_t

Definition at line 224 of file socket_wrapper_glibc.hpp.

◆ exception_t

template<class LkT>
using jmmcg::socket::glibc::server::wrapper< LkT >::exception_t = typename base_t::exception_t

Definition at line 225 of file socket_wrapper_glibc.hpp.

◆ socket_t

template<class LkT>
using jmmcg::socket::glibc::server::wrapper< LkT >::socket_t = base_t

Definition at line 226 of file socket_wrapper_glibc.hpp.

◆ socket_type

template<class LkT>
using jmmcg::socket::glibc::server::wrapper< LkT >::socket_type = typename base_t::socket_type

Definition at line 228 of file socket_wrapper_glibc.hpp.

◆ type_t

template<class LkT>
using jmmcg::socket::glibc::server::wrapper< LkT >::type_t = typename base_t::type_t

Definition at line 227 of file socket_wrapper_glibc.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<class LkT>
anonymous enum : int
Enumerator
max_backlog_connections 

Definition at line 230 of file socket_wrapper_glibc.hpp.

Constructor & Destructor Documentation

◆ wrapper()

template<class LkT >
jmmcg::socket::glibc::server::wrapper< LkT >::wrapper ( char const *  addr,
uint16_t  port,
std::size_t  min_message_size,
std::size_t  max_message_size,
unsigned short  timeout,
socket_priority  priority,
std::size_t  incoming_cpu,
type_t  type = type_t::stream,
domain_t  domain = domain_t::ip_v4 
)
inlinenoexcept

Wrap a TCP socket using the TCP/IP protocol.

Definition at line 594 of file socket_wrapper_glibc_impl.hpp.

◆ ~wrapper()

template<class LkT >
jmmcg::socket::glibc::server::wrapper< LkT >::~wrapper ( )
inlinenoexcept

Definition at line 652 of file socket_wrapper_glibc_impl.hpp.

Member Function Documentation

◆ async_accept()

template<class LkT >
template<class RecvProcMsgs >
void jmmcg::socket::glibc::server::wrapper< LkT >::async_accept ( RecvProcMsgs &&  f)
inlinenoexcept

Definition at line 780 of file socket_wrapper_glibc_impl.hpp.

◆ run()

template<class LkT >
void jmmcg::socket::glibc::server::wrapper< LkT >::run ( )
inlinenoexcept

Definition at line 658 of file socket_wrapper_glibc_impl.hpp.

◆ set_options()

template<class LkT >
void jmmcg::socket::glibc::server::wrapper< LkT >::set_options ( base_t skt) const
inlinenoexcept

Definition at line 729 of file socket_wrapper_glibc_impl.hpp.

◆ stop()

template<class LkT >
void jmmcg::socket::glibc::server::wrapper< LkT >::stop ( )
inlinenoexcept

Definition at line 642 of file socket_wrapper_glibc_impl.hpp.

◆ stopped()

template<class LkT >
bool jmmcg::socket::glibc::server::wrapper< LkT >::stopped ( ) const
inlinenoexcept

Definition at line 636 of file socket_wrapper_glibc_impl.hpp.


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