Skip to main content

msrt_ffi/
constants.rs

1//! C ABI constants.
2
3/// Maximum bytes carried by one C poll event.
4pub const MAX_EVENT_BYTES: usize = 256;
5/// Conservative caller-owned endpoint storage size.
6pub const ENDPOINT_STORAGE_BYTES: usize = 32 * 1024;
7
8/// Operation completed successfully.
9pub const MSRT_STATUS_OK: i32 = 0;
10/// A required pointer argument was null.
11pub const MSRT_STATUS_NULL: i32 = -1;
12/// A slice pointer was null while its length was non-zero.
13pub const MSRT_STATUS_INVALID_SLICE: i32 = -2;
14/// MSRT reported a protocol error.
15pub const MSRT_STATUS_PROTOCOL_ERROR: i32 = -3;
16/// The requested option value is not supported.
17pub const MSRT_STATUS_UNSUPPORTED: i32 = -4;
18/// The endpoint is not currently connected or accepted.
19pub const MSRT_STATUS_NO_SESSION: i32 = -5;
20/// Caller-provided storage is too small or insufficiently aligned.
21pub const MSRT_STATUS_INVALID_STORAGE: i32 = -6;
22
23/// Active client endpoint role.
24pub const MSRT_ROLE_CLIENT: u32 = 1;
25/// Passive single-peer endpoint role.
26pub const MSRT_ROLE_PASSIVE: u32 = 2;
27
28/// Default CRC-16/XMODEM integrity.
29pub const MSRT_INTEGRITY_CRC16: u32 = 1;
30/// CRC-32/ISO-HDLC integrity.
31pub const MSRT_INTEGRITY_CRC32: u32 = 2;
32/// CRC-64/ECMA-182 integrity.
33pub const MSRT_INTEGRITY_CRC64: u32 = 3;
34/// Keyed SipTag integrity using the MSRT default key.
35pub const MSRT_INTEGRITY_SIP_TAG_DEFAULT: u32 = 4;
36/// Keyed SipTag integrity using the configured key.
37pub const MSRT_INTEGRITY_SIP_TAG_KEY: u32 = 5;
38/// Backward-compatible alias for `MSRT_INTEGRITY_SIP_TAG_DEFAULT`.
39pub const MSRT_INTEGRITY_AEAD_DEFAULT: u32 = 4;
40/// Backward-compatible alias for `MSRT_INTEGRITY_SIP_TAG_KEY`.
41pub const MSRT_INTEGRITY_AEAD_KEY: u32 = 5;
42
43/// No endpoint action is pending.
44pub const MSRT_POLL_IDLE: u32 = 0;
45/// Event bytes should be transmitted by the caller.
46pub const MSRT_POLL_TRANSMIT: u32 = 1;
47/// A complete application message is available.
48pub const MSRT_POLL_MESSAGE: u32 = 2;
49/// A reliable message failed to send.
50pub const MSRT_POLL_SEND_FAILED: u32 = 3;
51
52/// Endpoint is disconnected.
53pub const MSRT_PEER_DISCONNECTED: u32 = 0;
54/// Endpoint has a local session but has not yet observed valid peer traffic.
55pub const MSRT_PEER_CONNECTING: u32 = 1;
56/// Endpoint has observed valid peer traffic.
57pub const MSRT_PEER_CONNECTED: u32 = 2;
58
59/// No receive detail is available.
60pub const MSRT_RECEIVE_NONE: u32 = 0;
61/// A packet was accepted.
62pub const MSRT_RECEIVE_PACKET: u32 = 1;
63/// A duplicate packet was accepted and acknowledged.
64pub const MSRT_RECEIVE_DUPLICATE: u32 = 2;
65/// An ACK packet was accepted.
66pub const MSRT_RECEIVE_ACK: u32 = 3;
67/// A PING packet was accepted.
68pub const MSRT_RECEIVE_PING: u32 = 4;
69/// A PONG packet was accepted.
70pub const MSRT_RECEIVE_PONG: u32 = 5;
71/// Noise was skipped.
72pub const MSRT_RECEIVE_NOISE: u32 = 6;
73/// A corrupted packet envelope was rejected.
74pub const MSRT_RECEIVE_CORRUPTED: u32 = 7;
75/// More bytes are needed.
76pub const MSRT_RECEIVE_INCOMPLETE: u32 = 8;
77/// The packet was valid but could not be applied.
78pub const MSRT_RECEIVE_ERROR: u32 = 9;