sudo_plugin_sys/
lib.rs

1// Copyright 2018 Square Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12// implied. See the License for the specific language governing
13// permissions and limitations under the License.
14
15//! This crate is a (lighly enhanced) set of bindgen-generated Rust FFI
16//! bindings for the [`sudo_plugin(8)`][sudo_plugin] facility. In
17//! general, it is expected that end-users will prefer to use the
18//! handcrafted Rust wrappers from the `sudo_plugin` crate which
19//! accompanies this project.
20//!
21//! [sudo_plugin]: https://www.sudo.ws/man/1.8.22/sudo_plugin.man.html
22
23#![warn(bad_style)]
24#![warn(future_incompatible)]
25#![warn(nonstandard_style)]
26#![warn(rust_2018_compatibility)]
27#![warn(rust_2018_idioms)]
28#![warn(rustdoc)]
29#![warn(unused)]
30
31#![warn(bare_trait_objects)]
32#![warn(missing_copy_implementations)]
33#![warn(missing_debug_implementations)]
34#![warn(missing_docs)]
35#![warn(single_use_lifetimes)]
36#![warn(unreachable_pub)]
37#![warn(unstable_features)]
38#![warn(unused_import_braces)]
39#![warn(unused_lifetimes)]
40#![warn(unused_qualifications)]
41#![warn(unused_results)]
42#![warn(variant_size_differences)]
43
44// this entire crate is unsafe code
45#![allow(unsafe_code)]
46
47// this entire crate is generated code
48#![allow(missing_docs)]
49#![allow(non_camel_case_types)]
50#![allow(trivial_casts)]
51#![allow(trivial_numeric_casts)]
52
53#![cfg_attr(feature="cargo-clippy", warn(clippy::all))]
54
55// this entire crate is generated code
56#![cfg_attr(feature="cargo-clippy", allow(clippy::similar_names))]
57#![cfg_attr(feature="cargo-clippy", allow(clippy::type_complexity))]
58
59use libc::{c_int, c_uint};
60
61include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
62
63pub type sudo_printf_non_null_t = unsafe extern "C" fn(
64    msg_type:   ::std::os::raw::c_int,
65    fmt: *const ::std::os::raw::c_char,
66    ...
67) -> ::std::os::raw::c_int;
68
69pub const SUDO_API_VERSION: c_uint =
70    SUDO_API_VERSION_MAJOR << 16 | SUDO_API_VERSION_MINOR;
71
72pub const SUDO_PLUGIN_OPEN_SUCCESS       : c_int =  1;
73pub const SUDO_PLUGIN_OPEN_FAILURE       : c_int =  0;
74pub const SUDO_PLUGIN_OPEN_GENERAL_ERROR : c_int = -1;
75pub const SUDO_PLUGIN_OPEN_USAGE_ERROR   : c_int = -2;