|
ORE Studio 0.0.4
|
Contains messaging related infrastructure in the comms library. More...
Classes | |
| struct | database_status_message |
| Server-initiated notification of database status. More... | |
| struct | error_response |
| Error response message sent when request processing fails. More... | |
| class | frame |
| Complete frame with header and payload. More... | |
| struct | frame_header |
| Frame header structure for the ORES protocol. More... | |
| struct | handshake_ack |
| Handshake acknowledgment message sent by client to complete handshake. More... | |
| struct | handshake_request |
| Handshake request message sent by client to initiate connection. More... | |
| struct | handshake_response |
| Handshake response message sent by server to client. More... | |
| class | message_dispatcher |
| Dispatches incoming messages to registered subsystem handlers. More... | |
| class | message_handler |
| Abstract interface for handling messages from a subsystem. More... | |
| struct | message_type_range |
| Range of message types handled by a subsystem. More... | |
| struct | notification_message |
| Server-initiated notification of an entity change. More... | |
| struct | ping |
| Ping message sent by client to check connection liveness. More... | |
| struct | pong |
| Pong message sent by server in response to ping. More... | |
| class | reader |
| Helper to read network data. More... | |
| class | result |
| Simple result type for C++20 (std::expected replacement). More... | |
| class | result< void, E > |
| Specialization for void value type. More... | |
| struct | subscribe_request |
| Request to subscribe to entity change notifications. More... | |
| struct | subscribe_response |
| Response confirming subscription request. More... | |
| struct | unsubscribe_request |
| Request to unsubscribe from entity change notifications. More... | |
| struct | unsubscribe_response |
| Response confirming unsubscription request. More... | |
| class | writer |
| Helper to write network data. More... | |
Enumerations | |
| enum class | compression_type : std::uint8_t { none = 0x00 , zlib = 0x01 , gzip = 0x02 , bzip2 = 0x03 } |
| Compression algorithm used for payload compression. More... | |
| enum class | message_type { handshake_request = 0x0001 , handshake_response = 0x0002 , handshake_ack = 0x0003 , error_response = 0x0004 , ping = 0x0005 , pong = 0x0006 , subscribe_request = 0x0010 , subscribe_response = 0x0011 , unsubscribe_request = 0x0012 , unsubscribe_response = 0x0013 , notification = 0x0014 , database_status_notification = 0x0020 , get_currencies_request = 0x1001 , get_currencies_response = 0x1002 , save_currency_request = 0x1003 , save_currency_response = 0x1004 , delete_currency_request = 0x1005 , delete_currency_response = 0x1006 , get_currency_history_request = 0x1007 , get_currency_history_response = 0x1008 , create_account_request = 0x2001 , create_account_response = 0x2002 , list_accounts_request = 0x2003 , list_accounts_response = 0x2004 , login_request = 0x2005 , login_response = 0x2006 , unlock_account_request = 0x2007 , unlock_account_response = 0x2008 , delete_account_request = 0x2009 , delete_account_response = 0x200A , list_login_info_request = 0x200B , list_login_info_response = 0x200C , logout_request = 0x200D , logout_response = 0x200E , create_initial_admin_request = 0x200F , create_initial_admin_response = 0x2010 , bootstrap_status_request = 0x2011 , bootstrap_status_response = 0x2012 , lock_account_request = 0x2013 , lock_account_response = 0x2014 , update_account_request = 0x2015 , update_account_response = 0x2016 , get_account_history_request = 0x2017 , get_account_history_response = 0x2018 , reset_password_request = 0x2019 , reset_password_response = 0x201A , change_password_request = 0x201B , change_password_response = 0x201C , update_my_email_request = 0x201D , update_my_email_response = 0x201E , list_roles_request = 0x2020 , list_roles_response = 0x2021 , list_permissions_request = 0x2022 , list_permissions_response = 0x2023 , assign_role_request = 0x2024 , assign_role_response = 0x2025 , revoke_role_request = 0x2026 , revoke_role_response = 0x2027 , get_account_roles_request = 0x2028 , get_account_roles_response = 0x2029 , get_account_permissions_request = 0x202A , get_account_permissions_response = 0x202B , list_feature_flags_request = 0x3000 , list_feature_flags_response = 0x3001 , last_value } |
| enum class | error_code { none = 0x0000 , version_mismatch = 0x0001 , crc_validation_failed = 0x0002 , invalid_message_type = 0x0003 , handshake_timeout = 0x0004 , handshake_failed = 0x0005 , payload_too_large = 0x0006 , network_error = 0x0007 , handler_error = 0x0008 , database_error = 0x0009 , authentication_failed = 0x000A , authorization_failed = 0x000B , invalid_request = 0x000C , bootstrap_mode_only = 0x000D , bootstrap_mode_forbidden = 0x000E , weak_password = 0x000F , not_localhost = 0x0010 , database_unavailable = 0x0011 , decompression_failed = 0x0012 , unsupported_compression = 0x0013 , compression_failed = 0x0014 , last_value } |
Functions | |
| std::expected< std::vector< std::byte >, error_code > | compress (std::span< const std::byte > data, compression_type type) |
| Compress data using the specified algorithm. | |
| std::expected< std::vector< std::byte >, error_code > | decompress (std::span< const std::byte > data, compression_type type) |
| Decompress data using the specified algorithm. | |
| bool | is_compression_supported (compression_type type) |
| Check if compression is supported for the given type. | |
| frame | create_error_response_frame (std::uint32_t sequence, std::uint32_t correlation_id, error_code code, const std::string &message) |
| Create an error response frame. | |
| std::ostream & | operator<< (std::ostream &s, const frame_header &v) |
| frame | create_handshake_request_frame (std::uint32_t sequence, const std::string &client_identifier, std::uint8_t supported_compression=0) |
| Create a handshake request frame. | |
| frame | create_handshake_response_frame (std::uint32_t sequence, bool version_compatible, const std::string &server_identifier, error_code status=error_code::none, compression_type selected_compression=compression_type::none) |
| Create a handshake response frame. | |
| frame | create_handshake_ack_frame (std::uint32_t sequence, error_code status=error_code::none) |
| Create a handshake acknowledgment frame. | |
| compression_type | select_compression (std::uint8_t supported_compression, compression_type preferred=compression_type::zlib) |
| Select a compression type from the client's supported types. | |
| frame | create_ping_frame (std::uint32_t sequence, std::uint32_t correlation_id=0) |
| Create a ping frame. | |
| frame | create_pong_frame (std::uint32_t sequence, std::uint32_t correlation_id=0) |
| Create a pong frame. | |
| std::ostream & | operator<< (std::ostream &os, message_type mt) |
| Stream output operator for message_type. | |
| std::ostream & | operator<< (std::ostream &os, error_code ec) |
| Stream output operator for error_code. | |
| std::ostream & | operator<< (std::ostream &os, compression_type ct) |
| Stream output operator for compression_type. | |
| std::string | to_string (error_code ec) |
| Convert error_code to string for display. | |
| std::ostream & | operator<< (std::ostream &s, const subscribe_request &v) |
| std::ostream & | operator<< (std::ostream &s, const subscribe_response &v) |
| std::ostream & | operator<< (std::ostream &s, const unsubscribe_request &v) |
| std::ostream & | operator<< (std::ostream &s, const unsubscribe_response &v) |
| std::ostream & | operator<< (std::ostream &s, const notification_message &v) |
| std::ostream & | operator<< (std::ostream &s, const database_status_message &v) |
Variables | |
| constexpr size_t | MAX_PAYLOAD_SIZE = 1'000'000 |
| constexpr std::uint8_t | COMPRESSION_SUPPORT_ZLIB = 0x01 |
| Compression support bitmask values. | |
| constexpr std::uint8_t | COMPRESSION_SUPPORT_GZIP = 0x02 |
| constexpr std::uint8_t | COMPRESSION_SUPPORT_BZIP2 = 0x04 |
| constexpr std::uint8_t | COMPRESSION_SUPPORT_ALL = 0x07 |
| constexpr std::uint32_t | PROTOCOL_MAGIC = 0x4F524553 |
| constexpr std::uint16_t | PROTOCOL_VERSION_MAJOR = 13 |
| constexpr std::uint16_t | PROTOCOL_VERSION_MINOR = 0 |
| constexpr std::uint16_t | CORE_SUBSYSTEM_MIN = 0x0000 |
| constexpr std::uint16_t | CORE_SUBSYSTEM_MAX = 0x0FFF |
| constexpr std::uint16_t | RISK_SUBSYSTEM_MIN = 0x1000 |
| constexpr std::uint16_t | RISK_SUBSYSTEM_MAX = 0x1FFF |
| constexpr std::uint16_t | ACCOUNTS_SUBSYSTEM_MIN = 0x2000 |
| constexpr std::uint16_t | ACCOUNTS_SUBSYSTEM_MAX = 0x2FFF |
| constexpr std::uint16_t | VARIABILITY_SUBSYSTEM_MIN = 0x3000 |
| constexpr std::uint16_t | VARIABILITY_SUBSYSTEM_MAX = 0x3FFF |
Contains messaging related infrastructure in the comms library.
Houses the core messaging primitives such as the frame, message types, readers and writers that can speak the binary protocol, etc.
|
strong |
Compression algorithm used for payload compression.
The compression type is stored in the high byte of the former reserved1 field in the frame header. Using none (0x00) maintains backward compatibility with uncompressed payloads.
| std::expected< std::vector< std::byte >, error_code > compress | ( | std::span< const std::byte > | data, |
| compression_type | type | ||
| ) |
Compress data using the specified algorithm.
| data | The data to compress |
| type | The compression algorithm to use |

| std::expected< std::vector< std::byte >, error_code > decompress | ( | std::span< const std::byte > | data, |
| compression_type | type | ||
| ) |
Decompress data using the specified algorithm.
| data | The compressed data |
| type | The compression algorithm used |

| bool is_compression_supported | ( | compression_type | type | ) |
Check if compression is supported for the given type.
| type | The compression type to check |

| frame create_error_response_frame | ( | std::uint32_t | sequence, |
| std::uint32_t | correlation_id, | ||
| error_code | code, | ||
| const std::string & | message | ||
| ) |
Create an error response frame.
| sequence | The sequence number for the frame |
| correlation_id | The correlation ID from the request (for matching) |
| code | The error code |
| message | Human-readable error message |
| frame create_handshake_request_frame | ( | std::uint32_t | sequence, |
| const std::string & | client_identifier, | ||
| std::uint8_t | supported_compression = 0 |
||
| ) |
Create a handshake request frame.
| sequence | Frame sequence number |
| client_identifier | Client identifier string |
| supported_compression | Bitmask of supported compression types (default: 0 = no compression support) |

| frame create_handshake_response_frame | ( | std::uint32_t | sequence, |
| bool | version_compatible, | ||
| const std::string & | server_identifier, | ||
| error_code | status = error_code::none, |
||
| compression_type | selected_compression = compression_type::none |
||
| ) |
Create a handshake response frame.
| sequence | Frame sequence number |
| version_compatible | Whether the client version is compatible |
| server_identifier | Server identifier string |
| status | Error status (default: none) |
| selected_compression | Compression type selected for this session (default: none) |

| compression_type select_compression | ( | std::uint8_t | supported_compression, |
| compression_type | preferred = compression_type::zlib |
||
| ) |
Select a compression type from the client's supported types.
Returns the preferred compression type that is supported by the client, or compression_type::none if no compression is supported.
| supported_compression | Bitmask of supported compression types |
| preferred | The server's preferred compression type (default: zlib) |

| std::ostream & operator<< | ( | std::ostream & | os, |
| message_type | mt | ||
| ) |
Stream output operator for message_type.
Uses magic_enum to provide human-readable enum names with hex values in logs. Example: "get_currencies_request (0x1001)" instead of just "0x1001"
| std::ostream & operator<< | ( | std::ostream & | os, |
| error_code | ec | ||
| ) |
Stream output operator for error_code.
Uses magic_enum to provide human-readable enum names with hex values in logs. Example: "version_mismatch (0x0001)" instead of just "0x0001"
|
constexpr |
Compression support bitmask values.
Used in handshake_request::supported_compression to indicate which compression algorithms the client supports.