summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/src/policy.rs
blob: 2c00ae520d590b653c766d148bcc68616d3bb911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! Policy objects.
//!
//! This module allows the caller to specify low-level policy like
//! what algorithms are allowed.
//!
//! Wraps the policy object functions, see
//! [`sequoia-openpgp::policy`].
//!
//! [`sequoia-openpgp::policy`]: ../../sequoia_openpgp/policy/index.html

extern crate sequoia_openpgp as openpgp;

use crate::MoveIntoRaw;

use self::openpgp::policy;

/// A policy object.
#[crate::ffi_wrapper_type(
    prefix = "pgp_",
    derive = "Clone, Debug")]
pub struct Policy(Box<policy::Policy>);

/// A StandardPolicy object.
#[crate::ffi_wrapper_type(
    prefix = "pgp_",
    derive = "Clone, Debug")]
pub struct StandardPolicy(policy::StandardPolicy);

/// Returns a new standard policy.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle]
pub extern "C" fn pgp_standard_policy()
    -> *mut Policy
{
    let p : Box<policy::Policy> = Box::new(policy::StandardPolicy::new());
    p.move_into_raw()
}