X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fln%2Fmsgs.rs;h=034f30763f889973232a585a93c5ee97db52dacc;hb=033f4f3b2750dcd5afc8b158d7474242b29b24f3;hp=d8906ea580f7782d5bbea957767c2c8ad9343143;hpb=1926a7a71ae0f37ebd6562996769334e0af0cf1b;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index d8906ea..034f307 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -2688,6 +2688,13 @@ pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::d let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = match o { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { e }).into() }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() }; local_res } +#[no_mangle] +/// Read a NetAddress from a byte array, created by NetAddress_write +pub extern "C" fn NetAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetAddressDecodeErrorZ { + let res = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() }; + local_res +} use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport; type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport; @@ -4007,6 +4014,9 @@ pub enum ErrorAction { }, /// The peer did something harmless that we weren't able to process, just log and ignore IgnoreError, + /// The peer did something harmless that we weren't able to meaningfully process. + /// If the error is logged, log it at the given level. + IgnoreAndLog(crate::lightning::util::logger::Level), /// The peer did something incorrect. Tell them. SendErrorMessage { /// The message to send. @@ -4026,6 +4036,12 @@ impl ErrorAction { } }, ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, + ErrorAction::IgnoreAndLog (ref a, ) => { + let mut a_nonref = (*a).clone(); + nativeErrorAction::IgnoreAndLog ( + a_nonref.into_native(), + ) + }, ErrorAction::SendErrorMessage {ref msg, } => { let mut msg_nonref = (*msg).clone(); nativeErrorAction::SendErrorMessage { @@ -4044,6 +4060,11 @@ impl ErrorAction { } }, ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, + ErrorAction::IgnoreAndLog (mut a, ) => { + nativeErrorAction::IgnoreAndLog ( + a.into_native(), + ) + }, ErrorAction::SendErrorMessage {mut msg, } => { nativeErrorAction::SendErrorMessage { msg: *unsafe { Box::from_raw(msg.take_inner()) }, @@ -4062,6 +4083,12 @@ impl ErrorAction { } }, nativeErrorAction::IgnoreError => ErrorAction::IgnoreError, + nativeErrorAction::IgnoreAndLog (ref a, ) => { + let mut a_nonref = (*a).clone(); + ErrorAction::IgnoreAndLog ( + crate::lightning::util::logger::Level::native_into(a_nonref), + ) + }, nativeErrorAction::SendErrorMessage {ref msg, } => { let mut msg_nonref = (*msg).clone(); ErrorAction::SendErrorMessage { @@ -4080,6 +4107,11 @@ impl ErrorAction { } }, nativeErrorAction::IgnoreError => ErrorAction::IgnoreError, + nativeErrorAction::IgnoreAndLog (mut a, ) => { + ErrorAction::IgnoreAndLog ( + crate::lightning::util::logger::Level::native_into(a), + ) + }, nativeErrorAction::SendErrorMessage {mut msg, } => { ErrorAction::SendErrorMessage { msg: crate::lightning::ln::msgs::ErrorMessage { inner: Box::into_raw(Box::new(msg)), is_owned: true }, @@ -4519,6 +4551,8 @@ pub struct ChannelMessageHandler { /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } +unsafe impl Send for ChannelMessageHandler {} +unsafe impl Sync for ChannelMessageHandler {} impl lightning::util::events::MessageSendEventsProvider for ChannelMessageHandler { fn get_and_clear_pending_msg_events(&self) -> Vec { let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg); @@ -4675,6 +4709,8 @@ pub struct RoutingMessageHandler { /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, } +unsafe impl Send for RoutingMessageHandler {} +unsafe impl Sync for RoutingMessageHandler {} impl lightning::util::events::MessageSendEventsProvider for RoutingMessageHandler { fn get_and_clear_pending_msg_events(&self) -> Vec { let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.this_arg);