Skip to main content

ironfix_engine/
lib.rs

1/******************************************************************************
2   Author: Joaquín Béjar García
3   Email: jb@taunais.com
4   Date: 27/1/26
5******************************************************************************/
6
7//! # IronFix Engine
8//!
9//! High-level FIX engine facade for the IronFix protocol implementation.
10//!
11//! This is the composition root: the only crate permitted to combine the
12//! session layer, the store, the transport codec and the tag=value codec.
13//!
14//! This crate provides:
15//! - **[`Initiator`]**: the client-side engine. [`Initiator::connect`] dials
16//!   the counterparty over TCP, runs the Logon handshake, and hands the socket
17//!   to a background reactor that owns framing, heartbeats and TestRequests,
18//!   CompID validation, sequence-gap detection, `ResendRequest` /
19//!   `SequenceReset` / gap fill, `PossDupFlag` and `OrigSendingTime`,
20//!   `ResetSeqNumFlag`, resend-from-store replay, and session-level `Reject`.
21//! - **[`Acceptor`]**: the server-side engine. [`Acceptor::serve`] runs the
22//!   acceptor half of the Logon handshake on an inbound connection and hands the
23//!   socket to the same reactor.
24//! - **[`Connection`]**: a cheap-clone handle returned by both engines — send,
25//!   logout, await close, read sequence numbers.
26//! - **[`OutboundMessage`]**: the body you hand to [`Connection::send`]; the
27//!   engine stamps the header, `MsgSeqNum` and trailer.
28//! - **[`Application`]**: the QuickFIX-shaped callback trait
29//!   (`on_create` / `on_logon` / `on_logout` / `to_admin` / `from_admin` /
30//!   `to_app` / `from_app`), plus [`NoOpApplication`].
31//! - **[`EngineBuilder`]**: fluent configuration that terminates in a
32//!   ready-to-run [`Initiator`] or [`Acceptor`].
33//!
34//! Both engines share the same internal session reactor (`reactor`): once
35//! a Logon handshake completes, the inbound-frame contract — sequence
36//! validation, gap recovery, identity and clock checks, heartbeating, and the
37//! Logout handshake — is identical for the two roles.
38//!
39//! ## Current limitations
40//!
41//! - **There is no TLS**, and no dictionary validation: `ironfix-dictionary`'s
42//!   `Validator` is never invoked on the session path.
43//! - **The store is opt-in and in-memory.** Attaching an
44//!   [`ironfix_store::MemoryStore`] with [`Initiator::with_store`] enables
45//!   resend-from-store replay, but there is no persistent implementation yet;
46//!   the acceptor attaches no store, so its resends are gap-filled.
47
48pub mod acceptor;
49pub mod application;
50pub mod builder;
51pub mod connection;
52pub mod error;
53pub mod initiator;
54pub mod outbound;
55mod reactor;
56mod wire;
57
58pub use acceptor::Acceptor;
59pub use application::{Application, NoOpApplication, RejectReason, SessionId};
60pub use builder::EngineBuilder;
61pub use connection::Connection;
62pub use error::EngineError;
63pub use initiator::Initiator;
64pub use outbound::{OutboundField, OutboundMessage};
65
66// Re-exported for convenience: the per-session configuration consumed by
67// [`Initiator`].
68pub use ironfix_session::SessionConfig;