├── .gitignore
├── 3S_slides
└── RustForSpace_Seidel.pdf
├── LICENSE
├── README.md
├── csp-rs
├── Cargo.toml
├── build.rs
├── src
│ ├── csp_structs.rs
│ ├── lib.rs
│ ├── libcsp_ffi.rs
│ └── macros.rs
└── wrapper.h
└── paper
├── RustForSpace.pdf
└── paper.png
/.gitignore:
--------------------------------------------------------------------------------
1 | csp-rs/target
2 |
3 |
--------------------------------------------------------------------------------
/3S_slides/RustForSpace_Seidel.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pr0me/rust-for-critical-space-systems/40f913626c5c59821e183984a5208714a84f8c2a/3S_slides/RustForSpace_Seidel.pdf
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Lukas Seidel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bringing Rust to Safety-Critical Systems in Space
2 |
3 |
4 |
5 | The development of safety-critical aerospace systems
6 | is traditionally dominated by the C language. Its language characteristics make it trivial to accidentally introduce memory safety
7 | issues resulting in undefined behavior or security vulnerabilities.
8 | The Rust language aims to drastically reduce the chance of
9 | introducing bugs and consequently produces overall more secure
10 | and safer code.
11 |
12 | ## Contributions
13 | 1. We evaluate the state of the Rust ecosystem for use in
14 | safety-critical systems in space.
15 | 2. We present a process to partially replace components
16 | of software developed in C with equivalent Rust implementations.
17 | 3. We identify and patch three security issues in the
18 | Cubesat Space Protocol, a popular open-source packet
19 | communication protocol for satellites.
20 | 4. We develop a new target configuration for the Rust
21 | compiler, allowing the compilation of programs for bare
22 | metal PowerPC CPUs.
23 | 5. Based on the combined insights of our contributions,
24 | we develop a set of recommendations for practitioners
25 | in the realms of space system development.
26 |
27 | This repository is still WIP and we will add source code and notes on the remaining contributions soon.
28 |
29 | ## libcsp-rs
30 | ### Partial Rewrite
31 |
32 | We perform a partial rewrite of critical sections in [libCSP's C implementation](https://github.com/libcsp/libcsp) to demonstrate how Rust can be gradually incorporated into existing C code bases.
33 |
34 | #### How to Build
35 | Build the static Rust lib and make sure to build `core::` with `panic = "abort"`.
36 | Building the lib will otherwise still succeed but linking it into a program later on will fail due to
37 | missing refs to `rust_eh_personality`.
38 | ```bash
39 | cargo build --release
40 | ```
41 |
42 | Note that the compiled lib will be in `./target/powerpc-unknown-none/release/libcsp_rs.a`.
43 |
44 | The flag to build the core lib and the target are defined in `.cargo/config.toml`, thus the library automatically builds for PPC.
45 |
46 | Other things to note (but that are taken care of):
47 | - `csp-rs` is intended to be used as part of `libcsp`, i.e., you should link against `libcsp` as a dependency.
48 | Linking directly against `csp-rs` is not tested.
49 | - FFI bindings were generated with `rust-bindgen` from the `wrapper.h` header:
50 | ```
51 | bindgen wrapper.h -o libcsp_ffi.rs --use-core --no-layout-tests
52 | ```
53 | (note the additional flags to make sure that we end up being `#![no_std]` compliant)
54 | - C bindings to our Rust lib are included in `./libcsp/src/libcsp_rs.h`
55 | - `csp_can1_rx` was replaced with an include and an `extern` ref in `libcsp/src/interfaces/csp_if_can.c`
56 |
57 | ### Security Analysis
58 | We identified and fixed multiple bugs in libCSP in collaboration with the maintainers:
59 | https://github.com/libcsp/libcsp/pull/510
60 |
61 | ## Citation
62 | ```json
63 | @inproceedings{rustspace3S,
64 | author = {Seidel, Lukas and Beier, Julian},
65 | title = {Bringing Rust to Safety-Critical Systems in Space},
66 | booktitle = {IEEE Security for Space Systems (3S)},
67 | year = {2024},
68 | month = {May},
69 | }
70 | ```
71 |
--------------------------------------------------------------------------------
/csp-rs/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "csp-rs"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [profile.dev]
9 | panic = "abort"
10 |
11 | [profile.release]
12 | panic = "abort"
13 |
14 | [lib]
15 | crate-type=["staticlib"]
16 |
17 | [dependencies]
18 | num_enum = { version = "0.7.1", default-features = false }
--------------------------------------------------------------------------------
/csp-rs/build.rs:
--------------------------------------------------------------------------------
1 | fn main() {
2 | println!("cargo:rustc-link-search=../libcsp/builddir/");
3 | println!("cargo:rustc-link-lib=libcsp");
4 |
5 | println!("cargo:rerun-if-changed=wrapper.h");
6 | }
--------------------------------------------------------------------------------
/csp-rs/src/csp_structs.rs:
--------------------------------------------------------------------------------
1 | use crate::libcsp_ffi;
2 | use num_enum::TryFromPrimitive;
3 |
4 | /// Cubesat Space Protocol Error Types
5 | #[repr(i32)]
6 | #[derive(Copy, Clone)]
7 | pub enum CspError {
8 | None = 0,
9 | Nomem = -1,
10 | Inval = -2,
11 | Timedout = -3,
12 | Used = -4,
13 | Notsup = -5,
14 | Busy = -6,
15 | Already = -7,
16 | Reset = -8,
17 | Nobufs = -9,
18 | Tx = -10,
19 | Driver = -11,
20 | Again = -12,
21 | Nosys = -38,
22 | Hmac = -100,
23 | Crc32 = -102,
24 | Sfp = -103,
25 | }
26 |
27 | /// CAN Fragmentation Protocol (CFP) Type
28 | #[repr(u32)]
29 | #[derive(Copy, Clone, Eq, PartialEq, TryFromPrimitive)]
30 | pub enum CfpFrameType {
31 | /// First CFP fragment of a CSP packet
32 | CfpBegin = 0,
33 | /// Remaining CFP fragment(s) of a CSP packet
34 | CfpMore = 1,
35 | }
36 |
37 | #[repr(C)]
38 | #[derive(Copy, Clone)]
39 | pub union LayerData {
40 | /// Only used on layer 3 (RDP)
41 | pub rdp_data: RdpData,
42 | /// Only used on interface RX/TX (layer 2)
43 | pub rx_tx_data: RxTxData,
44 | }
45 |
46 | #[repr(C)]
47 | #[derive(Copy, Clone)]
48 | pub union PacketData {
49 | pub data: [u8; libcsp_ffi::CSP_BUFFER_SIZE as _],
50 | pub data16: [u16; (libcsp_ffi::CSP_BUFFER_SIZE / 2) as _],
51 | pub data32: [u32; (libcsp_ffi::CSP_BUFFER_SIZE / 4) as _],
52 | }
53 |
54 | /// Data Struct only used on layer 3 (RDP)
55 | #[repr(C)]
56 | #[derive(Copy, Clone)]
57 | pub struct RdpData {
58 | /// EACK quarantine period
59 | pub rdp_quarantine: u32,
60 | /// Time the message was sent
61 | pub timestamp_tx: u32,
62 | /// Time the message was received
63 | pub timestamp_rx: u32,
64 | /// Associated connection (used in RDP queue); actually a *csp_conn_s
65 | pub conn: *mut libcsp_ffi::csp_conn_s,
66 | }
67 |
68 | /// Data Struct only used on interface RX/TX (layer 2)
69 | #[repr(C)]
70 | #[derive(Copy, Clone)]
71 | pub struct RxTxData {
72 | /// Received bytes
73 | pub rx_count: u16,
74 | /// Remaining packets
75 | pub remain: u16,
76 | /// Connection CFP identification number
77 | pub cfpid: u32,
78 | /// Timestamp in ms for last use of buffer
79 | pub last_used: u32,
80 | pub frame_begin: *mut u8,
81 | pub frame_length: u16,
82 | }
83 |
84 | /// CSP packet - constructed to fit with all interface and protocols to prevent the need to copy data (zero copy)
85 | #[repr(C)]
86 | #[derive(Copy, Clone)]
87 | pub struct CspPacket {
88 | pub layer: LayerData,
89 | pub length: u16,
90 | pub id: libcsp_ffi::csp_id_t,
91 | pub next: *mut CspPacket,
92 | pub header: [u8; libcsp_ffi::CSP_PACKET_PADDING_BYTES as _],
93 | pub data: PacketData,
94 | }
95 |
--------------------------------------------------------------------------------
/csp-rs/src/lib.rs:
--------------------------------------------------------------------------------
1 | #![no_std]
2 |
3 | pub mod csp_structs;
4 | pub mod libcsp_ffi;
5 | #[macro_use]
6 | pub mod macros;
7 |
8 | use libcsp_ffi::{csp_packet_t, csp_id_setup_rx, CFP2_DST_OFFSET};
9 |
10 | use crate::csp_structs::*;
11 | use core::{ffi, mem, ptr};
12 |
13 | /// Max number of bytes per CAN frame
14 | pub const CAN_FRAME_SIZE: u8 = 8;
15 |
16 | /// CFP 1.x defines
17 | pub const CFP1_CSP_HEADER_OFFSET: u8 = 0;
18 | pub const CFP1_CSP_HEADER_SIZE: u8 = 4;
19 | pub const CFP1_DATA_LEN_OFFSET: u8 = 4;
20 | pub const CFP1_DATA_LEN_SIZE: u8 = 2;
21 | pub const CFP1_DATA_OFFSET: u8 = 6;
22 | pub const CFP1_DATA_SIZE_BEGIN: u8 = 2;
23 | pub const CFP1_DATA_SIZE_MORE: u8 = 8;
24 |
25 | /// Mask to uniquely separate connections
26 | pub const CFP_ID_CONN_MASK: u32 = cfp_make_src!(((1u32 << libcsp_ffi::CFP_HOST_SIZE) - 1))
27 | | cfp_make_dst!(((1u32 << libcsp_ffi::CFP_HOST_SIZE) - 1))
28 | | cfp_make_id!(((1u32 << libcsp_ffi::CFP_ID_SIZE) - 1));
29 |
30 | #[panic_handler]
31 | fn panic_handler(_: &core::panic::PanicInfo<'_>) -> ! { loop {} }
32 |
33 | /// Handle incoming CSP v1.0 CAN frames
34 | #[no_mangle]
35 | pub extern "C" fn csp_can1_rx(
36 | iface: *mut libcsp_ffi::csp_iface_t,
37 | id: u32,
38 | data: *const u8,
39 | data_length: u8,
40 | task_woken: *mut i32,
41 | ) -> CspError {
42 | let curr_iface = unsafe {
43 | if !iface.is_null() {
44 | &mut *iface
45 | } else {
46 | return CspError::Inval;
47 | }
48 | };
49 | let if_data = curr_iface.interface_data as *mut libcsp_ffi::csp_can_interface_data_t;
50 |
51 | let curr_frame_type = {
52 | let type_from_raw_int = CfpFrameType::try_from(cfp_type!(id));
53 | if let Ok(tmp_type) = type_from_raw_int {
54 | tmp_type
55 | } else {
56 | // CSP_DBG_CAN_ERR_UNKNOWN
57 | return CspError::Inval;
58 | }
59 | };
60 |
61 | // bind incoming frame to a packet buffer
62 | let packet: &mut CspPacket = unsafe {
63 | let mut packet_ptr: *mut CspPacket =
64 | libcsp_ffi::csp_can_pbuf_find(if_data, id, CFP_ID_CONN_MASK, task_woken)
65 | as *mut CspPacket;
66 | if packet_ptr.is_null() {
67 | if curr_frame_type == CfpFrameType::CfpBegin {
68 | packet_ptr =
69 | libcsp_ffi::csp_can_pbuf_new(if_data, id, task_woken) as *mut CspPacket;
70 | if packet_ptr.is_null() {
71 | curr_iface.rx_error += 1;
72 | return CspError::Nomem;
73 | } else {
74 | &mut *packet_ptr
75 | }
76 | } else {
77 | curr_iface.frame += 1;
78 | return CspError::Inval;
79 | }
80 | } else {
81 | &mut *packet_ptr
82 | }
83 | };
84 |
85 | // reset frame data offset
86 | let mut offset = 0_u8;
87 | let packet_ptr = ptr::addr_of_mut!(*packet);
88 |
89 | // handle frame types
90 | loop {
91 | let mut fallthrough = false;
92 |
93 | if curr_frame_type == CfpFrameType::CfpBegin {
94 | // discard packet if DLC is less than CSP id + CSP length fields
95 | if (data_length as usize) < (mem::size_of::() + mem::size_of::()) {
96 | curr_iface.frame += 1;
97 | unsafe {
98 | libcsp_ffi::csp_can_pbuf_free(
99 | if_data,
100 | packet_ptr as *mut csp_packet_t,
101 | 1,
102 | task_woken,
103 | );
104 | }
105 | break;
106 | }
107 |
108 | curr_iface.frame += 1;
109 |
110 | unsafe {
111 | libcsp_ffi::csp_id_setup_rx(packet_ptr as *mut csp_packet_t);
112 |
113 | // copy CSP identifier (header)
114 | let header: u32 = ptr::read_unaligned(data as *const u32);
115 | ptr::write_unaligned(packet.layer.rx_tx_data.frame_begin as *mut u32, header);
116 | packet.layer.rx_tx_data.frame_length += mem::size_of::() as u16;
117 |
118 | libcsp_ffi::csp_id_strip(packet_ptr as *mut csp_packet_t);
119 |
120 | // copy CSP length (of data)
121 | let num_bytes =
122 | ptr::read_unaligned(data.add(mem::size_of::()) as *const [u8; 2]);
123 | packet.length = u16::from_ne_bytes(num_bytes);
124 |
125 | // check if incoming frame data length is larger than buffer length
126 | if packet.length as usize > mem::size_of_val(&packet.data) {
127 | curr_iface.rx_error += 1;
128 | libcsp_ffi::csp_can_pbuf_free(
129 | if_data,
130 | packet_ptr as *mut csp_packet_t,
131 | 1,
132 | task_woken,
133 | );
134 | break;
135 | }
136 | }
137 |
138 | // reset counter
139 | packet.layer.rx_tx_data.rx_count = 0;
140 |
141 | // adjust offset to prevent CSP header from being copied to CSP data
142 | offset = (mem::size_of::() + mem::size_of::()) as _;
143 |
144 | packet.layer.rx_tx_data.remain = (cfp_remain!(id) + 1) as u16;
145 |
146 | fallthrough = true;
147 | }
148 | if fallthrough || curr_frame_type == CfpFrameType::CfpMore {
149 | // union field accesses (no guarantee that they are initialized) and ffi calls are unsafe
150 | unsafe {
151 | // check 'remain' field match
152 | if (cfp_remain!(id)) != (packet.layer.rx_tx_data.remain - 1) as u32 {
153 | libcsp_ffi::csp_can_pbuf_free(
154 | if_data,
155 | packet_ptr as *mut csp_packet_t,
156 | 1,
157 | task_woken,
158 | );
159 | curr_iface.frame += 1;
160 | break;
161 | }
162 |
163 | // decrement remaining frames
164 | packet.layer.rx_tx_data.remain -= 1;
165 |
166 | // improved overflow check
167 | let copy_length = (data_length - offset) as u16;
168 | if (packet.length as usize > mem::size_of_val(&packet.data))
169 | || (packet.layer.rx_tx_data.rx_count + copy_length) > packet.length
170 | {
171 | curr_iface.frame += 1;
172 | libcsp_ffi::csp_can_pbuf_free(
173 | if_data,
174 | packet_ptr as *mut csp_packet_t,
175 | 1,
176 | task_woken,
177 | );
178 | break;
179 | }
180 |
181 | // copy data_length (dlc) bytes into buffer
182 | let src_ptr = data.add(offset.into());
183 | for i in 0..copy_length {
184 | packet.data.data[(packet.layer.rx_tx_data.rx_count + i) as usize] =
185 | ptr::read_unaligned(src_ptr.add(i.into()));
186 | }
187 | packet.layer.rx_tx_data.rx_count += copy_length;
188 |
189 | // check if more data is expected
190 | if packet.layer.rx_tx_data.rx_count < packet.length {
191 | break;
192 | }
193 |
194 | // rewrite incoming L2 broadcast to local node
195 | if packet.id.dst == 0x1F {
196 | packet.id.dst = curr_iface.addr;
197 | }
198 |
199 | // erase from list prev->next without actually freeing buffer
200 | libcsp_ffi::csp_can_pbuf_free(
201 | if_data,
202 | packet_ptr as *mut csp_packet_t,
203 | 0,
204 | task_woken,
205 | );
206 |
207 | // clear timestamp_rx for L3 as L2 last_used is not needed anymore
208 | packet.layer.rdp_data.timestamp_rx = 0;
209 |
210 | // signal that data is available
211 | libcsp_ffi::csp_qfifo_write(
212 | packet_ptr as *mut csp_packet_t,
213 | iface,
214 | task_woken as *mut ffi::c_void,
215 | );
216 | }
217 | }
218 | break;
219 | }
220 |
221 | CspError::None
222 | }
223 |
--------------------------------------------------------------------------------
/csp-rs/src/libcsp_ffi.rs:
--------------------------------------------------------------------------------
1 | /* automatically generated by rust-bindgen 0.69.1 */
2 | #![no_std]
3 | #![allow(unused)]
4 | #![allow(non_camel_case_types)]
5 | #![allow(non_upper_case_globals)]
6 |
7 | pub const CSP_ERR_NONE: u32 = 0;
8 | pub const CSP_ERR_NOMEM: i32 = -1;
9 | pub const CSP_ERR_INVAL: i32 = -2;
10 | pub const CSP_ERR_TIMEDOUT: i32 = -3;
11 | pub const CSP_ERR_USED: i32 = -4;
12 | pub const CSP_ERR_NOTSUP: i32 = -5;
13 | pub const CSP_ERR_BUSY: i32 = -6;
14 | pub const CSP_ERR_ALREADY: i32 = -7;
15 | pub const CSP_ERR_RESET: i32 = -8;
16 | pub const CSP_ERR_NOBUFS: i32 = -9;
17 | pub const CSP_ERR_TX: i32 = -10;
18 | pub const CSP_ERR_DRIVER: i32 = -11;
19 | pub const CSP_ERR_AGAIN: i32 = -12;
20 | pub const CSP_ERR_NOSYS: i32 = -38;
21 | pub const CSP_ERR_HMAC: i32 = -100;
22 | pub const CSP_ERR_CRC32: i32 = -102;
23 | pub const CSP_ERR_SFP: i32 = -103;
24 | pub const CSP_POSIX: u32 = 1;
25 | pub const CSP_ZEPHYR: u32 = 0;
26 | pub const CSP_HAVE_STDIO: u32 = 1;
27 | pub const CSP_ENABLE_CSP_PRINT: u32 = 1;
28 | pub const CSP_PRINT_STDIO: u32 = 1;
29 | pub const CSP_QFIFO_LEN: u32 = 15;
30 | pub const CSP_PORT_MAX_BIND: u32 = 16;
31 | pub const CSP_CONN_RXQUEUE_LEN: u32 = 16;
32 | pub const CSP_CONN_MAX: u32 = 8;
33 | pub const CSP_BUFFER_SIZE: u32 = 256;
34 | pub const CSP_BUFFER_COUNT: u32 = 15;
35 | pub const CSP_RDP_MAX_WINDOW: u32 = 5;
36 | pub const CSP_RTABLE_SIZE: u32 = 10;
37 | pub const CSP_USE_RDP: u32 = 1;
38 | pub const CSP_USE_HMAC: u32 = 1;
39 | pub const CSP_USE_PROMISC: u32 = 1;
40 | pub const CSP_USE_DEDUP: u32 = 1;
41 | pub const CSP_USE_RTABLE: u32 = 0;
42 | pub const CSP_HAVE_LIBSOCKETCAN: u32 = 1;
43 | pub const CSP_HAVE_LIBZMQ: u32 = 1;
44 | pub const _INTTYPES_H: u32 = 1;
45 | pub const _FEATURES_H: u32 = 1;
46 | pub const _DEFAULT_SOURCE: u32 = 1;
47 | pub const __GLIBC_USE_ISOC2X: u32 = 0;
48 | pub const __USE_ISOC11: u32 = 1;
49 | pub const __USE_ISOC99: u32 = 1;
50 | pub const __USE_ISOC95: u32 = 1;
51 | pub const __USE_POSIX_IMPLICITLY: u32 = 1;
52 | pub const _POSIX_SOURCE: u32 = 1;
53 | pub const _POSIX_C_SOURCE: u32 = 200809;
54 | pub const __USE_POSIX: u32 = 1;
55 | pub const __USE_POSIX2: u32 = 1;
56 | pub const __USE_POSIX199309: u32 = 1;
57 | pub const __USE_POSIX199506: u32 = 1;
58 | pub const __USE_XOPEN2K: u32 = 1;
59 | pub const __USE_XOPEN2K8: u32 = 1;
60 | pub const _ATFILE_SOURCE: u32 = 1;
61 | pub const __WORDSIZE: u32 = 64;
62 | pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
63 | pub const __SYSCALL_WORDSIZE: u32 = 64;
64 | pub const __TIMESIZE: u32 = 64;
65 | pub const __USE_MISC: u32 = 1;
66 | pub const __USE_ATFILE: u32 = 1;
67 | pub const __USE_FORTIFY_LEVEL: u32 = 0;
68 | pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
69 | pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
70 | pub const _STDC_PREDEF_H: u32 = 1;
71 | pub const __STDC_IEC_559__: u32 = 1;
72 | pub const __STDC_IEC_60559_BFP__: u32 = 201404;
73 | pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
74 | pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
75 | pub const __STDC_ISO_10646__: u32 = 201706;
76 | pub const __GNU_LIBRARY__: u32 = 6;
77 | pub const __GLIBC__: u32 = 2;
78 | pub const __GLIBC_MINOR__: u32 = 35;
79 | pub const _SYS_CDEFS_H: u32 = 1;
80 | pub const __glibc_c99_flexarr_available: u32 = 1;
81 | pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
82 | pub const __HAVE_GENERIC_SELECTION: u32 = 1;
83 | pub const _STDINT_H: u32 = 1;
84 | pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
85 | pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
86 | pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
87 | pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0;
88 | pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
89 | pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
90 | pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
91 | pub const _BITS_TYPES_H: u32 = 1;
92 | pub const _BITS_TYPESIZES_H: u32 = 1;
93 | pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
94 | pub const __INO_T_MATCHES_INO64_T: u32 = 1;
95 | pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
96 | pub const __STATFS_MATCHES_STATFS64: u32 = 1;
97 | pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
98 | pub const __FD_SETSIZE: u32 = 1024;
99 | pub const _BITS_TIME64_H: u32 = 1;
100 | pub const _BITS_WCHAR_H: u32 = 1;
101 | pub const _BITS_STDINT_INTN_H: u32 = 1;
102 | pub const _BITS_STDINT_UINTN_H: u32 = 1;
103 | pub const INT8_MIN: i32 = -128;
104 | pub const INT16_MIN: i32 = -32768;
105 | pub const INT32_MIN: i32 = -2147483648;
106 | pub const INT8_MAX: u32 = 127;
107 | pub const INT16_MAX: u32 = 32767;
108 | pub const INT32_MAX: u32 = 2147483647;
109 | pub const UINT8_MAX: u32 = 255;
110 | pub const UINT16_MAX: u32 = 65535;
111 | pub const UINT32_MAX: u32 = 4294967295;
112 | pub const INT_LEAST8_MIN: i32 = -128;
113 | pub const INT_LEAST16_MIN: i32 = -32768;
114 | pub const INT_LEAST32_MIN: i32 = -2147483648;
115 | pub const INT_LEAST8_MAX: u32 = 127;
116 | pub const INT_LEAST16_MAX: u32 = 32767;
117 | pub const INT_LEAST32_MAX: u32 = 2147483647;
118 | pub const UINT_LEAST8_MAX: u32 = 255;
119 | pub const UINT_LEAST16_MAX: u32 = 65535;
120 | pub const UINT_LEAST32_MAX: u32 = 4294967295;
121 | pub const INT_FAST8_MIN: i32 = -128;
122 | pub const INT_FAST16_MIN: i64 = -9223372036854775808;
123 | pub const INT_FAST32_MIN: i64 = -9223372036854775808;
124 | pub const INT_FAST8_MAX: u32 = 127;
125 | pub const INT_FAST16_MAX: u64 = 9223372036854775807;
126 | pub const INT_FAST32_MAX: u64 = 9223372036854775807;
127 | pub const UINT_FAST8_MAX: u32 = 255;
128 | pub const UINT_FAST16_MAX: i32 = -1;
129 | pub const UINT_FAST32_MAX: i32 = -1;
130 | pub const INTPTR_MIN: i64 = -9223372036854775808;
131 | pub const INTPTR_MAX: u64 = 9223372036854775807;
132 | pub const UINTPTR_MAX: i32 = -1;
133 | pub const PTRDIFF_MIN: i64 = -9223372036854775808;
134 | pub const PTRDIFF_MAX: u64 = 9223372036854775807;
135 | pub const SIG_ATOMIC_MIN: i32 = -2147483648;
136 | pub const SIG_ATOMIC_MAX: u32 = 2147483647;
137 | pub const SIZE_MAX: i32 = -1;
138 | pub const WINT_MIN: u32 = 0;
139 | pub const WINT_MAX: u32 = 4294967295;
140 | pub const ____gwchar_t_defined: u32 = 1;
141 | pub const __PRI64_PREFIX: &[u8; 2] = b"l\0";
142 | pub const __PRIPTR_PREFIX: &[u8; 2] = b"l\0";
143 | pub const PRId8: &[u8; 2] = b"d\0";
144 | pub const PRId16: &[u8; 2] = b"d\0";
145 | pub const PRId32: &[u8; 2] = b"d\0";
146 | pub const PRId64: &[u8; 3] = b"ld\0";
147 | pub const PRIdLEAST8: &[u8; 2] = b"d\0";
148 | pub const PRIdLEAST16: &[u8; 2] = b"d\0";
149 | pub const PRIdLEAST32: &[u8; 2] = b"d\0";
150 | pub const PRIdLEAST64: &[u8; 3] = b"ld\0";
151 | pub const PRIdFAST8: &[u8; 2] = b"d\0";
152 | pub const PRIdFAST16: &[u8; 3] = b"ld\0";
153 | pub const PRIdFAST32: &[u8; 3] = b"ld\0";
154 | pub const PRIdFAST64: &[u8; 3] = b"ld\0";
155 | pub const PRIi8: &[u8; 2] = b"i\0";
156 | pub const PRIi16: &[u8; 2] = b"i\0";
157 | pub const PRIi32: &[u8; 2] = b"i\0";
158 | pub const PRIi64: &[u8; 3] = b"li\0";
159 | pub const PRIiLEAST8: &[u8; 2] = b"i\0";
160 | pub const PRIiLEAST16: &[u8; 2] = b"i\0";
161 | pub const PRIiLEAST32: &[u8; 2] = b"i\0";
162 | pub const PRIiLEAST64: &[u8; 3] = b"li\0";
163 | pub const PRIiFAST8: &[u8; 2] = b"i\0";
164 | pub const PRIiFAST16: &[u8; 3] = b"li\0";
165 | pub const PRIiFAST32: &[u8; 3] = b"li\0";
166 | pub const PRIiFAST64: &[u8; 3] = b"li\0";
167 | pub const PRIo8: &[u8; 2] = b"o\0";
168 | pub const PRIo16: &[u8; 2] = b"o\0";
169 | pub const PRIo32: &[u8; 2] = b"o\0";
170 | pub const PRIo64: &[u8; 3] = b"lo\0";
171 | pub const PRIoLEAST8: &[u8; 2] = b"o\0";
172 | pub const PRIoLEAST16: &[u8; 2] = b"o\0";
173 | pub const PRIoLEAST32: &[u8; 2] = b"o\0";
174 | pub const PRIoLEAST64: &[u8; 3] = b"lo\0";
175 | pub const PRIoFAST8: &[u8; 2] = b"o\0";
176 | pub const PRIoFAST16: &[u8; 3] = b"lo\0";
177 | pub const PRIoFAST32: &[u8; 3] = b"lo\0";
178 | pub const PRIoFAST64: &[u8; 3] = b"lo\0";
179 | pub const PRIu8: &[u8; 2] = b"u\0";
180 | pub const PRIu16: &[u8; 2] = b"u\0";
181 | pub const PRIu32: &[u8; 2] = b"u\0";
182 | pub const PRIu64: &[u8; 3] = b"lu\0";
183 | pub const PRIuLEAST8: &[u8; 2] = b"u\0";
184 | pub const PRIuLEAST16: &[u8; 2] = b"u\0";
185 | pub const PRIuLEAST32: &[u8; 2] = b"u\0";
186 | pub const PRIuLEAST64: &[u8; 3] = b"lu\0";
187 | pub const PRIuFAST8: &[u8; 2] = b"u\0";
188 | pub const PRIuFAST16: &[u8; 3] = b"lu\0";
189 | pub const PRIuFAST32: &[u8; 3] = b"lu\0";
190 | pub const PRIuFAST64: &[u8; 3] = b"lu\0";
191 | pub const PRIx8: &[u8; 2] = b"x\0";
192 | pub const PRIx16: &[u8; 2] = b"x\0";
193 | pub const PRIx32: &[u8; 2] = b"x\0";
194 | pub const PRIx64: &[u8; 3] = b"lx\0";
195 | pub const PRIxLEAST8: &[u8; 2] = b"x\0";
196 | pub const PRIxLEAST16: &[u8; 2] = b"x\0";
197 | pub const PRIxLEAST32: &[u8; 2] = b"x\0";
198 | pub const PRIxLEAST64: &[u8; 3] = b"lx\0";
199 | pub const PRIxFAST8: &[u8; 2] = b"x\0";
200 | pub const PRIxFAST16: &[u8; 3] = b"lx\0";
201 | pub const PRIxFAST32: &[u8; 3] = b"lx\0";
202 | pub const PRIxFAST64: &[u8; 3] = b"lx\0";
203 | pub const PRIX8: &[u8; 2] = b"X\0";
204 | pub const PRIX16: &[u8; 2] = b"X\0";
205 | pub const PRIX32: &[u8; 2] = b"X\0";
206 | pub const PRIX64: &[u8; 3] = b"lX\0";
207 | pub const PRIXLEAST8: &[u8; 2] = b"X\0";
208 | pub const PRIXLEAST16: &[u8; 2] = b"X\0";
209 | pub const PRIXLEAST32: &[u8; 2] = b"X\0";
210 | pub const PRIXLEAST64: &[u8; 3] = b"lX\0";
211 | pub const PRIXFAST8: &[u8; 2] = b"X\0";
212 | pub const PRIXFAST16: &[u8; 3] = b"lX\0";
213 | pub const PRIXFAST32: &[u8; 3] = b"lX\0";
214 | pub const PRIXFAST64: &[u8; 3] = b"lX\0";
215 | pub const PRIdMAX: &[u8; 3] = b"ld\0";
216 | pub const PRIiMAX: &[u8; 3] = b"li\0";
217 | pub const PRIoMAX: &[u8; 3] = b"lo\0";
218 | pub const PRIuMAX: &[u8; 3] = b"lu\0";
219 | pub const PRIxMAX: &[u8; 3] = b"lx\0";
220 | pub const PRIXMAX: &[u8; 3] = b"lX\0";
221 | pub const PRIdPTR: &[u8; 3] = b"ld\0";
222 | pub const PRIiPTR: &[u8; 3] = b"li\0";
223 | pub const PRIoPTR: &[u8; 3] = b"lo\0";
224 | pub const PRIuPTR: &[u8; 3] = b"lu\0";
225 | pub const PRIxPTR: &[u8; 3] = b"lx\0";
226 | pub const PRIXPTR: &[u8; 3] = b"lX\0";
227 | pub const SCNd8: &[u8; 4] = b"hhd\0";
228 | pub const SCNd16: &[u8; 3] = b"hd\0";
229 | pub const SCNd32: &[u8; 2] = b"d\0";
230 | pub const SCNd64: &[u8; 3] = b"ld\0";
231 | pub const SCNdLEAST8: &[u8; 4] = b"hhd\0";
232 | pub const SCNdLEAST16: &[u8; 3] = b"hd\0";
233 | pub const SCNdLEAST32: &[u8; 2] = b"d\0";
234 | pub const SCNdLEAST64: &[u8; 3] = b"ld\0";
235 | pub const SCNdFAST8: &[u8; 4] = b"hhd\0";
236 | pub const SCNdFAST16: &[u8; 3] = b"ld\0";
237 | pub const SCNdFAST32: &[u8; 3] = b"ld\0";
238 | pub const SCNdFAST64: &[u8; 3] = b"ld\0";
239 | pub const SCNi8: &[u8; 4] = b"hhi\0";
240 | pub const SCNi16: &[u8; 3] = b"hi\0";
241 | pub const SCNi32: &[u8; 2] = b"i\0";
242 | pub const SCNi64: &[u8; 3] = b"li\0";
243 | pub const SCNiLEAST8: &[u8; 4] = b"hhi\0";
244 | pub const SCNiLEAST16: &[u8; 3] = b"hi\0";
245 | pub const SCNiLEAST32: &[u8; 2] = b"i\0";
246 | pub const SCNiLEAST64: &[u8; 3] = b"li\0";
247 | pub const SCNiFAST8: &[u8; 4] = b"hhi\0";
248 | pub const SCNiFAST16: &[u8; 3] = b"li\0";
249 | pub const SCNiFAST32: &[u8; 3] = b"li\0";
250 | pub const SCNiFAST64: &[u8; 3] = b"li\0";
251 | pub const SCNu8: &[u8; 4] = b"hhu\0";
252 | pub const SCNu16: &[u8; 3] = b"hu\0";
253 | pub const SCNu32: &[u8; 2] = b"u\0";
254 | pub const SCNu64: &[u8; 3] = b"lu\0";
255 | pub const SCNuLEAST8: &[u8; 4] = b"hhu\0";
256 | pub const SCNuLEAST16: &[u8; 3] = b"hu\0";
257 | pub const SCNuLEAST32: &[u8; 2] = b"u\0";
258 | pub const SCNuLEAST64: &[u8; 3] = b"lu\0";
259 | pub const SCNuFAST8: &[u8; 4] = b"hhu\0";
260 | pub const SCNuFAST16: &[u8; 3] = b"lu\0";
261 | pub const SCNuFAST32: &[u8; 3] = b"lu\0";
262 | pub const SCNuFAST64: &[u8; 3] = b"lu\0";
263 | pub const SCNo8: &[u8; 4] = b"hho\0";
264 | pub const SCNo16: &[u8; 3] = b"ho\0";
265 | pub const SCNo32: &[u8; 2] = b"o\0";
266 | pub const SCNo64: &[u8; 3] = b"lo\0";
267 | pub const SCNoLEAST8: &[u8; 4] = b"hho\0";
268 | pub const SCNoLEAST16: &[u8; 3] = b"ho\0";
269 | pub const SCNoLEAST32: &[u8; 2] = b"o\0";
270 | pub const SCNoLEAST64: &[u8; 3] = b"lo\0";
271 | pub const SCNoFAST8: &[u8; 4] = b"hho\0";
272 | pub const SCNoFAST16: &[u8; 3] = b"lo\0";
273 | pub const SCNoFAST32: &[u8; 3] = b"lo\0";
274 | pub const SCNoFAST64: &[u8; 3] = b"lo\0";
275 | pub const SCNx8: &[u8; 4] = b"hhx\0";
276 | pub const SCNx16: &[u8; 3] = b"hx\0";
277 | pub const SCNx32: &[u8; 2] = b"x\0";
278 | pub const SCNx64: &[u8; 3] = b"lx\0";
279 | pub const SCNxLEAST8: &[u8; 4] = b"hhx\0";
280 | pub const SCNxLEAST16: &[u8; 3] = b"hx\0";
281 | pub const SCNxLEAST32: &[u8; 2] = b"x\0";
282 | pub const SCNxLEAST64: &[u8; 3] = b"lx\0";
283 | pub const SCNxFAST8: &[u8; 4] = b"hhx\0";
284 | pub const SCNxFAST16: &[u8; 3] = b"lx\0";
285 | pub const SCNxFAST32: &[u8; 3] = b"lx\0";
286 | pub const SCNxFAST64: &[u8; 3] = b"lx\0";
287 | pub const SCNdMAX: &[u8; 3] = b"ld\0";
288 | pub const SCNiMAX: &[u8; 3] = b"li\0";
289 | pub const SCNoMAX: &[u8; 3] = b"lo\0";
290 | pub const SCNuMAX: &[u8; 3] = b"lu\0";
291 | pub const SCNxMAX: &[u8; 3] = b"lx\0";
292 | pub const SCNdPTR: &[u8; 3] = b"ld\0";
293 | pub const SCNiPTR: &[u8; 3] = b"li\0";
294 | pub const SCNoPTR: &[u8; 3] = b"lo\0";
295 | pub const SCNuPTR: &[u8; 3] = b"lu\0";
296 | pub const SCNxPTR: &[u8; 3] = b"lx\0";
297 | pub const CSP_DBG_ERR_CORRUPT_BUFFER: u32 = 1;
298 | pub const CSP_DBG_ERR_MTU_EXCEEDED: u32 = 2;
299 | pub const CSP_DBG_ERR_ALREADY_FREE: u32 = 3;
300 | pub const CSP_DBG_ERR_REFCOUNT: u32 = 4;
301 | pub const CSP_DBG_ERR_INVALID_RTABLE_ENTRY: u32 = 6;
302 | pub const CSP_DBG_ERR_UNSUPPORTED: u32 = 7;
303 | pub const CSP_DBG_ERR_INVALID_BIND_PORT: u32 = 8;
304 | pub const CSP_DBG_ERR_PORT_ALREADY_IN_USE: u32 = 9;
305 | pub const CSP_DBG_ERR_ALREADY_CLOSED: u32 = 10;
306 | pub const CSP_DBG_ERR_INVALID_POINTER: u32 = 11;
307 | pub const CSP_DBG_ERR_CLOCK_SET_FAIL: u32 = 12;
308 | pub const CSP_DBG_CAN_ERR_FRAME_LOST: u32 = 1;
309 | pub const CSP_DBG_CAN_ERR_RX_OVF: u32 = 2;
310 | pub const CSP_DBG_CAN_ERR_RX_OUT: u32 = 3;
311 | pub const CSP_DBG_CAN_ERR_SHORT_BEGIN: u32 = 4;
312 | pub const CSP_DBG_CAN_ERR_INCOMPLETE: u32 = 5;
313 | pub const CSP_DBG_CAN_ERR_UNKNOWN: u32 = 6;
314 | pub const CSP_DBG_ETH_ERR_FRAME_LOST: u32 = 1;
315 | pub const CSP_DBG_ETH_ERR_RX_OVF: u32 = 2;
316 | pub const CSP_DBG_ETH_ERR_RX_OUT: u32 = 3;
317 | pub const CSP_DBG_ETH_ERR_SHORT_BEGIN: u32 = 4;
318 | pub const CSP_DBG_ETH_ERR_INCOMPLETE: u32 = 5;
319 | pub const CSP_DBG_ETH_ERR_UNKNOWN: u32 = 6;
320 | pub const true_: u32 = 1;
321 | pub const false_: u32 = 0;
322 | pub const __bool_true_false_are_defined: u32 = 1;
323 | pub const CSP_QUEUE_OK: u32 = 0;
324 | pub const CSP_QUEUE_ERROR: i32 = -1;
325 | pub const CSP_ANY: u32 = 255;
326 | pub const CSP_FRES1: u32 = 128;
327 | pub const CSP_FRES2: u32 = 64;
328 | pub const CSP_FRES3: u32 = 32;
329 | pub const CSP_FFRAG: u32 = 16;
330 | pub const CSP_FHMAC: u32 = 8;
331 | pub const CSP_FRDP: u32 = 2;
332 | pub const CSP_FCRC32: u32 = 1;
333 | pub const CSP_SO_NONE: u32 = 0;
334 | pub const CSP_SO_RDPREQ: u32 = 1;
335 | pub const CSP_SO_RDPPROHIB: u32 = 2;
336 | pub const CSP_SO_HMACREQ: u32 = 4;
337 | pub const CSP_SO_HMACPROHIB: u32 = 8;
338 | pub const CSP_SO_CRC32REQ: u32 = 64;
339 | pub const CSP_SO_CRC32PROHIB: u32 = 128;
340 | pub const CSP_SO_CONN_LESS: u32 = 256;
341 | pub const CSP_SO_SAME: u32 = 32768;
342 | pub const CSP_O_NONE: u32 = 0;
343 | pub const CSP_O_RDP: u32 = 1;
344 | pub const CSP_O_NORDP: u32 = 2;
345 | pub const CSP_O_HMAC: u32 = 4;
346 | pub const CSP_O_NOHMAC: u32 = 8;
347 | pub const CSP_O_CRC32: u32 = 64;
348 | pub const CSP_O_NOCRC32: u32 = 128;
349 | pub const CSP_O_SAME: u32 = 32768;
350 | pub const CSP_PACKET_PADDING_BYTES: u32 = 8;
351 | pub const CSP_RDP_HEADER_SIZE: u32 = 5;
352 | pub const CSP_HOSTNAME_LEN: u32 = 20;
353 | pub const CSP_MODEL_LEN: u32 = 30;
354 | pub const CSP_REBOOT_MAGIC: u32 = 2147975175;
355 | pub const CSP_REBOOT_SHUTDOWN_MAGIC: u32 = 3521467034;
356 | pub const CSP_IFLIST_NAME_MAX: u32 = 10;
357 | pub const CSP_NO_VIA_ADDRESS: u32 = 65535;
358 | pub const _STRING_H: u32 = 1;
359 | pub const _BITS_TYPES_LOCALE_T_H: u32 = 1;
360 | pub const _BITS_TYPES___LOCALE_T_H: u32 = 1;
361 | pub const _STRINGS_H: u32 = 1;
362 | pub const CSP_MAX_TIMEOUT: u32 = 4294967295;
363 | pub const CSP_MAX_DELAY: u32 = 4294967295;
364 | pub const CSP_INFINITY: u32 = 4294967295;
365 | pub const CFP_HOST_SIZE: u32 = 5;
366 | pub const CFP_TYPE_SIZE: u32 = 1;
367 | pub const CFP_REMAIN_SIZE: u32 = 8;
368 | pub const CFP_ID_SIZE: u32 = 10;
369 | pub const CFP2_PRIO_MASK: u32 = 3;
370 | pub const CFP2_PRIO_OFFSET: u32 = 27;
371 | pub const CFP2_DST_SIZE: u32 = 14;
372 | pub const CFP2_DST_MASK: u32 = 16383;
373 | pub const CFP2_DST_OFFSET: u32 = 13;
374 | pub const CFP2_SENDER_SIZE: u32 = 6;
375 | pub const CFP2_SENDER_MASK: u32 = 63;
376 | pub const CFP2_SENDER_OFFSET: u32 = 7;
377 | pub const CFP2_SC_MASK: u32 = 3;
378 | pub const CFP2_SC_OFFSET: u32 = 5;
379 | pub const CFP2_FC_MASK: u32 = 7;
380 | pub const CFP2_FC_OFFSET: u32 = 2;
381 | pub const CFP2_BEGIN_MASK: u32 = 1;
382 | pub const CFP2_BEGIN_OFFSET: u32 = 1;
383 | pub const CFP2_END_MASK: u32 = 1;
384 | pub const CFP2_END_OFFSET: u32 = 0;
385 | pub const CFP2_SRC_SIZE: u32 = 14;
386 | pub const CFP2_SRC_MASK: u32 = 16383;
387 | pub const CFP2_SRC_OFFSET: u32 = 18;
388 | pub const CFP2_DPORT_MASK: u32 = 63;
389 | pub const CFP2_DPORT_OFFSET: u32 = 12;
390 | pub const CFP2_SPORT_MASK: u32 = 63;
391 | pub const CFP2_SPORT_OFFSET: u32 = 6;
392 | pub const CFP2_FLAGS_MASK: u32 = 63;
393 | pub const CFP2_FLAGS_OFFSET: u32 = 0;
394 | pub const CFP2_ID_CONN_MASK: u32 = 536870880;
395 | pub const CSP_IF_CAN_DEFAULT_NAME: &[u8; 4] = b"CAN\0";
396 | pub type __u_char = ::core::ffi::c_uchar;
397 | pub type __u_short = ::core::ffi::c_ushort;
398 | pub type __u_int = ::core::ffi::c_uint;
399 | pub type __u_long = ::core::ffi::c_ulong;
400 | pub type __int8_t = ::core::ffi::c_schar;
401 | pub type __uint8_t = ::core::ffi::c_uchar;
402 | pub type __int16_t = ::core::ffi::c_short;
403 | pub type __uint16_t = ::core::ffi::c_ushort;
404 | pub type __int32_t = ::core::ffi::c_int;
405 | pub type __uint32_t = ::core::ffi::c_uint;
406 | pub type __int64_t = ::core::ffi::c_long;
407 | pub type __uint64_t = ::core::ffi::c_ulong;
408 | pub type __int_least8_t = __int8_t;
409 | pub type __uint_least8_t = __uint8_t;
410 | pub type __int_least16_t = __int16_t;
411 | pub type __uint_least16_t = __uint16_t;
412 | pub type __int_least32_t = __int32_t;
413 | pub type __uint_least32_t = __uint32_t;
414 | pub type __int_least64_t = __int64_t;
415 | pub type __uint_least64_t = __uint64_t;
416 | pub type __quad_t = ::core::ffi::c_long;
417 | pub type __u_quad_t = ::core::ffi::c_ulong;
418 | pub type __intmax_t = ::core::ffi::c_long;
419 | pub type __uintmax_t = ::core::ffi::c_ulong;
420 | pub type __dev_t = ::core::ffi::c_ulong;
421 | pub type __uid_t = ::core::ffi::c_uint;
422 | pub type __gid_t = ::core::ffi::c_uint;
423 | pub type __ino_t = ::core::ffi::c_ulong;
424 | pub type __ino64_t = ::core::ffi::c_ulong;
425 | pub type __mode_t = ::core::ffi::c_uint;
426 | pub type __nlink_t = ::core::ffi::c_ulong;
427 | pub type __off_t = ::core::ffi::c_long;
428 | pub type __off64_t = ::core::ffi::c_long;
429 | pub type __pid_t = ::core::ffi::c_int;
430 | #[repr(C)]
431 | #[derive(Copy, Clone)]
432 | pub struct __fsid_t {
433 | pub __val: [::core::ffi::c_int; 2usize],
434 | }
435 | pub type __clock_t = ::core::ffi::c_long;
436 | pub type __rlim_t = ::core::ffi::c_ulong;
437 | pub type __rlim64_t = ::core::ffi::c_ulong;
438 | pub type __id_t = ::core::ffi::c_uint;
439 | pub type __time_t = ::core::ffi::c_long;
440 | pub type __useconds_t = ::core::ffi::c_uint;
441 | pub type __suseconds_t = ::core::ffi::c_long;
442 | pub type __suseconds64_t = ::core::ffi::c_long;
443 | pub type __daddr_t = ::core::ffi::c_int;
444 | pub type __key_t = ::core::ffi::c_int;
445 | pub type __clockid_t = ::core::ffi::c_int;
446 | pub type __timer_t = *mut ::core::ffi::c_void;
447 | pub type __blksize_t = ::core::ffi::c_long;
448 | pub type __blkcnt_t = ::core::ffi::c_long;
449 | pub type __blkcnt64_t = ::core::ffi::c_long;
450 | pub type __fsblkcnt_t = ::core::ffi::c_ulong;
451 | pub type __fsblkcnt64_t = ::core::ffi::c_ulong;
452 | pub type __fsfilcnt_t = ::core::ffi::c_ulong;
453 | pub type __fsfilcnt64_t = ::core::ffi::c_ulong;
454 | pub type __fsword_t = ::core::ffi::c_long;
455 | pub type __ssize_t = ::core::ffi::c_long;
456 | pub type __syscall_slong_t = ::core::ffi::c_long;
457 | pub type __syscall_ulong_t = ::core::ffi::c_ulong;
458 | pub type __loff_t = __off64_t;
459 | pub type __caddr_t = *mut ::core::ffi::c_char;
460 | pub type __intptr_t = ::core::ffi::c_long;
461 | pub type __socklen_t = ::core::ffi::c_uint;
462 | pub type __sig_atomic_t = ::core::ffi::c_int;
463 | pub type int_least8_t = __int_least8_t;
464 | pub type int_least16_t = __int_least16_t;
465 | pub type int_least32_t = __int_least32_t;
466 | pub type int_least64_t = __int_least64_t;
467 | pub type uint_least8_t = __uint_least8_t;
468 | pub type uint_least16_t = __uint_least16_t;
469 | pub type uint_least32_t = __uint_least32_t;
470 | pub type uint_least64_t = __uint_least64_t;
471 | pub type int_fast8_t = ::core::ffi::c_schar;
472 | pub type int_fast16_t = ::core::ffi::c_long;
473 | pub type int_fast32_t = ::core::ffi::c_long;
474 | pub type int_fast64_t = ::core::ffi::c_long;
475 | pub type uint_fast8_t = ::core::ffi::c_uchar;
476 | pub type uint_fast16_t = ::core::ffi::c_ulong;
477 | pub type uint_fast32_t = ::core::ffi::c_ulong;
478 | pub type uint_fast64_t = ::core::ffi::c_ulong;
479 | pub type intmax_t = __intmax_t;
480 | pub type uintmax_t = __uintmax_t;
481 | pub type __gwchar_t = ::core::ffi::c_int;
482 | #[repr(C)]
483 | #[derive(Copy, Clone)]
484 | pub struct imaxdiv_t {
485 | pub quot: ::core::ffi::c_long,
486 | pub rem: ::core::ffi::c_long,
487 | }
488 | extern "C" {
489 | pub fn imaxabs(__n: intmax_t) -> intmax_t;
490 | }
491 | extern "C" {
492 | pub fn imaxdiv(__numer: intmax_t, __denom: intmax_t) -> imaxdiv_t;
493 | }
494 | extern "C" {
495 | pub fn strtoimax(
496 | __nptr: *const ::core::ffi::c_char,
497 | __endptr: *mut *mut ::core::ffi::c_char,
498 | __base: ::core::ffi::c_int,
499 | ) -> intmax_t;
500 | }
501 | extern "C" {
502 | pub fn strtoumax(
503 | __nptr: *const ::core::ffi::c_char,
504 | __endptr: *mut *mut ::core::ffi::c_char,
505 | __base: ::core::ffi::c_int,
506 | ) -> uintmax_t;
507 | }
508 | extern "C" {
509 | pub fn wcstoimax(
510 | __nptr: *const __gwchar_t,
511 | __endptr: *mut *mut __gwchar_t,
512 | __base: ::core::ffi::c_int,
513 | ) -> intmax_t;
514 | }
515 | extern "C" {
516 | pub fn wcstoumax(
517 | __nptr: *const __gwchar_t,
518 | __endptr: *mut *mut __gwchar_t,
519 | __base: ::core::ffi::c_int,
520 | ) -> uintmax_t;
521 | }
522 | extern "C" {
523 | pub static mut csp_dbg_buffer_out: u8;
524 | }
525 | extern "C" {
526 | pub static mut csp_dbg_conn_out: u8;
527 | }
528 | extern "C" {
529 | pub static mut csp_dbg_conn_ovf: u8;
530 | }
531 | extern "C" {
532 | pub static mut csp_dbg_conn_noroute: u8;
533 | }
534 | extern "C" {
535 | pub static mut csp_dbg_inval_reply: u8;
536 | }
537 | extern "C" {
538 | pub static mut csp_dbg_errno: u8;
539 | }
540 | extern "C" {
541 | pub static mut csp_dbg_can_errno: u8;
542 | }
543 | extern "C" {
544 | pub static mut csp_dbg_eth_errno: u8;
545 | }
546 | extern "C" {
547 | pub static mut csp_dbg_rdp_print: u8;
548 | }
549 | extern "C" {
550 | pub static mut csp_dbg_packet_print: u8;
551 | }
552 | extern "C" {
553 | pub fn csp_print_func(fmt: *const ::core::ffi::c_char, ...);
554 | }
555 | pub type wchar_t = ::core::ffi::c_int;
556 | #[repr(C)]
557 | #[repr(align(16))]
558 | #[derive(Copy, Clone)]
559 | pub struct max_align_t {
560 | pub __clang_max_align_nonce1: ::core::ffi::c_longlong,
561 | pub __bindgen_padding_0: u64,
562 | pub __clang_max_align_nonce2: u128,
563 | }
564 | pub type csp_queue_handle_t = *mut ::core::ffi::c_void;
565 | pub type csp_static_queue_t = *mut ::core::ffi::c_void;
566 | extern "C" {
567 | pub fn csp_queue_create_static(
568 | length: ::core::ffi::c_int,
569 | item_size: usize,
570 | buffer: *mut ::core::ffi::c_char,
571 | queue: *mut csp_static_queue_t,
572 | ) -> csp_queue_handle_t;
573 | }
574 | extern "C" {
575 | pub fn csp_queue_enqueue(
576 | handle: csp_queue_handle_t,
577 | value: *const ::core::ffi::c_void,
578 | timeout: u32,
579 | ) -> ::core::ffi::c_int;
580 | }
581 | extern "C" {
582 | pub fn csp_queue_enqueue_isr(
583 | handle: csp_queue_handle_t,
584 | value: *const ::core::ffi::c_void,
585 | pxTaskWoken: *mut ::core::ffi::c_int,
586 | ) -> ::core::ffi::c_int;
587 | }
588 | extern "C" {
589 | pub fn csp_queue_dequeue(
590 | handle: csp_queue_handle_t,
591 | buf: *mut ::core::ffi::c_void,
592 | timeout: u32,
593 | ) -> ::core::ffi::c_int;
594 | }
595 | extern "C" {
596 | pub fn csp_queue_dequeue_isr(
597 | handle: csp_queue_handle_t,
598 | buf: *mut ::core::ffi::c_void,
599 | pxTaskWoken: *mut ::core::ffi::c_int,
600 | ) -> ::core::ffi::c_int;
601 | }
602 | extern "C" {
603 | pub fn csp_queue_size(handle: csp_queue_handle_t) -> ::core::ffi::c_int;
604 | }
605 | extern "C" {
606 | pub fn csp_queue_size_isr(handle: csp_queue_handle_t) -> ::core::ffi::c_int;
607 | }
608 | extern "C" {
609 | pub fn csp_queue_free(handle: csp_queue_handle_t) -> ::core::ffi::c_int;
610 | }
611 | #[repr(C)]
612 | #[derive(Copy, Clone)]
613 | pub struct csp_timestamp_t {
614 | pub tv_sec: u32,
615 | pub tv_nsec: u32,
616 | }
617 | pub const csp_service_port_t_CSP_CMP: csp_service_port_t = 0;
618 | pub const csp_service_port_t_CSP_PING: csp_service_port_t = 1;
619 | pub const csp_service_port_t_CSP_PS: csp_service_port_t = 2;
620 | pub const csp_service_port_t_CSP_MEMFREE: csp_service_port_t = 3;
621 | pub const csp_service_port_t_CSP_REBOOT: csp_service_port_t = 4;
622 | pub const csp_service_port_t_CSP_BUF_FREE: csp_service_port_t = 5;
623 | pub const csp_service_port_t_CSP_UPTIME: csp_service_port_t = 6;
624 | pub type csp_service_port_t = ::core::ffi::c_uint;
625 | pub const csp_prio_t_CSP_PRIO_CRITICAL: csp_prio_t = 0;
626 | pub const csp_prio_t_CSP_PRIO_HIGH: csp_prio_t = 1;
627 | pub const csp_prio_t_CSP_PRIO_NORM: csp_prio_t = 2;
628 | pub const csp_prio_t_CSP_PRIO_LOW: csp_prio_t = 3;
629 | pub type csp_prio_t = ::core::ffi::c_uint;
630 | #[repr(C)]
631 | #[derive(Copy, Clone)]
632 | pub struct __packed {
633 | pub pri: u8,
634 | pub flags: u8,
635 | pub src: u16,
636 | pub dst: u16,
637 | pub dport: u8,
638 | pub sport: u8,
639 | }
640 | pub type csp_id_t = __packed;
641 | #[repr(C)]
642 | #[derive(Copy, Clone)]
643 | pub struct csp_packet_s {
644 | pub __bindgen_anon_1: csp_packet_s__bindgen_ty_1,
645 | pub length: u16,
646 | pub id: csp_id_t,
647 | pub next: *mut csp_packet_s,
648 | pub header: [u8; 8usize],
649 | pub __bindgen_anon_2: csp_packet_s__bindgen_ty_2,
650 | }
651 | #[repr(C)]
652 | #[derive(Copy, Clone)]
653 | pub union csp_packet_s__bindgen_ty_1 {
654 | pub __bindgen_anon_1: csp_packet_s__bindgen_ty_1__bindgen_ty_1,
655 | pub __bindgen_anon_2: csp_packet_s__bindgen_ty_1__bindgen_ty_2,
656 | }
657 | #[repr(C)]
658 | #[derive(Copy, Clone)]
659 | pub struct csp_packet_s__bindgen_ty_1__bindgen_ty_1 {
660 | pub rdp_quarantine: u32,
661 | pub timestamp_tx: u32,
662 | pub timestamp_rx: u32,
663 | pub conn: *mut csp_conn_s,
664 | }
665 | #[repr(C)]
666 | #[derive(Copy, Clone)]
667 | pub struct csp_packet_s__bindgen_ty_1__bindgen_ty_2 {
668 | pub rx_count: u16,
669 | pub remain: u16,
670 | pub cfpid: u32,
671 | pub last_used: u32,
672 | pub frame_begin: *mut u8,
673 | pub frame_length: u16,
674 | }
675 | #[repr(C)]
676 | #[derive(Copy, Clone)]
677 | pub union csp_packet_s__bindgen_ty_2 {
678 | pub data: [u8; 256usize],
679 | pub data16: [u16; 128usize],
680 | pub data32: [u32; 64usize],
681 | }
682 | pub type csp_packet_t = csp_packet_s;
683 | pub type csp_iface_t = csp_iface_s;
684 | pub type csp_callback_t = ::core::option::Option;
685 | #[repr(C)]
686 | #[derive(Copy, Clone)]
687 | pub struct csp_socket_s {
688 | pub rx_queue: csp_queue_handle_t,
689 | pub rx_queue_static: csp_static_queue_t,
690 | pub rx_queue_static_data: [::core::ffi::c_char; 128usize],
691 | pub opts: u32,
692 | }
693 | pub type csp_socket_t = csp_socket_s;
694 | pub type csp_conn_t = csp_conn_s;
695 | pub type csp_memptr_t = *mut ::core::ffi::c_void;
696 | pub type csp_const_memptr_t = *const ::core::ffi::c_void;
697 | pub type csp_memcpy_fnc_t = ::core::option::Option<
698 | unsafe extern "C" fn(arg1: csp_memptr_t, arg2: csp_const_memptr_t, arg3: usize) -> csp_memptr_t,
699 | >;
700 | extern "C" {
701 | pub fn csp_buffer_get(unused: usize) -> *mut csp_packet_t;
702 | }
703 | extern "C" {
704 | pub fn csp_buffer_get_isr(unused: usize) -> *mut csp_packet_t;
705 | }
706 | extern "C" {
707 | pub fn csp_buffer_free(buffer: *mut ::core::ffi::c_void);
708 | }
709 | extern "C" {
710 | pub fn csp_buffer_free_isr(buffer: *mut ::core::ffi::c_void);
711 | }
712 | extern "C" {
713 | pub fn csp_buffer_clone(buffer: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void;
714 | }
715 | extern "C" {
716 | pub fn csp_buffer_remaining() -> ::core::ffi::c_int;
717 | }
718 | extern "C" {
719 | pub fn csp_buffer_init();
720 | }
721 | extern "C" {
722 | pub fn csp_buffer_data_size() -> usize;
723 | }
724 | extern "C" {
725 | pub fn csp_buffer_refc_inc(buffer: *mut ::core::ffi::c_void);
726 | }
727 | pub type nexthop_t = ::core::option::Option<
728 | unsafe extern "C" fn(
729 | iface: *mut csp_iface_t,
730 | via: u16,
731 | packet: *mut csp_packet_t,
732 | from_me: ::core::ffi::c_int,
733 | ) -> ::core::ffi::c_int,
734 | >;
735 | #[repr(C)]
736 | #[derive(Copy, Clone)]
737 | pub struct csp_iface_s {
738 | pub addr: u16,
739 | pub netmask: u16,
740 | pub name: *const ::core::ffi::c_char,
741 | pub interface_data: *mut ::core::ffi::c_void,
742 | pub driver_data: *mut ::core::ffi::c_void,
743 | pub nexthop: nexthop_t,
744 | pub is_default: u8,
745 | pub tx: u32,
746 | pub rx: u32,
747 | pub tx_error: u32,
748 | pub rx_error: u32,
749 | pub drop: u32,
750 | pub autherr: u32,
751 | pub frame: u32,
752 | pub txbytes: u32,
753 | pub rxbytes: u32,
754 | pub irq: u32,
755 | pub next: *mut csp_iface_s,
756 | }
757 | extern "C" {
758 | pub fn csp_qfifo_write(
759 | packet: *mut csp_packet_t,
760 | iface: *mut csp_iface_t,
761 | pxTaskWoken: *mut ::core::ffi::c_void,
762 | );
763 | }
764 | extern "C" {
765 | pub fn csp_iflist_add(iface: *mut csp_iface_t) -> ::core::ffi::c_int;
766 | }
767 | extern "C" {
768 | pub fn csp_iflist_remove(ifc: *mut csp_iface_t);
769 | }
770 | extern "C" {
771 | pub fn csp_iflist_get_by_name(name: *const ::core::ffi::c_char) -> *mut csp_iface_t;
772 | }
773 | extern "C" {
774 | pub fn csp_iflist_get_by_addr(addr: u16) -> *mut csp_iface_t;
775 | }
776 | extern "C" {
777 | pub fn csp_iflist_get_by_subnet(addr: u16, from: *mut csp_iface_t) -> *mut csp_iface_t;
778 | }
779 | extern "C" {
780 | pub fn csp_iflist_get_by_isdfl(ifc: *mut csp_iface_t) -> *mut csp_iface_t;
781 | }
782 | extern "C" {
783 | pub fn csp_iflist_get_by_index(idx: ::core::ffi::c_int) -> *mut csp_iface_t;
784 | }
785 | extern "C" {
786 | pub fn csp_iflist_is_within_subnet(addr: u16, ifc: *mut csp_iface_t) -> ::core::ffi::c_int;
787 | }
788 | extern "C" {
789 | pub fn csp_iflist_get() -> *mut csp_iface_t;
790 | }
791 | extern "C" {
792 | pub fn csp_bytesize(
793 | bytes: ::core::ffi::c_ulong,
794 | postfix: *mut ::core::ffi::c_char,
795 | ) -> ::core::ffi::c_ulong;
796 | }
797 | extern "C" {
798 | pub fn csp_iflist_check_dfl();
799 | }
800 | extern "C" {
801 | pub fn csp_iflist_print();
802 | }
803 | #[repr(C)]
804 | #[derive(Copy, Clone)]
805 | pub struct csp_route_s {
806 | pub address: u16,
807 | pub netmask: u16,
808 | pub via: u16,
809 | pub iface: *mut csp_iface_t,
810 | }
811 | pub type csp_route_t = csp_route_s;
812 | extern "C" {
813 | pub fn csp_rtable_search_backward(start_route: *mut csp_route_t) -> *mut csp_route_t;
814 | }
815 | extern "C" {
816 | pub fn csp_rtable_find_route(dest_address: u16) -> *mut csp_route_t;
817 | }
818 | extern "C" {
819 | pub fn csp_rtable_set(
820 | dest_address: u16,
821 | netmask: ::core::ffi::c_int,
822 | ifc: *mut csp_iface_t,
823 | via: u16,
824 | ) -> ::core::ffi::c_int;
825 | }
826 | extern "C" {
827 | pub fn csp_rtable_save(
828 | buffer: *mut ::core::ffi::c_char,
829 | buffer_size: usize,
830 | ) -> ::core::ffi::c_int;
831 | }
832 | extern "C" {
833 | pub fn csp_rtable_load(rtable: *const ::core::ffi::c_char) -> ::core::ffi::c_int;
834 | }
835 | extern "C" {
836 | pub fn csp_rtable_check(rtable: *const ::core::ffi::c_char) -> ::core::ffi::c_int;
837 | }
838 | extern "C" {
839 | pub fn csp_rtable_clear();
840 | }
841 | extern "C" {
842 | pub fn csp_rtable_free();
843 | }
844 | pub type csp_rtable_iterator_t = ::core::option::Option<
845 | unsafe extern "C" fn(ctx: *mut ::core::ffi::c_void, route: *mut csp_route_t) -> bool,
846 | >;
847 | extern "C" {
848 | pub fn csp_rtable_iterate(iter: csp_rtable_iterator_t, ctx: *mut ::core::ffi::c_void);
849 | }
850 | extern "C" {
851 | pub fn csp_rtable_print();
852 | }
853 | extern "C" {
854 | pub fn memcpy(
855 | __dest: *mut ::core::ffi::c_void,
856 | __src: *const ::core::ffi::c_void,
857 | __n: ::core::ffi::c_ulong,
858 | ) -> *mut ::core::ffi::c_void;
859 | }
860 | extern "C" {
861 | pub fn memmove(
862 | __dest: *mut ::core::ffi::c_void,
863 | __src: *const ::core::ffi::c_void,
864 | __n: ::core::ffi::c_ulong,
865 | ) -> *mut ::core::ffi::c_void;
866 | }
867 | extern "C" {
868 | pub fn memccpy(
869 | __dest: *mut ::core::ffi::c_void,
870 | __src: *const ::core::ffi::c_void,
871 | __c: ::core::ffi::c_int,
872 | __n: ::core::ffi::c_ulong,
873 | ) -> *mut ::core::ffi::c_void;
874 | }
875 | extern "C" {
876 | pub fn memset(
877 | __s: *mut ::core::ffi::c_void,
878 | __c: ::core::ffi::c_int,
879 | __n: ::core::ffi::c_ulong,
880 | ) -> *mut ::core::ffi::c_void;
881 | }
882 | extern "C" {
883 | pub fn memcmp(
884 | __s1: *const ::core::ffi::c_void,
885 | __s2: *const ::core::ffi::c_void,
886 | __n: ::core::ffi::c_ulong,
887 | ) -> ::core::ffi::c_int;
888 | }
889 | extern "C" {
890 | pub fn __memcmpeq(
891 | __s1: *const ::core::ffi::c_void,
892 | __s2: *const ::core::ffi::c_void,
893 | __n: usize,
894 | ) -> ::core::ffi::c_int;
895 | }
896 | extern "C" {
897 | pub fn memchr(
898 | __s: *const ::core::ffi::c_void,
899 | __c: ::core::ffi::c_int,
900 | __n: ::core::ffi::c_ulong,
901 | ) -> *mut ::core::ffi::c_void;
902 | }
903 | extern "C" {
904 | pub fn strcpy(
905 | __dest: *mut ::core::ffi::c_char,
906 | __src: *const ::core::ffi::c_char,
907 | ) -> *mut ::core::ffi::c_char;
908 | }
909 | extern "C" {
910 | pub fn strncpy(
911 | __dest: *mut ::core::ffi::c_char,
912 | __src: *const ::core::ffi::c_char,
913 | __n: ::core::ffi::c_ulong,
914 | ) -> *mut ::core::ffi::c_char;
915 | }
916 | extern "C" {
917 | pub fn strcat(
918 | __dest: *mut ::core::ffi::c_char,
919 | __src: *const ::core::ffi::c_char,
920 | ) -> *mut ::core::ffi::c_char;
921 | }
922 | extern "C" {
923 | pub fn strncat(
924 | __dest: *mut ::core::ffi::c_char,
925 | __src: *const ::core::ffi::c_char,
926 | __n: ::core::ffi::c_ulong,
927 | ) -> *mut ::core::ffi::c_char;
928 | }
929 | extern "C" {
930 | pub fn strcmp(
931 | __s1: *const ::core::ffi::c_char,
932 | __s2: *const ::core::ffi::c_char,
933 | ) -> ::core::ffi::c_int;
934 | }
935 | extern "C" {
936 | pub fn strncmp(
937 | __s1: *const ::core::ffi::c_char,
938 | __s2: *const ::core::ffi::c_char,
939 | __n: ::core::ffi::c_ulong,
940 | ) -> ::core::ffi::c_int;
941 | }
942 | extern "C" {
943 | pub fn strcoll(
944 | __s1: *const ::core::ffi::c_char,
945 | __s2: *const ::core::ffi::c_char,
946 | ) -> ::core::ffi::c_int;
947 | }
948 | extern "C" {
949 | pub fn strxfrm(
950 | __dest: *mut ::core::ffi::c_char,
951 | __src: *const ::core::ffi::c_char,
952 | __n: ::core::ffi::c_ulong,
953 | ) -> ::core::ffi::c_ulong;
954 | }
955 | #[repr(C)]
956 | #[derive(Copy, Clone)]
957 | pub struct __locale_struct {
958 | pub __locales: [*mut __locale_data; 13usize],
959 | pub __ctype_b: *const ::core::ffi::c_ushort,
960 | pub __ctype_tolower: *const ::core::ffi::c_int,
961 | pub __ctype_toupper: *const ::core::ffi::c_int,
962 | pub __names: [*const ::core::ffi::c_char; 13usize],
963 | }
964 | pub type __locale_t = *mut __locale_struct;
965 | pub type locale_t = __locale_t;
966 | extern "C" {
967 | pub fn strcoll_l(
968 | __s1: *const ::core::ffi::c_char,
969 | __s2: *const ::core::ffi::c_char,
970 | __l: locale_t,
971 | ) -> ::core::ffi::c_int;
972 | }
973 | extern "C" {
974 | pub fn strxfrm_l(
975 | __dest: *mut ::core::ffi::c_char,
976 | __src: *const ::core::ffi::c_char,
977 | __n: usize,
978 | __l: locale_t,
979 | ) -> usize;
980 | }
981 | extern "C" {
982 | pub fn strdup(__s: *const ::core::ffi::c_char) -> *mut ::core::ffi::c_char;
983 | }
984 | extern "C" {
985 | pub fn strndup(
986 | __string: *const ::core::ffi::c_char,
987 | __n: ::core::ffi::c_ulong,
988 | ) -> *mut ::core::ffi::c_char;
989 | }
990 | extern "C" {
991 | pub fn strchr(
992 | __s: *const ::core::ffi::c_char,
993 | __c: ::core::ffi::c_int,
994 | ) -> *mut ::core::ffi::c_char;
995 | }
996 | extern "C" {
997 | pub fn strrchr(
998 | __s: *const ::core::ffi::c_char,
999 | __c: ::core::ffi::c_int,
1000 | ) -> *mut ::core::ffi::c_char;
1001 | }
1002 | extern "C" {
1003 | pub fn strcspn(
1004 | __s: *const ::core::ffi::c_char,
1005 | __reject: *const ::core::ffi::c_char,
1006 | ) -> ::core::ffi::c_ulong;
1007 | }
1008 | extern "C" {
1009 | pub fn strspn(
1010 | __s: *const ::core::ffi::c_char,
1011 | __accept: *const ::core::ffi::c_char,
1012 | ) -> ::core::ffi::c_ulong;
1013 | }
1014 | extern "C" {
1015 | pub fn strpbrk(
1016 | __s: *const ::core::ffi::c_char,
1017 | __accept: *const ::core::ffi::c_char,
1018 | ) -> *mut ::core::ffi::c_char;
1019 | }
1020 | extern "C" {
1021 | pub fn strstr(
1022 | __haystack: *const ::core::ffi::c_char,
1023 | __needle: *const ::core::ffi::c_char,
1024 | ) -> *mut ::core::ffi::c_char;
1025 | }
1026 | extern "C" {
1027 | pub fn strtok(
1028 | __s: *mut ::core::ffi::c_char,
1029 | __delim: *const ::core::ffi::c_char,
1030 | ) -> *mut ::core::ffi::c_char;
1031 | }
1032 | extern "C" {
1033 | pub fn __strtok_r(
1034 | __s: *mut ::core::ffi::c_char,
1035 | __delim: *const ::core::ffi::c_char,
1036 | __save_ptr: *mut *mut ::core::ffi::c_char,
1037 | ) -> *mut ::core::ffi::c_char;
1038 | }
1039 | extern "C" {
1040 | pub fn strtok_r(
1041 | __s: *mut ::core::ffi::c_char,
1042 | __delim: *const ::core::ffi::c_char,
1043 | __save_ptr: *mut *mut ::core::ffi::c_char,
1044 | ) -> *mut ::core::ffi::c_char;
1045 | }
1046 | extern "C" {
1047 | pub fn strlen(__s: *const ::core::ffi::c_char) -> ::core::ffi::c_ulong;
1048 | }
1049 | extern "C" {
1050 | pub fn strnlen(__string: *const ::core::ffi::c_char, __maxlen: usize) -> usize;
1051 | }
1052 | extern "C" {
1053 | pub fn strerror(__errnum: ::core::ffi::c_int) -> *mut ::core::ffi::c_char;
1054 | }
1055 | extern "C" {
1056 | #[link_name = "\u{1}__xpg_strerror_r"]
1057 | pub fn strerror_r(
1058 | __errnum: ::core::ffi::c_int,
1059 | __buf: *mut ::core::ffi::c_char,
1060 | __buflen: usize,
1061 | ) -> ::core::ffi::c_int;
1062 | }
1063 | extern "C" {
1064 | pub fn strerror_l(__errnum: ::core::ffi::c_int, __l: locale_t) -> *mut ::core::ffi::c_char;
1065 | }
1066 | extern "C" {
1067 | pub fn bcmp(
1068 | __s1: *const ::core::ffi::c_void,
1069 | __s2: *const ::core::ffi::c_void,
1070 | __n: ::core::ffi::c_ulong,
1071 | ) -> ::core::ffi::c_int;
1072 | }
1073 | extern "C" {
1074 | pub fn bcopy(__src: *const ::core::ffi::c_void, __dest: *mut ::core::ffi::c_void, __n: usize);
1075 | }
1076 | extern "C" {
1077 | pub fn bzero(__s: *mut ::core::ffi::c_void, __n: ::core::ffi::c_ulong);
1078 | }
1079 | extern "C" {
1080 | pub fn index(
1081 | __s: *const ::core::ffi::c_char,
1082 | __c: ::core::ffi::c_int,
1083 | ) -> *mut ::core::ffi::c_char;
1084 | }
1085 | extern "C" {
1086 | pub fn rindex(
1087 | __s: *const ::core::ffi::c_char,
1088 | __c: ::core::ffi::c_int,
1089 | ) -> *mut ::core::ffi::c_char;
1090 | }
1091 | extern "C" {
1092 | pub fn ffs(__i: ::core::ffi::c_int) -> ::core::ffi::c_int;
1093 | }
1094 | extern "C" {
1095 | pub fn ffsl(__l: ::core::ffi::c_long) -> ::core::ffi::c_int;
1096 | }
1097 | extern "C" {
1098 | pub fn ffsll(__ll: ::core::ffi::c_longlong) -> ::core::ffi::c_int;
1099 | }
1100 | extern "C" {
1101 | pub fn strcasecmp(
1102 | __s1: *const ::core::ffi::c_char,
1103 | __s2: *const ::core::ffi::c_char,
1104 | ) -> ::core::ffi::c_int;
1105 | }
1106 | extern "C" {
1107 | pub fn strncasecmp(
1108 | __s1: *const ::core::ffi::c_char,
1109 | __s2: *const ::core::ffi::c_char,
1110 | __n: ::core::ffi::c_ulong,
1111 | ) -> ::core::ffi::c_int;
1112 | }
1113 | extern "C" {
1114 | pub fn strcasecmp_l(
1115 | __s1: *const ::core::ffi::c_char,
1116 | __s2: *const ::core::ffi::c_char,
1117 | __loc: locale_t,
1118 | ) -> ::core::ffi::c_int;
1119 | }
1120 | extern "C" {
1121 | pub fn strncasecmp_l(
1122 | __s1: *const ::core::ffi::c_char,
1123 | __s2: *const ::core::ffi::c_char,
1124 | __n: usize,
1125 | __loc: locale_t,
1126 | ) -> ::core::ffi::c_int;
1127 | }
1128 | extern "C" {
1129 | pub fn explicit_bzero(__s: *mut ::core::ffi::c_void, __n: usize);
1130 | }
1131 | extern "C" {
1132 | pub fn strsep(
1133 | __stringp: *mut *mut ::core::ffi::c_char,
1134 | __delim: *const ::core::ffi::c_char,
1135 | ) -> *mut ::core::ffi::c_char;
1136 | }
1137 | extern "C" {
1138 | pub fn strsignal(__sig: ::core::ffi::c_int) -> *mut ::core::ffi::c_char;
1139 | }
1140 | extern "C" {
1141 | pub fn __stpcpy(
1142 | __dest: *mut ::core::ffi::c_char,
1143 | __src: *const ::core::ffi::c_char,
1144 | ) -> *mut ::core::ffi::c_char;
1145 | }
1146 | extern "C" {
1147 | pub fn stpcpy(
1148 | __dest: *mut ::core::ffi::c_char,
1149 | __src: *const ::core::ffi::c_char,
1150 | ) -> *mut ::core::ffi::c_char;
1151 | }
1152 | extern "C" {
1153 | pub fn __stpncpy(
1154 | __dest: *mut ::core::ffi::c_char,
1155 | __src: *const ::core::ffi::c_char,
1156 | __n: usize,
1157 | ) -> *mut ::core::ffi::c_char;
1158 | }
1159 | extern "C" {
1160 | pub fn stpncpy(
1161 | __dest: *mut ::core::ffi::c_char,
1162 | __src: *const ::core::ffi::c_char,
1163 | __n: ::core::ffi::c_ulong,
1164 | ) -> *mut ::core::ffi::c_char;
1165 | }
1166 | extern "C" {
1167 | pub fn csp_sfp_send_own_memcpy(
1168 | conn: *mut csp_conn_t,
1169 | data: *const ::core::ffi::c_void,
1170 | datasize: ::core::ffi::c_uint,
1171 | mtu: ::core::ffi::c_uint,
1172 | timeout: u32,
1173 | memcpyfcn: csp_memcpy_fnc_t,
1174 | ) -> ::core::ffi::c_int;
1175 | }
1176 | extern "C" {
1177 | pub fn csp_sfp_recv_fp(
1178 | conn: *mut csp_conn_t,
1179 | dataout: *mut *mut ::core::ffi::c_void,
1180 | datasize: *mut ::core::ffi::c_int,
1181 | timeout: u32,
1182 | first_packet: *mut csp_packet_t,
1183 | ) -> ::core::ffi::c_int;
1184 | }
1185 | extern "C" {
1186 | pub fn csp_promisc_enable(queue_size: ::core::ffi::c_uint) -> ::core::ffi::c_int;
1187 | }
1188 | extern "C" {
1189 | pub fn csp_promisc_disable();
1190 | }
1191 | extern "C" {
1192 | pub fn csp_promisc_read(timeout: u32) -> *mut csp_packet_t;
1193 | }
1194 | pub const csp_dedup_types_CSP_DEDUP_OFF: csp_dedup_types = 0;
1195 | pub const csp_dedup_types_CSP_DEDUP_FWD: csp_dedup_types = 1;
1196 | pub const csp_dedup_types_CSP_DEDUP_INCOMING: csp_dedup_types = 2;
1197 | pub const csp_dedup_types_CSP_DEDUP_ALL: csp_dedup_types = 3;
1198 | pub type csp_dedup_types = ::core::ffi::c_uint;
1199 | #[repr(C)]
1200 | #[derive(Copy, Clone)]
1201 | pub struct csp_conf_s {
1202 | pub version: u8,
1203 | pub hostname: *const ::core::ffi::c_char,
1204 | pub model: *const ::core::ffi::c_char,
1205 | pub revision: *const ::core::ffi::c_char,
1206 | pub conn_dfl_so: u32,
1207 | pub dedup: u8,
1208 | }
1209 | pub type csp_conf_t = csp_conf_s;
1210 | extern "C" {
1211 | pub static mut csp_conf: csp_conf_t;
1212 | }
1213 | extern "C" {
1214 | pub fn csp_init();
1215 | }
1216 | extern "C" {
1217 | pub fn csp_free_resources();
1218 | }
1219 | extern "C" {
1220 | pub fn csp_get_conf() -> *const csp_conf_t;
1221 | }
1222 | extern "C" {
1223 | pub fn csp_id_copy(target: *mut csp_id_t, source: *mut csp_id_t);
1224 | }
1225 | extern "C" {
1226 | pub fn csp_accept(socket: *mut csp_socket_t, timeout: u32) -> *mut csp_conn_t;
1227 | }
1228 | extern "C" {
1229 | pub fn csp_read(conn: *mut csp_conn_t, timeout: u32) -> *mut csp_packet_t;
1230 | }
1231 | extern "C" {
1232 | pub fn csp_send(conn: *mut csp_conn_t, packet: *mut csp_packet_t);
1233 | }
1234 | extern "C" {
1235 | pub fn csp_send_prio(prio: u8, conn: *mut csp_conn_t, packet: *mut csp_packet_t);
1236 | }
1237 | extern "C" {
1238 | pub fn csp_transaction_w_opts(
1239 | prio: u8,
1240 | dst: u16,
1241 | dst_port: u8,
1242 | timeout: u32,
1243 | outbuf: *mut ::core::ffi::c_void,
1244 | outlen: ::core::ffi::c_int,
1245 | inbuf: *mut ::core::ffi::c_void,
1246 | inlen: ::core::ffi::c_int,
1247 | opts: u32,
1248 | ) -> ::core::ffi::c_int;
1249 | }
1250 | extern "C" {
1251 | pub fn csp_transaction_persistent(
1252 | conn: *mut csp_conn_t,
1253 | timeout: u32,
1254 | outbuf: *mut ::core::ffi::c_void,
1255 | outlen: ::core::ffi::c_int,
1256 | inbuf: *mut ::core::ffi::c_void,
1257 | inlen: ::core::ffi::c_int,
1258 | ) -> ::core::ffi::c_int;
1259 | }
1260 | extern "C" {
1261 | pub fn csp_recvfrom(socket: *mut csp_socket_t, timeout: u32) -> *mut csp_packet_t;
1262 | }
1263 | extern "C" {
1264 | pub fn csp_sendto(
1265 | prio: u8,
1266 | dst: u16,
1267 | dst_port: u8,
1268 | src_port: u8,
1269 | opts: u32,
1270 | packet: *mut csp_packet_t,
1271 | );
1272 | }
1273 | extern "C" {
1274 | pub fn csp_sendto_reply(request: *const csp_packet_t, reply: *mut csp_packet_t, opts: u32);
1275 | }
1276 | extern "C" {
1277 | pub fn csp_connect(
1278 | prio: u8,
1279 | dst: u16,
1280 | dst_port: u8,
1281 | timeout: u32,
1282 | opts: u32,
1283 | ) -> *mut csp_conn_t;
1284 | }
1285 | extern "C" {
1286 | pub fn csp_close(conn: *mut csp_conn_t) -> ::core::ffi::c_int;
1287 | }
1288 | extern "C" {
1289 | pub fn csp_socket_close(sock: *mut csp_socket_t) -> ::core::ffi::c_int;
1290 | }
1291 | extern "C" {
1292 | pub fn csp_conn_dport(conn: *mut csp_conn_t) -> ::core::ffi::c_int;
1293 | }
1294 | extern "C" {
1295 | pub fn csp_conn_sport(conn: *mut csp_conn_t) -> ::core::ffi::c_int;
1296 | }
1297 | extern "C" {
1298 | pub fn csp_conn_dst(conn: *mut csp_conn_t) -> ::core::ffi::c_int;
1299 | }
1300 | extern "C" {
1301 | pub fn csp_conn_src(conn: *mut csp_conn_t) -> ::core::ffi::c_int;
1302 | }
1303 | extern "C" {
1304 | pub fn csp_conn_flags(conn: *mut csp_conn_t) -> ::core::ffi::c_int;
1305 | }
1306 | extern "C" {
1307 | pub fn csp_listen(socket: *mut csp_socket_t, backlog: usize) -> ::core::ffi::c_int;
1308 | }
1309 | extern "C" {
1310 | pub fn csp_bind(socket: *mut csp_socket_t, port: u8) -> ::core::ffi::c_int;
1311 | }
1312 | extern "C" {
1313 | pub fn csp_bind_callback(callback: csp_callback_t, port: u8) -> ::core::ffi::c_int;
1314 | }
1315 | extern "C" {
1316 | pub fn csp_route_work() -> ::core::ffi::c_int;
1317 | }
1318 | extern "C" {
1319 | pub fn csp_bridge_set_interfaces(if_a: *mut csp_iface_t, if_b: *mut csp_iface_t);
1320 | }
1321 | extern "C" {
1322 | pub fn csp_bridge_work();
1323 | }
1324 | extern "C" {
1325 | pub fn csp_service_handler(packet: *mut csp_packet_t);
1326 | }
1327 | extern "C" {
1328 | pub fn csp_ping(
1329 | node: u16,
1330 | timeout: u32,
1331 | size: ::core::ffi::c_uint,
1332 | opts: u8,
1333 | ) -> ::core::ffi::c_int;
1334 | }
1335 | extern "C" {
1336 | pub fn csp_ping_noreply(node: u16);
1337 | }
1338 | extern "C" {
1339 | pub fn csp_ps(node: u16, timeout: u32);
1340 | }
1341 | extern "C" {
1342 | pub fn csp_get_memfree(node: u16, timeout: u32, size: *mut u32) -> ::core::ffi::c_int;
1343 | }
1344 | extern "C" {
1345 | pub fn csp_memfree(node: u16, timeout: u32);
1346 | }
1347 | extern "C" {
1348 | pub fn csp_get_buf_free(node: u16, timeout: u32, size: *mut u32) -> ::core::ffi::c_int;
1349 | }
1350 | extern "C" {
1351 | pub fn csp_buf_free(node: u16, timeout: u32);
1352 | }
1353 | extern "C" {
1354 | pub fn csp_reboot(node: u16);
1355 | }
1356 | extern "C" {
1357 | pub fn csp_shutdown(node: u16);
1358 | }
1359 | extern "C" {
1360 | pub fn csp_uptime(node: u16, timeout: u32);
1361 | }
1362 | extern "C" {
1363 | pub fn csp_get_uptime(node: u16, timeout: u32, uptime: *mut u32) -> ::core::ffi::c_int;
1364 | }
1365 | extern "C" {
1366 | pub fn csp_rdp_set_opt(
1367 | window_size: ::core::ffi::c_uint,
1368 | conn_timeout_ms: ::core::ffi::c_uint,
1369 | packet_timeout_ms: ::core::ffi::c_uint,
1370 | delayed_acks: ::core::ffi::c_uint,
1371 | ack_timeout: ::core::ffi::c_uint,
1372 | ack_delay_count: ::core::ffi::c_uint,
1373 | );
1374 | }
1375 | extern "C" {
1376 | pub fn csp_rdp_get_opt(
1377 | window_size: *mut ::core::ffi::c_uint,
1378 | conn_timeout_ms: *mut ::core::ffi::c_uint,
1379 | packet_timeout_ms: *mut ::core::ffi::c_uint,
1380 | delayed_acks: *mut ::core::ffi::c_uint,
1381 | ack_timeout: *mut ::core::ffi::c_uint,
1382 | ack_delay_count: *mut ::core::ffi::c_uint,
1383 | );
1384 | }
1385 | extern "C" {
1386 | pub fn csp_cmp_set_memcpy(fnc: csp_memcpy_fnc_t);
1387 | }
1388 | extern "C" {
1389 | pub fn csp_conn_print_table();
1390 | }
1391 | extern "C" {
1392 | pub fn csp_hex_dump(
1393 | desc: *const ::core::ffi::c_char,
1394 | addr: *mut ::core::ffi::c_void,
1395 | len: ::core::ffi::c_int,
1396 | );
1397 | }
1398 | extern "C" {
1399 | pub fn csp_conn_print_table_str(
1400 | str_buf: *mut ::core::ffi::c_char,
1401 | str_size: ::core::ffi::c_int,
1402 | ) -> ::core::ffi::c_int;
1403 | }
1404 | extern "C" {
1405 | pub fn csp_id1_prepend(packet: *mut csp_packet_t);
1406 | }
1407 | extern "C" {
1408 | pub fn csp_id1_strip(packet: *mut csp_packet_t) -> ::core::ffi::c_int;
1409 | }
1410 | extern "C" {
1411 | pub fn csp_id1_setup_rx(packet: *mut csp_packet_t);
1412 | }
1413 | extern "C" {
1414 | pub fn csp_id2_prepend(packet: *mut csp_packet_t);
1415 | }
1416 | extern "C" {
1417 | pub fn csp_id2_strip(packet: *mut csp_packet_t) -> ::core::ffi::c_int;
1418 | }
1419 | extern "C" {
1420 | pub fn csp_id2_setup_rx(packet: *mut csp_packet_t);
1421 | }
1422 | extern "C" {
1423 | pub fn csp_id_prepend(packet: *mut csp_packet_t);
1424 | }
1425 | extern "C" {
1426 | pub fn csp_id_strip(packet: *mut csp_packet_t) -> ::core::ffi::c_int;
1427 | }
1428 | extern "C" {
1429 | pub fn csp_id_setup_rx(packet: *mut csp_packet_t) -> ::core::ffi::c_int;
1430 | }
1431 | extern "C" {
1432 | pub fn csp_id_get_host_bits() -> ::core::ffi::c_uint;
1433 | }
1434 | extern "C" {
1435 | pub fn csp_id_get_max_nodeid() -> ::core::ffi::c_uint;
1436 | }
1437 | extern "C" {
1438 | pub fn csp_id_get_max_port() -> ::core::ffi::c_uint;
1439 | }
1440 | extern "C" {
1441 | pub fn csp_id_is_broadcast(addr: u16, iface: *mut csp_iface_t) -> ::core::ffi::c_int;
1442 | }
1443 | pub type csp_can_driver_tx_t = ::core::option::Option<
1444 | unsafe extern "C" fn(
1445 | driver_data: *mut ::core::ffi::c_void,
1446 | id: u32,
1447 | data: *const u8,
1448 | dlc: u8,
1449 | ) -> ::core::ffi::c_int,
1450 | >;
1451 | #[repr(C)]
1452 | #[derive(Copy, Clone)]
1453 | pub struct csp_can_interface_data_t {
1454 | pub cfp_packet_counter: u32,
1455 | pub tx_func: csp_can_driver_tx_t,
1456 | pub pbufs: *mut csp_packet_t,
1457 | }
1458 | extern "C" {
1459 | pub fn csp_can_add_interface(iface: *mut csp_iface_t) -> ::core::ffi::c_int;
1460 | }
1461 | extern "C" {
1462 | pub fn csp_can_remove_interface(iface: *mut csp_iface_t) -> ::core::ffi::c_int;
1463 | }
1464 | extern "C" {
1465 | pub fn csp_can_tx(
1466 | iface: *mut csp_iface_t,
1467 | via: u16,
1468 | packet: *mut csp_packet_t,
1469 | ) -> ::core::ffi::c_int;
1470 | }
1471 | extern "C" {
1472 | pub fn csp_can_rx(
1473 | iface: *mut csp_iface_t,
1474 | id: u32,
1475 | data: *const u8,
1476 | dlc: u8,
1477 | pxTaskWoken: *mut ::core::ffi::c_int,
1478 | ) -> ::core::ffi::c_int;
1479 | }
1480 | #[repr(C)]
1481 | #[derive(Copy, Clone)]
1482 | pub struct csp_can_pbuf_element_t {
1483 | pub rx_count: u16,
1484 | pub remain: u16,
1485 | pub cfpid: u32,
1486 | pub last_used: u32,
1487 | }
1488 | extern "C" {
1489 | pub fn csp_can_pbuf_free(
1490 | ifdata: *mut csp_can_interface_data_t,
1491 | buffer: *mut csp_packet_t,
1492 | buf_free: ::core::ffi::c_int,
1493 | task_woken: *mut ::core::ffi::c_int,
1494 | );
1495 | }
1496 | extern "C" {
1497 | pub fn csp_can_pbuf_new(
1498 | ifdata: *mut csp_can_interface_data_t,
1499 | id: u32,
1500 | task_woken: *mut ::core::ffi::c_int,
1501 | ) -> *mut csp_packet_t;
1502 | }
1503 | extern "C" {
1504 | pub fn csp_can_pbuf_find(
1505 | ifdata: *mut csp_can_interface_data_t,
1506 | id: u32,
1507 | mask: u32,
1508 | task_woken: *mut ::core::ffi::c_int,
1509 | ) -> *mut csp_packet_t;
1510 | }
1511 | extern "C" {
1512 | pub fn csp_can_pbuf_cleanup(
1513 | ifdata: *mut csp_can_interface_data_t,
1514 | task_woken: *mut ::core::ffi::c_int,
1515 | );
1516 | }
1517 | #[repr(C)]
1518 | #[derive(Copy, Clone)]
1519 | pub struct csp_conn_s {
1520 | pub _address: u8,
1521 | }
1522 | #[repr(C)]
1523 | #[derive(Copy, Clone)]
1524 | pub struct __locale_data {
1525 | pub _address: u8,
1526 | }
1527 |
--------------------------------------------------------------------------------
/csp-rs/src/macros.rs:
--------------------------------------------------------------------------------
1 | /* Manual Implementations of required macros as cbindgen does not generate these correctly (GH issue #753) */
2 | #![no_std]
3 | #![allow(unused)]
4 |
5 | // GETs
6 | macro_rules! cfp_field {
7 | ($id:expr, $rsiz:expr, $fsiz:expr) => {
8 | (($id >> $rsiz) & ((1u32 << $fsiz) - 1))
9 | };
10 | }
11 |
12 | macro_rules! cfp_type {
13 | ($id:expr) => {
14 | cfp_field!(
15 | $id,
16 | crate::libcsp_ffi::CFP_REMAIN_SIZE + crate::libcsp_ffi::CFP_ID_SIZE,
17 | crate::libcsp_ffi::CFP_TYPE_SIZE
18 | )
19 | };
20 | }
21 |
22 | macro_rules! cfp_remain {
23 | ($id:expr) => {
24 | cfp_field!(
25 | $id,
26 | crate::libcsp_ffi::CFP_ID_SIZE,
27 | crate::libcsp_ffi::CFP_REMAIN_SIZE
28 | )
29 | };
30 | }
31 |
32 | // MAKEs
33 | macro_rules! cfp_make_field {
34 | ($id:expr, $fsiz:expr, $rsiz:expr) => {
35 | (((($id) & ((1u32 << ($fsiz)) - 1)) as u32) << ($rsiz))
36 | };
37 | }
38 |
39 | macro_rules! cfp_make_src {
40 | ($id:expr) => {
41 | cfp_make_field!(
42 | $id,
43 | crate::libcsp_ffi::CFP_HOST_SIZE,
44 | crate::libcsp_ffi::CFP_HOST_SIZE
45 | + crate::libcsp_ffi::CFP_TYPE_SIZE
46 | + crate::libcsp_ffi::CFP_REMAIN_SIZE
47 | + crate::libcsp_ffi::CFP_ID_SIZE
48 | )
49 | };
50 | }
51 |
52 | macro_rules! cfp_make_dst {
53 | ($id:expr) => {
54 | cfp_make_field!(
55 | $id,
56 | crate::libcsp_ffi::CFP_HOST_SIZE,
57 | crate::libcsp_ffi::CFP_TYPE_SIZE
58 | + crate::libcsp_ffi::CFP_REMAIN_SIZE
59 | + crate::libcsp_ffi::CFP_ID_SIZE
60 | )
61 | };
62 | }
63 |
64 | macro_rules! cfp_make_type {
65 | ($id:expr) => {
66 | cfp_make_field!(
67 | $id,
68 | crate::libcsp_ffi::CFP_TYPE_SIZE,
69 | crate::libcsp_ffi::CFP_REMAIN_SIZE + crate::libcsp_ffi::CFP_ID_SIZE
70 | )
71 | };
72 | }
73 |
74 | macro_rules! cfp_make_remain {
75 | ($id:expr) => {
76 | cfp_make_field!(
77 | $id,
78 | crate::libcsp_ffi::CFP_REMAIN_SIZE,
79 | crate::libcsp_ffi::CFP_ID_SIZE
80 | )
81 | };
82 | }
83 |
84 | macro_rules! cfp_make_id {
85 | ($id:expr) => {
86 | cfp_make_field!($id, crate::libcsp_ffi::CFP_ID_SIZE, 0)
87 | };
88 | }
89 |
--------------------------------------------------------------------------------
/csp-rs/wrapper.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
--------------------------------------------------------------------------------
/paper/RustForSpace.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pr0me/rust-for-critical-space-systems/40f913626c5c59821e183984a5208714a84f8c2a/paper/RustForSpace.pdf
--------------------------------------------------------------------------------
/paper/paper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pr0me/rust-for-critical-space-systems/40f913626c5c59821e183984a5208714a84f8c2a/paper/paper.png
--------------------------------------------------------------------------------