diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-03-13 14:13:05 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-03-13 14:19:47 +0100 |
commit | 9279d898e30abe61e68cabcd7911ae2d9e9ab222 (patch) | |
tree | a8282c4f5fa7fec0f6680c8db9601bfaff384a39 /openpgp-ffi/src/policy.rs | |
parent | 1b6683e5ac362ebed79ad8d42018728b0db7a16e (diff) |
openpgp: Add a Null Policy.
- Add a new Null Policy, which accepts everything.
Diffstat (limited to 'openpgp-ffi/src/policy.rs')
-rw-r--r-- | openpgp-ffi/src/policy.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/openpgp-ffi/src/policy.rs b/openpgp-ffi/src/policy.rs index 1be75ef2..50a69236 100644 --- a/openpgp-ffi/src/policy.rs +++ b/openpgp-ffi/src/policy.rs @@ -26,6 +26,12 @@ pub struct Policy(Box<dyn policy::Policy>); derive = "Clone, Debug")] pub struct StandardPolicy<'a>(policy::StandardPolicy<'a>); +/// A NullPolicy object. +#[crate::ffi_wrapper_type( + prefix = "pgp_", + derive = "Clone, Debug")] +pub struct NullPolicy(policy::NullPolicy); + /// Returns a new standard policy. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_standard_policy() @@ -34,3 +40,12 @@ pub extern "C" fn pgp_standard_policy() let p : Box<dyn policy::Policy> = Box::new(policy::StandardPolicy::new()); p.move_into_raw() } + +/// Returns a new null policy. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "C" fn pgp_null_policy() + -> *mut Policy +{ + let p : Box<dyn policy::Policy> = Box::new(policy::NullPolicy::new()); + p.move_into_raw() +} |