+pub(crate) extern "C" fn ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyChannelRange)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange {
+ orig.clone()
+}
+/// The genesis hash of the blockchain being queried
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
+ (*inner_val).as_inner()
+}
+/// The genesis hash of the blockchain being queried
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+}
+/// The height of the first block in the range of the reply
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_blocknum;
+ (*inner_val)
+}
+/// The height of the first block in the range of the reply
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_set_first_blocknum(this_ptr: &mut ReplyChannelRange, mut val: u32) {
+ unsafe { &mut *this_ptr.inner }.first_blocknum = val;
+}
+/// The number of blocks included in the range of the reply
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.number_of_blocks;
+ (*inner_val)
+}
+/// The number of blocks included in the range of the reply
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_set_number_of_blocks(this_ptr: &mut ReplyChannelRange, mut val: u32) {
+ unsafe { &mut *this_ptr.inner }.number_of_blocks = val;
+}
+/// True when this is the final reply for a query
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.sync_complete;
+ (*inner_val)
+}
+/// True when this is the final reply for a query
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_set_sync_complete(this_ptr: &mut ReplyChannelRange, mut val: bool) {
+ unsafe { &mut *this_ptr.inner }.sync_complete = val;
+}
+/// The short_channel_ids in the channel range
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_set_short_channel_ids(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::derived::CVec_u64Z) {
+ let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
+ unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
+}
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ReplyChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32, mut sync_complete_arg: bool, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> ReplyChannelRange {
+ let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); };
+ ReplyChannelRange { inner: Box::into_raw(Box::new(nativeReplyChannelRange {
+ chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ first_blocknum: first_blocknum_arg,
+ number_of_blocks: number_of_blocks_arg,
+ sync_complete: sync_complete_arg,
+ short_channel_ids: local_short_channel_ids_arg,
+ })), is_owned: true }
+}
+
+use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport;
+type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport;
+
+/// A query_short_channel_ids message is used to query a peer for
+/// routing gossip messages related to one or more short_channel_ids.
+/// The query recipient will reply with the latest, if available,
+/// channel_announcement, channel_update and node_announcement messages
+/// it maintains for the requested short_channel_ids followed by a
+/// reply_short_channel_ids_end message. The short_channel_ids sent in
+/// this query are encoded. We only support encoding_type=0 uncompressed
+/// serialization and do not support encoding_type=1 zlib serialization.
+#[must_use]
+#[repr(C)]
+pub struct QueryShortChannelIds {
+ /// 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 nativeQueryShortChannelIds,
+ pub is_owned: bool,
+}
+
+impl Drop for QueryShortChannelIds {
+ fn drop(&mut self) {
+ if self.is_owned && !self.inner.is_null() {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_free(this_ptr: QueryShortChannelIds) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl QueryShortChannelIds {
+ pub(crate) fn take_inner(mut self) -> *mut nativeQueryShortChannelIds {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+impl Clone for QueryShortChannelIds {
+ 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 QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeQueryShortChannelIds)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds {
+ orig.clone()
+}
+/// The genesis hash of the blockchain being queried
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
+ (*inner_val).as_inner()
+}
+/// The genesis hash of the blockchain being queried
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+}
+/// The short_channel_ids that are being queried
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_set_short_channel_ids(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::derived::CVec_u64Z) {
+ let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); };
+ unsafe { &mut *this_ptr.inner }.short_channel_ids = local_val;
+}
+#[must_use]
+#[no_mangle]
+pub extern "C" fn QueryShortChannelIds_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> QueryShortChannelIds {
+ let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); };
+ QueryShortChannelIds { inner: Box::into_raw(Box::new(nativeQueryShortChannelIds {
+ chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ short_channel_ids: local_short_channel_ids_arg,
+ })), is_owned: true }
+}
+
+use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport;
+type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport;
+
+/// A reply_short_channel_ids_end message is sent as a reply to a
+/// query_short_channel_ids message. The query recipient makes a best
+/// effort to respond based on their local network view which may not be
+/// a perfect view of the network.
+#[must_use]
+#[repr(C)]
+pub struct ReplyShortChannelIdsEnd {
+ /// 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 nativeReplyShortChannelIdsEnd,
+ pub is_owned: bool,
+}
+
+impl Drop for ReplyShortChannelIdsEnd {
+ fn drop(&mut self) {
+ if self.is_owned && !self.inner.is_null() {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_free(this_ptr: ReplyShortChannelIdsEnd) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl ReplyShortChannelIdsEnd {
+ pub(crate) fn take_inner(mut self) -> *mut nativeReplyShortChannelIdsEnd {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+impl Clone for ReplyShortChannelIdsEnd {
+ 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 ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd {
+ orig.clone()
+}
+/// The genesis hash of the blockchain that was queried
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
+ (*inner_val).as_inner()
+}
+/// The genesis hash of the blockchain that was queried
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+}
+/// Indicates if the query recipient maintains up-to-date channel
+/// information for the chain_hash
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.full_information;
+ (*inner_val)
+}
+/// Indicates if the query recipient maintains up-to-date channel
+/// information for the chain_hash
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_set_full_information(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: bool) {
+ unsafe { &mut *this_ptr.inner }.full_information = val;
+}
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd {
+ ReplyShortChannelIdsEnd { inner: Box::into_raw(Box::new(nativeReplyShortChannelIdsEnd {
+ chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ full_information: full_information_arg,
+ })), is_owned: true }
+}
+
+use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport;
+type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport;
+
+/// A gossip_timestamp_filter message is used by a node to request
+/// gossip relay for messages in the requested time range when the
+/// gossip_queries feature has been negotiated.
+#[must_use]
+#[repr(C)]
+pub struct GossipTimestampFilter {
+ /// 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 nativeGossipTimestampFilter,
+ pub is_owned: bool,
+}
+
+impl Drop for GossipTimestampFilter {
+ fn drop(&mut self) {
+ if self.is_owned && !self.inner.is_null() {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_free(this_ptr: GossipTimestampFilter) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl GossipTimestampFilter {
+ pub(crate) fn take_inner(mut self) -> *mut nativeGossipTimestampFilter {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+impl Clone for GossipTimestampFilter {
+ 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 GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeGossipTimestampFilter)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter {
+ orig.clone()
+}
+/// The genesis hash of the blockchain for channel and node information
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.chain_hash;
+ (*inner_val).as_inner()
+}
+/// The genesis hash of the blockchain for channel and node information
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *this_ptr.inner }.chain_hash = ::bitcoin::hash_types::BlockHash::from_slice(&val.data[..]).unwrap();
+}
+/// The starting unix timestamp
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.first_timestamp;
+ (*inner_val)
+}
+/// The starting unix timestamp
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_set_first_timestamp(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
+ unsafe { &mut *this_ptr.inner }.first_timestamp = val;
+}
+/// The range of information in seconds
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.timestamp_range;
+ (*inner_val)
+}
+/// The range of information in seconds
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_set_timestamp_range(this_ptr: &mut GossipTimestampFilter, mut val: u32) {
+ unsafe { &mut *this_ptr.inner }.timestamp_range = val;
+}
+#[must_use]
+#[no_mangle]
+pub extern "C" fn GossipTimestampFilter_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_timestamp_arg: u32, mut timestamp_range_arg: u32) -> GossipTimestampFilter {
+ GossipTimestampFilter { inner: Box::into_raw(Box::new(nativeGossipTimestampFilter {
+ chain_hash: ::bitcoin::hash_types::BlockHash::from_slice(&chain_hash_arg.data[..]).unwrap(),
+ first_timestamp: first_timestamp_arg,
+ timestamp_range: timestamp_range_arg,
+ })), is_owned: true }
+}
+/// Used to put an error message in a LightningError
+#[must_use]
+#[derive(Clone)]
+#[repr(C)]
+pub enum ErrorAction {
+ /// The peer took some action which made us think they were useless. Disconnect them.
+ DisconnectPeer {
+ msg: crate::ln::msgs::ErrorMessage,
+ },
+ /// The peer did something harmless that we weren't able to process, just log and ignore
+ IgnoreError,
+ /// The peer did something incorrect. Tell them.
+ SendErrorMessage {
+ msg: crate::ln::msgs::ErrorMessage,
+ },
+}
+use lightning::ln::msgs::ErrorAction as nativeErrorAction;
+impl ErrorAction {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeErrorAction {
+ match self {
+ ErrorAction::DisconnectPeer {ref msg, } => {
+ let mut msg_nonref = (*msg).clone();
+ let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) };
+ nativeErrorAction::DisconnectPeer {
+ msg: local_msg_nonref,
+ }
+ },
+ ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
+ ErrorAction::SendErrorMessage {ref msg, } => {
+ let mut msg_nonref = (*msg).clone();
+ nativeErrorAction::SendErrorMessage {
+ msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) },
+ }
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeErrorAction {
+ match self {
+ ErrorAction::DisconnectPeer {mut msg, } => {
+ let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) };
+ nativeErrorAction::DisconnectPeer {
+ msg: local_msg,
+ }
+ },
+ ErrorAction::IgnoreError => nativeErrorAction::IgnoreError,
+ ErrorAction::SendErrorMessage {mut msg, } => {
+ nativeErrorAction::SendErrorMessage {
+ msg: *unsafe { Box::from_raw(msg.take_inner()) },
+ }
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativeErrorAction) -> Self {
+ match native {
+ nativeErrorAction::DisconnectPeer {ref msg, } => {
+ let mut msg_nonref = (*msg).clone();
+ let mut local_msg_nonref = crate::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((msg_nonref.unwrap()))) } }, is_owned: true };
+ ErrorAction::DisconnectPeer {
+ msg: local_msg_nonref,
+ }
+ },
+ nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
+ nativeErrorAction::SendErrorMessage {ref msg, } => {
+ let mut msg_nonref = (*msg).clone();
+ ErrorAction::SendErrorMessage {
+ msg: crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg_nonref)), is_owned: true },
+ }
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeErrorAction) -> Self {
+ match native {
+ nativeErrorAction::DisconnectPeer {mut msg, } => {
+ let mut local_msg = crate::ln::msgs::ErrorMessage { inner: if msg.is_none() { std::ptr::null_mut() } else { { Box::into_raw(Box::new((msg.unwrap()))) } }, is_owned: true };
+ ErrorAction::DisconnectPeer {
+ msg: local_msg,
+ }
+ },
+ nativeErrorAction::IgnoreError => ErrorAction::IgnoreError,
+ nativeErrorAction::SendErrorMessage {mut msg, } => {
+ ErrorAction::SendErrorMessage {
+ msg: crate::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg)), is_owned: true },
+ }
+ },
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { }
+#[no_mangle]
+pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction {
+ orig.clone()
+}
+
+use lightning::ln::msgs::LightningError as nativeLightningErrorImport;
+type nativeLightningError = nativeLightningErrorImport;
+
+/// An Err type for failure to process messages.
+#[must_use]
+#[repr(C)]
+pub struct LightningError {
+ /// 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 nativeLightningError,
+ pub is_owned: bool,
+}
+
+impl Drop for LightningError {
+ fn drop(&mut self) {
+ if self.is_owned && !self.inner.is_null() {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn LightningError_free(this_ptr: LightningError) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn LightningError_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLightningError); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl LightningError {
+ pub(crate) fn take_inner(mut self) -> *mut nativeLightningError {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+impl Clone for LightningError {
+ 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 LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeLightningError)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError {
+ orig.clone()
+}
+/// A human-readable message describing the error
+#[no_mangle]
+pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.err;
+ (*inner_val).as_str().into()
+}
+/// A human-readable message describing the error
+#[no_mangle]
+pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::derived::CVec_u8Z) {
+ unsafe { &mut *this_ptr.inner }.err = String::from_utf8(val.into_rust()).unwrap();
+}
+/// The action which should be taken against the offending peer.
+#[no_mangle]
+pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::ln::msgs::ErrorAction {
+ let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.action;
+ crate::ln::msgs::ErrorAction::from_native(&(*inner_val))
+}
+/// The action which should be taken against the offending peer.
+#[no_mangle]
+pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut val: crate::ln::msgs::ErrorAction) {
+ unsafe { &mut *this_ptr.inner }.action = val.into_native();
+}
+#[must_use]
+#[no_mangle]
+pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::derived::CVec_u8Z, mut action_arg: crate::ln::msgs::ErrorAction) -> LightningError {
+ LightningError { inner: Box::into_raw(Box::new(nativeLightningError {
+ err: String::from_utf8(err_arg.into_rust()).unwrap(),
+ action: action_arg.into_native(),
+ })), is_owned: true }
+}
+
+use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport;
+type nativeCommitmentUpdate = nativeCommitmentUpdateImport;
+
+/// Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
+/// transaction updates if they were pending.
+#[must_use]
+#[repr(C)]
+pub struct CommitmentUpdate {
+ /// 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 nativeCommitmentUpdate,
+ pub is_owned: bool,
+}
+
+impl Drop for CommitmentUpdate {
+ fn drop(&mut self) {
+ if self.is_owned && !self.inner.is_null() {
+ let _ = unsafe { Box::from_raw(self.inner) };
+ }
+ }
+}
+#[no_mangle]
+pub extern "C" fn CommitmentUpdate_free(this_ptr: CommitmentUpdate) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) {
+ unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentUpdate); }
+}
+#[allow(unused)]
+/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+impl CommitmentUpdate {
+ pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentUpdate {
+ assert!(self.is_owned);
+ let ret = self.inner;
+ self.inner = std::ptr::null_mut();
+ ret
+ }
+}
+impl Clone for CommitmentUpdate {
+ 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 CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void {