iceoryx2_pal_configuration/
lib.rs

1// Copyright (c) 2023 Contributors to the Eclipse Foundation
2//
3// See the NOTICE file(s) distributed with this work for additional
4// information regarding copyright ownership.
5//
6// This program and the accompanying materials are made available under the
7// terms of the Apache Software License 2.0 which is available at
8// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
9// which is available at https://opensource.org/licenses/MIT.
10//
11// SPDX-License-Identifier: Apache-2.0 OR MIT
12
13#![no_std]
14
15#[cfg(all(not(target_os = "windows"), not(target_os = "nto")))]
16pub mod settings {
17    pub const GLOBAL_CONFIG_PATH: &[u8] = b"/etc";
18    pub const USER_CONFIG_PATH: &[u8] = b".config";
19    pub const TEMP_DIRECTORY: &[u8] = b"/tmp/";
20    pub const TEST_DIRECTORY: &[u8] = b"/tmp/iceoryx2/tests/";
21    pub const SHARED_MEMORY_DIRECTORY: &[u8] = b"/dev/shm/";
22    pub const PATH_SEPARATOR: u8 = b'/';
23    pub const ROOT: &[u8] = b"/";
24    pub const ICEORYX2_ROOT_PATH: &[u8] = b"/tmp/iceoryx2/";
25    pub const FILENAME_LENGTH: usize = 255;
26    // it is actually 4096 but to be more compatible with windows and also safe some stack the number
27    // is reduced to 255
28    pub const PATH_LENGTH: usize = 255;
29    #[cfg(not(target_os = "macos"))]
30    pub const AT_LEAST_TIMING_VARIANCE: f32 = 0.25;
31    #[cfg(target_os = "macos")]
32    pub const AT_LEAST_TIMING_VARIANCE: f32 = 1.0;
33}
34
35#[cfg(target_os = "nto")]
36pub mod settings {
37    pub const GLOBAL_CONFIG_PATH: &[u8] = b"/etc";
38    pub const USER_CONFIG_PATH: &[u8] = b".config";
39    pub const TEMP_DIRECTORY: &[u8] = b"/data/iceoryx2/tmp/";
40    pub const TEST_DIRECTORY: &[u8] = b"/data/iceoryx2/tests/";
41    pub const SHARED_MEMORY_DIRECTORY: &[u8] = b"/dev/shmem/";
42    pub const PATH_SEPARATOR: u8 = b'/';
43    pub const ROOT: &[u8] = b"/";
44    pub const ICEORYX2_ROOT_PATH: &[u8] = b"/data/iceoryx2/";
45    pub const FILENAME_LENGTH: usize = 255;
46    pub const PATH_LENGTH: usize = 255;
47    pub const AT_LEAST_TIMING_VARIANCE: f32 = 0.25;
48}
49
50#[cfg(target_os = "windows")]
51pub mod settings {
52    pub const GLOBAL_CONFIG_PATH: &[u8] = b"C:\\ProgramData";
53    pub const USER_CONFIG_PATH: &[u8] = b".config";
54    pub const TEMP_DIRECTORY: &[u8] = b"C:\\Temp\\";
55    pub const TEST_DIRECTORY: &[u8] = b"C:\\Temp\\iceoryx2\\tests\\";
56    pub const SHARED_MEMORY_DIRECTORY: &[u8] = b"C:\\Temp\\iceoryx2\\shm\\";
57    pub const PATH_SEPARATOR: u8 = b'\\';
58    pub const ROOT: &[u8] = b"C:\\";
59    pub const ICEORYX2_ROOT_PATH: &[u8] = b"C:\\Temp\\iceoryx2\\";
60    pub const FILENAME_LENGTH: usize = 255;
61    pub const PATH_LENGTH: usize = 255;
62    pub const AT_LEAST_TIMING_VARIANCE: f32 = 1.0;
63}
64
65pub use settings::*;