|
llfix
Low-latency FIX engine
|
FIX server implementation. More...
#include <fix_server.h>
Inherits Transport, and ManagedInstance.
Public Member Functions | |
| bool | create (const std::string &server_name, const std::string server_config_file_path) |
| Creates and initialises the FIX server instance. More... | |
| bool | add_session (const std::string &session_name, FixSessionSettings &session_settings) |
| Adds a FIX session using preloaded session settings. More... | |
| bool | add_session (const std::string &session_config_file_path, const std::string &session_name) |
| Adds a FIX session by loading settings from a configuration file. More... | |
| bool | add_sessions_from (const std::string &session_config_file_path) |
| Adds all FIX sessions found in a configuration file. More... | |
| std::size_t | get_session_count () const |
| Returns the number of configured FIX sessions. More... | |
| FixSession * | get_session (const std::string &session_name) override |
| Retrieves a FIX session by name. More... | |
| std::string | get_session_name (FixSession *session) |
| Retrieves the name of a FIX session. More... | |
| void | get_session_names (std::vector< std::string > &target) override |
| Retrieves the names of all configured FIX sessions. More... | |
| template<typename... Args> | |
| void | specify_repeating_group (Args... args) |
| Specify repeating group definitions for incoming FIX messages for all sessions. More... | |
| OutgoingFixMessage * | outgoing_message_instance (FixSession *session) |
| Retrieves the reusable outgoing FIX message instance for a session. More... | |
| virtual bool | send_outgoing_message (FixSession *session, OutgoingFixMessage *message) |
| Encodes and sends an outgoing FIX message. More... | |
| void | shutdown () |
| Shuts down the FIX server. More... | |
| virtual void | on_new_order (FixSession *session, const IncomingFixMessage *message) |
| Called when a New Order (35=D) message is received. More... | |
| virtual void | on_cancel_order (FixSession *session, const IncomingFixMessage *message) |
| Called when an Order Cancel Request (35=F) message is received. More... | |
| virtual void | on_replace_order (FixSession *session, const IncomingFixMessage *message) |
| Called when an Order Cancel/Replace Request (35=G) message is received. More... | |
| virtual void | on_application_level_reject (FixSession *session, const IncomingFixMessage *message) |
| Called when an application-level reject message is generated. More... | |
| virtual void | on_session_level_reject (FixSession *session, const IncomingFixMessage *message) |
| Called when a session-level reject message is generated. More... | |
| virtual void | on_custom_message (FixSession *session, const IncomingFixMessage *message) |
| Called when any other FIX message type is received. More... | |
| virtual void | on_logon_request (FixSession *session, const IncomingFixMessage *message) |
| Called when a Logon (35=A) request is received from a client. More... | |
| virtual void | on_logout_request (FixSession *session, const IncomingFixMessage *message) |
| Called when a Logout (35=5) request is received from a client. More... | |
| virtual void | on_client_resend_request (FixSession *session, const IncomingFixMessage *message) |
| Called when a Resend Request (35=2) is received from a client. More... | |
| virtual void | on_client_test_request (FixSession *session, const IncomingFixMessage *message) |
| Called when a Test Request (35=1) is received from a client. More... | |
| virtual void | on_client_heartbeat (FixSession *session) |
| Called when a Heartbeat (35=0) message is received from a client. More... | |
| virtual bool | process_incoming_throttling (FixSession *session, const IncomingFixMessage *incoming_fix_message) |
| Applies incoming message throttling logic. More... | |
| virtual void | process_schedule_validator (FixSession *session) |
| Validates the session against configured schedule rules. More... | |
| virtual FixSession * | accept_session (std::size_t peer_index, const IncomingFixMessage *incoming_fix_message, const char *buffer, std::size_t buffer_length, uint32_t parser_reject_code) |
| Accepts and validates an incoming session before logon processing. More... | |
| virtual void | process_logon_request (FixSession *session, std::size_t peer_index, const IncomingFixMessage *message) |
| Processes an incoming Logon (35=A) request. More... | |
| virtual bool | authenticate_logon_request (FixSession *session, const IncomingFixMessage *message) |
| Authenticates an incoming Logon (35=A) request. More... | |
| void | set_message_persist_plugin (MessagePersistPlugin *plugin) |
| Set the message persistence plugin. More... | |
Protected Member Functions | |
| virtual bool | send_heartbeat (FixSession *session, FixString *test_request_id) |
| Sends a Heartbeat (35=0) message to the client. More... | |
| virtual bool | send_logon_response (FixSession *session, const IncomingFixMessage *message) |
| Sends a Logon (35=A) response message. More... | |
| virtual bool | send_logout_message (FixSession *session, const std::string &reason_text="") |
| Sends a Logout (35=5) message. More... | |
| virtual bool | send_test_request (FixSession *session) |
| Sends a Test Request (35=1) message. More... | |
| virtual bool | send_resend_request (FixSession *session) |
| Sends a Resend Request (35=2) message. More... | |
| virtual bool | send_sequence_reset_message (FixSession *session, uint32_t desired_sequence_no) |
| Sends a Sequence Reset (35=4) message without gap fill. More... | |
| virtual bool | send_gap_fill_message (FixSession *session) |
| Sends a Gap Fill message in response to a Resend Request. More... | |
FIX server implementation.
Manages FIX sessions, accepts incoming client connections, routes FIX messages, and provides virtual callbacks for application-level and session-level message handling.
| Transport | Transport layer implementation: one of TcpReactor TcpReactorScalable TcpReactorScalableSSL. |
|
inlinevirtual |
Accepts and validates an incoming session before logon processing.
Handles parser-level validation failures, checks required header tags, resolves the target session from CompIDs and BeginString, and rejects invalid or duplicate live logon attempts.
| peer_index | Transport peer index associated with the connection. |
| incoming_fix_message | Parsed incoming FIX message. |
| buffer | Raw incoming FIX bytes for logging/reject context. |
| buffer_length | Length of the raw incoming FIX buffer. |
| parser_reject_code | Parser validation result code. |
|
inline |
Adds a FIX session by loading settings from a configuration file.
| session_config_file_path | Path to the session configuration file. |
| session_name | Name of the session group in the configuration. |
|
inline |
Adds a FIX session using preloaded session settings.
| session_name | Logical name of the session. |
| session_settings | Session configuration settings. |
|
inline |
Adds all FIX sessions found in a configuration file.
Scans the configuration file for groups containing "SESSION" in their name and creates a FIX session for each.
| session_config_file_path | Path to the session configuration file. |
|
inlinevirtual |
Authenticates an incoming Logon (35=A) request.
Allows applications to implement custom authentication logic such as logon usernames and password
| session | FIX session attempting to log on. |
| message | Incoming Logon FIX message. |
|
inline |
Creates and initialises the FIX server instance.
| server_name | Logical name of the FIX server instance. |
| server_config_file_path | Path to the server configuration file. |
|
inlineoverride |
Retrieves a FIX session by name.
| session_name | Name of the FIX session. |
|
inline |
Returns the number of configured FIX sessions.
|
inline |
Retrieves the name of a FIX session.
| session | Pointer to a FIX session. |
|
inlineoverride |
Retrieves the names of all configured FIX sessions.
| target | Output vector populated with session names. |
|
inlinevirtual |
Called when an application-level reject message is generated.
| session | FIX session associated with the reject. |
| message | Incoming FIX message that caused the reject. |
|
inlinevirtual |
Called when an Order Cancel Request (35=F) message is received.
| session | FIX session that received the message. |
| message | Incoming FIX message. |
|
inlinevirtual |
Called when a Heartbeat (35=0) message is received from a client.
| session | FIX session that received the heartbeat. |
|
inlinevirtual |
Called when a Resend Request (35=2) is received from a client.
| session | FIX session that received the resend request. |
| message | Incoming Resend Request FIX message. |
|
inlinevirtual |
Called when a Test Request (35=1) is received from a client.
| session | FIX session that received the test request. |
| message | Incoming Test Request FIX message. |
|
inlinevirtual |
Called when any other FIX message type is received.
| session | FIX session that received the message. |
| message | Incoming FIX message. |
|
inlinevirtual |
Called when a Logon (35=A) request is received from a client.
| session | FIX session requesting logon. |
| message | Incoming Logon FIX message. |
|
inlinevirtual |
Called when a Logout (35=5) request is received from a client.
| session | FIX session requesting logout. |
| message | Incoming Logout FIX message. |
|
inlinevirtual |
Called when a New Order (35=D) message is received.
| session | FIX session that received the message. |
| message | Incoming FIX message. |
|
inlinevirtual |
Called when an Order Cancel/Replace Request (35=G) message is received.
| session | FIX session that received the message. |
| message | Incoming FIX message. |
|
inlinevirtual |
Called when a session-level reject message is generated.
| session | FIX session associated with the reject. |
| message | Incoming FIX message that caused the reject. |
|
inline |
Retrieves the reusable outgoing FIX message instance for a session.
| session | Target FIX session. |
|
inlinevirtual |
Applies incoming message throttling logic.
Determines whether an incoming FIX message should be processed, delayed, rejected, or cause session termination based on throttling configuration.
| session | FIX session receiving the message. |
| incoming_fix_message | Incoming FIX message. |
|
inlinevirtual |
Processes an incoming Logon (35=A) request.
Validates and authenticates the incoming logon, applies heartbeat timing from the request, sends the logon response, and finalises session state transition to logged on.
| session | FIX session handling the logon request. |
| peer_index | Transport peer index associated with the connection. |
| message | Incoming Logon FIX message. |
|
inlinevirtual |
Validates the session against configured schedule rules.
Checks whether the current time is within the session's allowed schedule and terminates the connection if it is not.
| session | FIX session to validate. |
|
inlineprotectedvirtual |
Sends a Gap Fill message in response to a Resend Request.
| session | FIX session to send the gap fill on. |
|
inlineprotectedvirtual |
Sends a Heartbeat (35=0) message to the client.
| session | FIX session to send the heartbeat on. |
| test_request_id | Optional TestReqID (tag 112), may be null. |
|
inlineprotectedvirtual |
Sends a Logon (35=A) response message.
| session | FIX session to send the logon response on. |
| message | Incoming Logon FIX message being responded to. |
|
inlineprotectedvirtual |
Sends a Logout (35=5) message.
| session | FIX session to send the logout message on. |
| reason_text | Optional human-readable logout reason. |
|
inlinevirtual |
Encodes and sends an outgoing FIX message.
| session | Target FIX session. |
| message | Outgoing FIX message to send. |
|
inlineprotectedvirtual |
Sends a Resend Request (35=2) message.
| session | FIX session to send the resend request on. |
|
inlineprotectedvirtual |
Sends a Sequence Reset (35=4) message without gap fill.
| session | FIX session to send the sequence reset on. |
| desired_sequence_no | Target sequence number. |
|
inlineprotectedvirtual |
Sends a Test Request (35=1) message.
| session | FIX session to send the test request on. |
|
inline |
Set the message persistence plugin.
| plugin | Pointer to a MessagePersistPlugin implementation. |
|
inline |
Shuts down the FIX server.
Stops the underlying transport and terminates all sessions.
|
inline |
Specify repeating group definitions for incoming FIX messages for all sessions.
| Args | Parameter pack defining repeating group structure. |
| args | Repeating group specification arguments. |
Not needed in the commercial edition