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
// License: see LICENSE file at root directory of `master` branch
//! # Server
//!
//! A client connecting to Namaste server is expected to send:
//!
//! - A command.
//! - Data belonged to the command.
//!
//! Currently, supported commands are: [`CMD_BOOK`][::CMD_BOOK], [`CMD_CHECK_OUT`][::CMD_CHECK_OUT].
//!
//! Server is expected to send back one-byte result. A zero (`0`) means `false`, others mean `true`.
//!
//! [::CMD_BOOK]: constant.CMD_BOOK.html
//! [::CMD_CHECK_OUT]: constant.CMD_CHECK_OUT.html
/// # Default port
pub const DEFAULT_PORT: u16 = 64009;
/// # Command to book a seat
///
/// ## Data
///
/// - ID - _must_ be a constant.
/// - Handshake ID - _must_ be different to ID and _should_ be generated per each command.
/// - Client's local TCP server port, consisting of 2 bytes, in big-endian order.
pub const CMD_BOOK: u8 = 0;
/// # Command to check out
///
/// ## Data
///
/// - ID - the one previously sent via [`CMD_BOOK`][::CMD_BOOK].
/// - Handshake ID - the one previously sent via [`CMD_BOOK`][::CMD_BOOK].
///
/// [::CMD_BOOK]: constant.CMD_BOOK.html
pub const CMD_CHECK_OUT: u8 = 1;