]> git.bitcoin.ninja Git - rust-lightning/commitdiff
- bindings updates
authorMatt Corallo <git@bluematt.me>
Thu, 31 Dec 2020 16:42:14 +0000 (11:42 -0500)
committerMatt Corallo <git@bluematt.me>
Fri, 15 Jan 2021 00:49:14 +0000 (19:49 -0500)
lightning-c-bindings/include/lightning.h
lightning-c-bindings/include/lightningpp.hpp
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/chain/channelmonitor.rs
lightning-c-bindings/src/ln/channelmanager.rs
lightning-c-bindings/src/ln/msgs.rs

index 17b62a3383f496c1aecc1f1773838ce2ac793e68..a653b5a827085bdba0cb5e97999fa11b90f6b8ca 100644 (file)
@@ -2715,6 +2715,28 @@ typedef struct MUST_USE_STRUCT LDKDataLossProtect {
    bool is_owned;
 } LDKDataLossProtect;
 
+typedef union LDKCResultPtr_NetAddress__u8 {
+   struct LDKNetAddress *result;
+   uint8_t *err;
+} LDKCResultPtr_NetAddress__u8;
+
+typedef struct LDKCResultTempl_NetAddress__u8 {
+   union LDKCResultPtr_NetAddress__u8 contents;
+   bool result_ok;
+} LDKCResultTempl_NetAddress__u8;
+
+typedef union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError {
+   struct LDKCResultTempl_NetAddress__u8 *result;
+   struct LDKDecodeError *err;
+} LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError;
+
+typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError {
+   union LDKCResultPtr_CResultTempl_NetAddress__u8_____DecodeError contents;
+   bool result_ok;
+} LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError;
+
+typedef struct LDKCResultTempl_CResultTempl_NetAddress__u8_____DecodeError LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
+
 
 
 /**
@@ -3574,6 +3596,8 @@ typedef struct LDKCResultTempl_NetworkGraph__DecodeError {
 
 typedef struct LDKCResultTempl_NetworkGraph__DecodeError LDKCResult_NetworkGraphDecodeErrorZ;
 
+typedef struct LDKCResultTempl_NetAddress__u8 LDKCResult_NetAddressu8Z;
+
 typedef struct LDKCVecTempl_RouteHop LDKCVec_RouteHopZ;
 
 extern const void (*CVec_SpendableOutputDescriptorZ_free)(LDKCVec_SpendableOutputDescriptorZ);
@@ -3686,6 +3710,18 @@ extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C
 
 extern const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ (*CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err)(struct LDKDecodeError);
 
+extern const void (*CResult_NetAddressu8Z_free)(LDKCResult_NetAddressu8Z);
+
+extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_ok)(struct LDKNetAddress);
+
+extern const LDKCResult_NetAddressu8Z (*CResult_NetAddressu8Z_err)(uint8_t);
+
+extern const void (*CResult_CResult_NetAddressu8ZDecodeErrorZ_free)(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ);
+
+extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_ok)(LDKCResult_NetAddressu8Z);
+
+extern const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ (*CResult_CResult_NetAddressu8ZDecodeErrorZ_err)(struct LDKDecodeError);
+
 extern const void (*CVec_u64Z_free)(LDKCVec_u64Z);
 
 extern const void (*CVec_UpdateAddHTLCZ_free)(LDKCVec_UpdateAddHTLCZ);
@@ -4494,6 +4530,8 @@ struct LDKHTLCUpdate HTLCUpdate_read(struct LDKu8slice ser);
 
 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
 
+LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *obj);
+
 /**
  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
  * itself.
@@ -5130,6 +5168,8 @@ void ChannelManager_block_disconnected(const struct LDKChannelManager *this_arg,
 
 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *this_arg);
 
+LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *obj);
+
 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_ptr);
 
 /**
@@ -6154,6 +6194,8 @@ struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *orig);
 
 LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *obj);
 
+LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
+
 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_ptr);
 
 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *orig);
index b68fa06d94d25bacec7793d98f5980b50b2e97e8..3464849084176b919c3365331b9b00f34872506e 100644 (file)
@@ -2054,6 +2054,20 @@ public:
        const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_NetAddressu8Z {
+private:
+       LDKCResult_NetAddressu8Z self;
+public:
+       CResult_NetAddressu8Z(const CResult_NetAddressu8Z&) = delete;
+       ~CResult_NetAddressu8Z() { CResult_NetAddressu8Z_free(self); }
+       CResult_NetAddressu8Z(CResult_NetAddressu8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetAddressu8Z)); }
+       CResult_NetAddressu8Z(LDKCResult_NetAddressu8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetAddressu8Z)); }
+       operator LDKCResult_NetAddressu8Z() { LDKCResult_NetAddressu8Z res = self; memset(&self, 0, sizeof(LDKCResult_NetAddressu8Z)); return res; }
+       LDKCResult_NetAddressu8Z* operator &() { return &self; }
+       LDKCResult_NetAddressu8Z* operator ->() { return &self; }
+       const LDKCResult_NetAddressu8Z* operator &() const { return &self; }
+       const LDKCResult_NetAddressu8Z* operator ->() const { return &self; }
+};
 class CVec_UpdateFailMalformedHTLCZ {
 private:
        LDKCVec_UpdateFailMalformedHTLCZ self;
@@ -2334,6 +2348,20 @@ public:
        const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_CResult_NetAddressu8ZDecodeErrorZ {
+private:
+       LDKCResult_CResult_NetAddressu8ZDecodeErrorZ self;
+public:
+       CResult_CResult_NetAddressu8ZDecodeErrorZ(const CResult_CResult_NetAddressu8ZDecodeErrorZ&) = delete;
+       ~CResult_CResult_NetAddressu8ZDecodeErrorZ() { CResult_CResult_NetAddressu8ZDecodeErrorZ_free(self); }
+       CResult_CResult_NetAddressu8ZDecodeErrorZ(CResult_CResult_NetAddressu8ZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CResult_NetAddressu8ZDecodeErrorZ)); }
+       CResult_CResult_NetAddressu8ZDecodeErrorZ(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ)); }
+       operator LDKCResult_CResult_NetAddressu8ZDecodeErrorZ() { LDKCResult_CResult_NetAddressu8ZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ)); return res; }
+       LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* operator ->() const { return &self; }
+};
 class CVec_ChannelDetailsZ {
 private:
        LDKCVec_ChannelDetailsZ self;
index ba9397be1da5072b8148e9a223d051f9140e679c..092c5d5d4dd6eef4e99d952c79511f73800ec898 100644 (file)
@@ -271,6 +271,28 @@ pub static CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok: extern "C" f
 pub static CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ =
        crate::c_types::CResultTempl::<crate::c_types::C2TupleTempl<crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager>, crate::ln::msgs::DecodeError>::err;
 
+pub type CResult_NetAddressu8Z = crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>;
+#[no_mangle]
+pub static CResult_NetAddressu8Z_free: extern "C" fn(CResult_NetAddressu8Z) = crate::c_types::CResultTempl_free::<crate::ln::msgs::NetAddress, u8>;
+#[no_mangle]
+pub static CResult_NetAddressu8Z_ok: extern "C" fn (crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z =
+       crate::c_types::CResultTempl::<crate::ln::msgs::NetAddress, u8>::ok;
+
+#[no_mangle]
+pub static CResult_NetAddressu8Z_err: extern "C" fn (u8) -> CResult_NetAddressu8Z =
+       crate::c_types::CResultTempl::<crate::ln::msgs::NetAddress, u8>::err;
+
+pub type CResult_CResult_NetAddressu8ZDecodeErrorZ = crate::c_types::CResultTempl<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>, crate::ln::msgs::DecodeError>;
+#[no_mangle]
+pub static CResult_CResult_NetAddressu8ZDecodeErrorZ_free: extern "C" fn(CResult_CResult_NetAddressu8ZDecodeErrorZ) = crate::c_types::CResultTempl_free::<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>, crate::ln::msgs::DecodeError>;
+#[no_mangle]
+pub static CResult_CResult_NetAddressu8ZDecodeErrorZ_ok: extern "C" fn (CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ =
+       crate::c_types::CResultTempl::<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>, crate::ln::msgs::DecodeError>::ok;
+
+#[no_mangle]
+pub static CResult_CResult_NetAddressu8ZDecodeErrorZ_err: extern "C" fn (crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ =
+       crate::c_types::CResultTempl::<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>, crate::ln::msgs::DecodeError>::err;
+
 pub type CVec_u64Z = crate::c_types::CVecTempl<u64>;
 #[no_mangle]
 pub static CVec_u64Z_free: extern "C" fn(CVec_u64Z) = crate::c_types::CVecTempl_free::<u64>;
index 8c2e40c0c90a652253c3df350e3ac39f2850869e..ae364555646bfddd6c41b70f439b81e314d07f21 100644 (file)
@@ -447,6 +447,14 @@ impl ChannelMonitor {
                ret
        }
 }
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_write(obj: *const ChannelMonitor) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
+}
+#[no_mangle]
+pub(crate) extern "C" fn ChannelMonitor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelMonitor) })
+}
 /// Updates a ChannelMonitor on the basis of some new information provided by the Channel
 /// itself.
 ///
index 99a73e3213fd6858147ee87d64c3833a9c924d58..4d18ea1a1fb0e96ab5d21306dc69da5334b75054 100644 (file)
@@ -731,6 +731,14 @@ extern "C" fn ChannelManager_ChannelMessageHandler_get_and_clear_pending_msg_eve
        local_ret.into()
 }
 
+#[no_mangle]
+pub extern "C" fn ChannelManager_write(obj: *const ChannelManager) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
+}
+#[no_mangle]
+pub(crate) extern "C" fn ChannelManager_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelManager) })
+}
 
 use lightning::ln::channelmanager::ChannelManagerReadArgs as nativeChannelManagerReadArgsImport;
 type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, crate::chain::keysinterface::ChannelKeys, crate::chain::Watch, crate::chain::chaininterface::BroadcasterInterface, crate::chain::keysinterface::KeysInterface, crate::chain::chaininterface::FeeEstimator, crate::util::logger::Logger>;
index b8567500de9faad47a8dc3d0df3fb9718b04cf20..23520c4b663e2ce38c88b0ea11c18f93e247b21f 100644 (file)
@@ -2411,6 +2411,12 @@ pub extern "C" fn NetAddress_clone(orig: &NetAddress) -> NetAddress {
 pub extern "C" fn NetAddress_write(obj: *const NetAddress) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
 }
+#[no_mangle]
+pub extern "C" fn Result_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CResult_NetAddressu8ZDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       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::ln::msgs::NetAddress::native_into(o) }), Err(mut e) => crate::c_types::CResultTempl::err( { e }) }; local_res_0 }), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }) };
+       local_res
+}
 
 use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport;
 type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport;