libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
socket_server.cpp File Reference
#include "stdafx.h"
#include <boost/test/included/unit_test.hpp>
#include <boost/mpl/list.hpp>
#include "core/ave_deviation_meter.hpp"
#include "core/jthread.hpp"
#include "core/latency_timestamps.hpp"
#include "core/max_min.hpp"
#include "core/socket_client_manager.hpp"
#include "core/socket_server.hpp"
Include dependency graph for socket_server.cpp:

Go to the source code of this file.

Classes

struct  isimud::ISIMUD_VER_NAMESPACE::exchanges::common::thread_traits
 From the detected NUMA layout, assign cores to the logical threads in the FIX-to-exchange translator. More...
 
struct  isimud::ISIMUD_VER_NAMESPACE::exchanges::common::thread_traits::thread_info
 
struct  msgs_t
 
struct  msgs_t::static_size
 
struct  msgs_t::static_size::Header_t
 
struct  msgs_t::static_size::message
 
struct  msgs_t::static_size::heartbeat
 
struct  msgs_t::variable_size
 
struct  msgs_t::variable_size::Header_t
 
struct  msgs_t::variable_size::message
 
struct  msgs_t::variable_size::heartbeat
 
struct  just_connect
 
struct  num_msgs
 
struct  sink< SktT, MsgsT >
 
struct  sink< SktT, MsgsT >::heartbeats
 
struct  simple_reflect< SktT, MsgsT >
 
struct  simple_reflect< SktT, MsgsT >::heartbeats
 

Namespaces

namespace  isimud
 
namespace  isimud::ISIMUD_VER_NAMESPACE
 
namespace  isimud::ISIMUD_VER_NAMESPACE::exchanges
 
namespace  isimud::ISIMUD_VER_NAMESPACE::exchanges::common
 

Macros

#define BOOST_TEST_MODULE   libjmmcg_tests
 

Typedefs

using api_thread_traits = ppd::thread_params< ppd::platform_api >
 
using timed_results_t = ave_deviation_meter< double >
 
using asio_client_mgr_t = socket::asio::client_manager< ppd::api_lock_traits< ppd::platform_api, ppd::heavyweight_threading >::critical_section_type::lock_type >
 
using glibc_client_mgr_t = socket::glibc::client_manager< ppd::api_lock_traits< ppd::platform_api, ppd::heavyweight_threading >::critical_section_type::lock_type >
 
template<template< class, class > class ProcRules>
using cxns_types = boost::mpl::list< std::pair< asio_client_mgr_t, socket::svr< ProcRules< asio_client_mgr_t::socket_t, msgs_t::static_size >, socket::server_manager::loopback< typename ProcRules< asio_client_mgr_t::socket_t, msgs_t::static_size >::heartbeats, asio_client_mgr_t::socket_t > > >, std::pair< glibc_client_mgr_t, socket::svr< ProcRules< glibc_client_mgr_t::socket_t, msgs_t::static_size >, socket::server_manager::loopback< typename ProcRules< glibc_client_mgr_t::socket_t, msgs_t::static_size >::heartbeats, glibc_client_mgr_t::socket_t > > >, std::pair< asio_client_mgr_t, socket::svr< ProcRules< asio_client_mgr_t::socket_t, msgs_t::variable_size >, socket::server_manager::loopback< typename ProcRules< asio_client_mgr_t::socket_t, msgs_t::variable_size >::heartbeats, asio_client_mgr_t::socket_t > > >, std::pair< glibc_client_mgr_t, socket::svr< ProcRules< glibc_client_mgr_t::socket_t, msgs_t::variable_size >, socket::server_manager::loopback< typename ProcRules< glibc_client_mgr_t::socket_t, msgs_t::variable_size >::heartbeats, glibc_client_mgr_t::socket_t > > > >
 
using cxns_sink_types = cxns_types< sink >
 
using cxns_reflect_types = cxns_types< simple_reflect >
 

Enumerations

enum  : bool { has_static_size =true }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : unsigned { max_missed_heartbeats =1 }
 
enum  : bool { has_static_size =true }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : unsigned { max_missed_heartbeats =1 }
 
enum  : bool { has_static_size =true }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : unsigned { max_missed_heartbeats =1 }
 
enum  : bool { has_static_size =true }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : std::size_t { header_t_size =sizeof(Header_t) }
 
enum  : unsigned { max_missed_heartbeats =1 }
 

Functions

const boost::asio::ip::address localhost (boost::asio::ip::address_v4::loopback())
 
constexpr Header_t (std::size_t l) noexcept(true)
 
constexpr std::size_t length () const noexcept(true)
 The actual, not the foolish BATSBOE-specified, length which excludes the start_of_message field. More...
 
constexpr bool is_valid () const noexcept(true)
 Verify that the referenced FIX message is valid. More...
 
constexpr message () noexcept(true)
 
constexpr heartbeat () noexcept(true)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (ctor, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (single_server_and_client, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (single_server_and_two_successive_clients, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (single_server_and_two_simultaneous_clients, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (single_server_and_client_one_message, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (single_server_and_client_one_message_reconnect_sequential, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (single_server_and_client_two_messages, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (two_repeated_servers_and_clients, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (reflect_msgs_at_a_time, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (sink_one_msg_repeatedly, cxns_t, cxns_sink_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (sink_different_msgs_parallel, cxns_t, cxns_sink_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (reflect_msgs_parallel, cxns_t, cxns_reflect_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (reflect_different_msgs_parallel, cxns_t, cxns_reflect_types)
 

Variables

const unsigned short unused_port =12347u
 
const unsigned short timeout =5u
 
const std::size_t length_
 
std::uint64_t sequence {}
 
const uint8_t c =42
 
std::array< char, 123 > data {'x'}
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   libjmmcg_tests

Definition at line 21 of file socket_server.cpp.

Typedef Documentation

◆ api_thread_traits

typedef ppd::thread_params< ppd::platform_api > api_thread_traits

Definition at line 56 of file socket_server.cpp.

◆ asio_client_mgr_t

typedef socket::asio::client_manager< ppd::api_lock_traits< ppd::platform_api, ppd::heavyweight_threading >::critical_section_type::lock_type > asio_client_mgr_t

Definition at line 257 of file socket_server.cpp.

◆ cxns_reflect_types

Definition at line 309 of file socket_server.cpp.

◆ cxns_sink_types

Definition at line 308 of file socket_server.cpp.

◆ cxns_types

template<template< class, class > class ProcRules>
using cxns_types = boost::mpl::list< std::pair< asio_client_mgr_t, socket::svr< ProcRules<asio_client_mgr_t::socket_t, msgs_t::static_size>, socket::server_manager::loopback< typename ProcRules<asio_client_mgr_t::socket_t, msgs_t::static_size>::heartbeats, asio_client_mgr_t::socket_t > > >, std::pair< glibc_client_mgr_t, socket::svr< ProcRules<glibc_client_mgr_t::socket_t, msgs_t::static_size>, socket::server_manager::loopback< typename ProcRules<glibc_client_mgr_t::socket_t, msgs_t::static_size>::heartbeats, glibc_client_mgr_t::socket_t > > >, std::pair< asio_client_mgr_t, socket::svr< ProcRules<asio_client_mgr_t::socket_t, msgs_t::variable_size>, socket::server_manager::loopback< typename ProcRules<asio_client_mgr_t::socket_t, msgs_t::variable_size>::heartbeats, asio_client_mgr_t::socket_t > > >, std::pair< glibc_client_mgr_t, socket::svr< ProcRules<glibc_client_mgr_t::socket_t, msgs_t::variable_size>, socket::server_manager::loopback< typename ProcRules<glibc_client_mgr_t::socket_t, msgs_t::variable_size>::heartbeats, glibc_client_mgr_t::socket_t > > > >

Definition at line 265 of file socket_server.cpp.

◆ glibc_client_mgr_t

typedef socket::glibc::client_manager< ppd::api_lock_traits< ppd::platform_api, ppd::heavyweight_threading >::critical_section_type::lock_type > glibc_client_mgr_t

Definition at line 260 of file socket_server.cpp.

◆ timed_results_t

using timed_results_t = ave_deviation_meter<double>

Definition at line 57 of file socket_server.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
max_missed_heartbeats 

Definition at line 3 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : bool
Enumerator
has_static_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : unsigned
Enumerator
max_missed_heartbeats 

Definition at line 3 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : bool
Enumerator
has_static_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : unsigned
Enumerator
max_missed_heartbeats 

Definition at line 3 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : bool
Enumerator
has_static_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : unsigned
Enumerator
max_missed_heartbeats 

Definition at line 3 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : bool
Enumerator
has_static_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 0 of file socket_server.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [1/13]

BOOST_AUTO_TEST_CASE_TEMPLATE ( ctor  ,
cxns_t  ,
cxns_reflect_types   
)

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [2/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [3/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [4/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [5/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [6/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [7/13]

BOOST_AUTO_TEST_CASE_TEMPLATE ( single_server_and_client_one_message_reconnect_sequential  ,
cxns_t  ,
cxns_reflect_types   
)

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [8/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [9/13]

BOOST_AUTO_TEST_CASE_TEMPLATE ( single_server_and_two_simultaneous_clients  ,
cxns_t  ,
cxns_reflect_types   
)

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [10/13]

BOOST_AUTO_TEST_CASE_TEMPLATE ( single_server_and_two_successive_clients  ,
cxns_t  ,
cxns_reflect_types   
)

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [11/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [12/13]

◆ BOOST_AUTO_TEST_CASE_TEMPLATE() [13/13]

◆ Header_t()

constexpr __attribute__::Header_t ( std::size_t  l)
explicitconstexprnoexcept

Definition at line 7 of file socket_server.cpp.

◆ heartbeat()

constexpr heartbeat ( )
constexprnoexcept

Definition at line 10 of file socket_server.cpp.

◆ is_valid()

constexpr bool is_valid ( ) const
constexprnoexcept

Verify that the referenced FIX message is valid.

Returns
True is the referenced FIX message is valid, false otherwise.

Definition at line 9 of file socket_server.cpp.

◆ length()

constexpr std::size_t length ( ) const
constexprnoexcept

The actual, not the foolish BATSBOE-specified, length which excludes the start_of_message field.

Determine the total size of the referenced message.

Definition at line 9 of file socket_server.cpp.

◆ localhost()

const boost::asio::ip::address localhost ( boost::asio::ip::address_v4::loopback()  )

◆ message()

constexpr message ( )
constexprnoexcept

Definition at line 7 of file socket_server.cpp.

Variable Documentation

◆ c

const std::uint64_t c =42

Definition at line 4 of file socket_server.cpp.

◆ data

std::array<char, 123> data {'x'}

Definition at line 5 of file socket_server.cpp.

◆ length_

const std::size_t length_

Definition at line 4 of file socket_server.cpp.

◆ sequence

std::uint64_t sequence {}

Definition at line 5 of file socket_server.cpp.

◆ timeout

const unsigned short timeout =5u

Definition at line 60 of file socket_server.cpp.

Referenced by BOOST_AUTO_TEST_CASE_TEMPLATE().

◆ unused_port

const unsigned short unused_port =12347u

Definition at line 59 of file socket_server.cpp.

Referenced by BOOST_AUTO_TEST_CASE_TEMPLATE().