+/// Represents the set of gossip messages that require a signature from a node's identity key.
+#[derive(Clone)]
+#[must_use]
+#[repr(C)]
+pub enum UnsignedGossipMessage {
+ /// An unsigned channel announcement.
+ ChannelAnnouncement(
+ crate::lightning::ln::msgs::UnsignedChannelAnnouncement),
+ /// An unsigned channel update.
+ ChannelUpdate(
+ crate::lightning::ln::msgs::UnsignedChannelUpdate),
+ /// An unsigned node announcement.
+ NodeAnnouncement(
+ crate::lightning::ln::msgs::UnsignedNodeAnnouncement),
+}
+use lightning::ln::msgs::UnsignedGossipMessage as UnsignedGossipMessageImport;
+pub(crate) type nativeUnsignedGossipMessage = UnsignedGossipMessageImport;
+
+impl UnsignedGossipMessage {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeUnsignedGossipMessage {
+ match self {
+ UnsignedGossipMessage::ChannelAnnouncement (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeUnsignedGossipMessage::ChannelAnnouncement (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ UnsignedGossipMessage::ChannelUpdate (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeUnsignedGossipMessage::ChannelUpdate (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ UnsignedGossipMessage::NodeAnnouncement (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ nativeUnsignedGossipMessage::NodeAnnouncement (
+ *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeUnsignedGossipMessage {
+ match self {
+ UnsignedGossipMessage::ChannelAnnouncement (mut a, ) => {
+ nativeUnsignedGossipMessage::ChannelAnnouncement (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ UnsignedGossipMessage::ChannelUpdate (mut a, ) => {
+ nativeUnsignedGossipMessage::ChannelUpdate (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ UnsignedGossipMessage::NodeAnnouncement (mut a, ) => {
+ nativeUnsignedGossipMessage::NodeAnnouncement (
+ *unsafe { Box::from_raw(a.take_inner()) },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativeUnsignedGossipMessage) -> Self {
+ match native {
+ nativeUnsignedGossipMessage::ChannelAnnouncement (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ UnsignedGossipMessage::ChannelAnnouncement (
+ crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ nativeUnsignedGossipMessage::ChannelUpdate (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ UnsignedGossipMessage::ChannelUpdate (
+ crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ nativeUnsignedGossipMessage::NodeAnnouncement (ref a, ) => {
+ let mut a_nonref = Clone::clone(a);
+ UnsignedGossipMessage::NodeAnnouncement (
+ crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ )
+ },
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeUnsignedGossipMessage) -> Self {
+ match native {
+ nativeUnsignedGossipMessage::ChannelAnnouncement (mut a, ) => {
+ UnsignedGossipMessage::ChannelAnnouncement (
+ crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ nativeUnsignedGossipMessage::ChannelUpdate (mut a, ) => {
+ UnsignedGossipMessage::ChannelUpdate (
+ crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ nativeUnsignedGossipMessage::NodeAnnouncement (mut a, ) => {
+ UnsignedGossipMessage::NodeAnnouncement (
+ crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(a), is_owned: true },
+ )
+ },
+ }
+ }
+}
+/// Frees any resources used by the UnsignedGossipMessage
+#[no_mangle]
+pub extern "C" fn UnsignedGossipMessage_free(this_ptr: UnsignedGossipMessage) { }
+/// Creates a copy of the UnsignedGossipMessage
+#[no_mangle]
+pub extern "C" fn UnsignedGossipMessage_clone(orig: &UnsignedGossipMessage) -> UnsignedGossipMessage {
+ orig.clone()
+}
+#[no_mangle]
+/// Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage
+pub extern "C" fn UnsignedGossipMessage_channel_announcement(a: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> UnsignedGossipMessage {
+ UnsignedGossipMessage::ChannelAnnouncement(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage
+pub extern "C" fn UnsignedGossipMessage_channel_update(a: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> UnsignedGossipMessage {
+ UnsignedGossipMessage::ChannelUpdate(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage
+pub extern "C" fn UnsignedGossipMessage_node_announcement(a: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> UnsignedGossipMessage {
+ UnsignedGossipMessage::NodeAnnouncement(a, )
+}
+#[no_mangle]
+/// Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read
+pub extern "C" fn UnsignedGossipMessage_write(obj: &crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CVec_u8Z {
+ crate::c_types::serialize_obj(&unsafe { &*obj }.to_native())
+}