summaryrefslogtreecommitdiffstats
path: root/ffi/src/net.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ffi/src/net.rs')
-rw-r--r--ffi/src/net.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/ffi/src/net.rs b/ffi/src/net.rs
index 7d1558f6..ab0800eb 100644
--- a/ffi/src/net.rs
+++ b/ffi/src/net.rs
@@ -51,9 +51,10 @@ use super::core::Context;
pub extern "system" fn sq_keyserver_new(ctx: *mut Context,
uri: *const c_char) -> *mut KeyServer {
let ctx = ffi_param_ref_mut!(ctx);
+ ffi_make_fry_from_ctx!(ctx);
let uri = ffi_param_cstr!(uri).to_string_lossy();
- fry_box!(ctx, KeyServer::new(&ctx.c, &uri))
+ ffi_try_box!(KeyServer::new(&ctx.c, &uri))
}
/// Returns a handle for the given URI.
@@ -69,6 +70,7 @@ pub extern "system" fn sq_keyserver_with_cert(ctx: *mut Context,
cert: *const uint8_t,
len: size_t) -> *mut KeyServer {
let ctx = ffi_param_ref_mut!(ctx);
+ ffi_make_fry_from_ctx!(ctx);
let uri = ffi_param_cstr!(uri).to_string_lossy();
if cert.is_null() {
@@ -79,9 +81,9 @@ pub extern "system" fn sq_keyserver_with_cert(ctx: *mut Context,
slice::from_raw_parts(cert, len as usize)
};
- let cert = fry!(ctx, Certificate::from_der(cert)
+ let cert = ffi_try!(Certificate::from_der(cert)
.map_err(|e| e.into()));
- fry_box!(ctx, KeyServer::with_cert(&ctx.c, &uri, cert))
+ ffi_try_box!(KeyServer::with_cert(&ctx.c, &uri, cert))
}
/// Returns a handle for the SKS keyserver pool.
@@ -95,7 +97,8 @@ pub extern "system" fn sq_keyserver_with_cert(ctx: *mut Context,
pub extern "system" fn sq_keyserver_sks_pool(ctx: *mut Context)
-> *mut KeyServer {
let ctx = ffi_param_ref_mut!(ctx);
- fry_box!(ctx, KeyServer::sks_pool(&ctx.c))
+ ffi_make_fry_from_ctx!(ctx);
+ ffi_try_box!(KeyServer::sks_pool(&ctx.c))
}
/// Frees a keyserver object.
@@ -113,10 +116,11 @@ pub extern "system" fn sq_keyserver_get(ctx: *mut Context,
id: *const KeyID)
-> *mut TPK {
let ctx = ffi_param_ref_mut!(ctx);
+ ffi_make_fry_from_ctx!(ctx);
let ks = ffi_param_ref_mut!(ks);
let id = ffi_param_ref!(id);
- fry_box!(ctx, ks.get(&id))
+ ffi_try_box!(ks.get(&id))
}
/// Sends the given key to the server.
@@ -128,8 +132,9 @@ pub extern "system" fn sq_keyserver_send(ctx: *mut Context,
tpk: *const TPK)
-> Status {
let ctx = ffi_param_ref_mut!(ctx);
+ ffi_make_fry_from_ctx!(ctx);
let ks = ffi_param_ref_mut!(ks);
let tpk = ffi_param_ref!(tpk);
- fry_status!(ctx, ks.send(tpk))
+ ffi_try_status!(ks.send(tpk))
}