| 1 |
use std::os::raw::c_uint; |
| 2 |
|
| 3 |
/// Security contexts backend. |
| 4 |
pub trait BackEnd { |
| 5 |
/// Security contexts backend index. |
| 6 |
const BACK_END: c_uint; |
| 7 |
} |
| 8 |
|
| 9 |
/// File contexts backend, described in `selabel_file()`. |
| 10 |
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| 11 |
#[non_exhaustive] |
| 12 |
pub struct File; |
| 13 |
|
| 14 |
impl BackEnd for File { |
| 15 |
#[allow(clippy::as_conversions)] |
| 16 |
const BACK_END: c_uint = selinux_sys::SELABEL_CTX_FILE as c_uint; |
| 17 |
} |
| 18 |
|
| 19 |
/// Media contexts backend, described in `selabel_media()`. |
| 20 |
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| 21 |
#[non_exhaustive] |
| 22 |
pub struct Media; |
| 23 |
|
| 24 |
impl BackEnd for Media { |
| 25 |
#[allow(clippy::as_conversions)] |
| 26 |
const BACK_END: c_uint = selinux_sys::SELABEL_CTX_MEDIA as c_uint; |
| 27 |
} |
| 28 |
|
| 29 |
/// X Windows contexts backend, described in `selabel_x()`. |
| 30 |
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| 31 |
#[non_exhaustive] |
| 32 |
pub struct X; |
| 33 |
|
| 34 |
impl BackEnd for X { |
| 35 |
#[allow(clippy::as_conversions)] |
| 36 |
const BACK_END: c_uint = selinux_sys::SELABEL_CTX_X as c_uint; |
| 37 |
} |
| 38 |
|
| 39 |
/// Database objects contexts backend, described in `selabel_db()`. |
| 40 |
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| 41 |
#[non_exhaustive] |
| 42 |
pub struct DB; |
| 43 |
|
| 44 |
impl BackEnd for DB { |
| 45 |
#[allow(clippy::as_conversions)] |
| 46 |
const BACK_END: c_uint = selinux_sys::SELABEL_CTX_DB as c_uint; |
| 47 |
} |