rusmpp_core/
fields.rs

1//! `SMPP` Fields.
2
3/// Every field defined in the `SMPP` protocol and extra fields defined in this library.
4///
5/// Used for verbose error handling while decoding invalid pdus, if the `verbose` feature is enabled.
6///
7/// # Example
8///
9/// ```rust
10/// # #[cfg(all(feature = "verbose", feature = "alloc"))]
11/// # {
12/// # use rusmpp_core::{command::owned::Command, decode::owned::DecodeWithLength, fields::SmppField};
13/// // bind_transmitter bytes
14/// // The `password` field is not null terminated.
15/// // The `decode` method will return an error with
16/// // the `SmppField::password` field as a source in
17/// // the sources tree.
18/// let bytes: [u8; 46] = [
19///     // Header
20///     0x00, 0x00, 0x00, 0x2E, // Command Length (46 bytes total)
21///     0x00, 0x00, 0x00, 0x02, // Command ID (bind_transmitter)
22///     0x00, 0x00, 0x00, 0x00, // Command Status (0 - OK)
23///     0x00, 0x00, 0x00, 0x01, // Sequence Number (1)
24///
25///     // system_id: "SMPP3TEST\0"
26///     0x53, 0x4D, 0x50, 0x50, 0x33, 0x54, 0x45, 0x53, 0x54, 0x00,
27///     // password: "secret08" WRONG! not null terminated!
28///     0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x30, 0x38,
29///     // system_type: "SUBMIT1"
30///     0x53, 0x55, 0x42, 0x4D, 0x49, 0x54, 0x31, 0x00,
31///     // interface_version
32///     0x50,
33///     // addr_ton
34///     0x01,
35///     // addr_npi
36///     0x01,
37///     // addr_range
38///     0x00,
39/// ];
40///
41/// let error = Command::decode(&bytes[4..], 46 - 4).unwrap_err();
42///
43/// assert!(error.field_exists(SmppField::password));
44///
45/// // Knowing that the `password` field is invalid,
46/// // we can respond with `ESME_RINVPASWD` (Invalid Password).
47/// # }
48#[allow(non_camel_case_types)]
49#[derive(Debug, Copy, Clone, PartialEq, Eq)]
50pub enum SmppField {
51    addr,
52    addr_npi,
53    addr_ton,
54    address_range,
55    area,
56    data_coding,
57    dest_addr_npi,
58    dest_addr_ton,
59    dest_address,
60    destination_addr,
61    dl_name,
62    encoding_content_type,
63    error_code,
64    error_status_code,
65    esm_class,
66    esme_addr,
67    esme_addr_npi,
68    esme_addr_ton,
69    final_date,
70    format,
71    id,
72    interface_version,
73    message_id,
74    message_payload,
75    message_state,
76    ms_availability_status,
77    network_type,
78    no_unsuccess,
79    number_of_dests,
80    number_of_time_units,
81    password,
82    pdu,
83    priority_flag,
84    protocol_id,
85    registered_delivery,
86    replace_if_present_flag,
87    sc_interface_version,
88    schedule_delivery_time,
89    sequence_number,
90    service_type,
91    session_number,
92    short_message,
93    sm_default_msg_id,
94    sm_length,
95    source_addr,
96    source_addr_npi,
97    source_addr_ton,
98    status,
99    system_id,
100    system_type,
101    tag,
102    tlvs,
103    type_of_network,
104    unit,
105    units_of_time,
106    unsuccess_sme,
107    user_message_reference,
108    validity_behavior,
109    validity_information,
110    validity_period,
111    value,
112    value_length,
113}