1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! *FIX Performance Session Layer*
//! ([FIXP](https://www.fixtrading.org/standards/fixp-online/)) support.

type SessionId = u128;

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum FlowType {
    Recoverable,
    Idempotent,
    Unsequenced,
    None,
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum MessageType {
    Sequence,
    Context,
    MessageTemplate,
    Negotiate,
}

#[derive(Debug, Clone)]
pub struct Sequence {
    next_seq_number: u64,
}

#[derive(Debug, Clone)]
pub struct Context {
    session_id: SessionId,
    next_seq_number: u64,
}

#[derive(Debug, Clone)]
pub struct MessageTemplate {
    encoding_type: u32,
    effective_time: u64,
    version: Vec<u8>,
    template: Vec<u8>,
}

#[derive(Debug, Clone)]
pub struct Negotiate {
    session_id: SessionId,
    client_flow: FlowType,
    credentials: Option<Vec<u8>>,
}

#[derive(Debug, Clone)]
pub struct NegotiationReject {
    session_id: SessionId,
    reason: Option<String>,
}

#[derive(Debug, Clone)]
pub struct Establish {
    session_id: SessionId,
    next_seq_number: u64,
    credentials: Option<Vec<u8>>,
}

#[derive(Debug, Clone)]
pub struct EstablishmentAck {
    next_seq_number: u64,
}