From c2297353b53eb11528e401fe6743381c3a5bc3b5 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 22 Feb 2021 11:48:24 -0500 Subject: [PATCH] Update auto-generated bindings --- lightning-c-bindings/include/lightning.h | 20 +++++++++++ lightning-c-bindings/src/c_types/derived.rs | 30 ++++++++++++++++ lightning-c-bindings/src/ln/msgs.rs | 18 ++++++++++ .../src/routing/network_graph.rs | 36 +++++++++++++++++++ 4 files changed, 104 insertions(+) diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 01a252ee3..28e54f4f3 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -4150,6 +4150,8 @@ struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(st void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); + struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); @@ -4184,6 +4186,8 @@ struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err( void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); + struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); @@ -6149,6 +6153,18 @@ struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR void Init_free(struct LDKInit this_ptr); +/** + * The relevant features which the sender supports + */ +struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); + +/** + * The relevant features which the sender supports + */ +void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); + +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); + struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); void ErrorMessage_free(struct LDKErrorMessage this_ptr); @@ -8772,6 +8788,8 @@ struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id void NetworkGraph_free(struct LDKNetworkGraph this_ptr); +struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); + void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr); void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr); @@ -8952,6 +8970,8 @@ struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct */ void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); +struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); + struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index d58c56b45..f2211f191 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -1940,6 +1940,21 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() } #[repr(C)] pub union CResult_RoutingFeesDecodeErrorZPtr { pub result: *mut crate::routing::network_graph::RoutingFees, @@ -2305,6 +2320,21 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() } #[repr(C)] pub struct C2Tuple_usizeTransactionZ { pub a: usize, diff --git a/lightning-c-bindings/src/ln/msgs.rs b/lightning-c-bindings/src/ln/msgs.rs index 308730f53..dd60efa03 100644 --- a/lightning-c-bindings/src/ln/msgs.rs +++ b/lightning-c-bindings/src/ln/msgs.rs @@ -113,6 +113,24 @@ impl Init { ret } } +/// The relevant features which the sender supports +#[no_mangle] +pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::ln::features::InitFeatures { + let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.features; + crate::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false } +} +/// The relevant features which the sender supports +#[no_mangle] +pub extern "C" fn Init_set_features(this_ptr: &mut Init, mut val: crate::ln::features::InitFeatures) { + unsafe { &mut *this_ptr.inner }.features = *unsafe { Box::from_raw(val.take_inner()) }; +} +#[must_use] +#[no_mangle] +pub extern "C" fn Init_new(mut features_arg: crate::ln::features::InitFeatures) -> Init { + Init { inner: Box::into_raw(Box::new(nativeInit { + features: *unsafe { Box::from_raw(features_arg.take_inner()) }, + })), is_owned: true } +} impl Clone for Init { fn clone(&self) -> Self { Self { diff --git a/lightning-c-bindings/src/routing/network_graph.rs b/lightning-c-bindings/src/routing/network_graph.rs index ad4c0c3b3..157dbc422 100644 --- a/lightning-c-bindings/src/routing/network_graph.rs +++ b/lightning-c-bindings/src/routing/network_graph.rs @@ -42,6 +42,24 @@ impl NetworkGraph { ret } } +impl Clone for NetworkGraph { + fn clone(&self) -> Self { + Self { + inner: if self.inner.is_null() { std::ptr::null_mut() } else { + Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn NetworkGraph_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNetworkGraph)).clone() })) as *mut c_void +} +#[no_mangle] +pub extern "C" fn NetworkGraph_clone(orig: &NetworkGraph) -> NetworkGraph { + orig.clone() +} use lightning::routing::network_graph::LockedNetworkGraph as nativeLockedNetworkGraphImport; type nativeLockedNetworkGraph = nativeLockedNetworkGraphImport<'static>; @@ -559,6 +577,24 @@ pub extern "C" fn ChannelInfo_set_announcement_message(this_ptr: &mut ChannelInf let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *this_ptr.inner }.announcement_message = local_val; } +impl Clone for ChannelInfo { + fn clone(&self) -> Self { + Self { + inner: if self.inner.is_null() { std::ptr::null_mut() } else { + Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelInfo)).clone() })) as *mut c_void +} +#[no_mangle] +pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo { + orig.clone() +} #[no_mangle] pub extern "C" fn ChannelInfo_write(obj: &ChannelInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner }) -- 2.39.5