easyfix_session/
settings.rs1use std::ops::RangeInclusive;
2
3use chrono::NaiveTime;
4use easyfix_messages::fields::FixString;
5use serde::{Deserialize, Deserializer};
6use tokio::time::Duration;
7
8use crate::session_id::SessionId;
9
10fn duration_from_seconds<'de, D>(deserializer: D) -> Result<Duration, D::Error>
11where
12 D: Deserializer<'de>,
13{
14 Ok(Duration::from_secs(u64::deserialize(deserializer)?))
15}
16
17#[derive(Clone, Debug, Deserialize)]
19pub struct Settings {
20 pub sender_comp_id: FixString,
22 pub sender_sub_id: Option<FixString>,
24 #[serde(deserialize_with = "duration_from_seconds")]
28 pub heartbeat_interval: Duration,
29 #[serde(deserialize_with = "duration_from_seconds")]
31 pub auto_disconnect_after_no_logon_received: Duration,
32 pub auto_disconnect_after_no_heartbeat: u32,
35}
36
37#[derive(Clone, Debug, Deserialize)]
38pub struct SessionSettings {
39 pub session_id: SessionId,
40 pub session_time: RangeInclusive<NaiveTime>,
42 pub logon_time: RangeInclusive<NaiveTime>,
43
44 pub send_redundant_resend_requests: bool,
45 pub check_comp_id: bool,
46 pub check_latency: bool,
47 pub max_latency: Duration,
48
49 pub reset_on_logon: bool,
50 pub reset_on_logout: bool,
51 pub reset_on_disconnect: bool,
52
53 pub refresh_on_logon: bool,
54
55 pub sender_default_appl_ver_id: FixString,
56 pub target_default_appl_ver_id: FixString,
57
58 pub enable_next_expected_msg_seq_num: bool,
62
63 pub persist: bool,
65
66 pub verify_logout: bool,
68
69 pub verify_test_request_id: bool,
73}