X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fln%2Fpeer_handler.rs;h=20aac90971b74e73c42ae9dc81726ab90763dbab;hb=0ba47de779032dfb5d6a3587a17fcc31e1e659f9;hp=d349f6fd75ff63bd20ddf8cc99d09d61132a8d1c;hpb=3e46e1794f14640e35f09cc6da4169c152de34ce;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/ln/peer_handler.rs b/lightning-c-bindings/src/lightning/ln/peer_handler.rs index d349f6f..20aac90 100644 --- a/lightning-c-bindings/src/lightning/ln/peer_handler.rs +++ b/lightning-c-bindings/src/lightning/ln/peer_handler.rs @@ -64,6 +64,7 @@ pub struct CustomMessageHandler { } unsafe impl Send for CustomMessageHandler {} unsafe impl Sync for CustomMessageHandler {} +#[allow(unused)] pub(crate) fn CustomMessageHandler_clone_fields(orig: &CustomMessageHandler) -> CustomMessageHandler { CustomMessageHandler { this_arg: orig.this_arg, @@ -188,12 +189,37 @@ pub extern "C" fn IgnoringMessageHandler_new() -> IgnoringMessageHandler { IgnoringMessageHandler { inner: ObjOps::heap_alloc(nativeIgnoringMessageHandler { }), is_owned: true } } +impl From for crate::lightning::events::EventsProvider { + fn from(obj: nativeIgnoringMessageHandler) -> Self { + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = IgnoringMessageHandler_as_EventsProvider(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(IgnoringMessageHandler_free_void); + ret + } +} +/// Constructs a new EventsProvider which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is +#[no_mangle] +pub extern "C" fn IgnoringMessageHandler_as_EventsProvider(this_arg: &IgnoringMessageHandler) -> crate::lightning::events::EventsProvider { + crate::lightning::events::EventsProvider { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + process_pending_events: IgnoringMessageHandler_EventsProvider_process_pending_events, + } +} + +extern "C" fn IgnoringMessageHandler_EventsProvider_process_pending_events(this_arg: *const c_void, mut handler: crate::lightning::events::EventHandler) { + >::process_pending_events(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, handler) +} + impl From for crate::lightning::events::MessageSendEventsProvider { fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } @@ -218,10 +244,10 @@ extern "C" fn IgnoringMessageHandler_MessageSendEventsProvider_get_and_clear_pen impl From for crate::lightning::ln::msgs::RoutingMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = IgnoringMessageHandler_as_RoutingMessageHandler(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } @@ -331,40 +357,12 @@ extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_provided_init_feature crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } -impl From for crate::lightning::events::OnionMessageProvider { - fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = IgnoringMessageHandler_as_OnionMessageProvider(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); - ret.free = Some(IgnoringMessageHandler_free_void); - ret - } -} -/// Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is -#[no_mangle] -pub extern "C" fn IgnoringMessageHandler_as_OnionMessageProvider(this_arg: &IgnoringMessageHandler) -> crate::lightning::events::OnionMessageProvider { - crate::lightning::events::OnionMessageProvider { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - next_onion_message_for_peer: IgnoringMessageHandler_OnionMessageProvider_next_onion_message_for_peer, - } -} - -#[must_use] -extern "C" fn IgnoringMessageHandler_OnionMessageProvider_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage { - let mut ret = >::next_onion_message_for_peer(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, peer_node_id.into_rust()); - let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; - local_ret -} - impl From for crate::lightning::ln::msgs::OnionMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = IgnoringMessageHandler_as_OnionMessageHandler(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } @@ -376,23 +374,33 @@ pub extern "C" fn IgnoringMessageHandler_as_OnionMessageHandler(this_arg: &Ignor crate::lightning::ln::msgs::OnionMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, + get_and_clear_connections_needed: IgnoringMessageHandler_OnionMessageHandler_get_and_clear_connections_needed, handle_onion_message: IgnoringMessageHandler_OnionMessageHandler_handle_onion_message, + next_onion_message_for_peer: IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_peer, peer_connected: IgnoringMessageHandler_OnionMessageHandler_peer_connected, peer_disconnected: IgnoringMessageHandler_OnionMessageHandler_peer_disconnected, + timer_tick_occurred: IgnoringMessageHandler_OnionMessageHandler_timer_tick_occurred, provided_node_features: IgnoringMessageHandler_OnionMessageHandler_provided_node_features, provided_init_features: IgnoringMessageHandler_OnionMessageHandler_provided_init_features, - OnionMessageProvider: crate::lightning::events::OnionMessageProvider { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - next_onion_message_for_peer: IgnoringMessageHandler_OnionMessageProvider_next_onion_message_for_peer, - }, } } +#[must_use] +extern "C" fn IgnoringMessageHandler_OnionMessageHandler_get_and_clear_connections_needed(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { + let mut ret = >::get_and_clear_connections_needed(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; let mut local_ret_0 = (crate::c_types::PublicKey::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }); }; + local_ret.into() +} extern "C" fn IgnoringMessageHandler_OnionMessageHandler_handle_onion_message(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage) { >::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &peer_node_id.into_rust(), msg.get_native_ref()) } #[must_use] +extern "C" fn IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage { + let mut ret = >::next_onion_message_for_peer(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, peer_node_id.into_rust()); + let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} +#[must_use] extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { let mut ret = >::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -401,6 +409,9 @@ extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_connected(this_arg extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { >::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust()) } +extern "C" fn IgnoringMessageHandler_OnionMessageHandler_timer_tick_occurred(this_arg: *const c_void) { + >::timer_tick_occurred(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ) +} #[must_use] extern "C" fn IgnoringMessageHandler_OnionMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning::ln::features::NodeFeatures { let mut ret = >::provided_node_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); @@ -414,10 +425,10 @@ extern "C" fn IgnoringMessageHandler_OnionMessageHandler_provided_init_features( impl From for crate::lightning::onion_message::offers::OffersMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = IgnoringMessageHandler_as_OffersMessageHandler(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } @@ -430,6 +441,7 @@ pub extern "C" fn IgnoringMessageHandler_as_OffersMessageHandler(this_arg: &Igno this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, handle_message: IgnoringMessageHandler_OffersMessageHandler_handle_message, + release_pending_messages: IgnoringMessageHandler_OffersMessageHandler_release_pending_messages, } } @@ -439,13 +451,19 @@ extern "C" fn IgnoringMessageHandler_OffersMessageHandler_handle_message(this_ar let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_OffersMessageZ::None } else { crate::c_types::derived::COption_OffersMessageZ::Some( { crate::lightning::onion_message::offers::OffersMessage::native_into(ret.unwrap()) }) }; local_ret } +#[must_use] +extern "C" fn IgnoringMessageHandler_OffersMessageHandler_release_pending_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ { + let mut ret = >::release_pending_messages(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_2 = crate::lightning::blinded_path::BlindedPath { inner: if orig_ret_0_2.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((orig_ret_0_2.unwrap())) } }, is_owned: true }; let mut local_ret_0 = (crate::lightning::onion_message::offers::OffersMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::Destination::native_into(orig_ret_0_1), local_orig_ret_0_2).into(); local_ret_0 }); }; + local_ret.into() +} impl From for crate::lightning::onion_message::messenger::CustomOnionMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } @@ -459,21 +477,28 @@ pub extern "C" fn IgnoringMessageHandler_as_CustomOnionMessageHandler(this_arg: free: None, handle_custom_message: IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message, read_custom_message: IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message, + release_pending_custom_messages: IgnoringMessageHandler_CustomOnionMessageHandler_release_pending_custom_messages, } } #[must_use] -extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message(this_arg: *const c_void, mut msg: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> crate::c_types::derived::COption_CustomOnionMessageContentsZ { +extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_message(this_arg: *const c_void, mut msg: crate::lightning::onion_message::packet::OnionMessageContents) -> crate::c_types::derived::COption_OnionMessageContentsZ { unreachable!(); } #[must_use] -extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message(this_arg: *const c_void, mut message_type: u64, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { +extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message(this_arg: *const c_void, mut message_type: u64, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_OnionMessageContentsZDecodeErrorZ { let mut ret = >::read_custom_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_reader()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_CustomOnionMessageContentsZ::None } else { crate::c_types::derived::COption_CustomOnionMessageContentsZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = if o.is_none() { crate::c_types::derived::COption_OnionMessageContentsZ::None } else { crate::c_types::derived::COption_OnionMessageContentsZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_ret } +#[must_use] +extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_release_pending_custom_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { + let mut ret = >::release_pending_custom_messages(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2) = item; let mut local_orig_ret_0_2 = crate::lightning::blinded_path::BlindedPath { inner: if orig_ret_0_2.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((orig_ret_0_2.unwrap())) } }, is_owned: true }; let mut local_ret_0 = (Into::into(orig_ret_0_0), crate::lightning::onion_message::messenger::Destination::native_into(orig_ret_0_1), local_orig_ret_0_2).into(); local_ret_0 }); }; + local_ret.into() +} -impl From for crate::lightning::onion_message::packet::CustomOnionMessageContents { +impl From for crate::lightning::onion_message::packet::OnionMessageContents { fn from(obj: nativeInfallible) -> Self { unreachable!(); } @@ -485,10 +510,10 @@ impl From for crate::lightning::ln::wire::Type { } impl From for crate::lightning::ln::wire::CustomMessageReader { fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = IgnoringMessageHandler_as_CustomMessageReader(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } @@ -513,10 +538,10 @@ extern "C" fn IgnoringMessageHandler_CustomMessageReader_read(this_arg: *const c impl From for crate::lightning::ln::peer_handler::CustomMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { - let mut rust_obj = IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = IgnoringMessageHandler_as_CustomMessageHandler(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } @@ -623,10 +648,10 @@ pub extern "C" fn ErroringMessageHandler_new() -> crate::lightning::ln::peer_han impl From for crate::lightning::events::MessageSendEventsProvider { fn from(obj: nativeErroringMessageHandler) -> Self { - let mut rust_obj = ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = ErroringMessageHandler_as_MessageSendEventsProvider(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(ErroringMessageHandler_free_void); ret } @@ -651,10 +676,10 @@ extern "C" fn ErroringMessageHandler_MessageSendEventsProvider_get_and_clear_pen impl From for crate::lightning::ln::msgs::ChannelMessageHandler { fn from(obj: nativeErroringMessageHandler) -> Self { - let mut rust_obj = ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let rust_obj = crate::lightning::ln::peer_handler::ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; let mut ret = ErroringMessageHandler_as_ChannelMessageHandler(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); ret.free = Some(ErroringMessageHandler_free_void); ret } @@ -675,6 +700,10 @@ pub extern "C" fn ErroringMessageHandler_as_ChannelMessageHandler(this_arg: &Err handle_channel_ready: ErroringMessageHandler_ChannelMessageHandler_handle_channel_ready, handle_shutdown: ErroringMessageHandler_ChannelMessageHandler_handle_shutdown, handle_closing_signed: ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed, + handle_stfu: ErroringMessageHandler_ChannelMessageHandler_handle_stfu, + handle_splice: ErroringMessageHandler_ChannelMessageHandler_handle_splice, + handle_splice_ack: ErroringMessageHandler_ChannelMessageHandler_handle_splice_ack, + handle_splice_locked: ErroringMessageHandler_ChannelMessageHandler_handle_splice_locked, handle_tx_add_input: ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_input, handle_tx_add_output: ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_output, handle_tx_remove_input: ErroringMessageHandler_ChannelMessageHandler_handle_tx_remove_input, @@ -699,7 +728,7 @@ pub extern "C" fn ErroringMessageHandler_as_ChannelMessageHandler(this_arg: &Err handle_error: ErroringMessageHandler_ChannelMessageHandler_handle_error, provided_node_features: ErroringMessageHandler_ChannelMessageHandler_provided_node_features, provided_init_features: ErroringMessageHandler_ChannelMessageHandler_provided_init_features, - get_genesis_hashes: ErroringMessageHandler_ChannelMessageHandler_get_genesis_hashes, + get_chain_hashes: ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes, MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, @@ -735,6 +764,18 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_shutdown(this_ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ClosingSigned) { >::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) } +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_stfu(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Stfu) { + >::handle_stfu(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) +} +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_splice(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Splice) { + >::handle_splice(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) +} +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_splice_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceAck) { + >::handle_splice_ack(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) +} +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_splice_locked(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceLocked) { + >::handle_splice_locked(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) +} extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_input(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddInput) { >::handle_tx_add_input(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) } @@ -815,9 +856,9 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_provided_init_feature crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] -extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_genesis_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { - let mut ret = >::get_genesis_hashes(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) }; +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { + let mut ret = >::get_chain_hashes(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: *item.as_ref() } }); }; local_ret_0.into() }) }; local_ret } @@ -909,7 +950,7 @@ pub extern "C" fn MessageHandler_set_route_handler(this_ptr: &mut MessageHandler /// A message handler which handles onion messages. This should generally be an /// [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. /// -/// [`OnionMessenger`]: crate::onion_message::OnionMessenger +/// [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger #[no_mangle] pub extern "C" fn MessageHandler_get_onion_message_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::OnionMessageHandler { let mut inner_val = &mut this_ptr.get_native_mut_ref().onion_message_handler; @@ -918,7 +959,7 @@ pub extern "C" fn MessageHandler_get_onion_message_handler(this_ptr: &MessageHan /// A message handler which handles onion messages. This should generally be an /// [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. /// -/// [`OnionMessenger`]: crate::onion_message::OnionMessenger +/// [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger #[no_mangle] pub extern "C" fn MessageHandler_set_onion_message_handler(this_ptr: &mut MessageHandler, mut val: crate::lightning::ln::msgs::OnionMessageHandler) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.onion_message_handler = val; @@ -1002,6 +1043,7 @@ pub struct SocketDescriptor { } unsafe impl Send for SocketDescriptor {} unsafe impl Sync for SocketDescriptor {} +#[allow(unused)] pub(crate) fn SocketDescriptor_clone_fields(orig: &SocketDescriptor) -> SocketDescriptor { SocketDescriptor { this_arg: orig.this_arg, @@ -1140,13 +1182,16 @@ impl Clone for PeerHandleError { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PeerHandleError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativePeerHandleError)).clone() })) as *mut c_void + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePeerHandleError)).clone() })) as *mut c_void } #[no_mangle] /// Creates a copy of the PeerHandleError pub extern "C" fn PeerHandleError_clone(orig: &PeerHandleError) -> PeerHandleError { orig.clone() } +/// Get a string which allows debug introspection of a PeerHandleError object +pub extern "C" fn PeerHandleError_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::peer_handler::PeerHandleError }).into()} use lightning::ln::peer_handler::PeerManager as nativePeerManagerImport; pub(crate) type nativePeerManager = nativePeerManagerImport;