+pub struct RevokeAndACK {
+ /// A pointer to the opaque Rust object.
+
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeRevokeAndACK,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
+ pub is_owned: bool,
+}
+
+impl Drop for RevokeAndACK {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeRevokeAndACK>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRevokeAndACK) };
+}
+#[allow(unused)]
+impl RevokeAndACK {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeRevokeAndACK {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRevokeAndACK {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeRevokeAndACK {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The secret corresponding to the per-commitment point
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_secret;
+ inner_val
+}
+/// The secret corresponding to the per-commitment point
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_set_per_commitment_secret(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_secret = val.data;
+}
+/// The next sender-broadcast commitment transaction's per-commitment point
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().next_per_commitment_point;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The next sender-broadcast commitment transaction's per-commitment point
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_per_commitment_point = val.into_rust();
+}
+/// Constructs a new RevokeAndACK given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey) -> RevokeAndACK {
+ RevokeAndACK { inner: ObjOps::heap_alloc(nativeRevokeAndACK {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ per_commitment_secret: per_commitment_secret_arg.data,
+ next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for RevokeAndACK {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(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 RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRevokeAndACK)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the RevokeAndACK
+pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a RevokeAndACK object
+pub extern "C" fn RevokeAndACK_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::RevokeAndACK }).into()}
+/// Generates a non-cryptographic 64-bit hash of the RevokeAndACK.
+#[no_mangle]
+pub extern "C" fn RevokeAndACK_hash(o: &RevokeAndACK) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two RevokeAndACKs 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 RevokeAndACK_eq(a: &RevokeAndACK, b: &RevokeAndACK) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport;
+pub(crate) type nativeUpdateFee = nativeUpdateFeeImport;
+
+/// An [`update_fee`] message to be sent to or received from a peer
+///
+/// [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
+#[must_use]
+#[repr(C)]
+pub struct UpdateFee {
+ /// A pointer to the opaque Rust object.
+
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeUpdateFee,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
+ pub is_owned: bool,
+}
+
+impl Drop for UpdateFee {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeUpdateFee>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFee) };
+}
+#[allow(unused)]
+impl UpdateFee {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFee {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFee {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFee {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Fee rate per 1000-weight of the transaction
+#[no_mangle]
+pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_per_kw;
+ *inner_val
+}
+/// Fee rate per 1000-weight of the transaction
+#[no_mangle]
+pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.feerate_per_kw = val;
+}
+/// Constructs a new UpdateFee given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut feerate_per_kw_arg: u32) -> UpdateFee {
+ UpdateFee { inner: ObjOps::heap_alloc(nativeUpdateFee {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ feerate_per_kw: feerate_per_kw_arg,
+ }), is_owned: true }
+}
+impl Clone for UpdateFee {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeUpdateFee>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(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 UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFee)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the UpdateFee
+pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a UpdateFee object
+pub extern "C" fn UpdateFee_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFee }).into()}
+/// Generates a non-cryptographic 64-bit hash of the UpdateFee.
+#[no_mangle]
+pub extern "C" fn UpdateFee_hash(o: &UpdateFee) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two UpdateFees 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 UpdateFee_eq(a: &UpdateFee, b: &UpdateFee) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport;
+pub(crate) type nativeChannelReestablish = nativeChannelReestablishImport;
+
+/// A [`channel_reestablish`] message to be sent to or received from a peer.
+///
+/// [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
+#[must_use]
+#[repr(C)]
+pub struct ChannelReestablish {
+ /// A pointer to the opaque Rust object.
+
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeChannelReestablish,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
+ pub is_owned: bool,
+}
+
+impl Drop for ChannelReestablish {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChannelReestablish>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelReestablish) };
+}
+#[allow(unused)]
+impl ChannelReestablish {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelReestablish {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelReestablish {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The next commitment number for the sender
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().next_local_commitment_number;
+ *inner_val
+}
+/// The next commitment number for the sender
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_set_next_local_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_local_commitment_number = val;
+}
+/// The next commitment number for the recipient
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().next_remote_commitment_number;
+ *inner_val
+}
+/// The next commitment number for the recipient
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_remote_commitment_number = val;
+}
+/// Proof that the sender knows the per-commitment secret of a specific commitment transaction
+/// belonging to the recipient
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_get_your_last_per_commitment_secret(this_ptr: &ChannelReestablish) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().your_last_per_commitment_secret;
+ inner_val
+}
+/// Proof that the sender knows the per-commitment secret of a specific commitment transaction
+/// belonging to the recipient
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_set_your_last_per_commitment_secret(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.your_last_per_commitment_secret = val.data;
+}
+/// The sender's per-commitment point for their current commitment transaction
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_get_my_current_per_commitment_point(this_ptr: &ChannelReestablish) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().my_current_per_commitment_point;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The sender's per-commitment point for their current commitment transaction
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_set_my_current_per_commitment_point(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.my_current_per_commitment_point = val.into_rust();
+}
+/// The next funding transaction ID
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_get_next_funding_txid(this_ptr: &ChannelReestablish) -> crate::c_types::derived::COption_ThirtyTwoBytesZ {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().next_funding_txid;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: *(*inner_val.as_ref().unwrap()).clone().as_ref() } }) };
+ local_inner_val
+}
+/// The next funding transaction ID
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_set_next_funding_txid(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) {
+ let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ val_opt.take() }.data[..]).unwrap() }})} };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_funding_txid = local_val;
+}
+/// Constructs a new ChannelReestablish given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut next_local_commitment_number_arg: u64, mut next_remote_commitment_number_arg: u64, mut your_last_per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut my_current_per_commitment_point_arg: crate::c_types::PublicKey, mut next_funding_txid_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> ChannelReestablish {
+ let mut local_next_funding_txid_arg = { /*next_funding_txid_arg*/ let next_funding_txid_arg_opt = next_funding_txid_arg; if next_funding_txid_arg_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ next_funding_txid_arg_opt.take() }.data[..]).unwrap() }})} };
+ ChannelReestablish { inner: ObjOps::heap_alloc(nativeChannelReestablish {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ next_local_commitment_number: next_local_commitment_number_arg,
+ next_remote_commitment_number: next_remote_commitment_number_arg,
+ your_last_per_commitment_secret: your_last_per_commitment_secret_arg.data,
+ my_current_per_commitment_point: my_current_per_commitment_point_arg.into_rust(),
+ next_funding_txid: local_next_funding_txid_arg,
+ }), is_owned: true }
+}
+impl Clone for ChannelReestablish {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(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 ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelReestablish)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ChannelReestablish
+pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a ChannelReestablish object
+pub extern "C" fn ChannelReestablish_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelReestablish }).into()}
+/// Generates a non-cryptographic 64-bit hash of the ChannelReestablish.
+#[no_mangle]
+pub extern "C" fn ChannelReestablish_hash(o: &ChannelReestablish) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two ChannelReestablishs 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 ChannelReestablish_eq(a: &ChannelReestablish, b: &ChannelReestablish) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport;
+pub(crate) type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport;
+
+/// An [`announcement_signatures`] message to be sent to or received from a peer.
+///
+/// [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
+#[must_use]
+#[repr(C)]
+pub struct AnnouncementSignatures {
+ /// A pointer to the opaque Rust object.
+
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeAnnouncementSignatures,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
+ pub is_owned: bool,
+}
+
+impl Drop for AnnouncementSignatures {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeAnnouncementSignatures>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures) };
+}
+#[allow(unused)]
+impl AnnouncementSignatures {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeAnnouncementSignatures {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAnnouncementSignatures {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The short channel ID
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id;
+ *inner_val
+}
+/// The short channel ID
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val;
+}
+/// A signature by the node key
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::ECDSASignature {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().node_signature;
+ crate::c_types::ECDSASignature::from_rust(&inner_val)
+}
+/// A signature by the node key
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_set_node_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ECDSASignature) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_signature = val.into_rust();
+}
+/// A signature by the funding key
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::ECDSASignature {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().bitcoin_signature;
+ crate::c_types::ECDSASignature::from_rust(&inner_val)
+}
+/// A signature by the funding key
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_set_bitcoin_signature(this_ptr: &mut AnnouncementSignatures, mut val: crate::c_types::ECDSASignature) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_signature = val.into_rust();
+}
+/// Constructs a new AnnouncementSignatures given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut short_channel_id_arg: u64, mut node_signature_arg: crate::c_types::ECDSASignature, mut bitcoin_signature_arg: crate::c_types::ECDSASignature) -> AnnouncementSignatures {
+ AnnouncementSignatures { inner: ObjOps::heap_alloc(nativeAnnouncementSignatures {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ short_channel_id: short_channel_id_arg,
+ node_signature: node_signature_arg.into_rust(),
+ bitcoin_signature: bitcoin_signature_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for AnnouncementSignatures {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(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 AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAnnouncementSignatures)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the AnnouncementSignatures
+pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a AnnouncementSignatures object
+pub extern "C" fn AnnouncementSignatures_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::AnnouncementSignatures }).into()}
+/// Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures.
+#[no_mangle]
+pub extern "C" fn AnnouncementSignatures_hash(o: &AnnouncementSignatures) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two AnnouncementSignaturess 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 AnnouncementSignatures_eq(a: &AnnouncementSignatures, b: &AnnouncementSignatures) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+/// An address which can be used to connect to a remote peer.
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum SocketAddress {
+ /// An IPv4 address and port on which the peer is listening.
+ TcpIpV4 {
+ /// The 4-byte IPv4 address
+ addr: crate::c_types::FourBytes,
+ /// The port on which the node is listening
+ port: u16,
+ },
+ /// An IPv6 address and port on which the peer is listening.
+ TcpIpV6 {
+ /// The 16-byte IPv6 address
+ addr: crate::c_types::SixteenBytes,
+ /// The port on which the node is listening
+ port: u16,
+ },
+ /// An old-style Tor onion address/port on which the peer is listening.
+ ///
+ /// This field is deprecated and the Tor network generally no longer supports V2 Onion
+ /// addresses. Thus, the details are not parsed here.
+ OnionV2(
+ crate::c_types::TwelveBytes),
+ /// A new-style Tor onion address/port on which the peer is listening.
+ ///
+ /// To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version,
+ /// wrap as base32 and append \".onion\".
+ OnionV3 {
+ /// The ed25519 long-term public key of the peer
+ ed25519_pubkey: crate::c_types::ThirtyTwoBytes,
+ /// The checksum of the pubkey and version, as included in the onion address
+ checksum: u16,
+ /// The version byte, as defined by the Tor Onion v3 spec.
+ version: u8,
+ /// The port on which the node is listening
+ port: u16,
+ },
+ /// A hostname/port on which the peer is listening.
+ Hostname {
+ /// The hostname on which the node is listening.
+ hostname: crate::lightning::util::ser::Hostname,
+ /// The port on which the node is listening.
+ port: u16,
+ },
+}