X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fln%2Ffeatures.rs;fp=lightning-c-bindings%2Fsrc%2Flightning%2Fln%2Ffeatures.rs;h=8a61a8536c389dda9f542f075b0753922b7839e3;hb=6658ad877ed253301df2c729b1c6a2a859515777;hp=52e06dbab319b5bd0bead7e27d61884c394b90e3;hpb=7e6274489182ebb64202f790e462a9d464d75de2;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/ln/features.rs b/lightning-c-bindings/src/lightning/ln/features.rs index 52e06db..8a61a85 100644 --- a/lightning-c-bindings/src/lightning/ln/features.rs +++ b/lightning-c-bindings/src/lightning/ln/features.rs @@ -33,6 +33,42 @@ use std::ffi::c_void; use bitcoin::hashes::Hash; use crate::c_types::*; +} +/// Checks if two InitFeaturess contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +/// Two objects with NULL inner values will be considered "equal" here. +#[no_mangle] +pub extern "C" fn InitFeatures_eq(a: &InitFeatures, b: &InitFeatures) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if unsafe { &*a.inner } == unsafe { &*b.inner } { true } else { false } +} +/// Checks if two NodeFeaturess contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +/// Two objects with NULL inner values will be considered "equal" here. +#[no_mangle] +pub extern "C" fn NodeFeatures_eq(a: &NodeFeatures, b: &NodeFeatures) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if unsafe { &*a.inner } == unsafe { &*b.inner } { true } else { false } +} +/// Checks if two ChannelFeaturess contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +/// Two objects with NULL inner values will be considered "equal" here. +#[no_mangle] +pub extern "C" fn ChannelFeatures_eq(a: &ChannelFeatures, b: &ChannelFeatures) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if unsafe { &*a.inner } == unsafe { &*b.inner } { true } else { false } +} +/// Checks if two InvoiceFeaturess contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +/// Two objects with NULL inner values will be considered "equal" here. +#[no_mangle] +pub extern "C" fn InvoiceFeatures_eq(a: &InvoiceFeatures, b: &InvoiceFeatures) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if unsafe { &*a.inner } == unsafe { &*b.inner } { true } else { false } } impl Clone for InitFeatures { fn clone(&self) -> Self { @@ -354,6 +390,30 @@ pub extern "C" fn InvoiceFeatures_known() -> InvoiceFeatures { InvoiceFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true } } +/// Returns whether the `payment_secret` feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_payment_secret(this_arg: &InitFeatures) -> bool { + let mut ret = unsafe { &*this_arg.inner }.supports_payment_secret(); + ret +} + +/// Returns whether the `payment_secret` feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_payment_secret(this_arg: &NodeFeatures) -> bool { + let mut ret = unsafe { &*this_arg.inner }.supports_payment_secret(); + ret +} + +/// Returns whether the `payment_secret` feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceFeatures_supports_payment_secret(this_arg: &InvoiceFeatures) -> bool { + let mut ret = unsafe { &*this_arg.inner }.supports_payment_secret(); + ret +} + #[no_mangle] /// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read pub extern "C" fn InitFeatures_write(obj: &InitFeatures) -> crate::c_types::derived::CVec_u8Z {