]> git.proxmox.com Git - cargo.git/blame - vendor/openssl-0.9.15/src/conf.rs
New upstream version 0.22.0
[cargo.git] / vendor / openssl-0.9.15 / src / conf.rs
CommitLineData
3ee932bc
VK
1use ffi;
2
3use cvt_p;
4use error::ErrorStack;
5
6pub struct ConfMethod(*mut ffi::CONF_METHOD);
7
8impl ConfMethod {
9 pub fn default() -> ConfMethod {
10 unsafe {
11 ffi::init();
12 ConfMethod(ffi::NCONF_default())
13 }
14 }
15
16 pub unsafe fn from_ptr(ptr: *mut ffi::CONF_METHOD) -> ConfMethod {
17 ConfMethod(ptr)
18 }
19
20 pub fn as_ptr(&self) -> *mut ffi::CONF_METHOD {
21 self.0
22 }
23}
24
25foreign_type! {
26 type CType = ffi::CONF;
27 fn drop = ffi::NCONF_free;
28
29 pub struct Conf;
30 pub struct ConfRef;
31}
32
33impl Conf {
34 pub fn new(method: ConfMethod) -> Result<Conf, ErrorStack> {
35 unsafe { cvt_p(ffi::NCONF_new(method.as_ptr())).map(Conf) }
36 }
37}