1 // This file is Copyright its original authors, visible in version control
2 // history and in the source files from which this was generated.
4 // This file is licensed under the license available in the LICENSE or LICENSE.md
5 // file in the root of this repository or, if no such file exists, the same
6 // license as that which applies to the original source files from which this
7 // source was automatically generated.
9 //! Feature flag definitions for the Lightning protocol according to [BOLT #9].
11 //! Lightning nodes advertise a supported set of operation through feature flags. Features are
12 //! applicable for a specific context as indicated in some [messages]. [`Features`] encapsulates
13 //! behavior for specifying and checking feature flags for a particular context. Each feature is
14 //! defined internally by a trait specifying the corresponding flags (i.e., even and odd bits).
16 //! Whether a feature is considered \"known\" or \"unknown\" is relative to the implementation, whereas
17 //! the term \"supports\" is used in reference to a particular set of [`Features`]. That is, a node
18 //! supports a feature if it advertises the feature (as either required or optional) to its peers.
19 //! And the implementation can interpret a feature if the feature is known to it.
21 //! [BOLT #9]: https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md
22 //! [messages]: crate::ln::msgs
24 use alloc::str::FromStr;
25 use core::ffi::c_void;
26 use core::convert::Infallible;
27 use bitcoin::hashes::Hash;
28 use crate::c_types::*;
29 #[cfg(feature="no-std")]
30 use alloc::{vec::Vec, boxed::Box};
34 use alloc::str::FromStr;
35 use core::ffi::c_void;
36 use core::convert::Infallible;
37 use bitcoin::hashes::Hash;
38 use crate::c_types::*;
39 #[cfg(feature="no-std")]
40 use alloc::{vec::Vec, boxed::Box};
42 /// Set this feature as optional.
44 pub extern "C" fn InitFeatures_set_data_loss_protect_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
45 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_data_loss_protect_optional()
48 /// Set this feature as required.
50 pub extern "C" fn InitFeatures_set_data_loss_protect_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
51 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_data_loss_protect_required()
54 /// Checks if this feature is supported.
57 pub extern "C" fn InitFeatures_supports_data_loss_protect(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
58 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_data_loss_protect();
62 /// Set this feature as optional.
64 pub extern "C" fn NodeFeatures_set_data_loss_protect_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
65 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_data_loss_protect_optional()
68 /// Set this feature as required.
70 pub extern "C" fn NodeFeatures_set_data_loss_protect_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
71 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_data_loss_protect_required()
74 /// Checks if this feature is supported.
77 pub extern "C" fn NodeFeatures_supports_data_loss_protect(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
78 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_data_loss_protect();
82 /// Checks if this feature is required.
85 pub extern "C" fn InitFeatures_requires_data_loss_protect(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
86 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_data_loss_protect();
90 /// Checks if this feature is required.
93 pub extern "C" fn NodeFeatures_requires_data_loss_protect(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
94 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_data_loss_protect();
98 /// Set this feature as optional.
100 pub extern "C" fn InitFeatures_set_initial_routing_sync_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
101 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_initial_routing_sync_optional()
104 /// Set this feature as required.
106 pub extern "C" fn InitFeatures_set_initial_routing_sync_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
107 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_initial_routing_sync_required()
110 /// Checks if this feature is supported.
113 pub extern "C" fn InitFeatures_initial_routing_sync(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
114 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.initial_routing_sync();
118 /// Set this feature as optional.
120 pub extern "C" fn InitFeatures_set_upfront_shutdown_script_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
121 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_upfront_shutdown_script_optional()
124 /// Set this feature as required.
126 pub extern "C" fn InitFeatures_set_upfront_shutdown_script_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
127 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_upfront_shutdown_script_required()
130 /// Checks if this feature is supported.
133 pub extern "C" fn InitFeatures_supports_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
134 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_upfront_shutdown_script();
138 /// Set this feature as optional.
140 pub extern "C" fn NodeFeatures_set_upfront_shutdown_script_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
141 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_upfront_shutdown_script_optional()
144 /// Set this feature as required.
146 pub extern "C" fn NodeFeatures_set_upfront_shutdown_script_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
147 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_upfront_shutdown_script_required()
150 /// Checks if this feature is supported.
153 pub extern "C" fn NodeFeatures_supports_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
154 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_upfront_shutdown_script();
158 /// Checks if this feature is required.
161 pub extern "C" fn InitFeatures_requires_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
162 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_upfront_shutdown_script();
166 /// Checks if this feature is required.
169 pub extern "C" fn NodeFeatures_requires_upfront_shutdown_script(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
170 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_upfront_shutdown_script();
174 /// Set this feature as optional.
176 pub extern "C" fn InitFeatures_set_gossip_queries_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
177 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_gossip_queries_optional()
180 /// Set this feature as required.
182 pub extern "C" fn InitFeatures_set_gossip_queries_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
183 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_gossip_queries_required()
186 /// Checks if this feature is supported.
189 pub extern "C" fn InitFeatures_supports_gossip_queries(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
190 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_gossip_queries();
194 /// Set this feature as optional.
196 pub extern "C" fn NodeFeatures_set_gossip_queries_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
197 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_gossip_queries_optional()
200 /// Set this feature as required.
202 pub extern "C" fn NodeFeatures_set_gossip_queries_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
203 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_gossip_queries_required()
206 /// Checks if this feature is supported.
209 pub extern "C" fn NodeFeatures_supports_gossip_queries(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
210 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_gossip_queries();
214 /// Checks if this feature is required.
217 pub extern "C" fn InitFeatures_requires_gossip_queries(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
218 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_gossip_queries();
222 /// Checks if this feature is required.
225 pub extern "C" fn NodeFeatures_requires_gossip_queries(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
226 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_gossip_queries();
230 /// Set this feature as optional.
232 pub extern "C" fn InitFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
233 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_variable_length_onion_optional()
236 /// Set this feature as required.
238 pub extern "C" fn InitFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
239 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_variable_length_onion_required()
242 /// Checks if this feature is supported.
245 pub extern "C" fn InitFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
246 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion();
250 /// Set this feature as optional.
252 pub extern "C" fn NodeFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
253 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_variable_length_onion_optional()
256 /// Set this feature as required.
258 pub extern "C" fn NodeFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
259 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_variable_length_onion_required()
262 /// Checks if this feature is supported.
265 pub extern "C" fn NodeFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
266 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion();
270 /// Set this feature as optional.
272 pub extern "C" fn InvoiceFeatures_set_variable_length_onion_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
273 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_variable_length_onion_optional()
276 /// Set this feature as required.
278 pub extern "C" fn InvoiceFeatures_set_variable_length_onion_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
279 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_variable_length_onion_required()
282 /// Checks if this feature is supported.
285 pub extern "C" fn InvoiceFeatures_supports_variable_length_onion(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
286 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_variable_length_onion();
290 /// Checks if this feature is required.
293 pub extern "C" fn InitFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
294 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion();
298 /// Checks if this feature is required.
301 pub extern "C" fn NodeFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
302 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion();
306 /// Checks if this feature is required.
309 pub extern "C" fn InvoiceFeatures_requires_variable_length_onion(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
310 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_variable_length_onion();
314 /// Set this feature as optional.
316 pub extern "C" fn InitFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
317 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_static_remote_key_optional()
320 /// Set this feature as required.
322 pub extern "C" fn InitFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
323 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_static_remote_key_required()
326 /// Checks if this feature is supported.
329 pub extern "C" fn InitFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
330 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key();
334 /// Set this feature as optional.
336 pub extern "C" fn NodeFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
337 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_static_remote_key_optional()
340 /// Set this feature as required.
342 pub extern "C" fn NodeFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
343 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_static_remote_key_required()
346 /// Checks if this feature is supported.
349 pub extern "C" fn NodeFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
350 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key();
354 /// Set this feature as optional.
356 pub extern "C" fn ChannelTypeFeatures_set_static_remote_key_optional(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
357 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_static_remote_key_optional()
360 /// Set this feature as required.
362 pub extern "C" fn ChannelTypeFeatures_set_static_remote_key_required(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
363 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_static_remote_key_required()
366 /// Checks if this feature is supported.
369 pub extern "C" fn ChannelTypeFeatures_supports_static_remote_key(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
370 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_static_remote_key();
374 /// Checks if this feature is required.
377 pub extern "C" fn InitFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
378 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key();
382 /// Checks if this feature is required.
385 pub extern "C" fn NodeFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
386 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key();
390 /// Checks if this feature is required.
393 pub extern "C" fn ChannelTypeFeatures_requires_static_remote_key(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
394 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_static_remote_key();
398 /// Set this feature as optional.
400 pub extern "C" fn InitFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
401 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_payment_secret_optional()
404 /// Set this feature as required.
406 pub extern "C" fn InitFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
407 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_payment_secret_required()
410 /// Checks if this feature is supported.
413 pub extern "C" fn InitFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
414 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
418 /// Set this feature as optional.
420 pub extern "C" fn NodeFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
421 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_payment_secret_optional()
424 /// Set this feature as required.
426 pub extern "C" fn NodeFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
427 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_payment_secret_required()
430 /// Checks if this feature is supported.
433 pub extern "C" fn NodeFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
434 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
438 /// Set this feature as optional.
440 pub extern "C" fn InvoiceFeatures_set_payment_secret_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
441 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_payment_secret_optional()
444 /// Set this feature as required.
446 pub extern "C" fn InvoiceFeatures_set_payment_secret_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
447 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_payment_secret_required()
450 /// Checks if this feature is supported.
453 pub extern "C" fn InvoiceFeatures_supports_payment_secret(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
454 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_secret();
458 /// Checks if this feature is required.
461 pub extern "C" fn InitFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
462 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret();
466 /// Checks if this feature is required.
469 pub extern "C" fn NodeFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
470 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret();
474 /// Checks if this feature is required.
477 pub extern "C" fn InvoiceFeatures_requires_payment_secret(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
478 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_secret();
482 /// Set this feature as optional.
484 pub extern "C" fn InitFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
485 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_basic_mpp_optional()
488 /// Set this feature as required.
490 pub extern "C" fn InitFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
491 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_basic_mpp_required()
494 /// Checks if this feature is supported.
497 pub extern "C" fn InitFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
498 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp();
502 /// Set this feature as optional.
504 pub extern "C" fn NodeFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
505 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_basic_mpp_optional()
508 /// Set this feature as required.
510 pub extern "C" fn NodeFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
511 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_basic_mpp_required()
514 /// Checks if this feature is supported.
517 pub extern "C" fn NodeFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
518 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp();
522 /// Set this feature as optional.
524 pub extern "C" fn InvoiceFeatures_set_basic_mpp_optional(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
525 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_basic_mpp_optional()
528 /// Set this feature as required.
530 pub extern "C" fn InvoiceFeatures_set_basic_mpp_required(this_arg: &mut crate::lightning::ln::features::InvoiceFeatures) {
531 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInvoiceFeatures)) }.set_basic_mpp_required()
534 /// Checks if this feature is supported.
537 pub extern "C" fn InvoiceFeatures_supports_basic_mpp(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
538 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_basic_mpp();
542 /// Checks if this feature is required.
545 pub extern "C" fn InitFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
546 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp();
550 /// Checks if this feature is required.
553 pub extern "C" fn NodeFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
554 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp();
558 /// Checks if this feature is required.
561 pub extern "C" fn InvoiceFeatures_requires_basic_mpp(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
562 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_basic_mpp();
566 /// Set this feature as optional.
568 pub extern "C" fn InitFeatures_set_shutdown_any_segwit_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
569 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_shutdown_any_segwit_optional()
572 /// Set this feature as required.
574 pub extern "C" fn InitFeatures_set_shutdown_any_segwit_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
575 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_shutdown_any_segwit_required()
578 /// Checks if this feature is supported.
581 pub extern "C" fn InitFeatures_supports_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
582 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_shutdown_anysegwit();
586 /// Set this feature as optional.
588 pub extern "C" fn NodeFeatures_set_shutdown_any_segwit_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
589 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_shutdown_any_segwit_optional()
592 /// Set this feature as required.
594 pub extern "C" fn NodeFeatures_set_shutdown_any_segwit_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
595 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_shutdown_any_segwit_required()
598 /// Checks if this feature is supported.
601 pub extern "C" fn NodeFeatures_supports_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
602 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_shutdown_anysegwit();
606 /// Checks if this feature is required.
609 pub extern "C" fn InitFeatures_requires_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
610 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_shutdown_anysegwit();
614 /// Checks if this feature is required.
617 pub extern "C" fn NodeFeatures_requires_shutdown_anysegwit(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
618 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_shutdown_anysegwit();
622 /// Set this feature as optional.
624 pub extern "C" fn InitFeatures_set_channel_type_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
625 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_channel_type_optional()
628 /// Set this feature as required.
630 pub extern "C" fn InitFeatures_set_channel_type_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
631 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_channel_type_required()
634 /// Checks if this feature is supported.
637 pub extern "C" fn InitFeatures_supports_channel_type(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
638 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_channel_type();
642 /// Set this feature as optional.
644 pub extern "C" fn NodeFeatures_set_channel_type_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
645 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_channel_type_optional()
648 /// Set this feature as required.
650 pub extern "C" fn NodeFeatures_set_channel_type_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
651 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_channel_type_required()
654 /// Checks if this feature is supported.
657 pub extern "C" fn NodeFeatures_supports_channel_type(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
658 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_channel_type();
662 /// Checks if this feature is required.
665 pub extern "C" fn InitFeatures_requires_channel_type(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
666 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_channel_type();
670 /// Checks if this feature is required.
673 pub extern "C" fn NodeFeatures_requires_channel_type(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
674 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_channel_type();
678 /// Set this feature as optional.
680 pub extern "C" fn InitFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
681 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_scid_privacy_optional()
684 /// Set this feature as required.
686 pub extern "C" fn InitFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::InitFeatures) {
687 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeInitFeatures)) }.set_scid_privacy_required()
690 /// Checks if this feature is supported.
693 pub extern "C" fn InitFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
694 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy();
698 /// Set this feature as optional.
700 pub extern "C" fn NodeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
701 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_scid_privacy_optional()
704 /// Set this feature as required.
706 pub extern "C" fn NodeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
707 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_scid_privacy_required()
710 /// Checks if this feature is supported.
713 pub extern "C" fn NodeFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
714 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy();
718 /// Set this feature as optional.
720 pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
721 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_scid_privacy_optional()
724 /// Set this feature as required.
726 pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning::ln::features::ChannelTypeFeatures) {
727 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeChannelTypeFeatures)) }.set_scid_privacy_required()
730 /// Checks if this feature is supported.
733 pub extern "C" fn ChannelTypeFeatures_supports_scid_privacy(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
734 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy();
738 /// Checks if this feature is required.
741 pub extern "C" fn InitFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
742 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy();
746 /// Checks if this feature is required.
749 pub extern "C" fn NodeFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
750 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy();
754 /// Checks if this feature is required.
757 pub extern "C" fn ChannelTypeFeatures_requires_scid_privacy(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
758 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy();
762 /// Set this feature as optional.
764 pub extern "C" fn NodeFeatures_set_keysend_optional(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
765 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_keysend_optional()
768 /// Set this feature as required.
770 pub extern "C" fn NodeFeatures_set_keysend_required(this_arg: &mut crate::lightning::ln::features::NodeFeatures) {
771 unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::features::nativeNodeFeatures)) }.set_keysend_required()
774 /// Checks if this feature is supported.
777 pub extern "C" fn NodeFeatures_supports_keysend(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
778 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_keysend();
782 /// Checks if this feature is required.
785 pub extern "C" fn NodeFeatures_requires_keysend(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
786 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_keysend();
791 /// Checks if two InitFeaturess contain equal inner contents.
792 /// This ignores pointers and is_owned flags and looks at the values in fields.
793 /// Two objects with NULL inner values will be considered "equal" here.
795 pub extern "C" fn InitFeatures_eq(a: &InitFeatures, b: &InitFeatures) -> bool {
796 if a.inner == b.inner { return true; }
797 if a.inner.is_null() || b.inner.is_null() { return false; }
798 if a.get_native_ref() == b.get_native_ref() { true } else { false }
800 /// Checks if two NodeFeaturess contain equal inner contents.
801 /// This ignores pointers and is_owned flags and looks at the values in fields.
802 /// Two objects with NULL inner values will be considered "equal" here.
804 pub extern "C" fn NodeFeatures_eq(a: &NodeFeatures, b: &NodeFeatures) -> bool {
805 if a.inner == b.inner { return true; }
806 if a.inner.is_null() || b.inner.is_null() { return false; }
807 if a.get_native_ref() == b.get_native_ref() { true } else { false }
809 /// Checks if two ChannelFeaturess contain equal inner contents.
810 /// This ignores pointers and is_owned flags and looks at the values in fields.
811 /// Two objects with NULL inner values will be considered "equal" here.
813 pub extern "C" fn ChannelFeatures_eq(a: &ChannelFeatures, b: &ChannelFeatures) -> bool {
814 if a.inner == b.inner { return true; }
815 if a.inner.is_null() || b.inner.is_null() { return false; }
816 if a.get_native_ref() == b.get_native_ref() { true } else { false }
818 /// Checks if two InvoiceFeaturess contain equal inner contents.
819 /// This ignores pointers and is_owned flags and looks at the values in fields.
820 /// Two objects with NULL inner values will be considered "equal" here.
822 pub extern "C" fn InvoiceFeatures_eq(a: &InvoiceFeatures, b: &InvoiceFeatures) -> bool {
823 if a.inner == b.inner { return true; }
824 if a.inner.is_null() || b.inner.is_null() { return false; }
825 if a.get_native_ref() == b.get_native_ref() { true } else { false }
827 /// Checks if two ChannelTypeFeaturess contain equal inner contents.
828 /// This ignores pointers and is_owned flags and looks at the values in fields.
829 /// Two objects with NULL inner values will be considered "equal" here.
831 pub extern "C" fn ChannelTypeFeatures_eq(a: &ChannelTypeFeatures, b: &ChannelTypeFeatures) -> bool {
832 if a.inner == b.inner { return true; }
833 if a.inner.is_null() || b.inner.is_null() { return false; }
834 if a.get_native_ref() == b.get_native_ref() { true } else { false }
836 impl Clone for InitFeatures {
837 fn clone(&self) -> Self {
839 inner: if <*mut nativeInitFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
840 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
846 /// Used only if an object of this type is returned as a trait impl by a method
847 pub(crate) extern "C" fn InitFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
848 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInitFeatures)).clone() })) as *mut c_void
851 /// Creates a copy of the InitFeatures
852 pub extern "C" fn InitFeatures_clone(orig: &InitFeatures) -> InitFeatures {
855 impl Clone for NodeFeatures {
856 fn clone(&self) -> Self {
858 inner: if <*mut nativeNodeFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
859 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
865 /// Used only if an object of this type is returned as a trait impl by a method
866 pub(crate) extern "C" fn NodeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
867 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeFeatures)).clone() })) as *mut c_void
870 /// Creates a copy of the NodeFeatures
871 pub extern "C" fn NodeFeatures_clone(orig: &NodeFeatures) -> NodeFeatures {
874 impl Clone for ChannelFeatures {
875 fn clone(&self) -> Self {
877 inner: if <*mut nativeChannelFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
878 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
884 /// Used only if an object of this type is returned as a trait impl by a method
885 pub(crate) extern "C" fn ChannelFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
886 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelFeatures)).clone() })) as *mut c_void
889 /// Creates a copy of the ChannelFeatures
890 pub extern "C" fn ChannelFeatures_clone(orig: &ChannelFeatures) -> ChannelFeatures {
893 impl Clone for InvoiceFeatures {
894 fn clone(&self) -> Self {
896 inner: if <*mut nativeInvoiceFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
897 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
903 /// Used only if an object of this type is returned as a trait impl by a method
904 pub(crate) extern "C" fn InvoiceFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
905 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceFeatures)).clone() })) as *mut c_void
908 /// Creates a copy of the InvoiceFeatures
909 pub extern "C" fn InvoiceFeatures_clone(orig: &InvoiceFeatures) -> InvoiceFeatures {
912 impl Clone for ChannelTypeFeatures {
913 fn clone(&self) -> Self {
915 inner: if <*mut nativeChannelTypeFeatures>::is_null(self.inner) { core::ptr::null_mut() } else {
916 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
922 /// Used only if an object of this type is returned as a trait impl by a method
923 pub(crate) extern "C" fn ChannelTypeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
924 Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelTypeFeatures)).clone() })) as *mut c_void
927 /// Creates a copy of the ChannelTypeFeatures
928 pub extern "C" fn ChannelTypeFeatures_clone(orig: &ChannelTypeFeatures) -> ChannelTypeFeatures {
932 use lightning::ln::features::InitFeatures as nativeInitFeaturesImport;
933 pub(crate) type nativeInitFeatures = nativeInitFeaturesImport;
935 /// Features used within an `init` message.
938 pub struct InitFeatures {
939 /// A pointer to the opaque Rust object.
941 /// Nearly everywhere, inner must be non-null, however in places where
942 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
943 pub inner: *mut nativeInitFeatures,
944 /// Indicates that this is the only struct which contains the same pointer.
946 /// Rust functions which take ownership of an object provided via an argument require
947 /// this to be true and invalidate the object pointed to by inner.
951 impl Drop for InitFeatures {
953 if self.is_owned && !<*mut nativeInitFeatures>::is_null(self.inner) {
954 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
958 /// Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
960 pub extern "C" fn InitFeatures_free(this_obj: InitFeatures) { }
962 /// Used only if an object of this type is returned as a trait impl by a method
963 pub(crate) extern "C" fn InitFeatures_free_void(this_ptr: *mut c_void) {
964 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInitFeatures); }
968 pub(crate) fn get_native_ref(&self) -> &'static nativeInitFeatures {
969 unsafe { &*ObjOps::untweak_ptr(self.inner) }
971 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInitFeatures {
972 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
974 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
975 pub(crate) fn take_inner(mut self) -> *mut nativeInitFeatures {
976 assert!(self.is_owned);
977 let ret = ObjOps::untweak_ptr(self.inner);
978 self.inner = core::ptr::null_mut();
983 use lightning::ln::features::NodeFeatures as nativeNodeFeaturesImport;
984 pub(crate) type nativeNodeFeatures = nativeNodeFeaturesImport;
986 /// Features used within a `node_announcement` message.
989 pub struct NodeFeatures {
990 /// A pointer to the opaque Rust object.
992 /// Nearly everywhere, inner must be non-null, however in places where
993 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
994 pub inner: *mut nativeNodeFeatures,
995 /// Indicates that this is the only struct which contains the same pointer.
997 /// Rust functions which take ownership of an object provided via an argument require
998 /// this to be true and invalidate the object pointed to by inner.
1002 impl Drop for NodeFeatures {
1003 fn drop(&mut self) {
1004 if self.is_owned && !<*mut nativeNodeFeatures>::is_null(self.inner) {
1005 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1009 /// Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
1011 pub extern "C" fn NodeFeatures_free(this_obj: NodeFeatures) { }
1013 /// Used only if an object of this type is returned as a trait impl by a method
1014 pub(crate) extern "C" fn NodeFeatures_free_void(this_ptr: *mut c_void) {
1015 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeFeatures); }
1019 pub(crate) fn get_native_ref(&self) -> &'static nativeNodeFeatures {
1020 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1022 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeFeatures {
1023 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1025 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1026 pub(crate) fn take_inner(mut self) -> *mut nativeNodeFeatures {
1027 assert!(self.is_owned);
1028 let ret = ObjOps::untweak_ptr(self.inner);
1029 self.inner = core::ptr::null_mut();
1034 use lightning::ln::features::ChannelFeatures as nativeChannelFeaturesImport;
1035 pub(crate) type nativeChannelFeatures = nativeChannelFeaturesImport;
1037 /// Features used within a `channel_announcement` message.
1040 pub struct ChannelFeatures {
1041 /// A pointer to the opaque Rust object.
1043 /// Nearly everywhere, inner must be non-null, however in places where
1044 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1045 pub inner: *mut nativeChannelFeatures,
1046 /// Indicates that this is the only struct which contains the same pointer.
1048 /// Rust functions which take ownership of an object provided via an argument require
1049 /// this to be true and invalidate the object pointed to by inner.
1053 impl Drop for ChannelFeatures {
1054 fn drop(&mut self) {
1055 if self.is_owned && !<*mut nativeChannelFeatures>::is_null(self.inner) {
1056 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1060 /// Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
1062 pub extern "C" fn ChannelFeatures_free(this_obj: ChannelFeatures) { }
1064 /// Used only if an object of this type is returned as a trait impl by a method
1065 pub(crate) extern "C" fn ChannelFeatures_free_void(this_ptr: *mut c_void) {
1066 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelFeatures); }
1069 impl ChannelFeatures {
1070 pub(crate) fn get_native_ref(&self) -> &'static nativeChannelFeatures {
1071 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1073 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelFeatures {
1074 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1076 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1077 pub(crate) fn take_inner(mut self) -> *mut nativeChannelFeatures {
1078 assert!(self.is_owned);
1079 let ret = ObjOps::untweak_ptr(self.inner);
1080 self.inner = core::ptr::null_mut();
1085 use lightning::ln::features::InvoiceFeatures as nativeInvoiceFeaturesImport;
1086 pub(crate) type nativeInvoiceFeatures = nativeInvoiceFeaturesImport;
1088 /// Features used within an invoice.
1091 pub struct InvoiceFeatures {
1092 /// A pointer to the opaque Rust object.
1094 /// Nearly everywhere, inner must be non-null, however in places where
1095 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1096 pub inner: *mut nativeInvoiceFeatures,
1097 /// Indicates that this is the only struct which contains the same pointer.
1099 /// Rust functions which take ownership of an object provided via an argument require
1100 /// this to be true and invalidate the object pointed to by inner.
1104 impl Drop for InvoiceFeatures {
1105 fn drop(&mut self) {
1106 if self.is_owned && !<*mut nativeInvoiceFeatures>::is_null(self.inner) {
1107 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1111 /// Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
1113 pub extern "C" fn InvoiceFeatures_free(this_obj: InvoiceFeatures) { }
1115 /// Used only if an object of this type is returned as a trait impl by a method
1116 pub(crate) extern "C" fn InvoiceFeatures_free_void(this_ptr: *mut c_void) {
1117 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoiceFeatures); }
1120 impl InvoiceFeatures {
1121 pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceFeatures {
1122 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1124 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceFeatures {
1125 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1127 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1128 pub(crate) fn take_inner(mut self) -> *mut nativeInvoiceFeatures {
1129 assert!(self.is_owned);
1130 let ret = ObjOps::untweak_ptr(self.inner);
1131 self.inner = core::ptr::null_mut();
1136 use lightning::ln::features::ChannelTypeFeatures as nativeChannelTypeFeaturesImport;
1137 pub(crate) type nativeChannelTypeFeatures = nativeChannelTypeFeaturesImport;
1139 /// Features used within the channel_type field in an OpenChannel message.
1141 /// A channel is always of some known \"type\", describing the transaction formats used and the exact
1142 /// semantics of our interaction with our peer.
1144 /// Note that because a channel is a specific type which is proposed by the opener and accepted by
1145 /// the counterparty, only required features are allowed here.
1147 /// This is serialized differently from other feature types - it is not prefixed by a length, and
1148 /// thus must only appear inside a TLV where its length is known in advance.
1151 pub struct ChannelTypeFeatures {
1152 /// A pointer to the opaque Rust object.
1154 /// Nearly everywhere, inner must be non-null, however in places where
1155 /// the Rust equivalent takes an Option, it may be set to null to indicate None.
1156 pub inner: *mut nativeChannelTypeFeatures,
1157 /// Indicates that this is the only struct which contains the same pointer.
1159 /// Rust functions which take ownership of an object provided via an argument require
1160 /// this to be true and invalidate the object pointed to by inner.
1164 impl Drop for ChannelTypeFeatures {
1165 fn drop(&mut self) {
1166 if self.is_owned && !<*mut nativeChannelTypeFeatures>::is_null(self.inner) {
1167 let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
1171 /// Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
1173 pub extern "C" fn ChannelTypeFeatures_free(this_obj: ChannelTypeFeatures) { }
1175 /// Used only if an object of this type is returned as a trait impl by a method
1176 pub(crate) extern "C" fn ChannelTypeFeatures_free_void(this_ptr: *mut c_void) {
1177 unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelTypeFeatures); }
1180 impl ChannelTypeFeatures {
1181 pub(crate) fn get_native_ref(&self) -> &'static nativeChannelTypeFeatures {
1182 unsafe { &*ObjOps::untweak_ptr(self.inner) }
1184 pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelTypeFeatures {
1185 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
1187 /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
1188 pub(crate) fn take_inner(mut self) -> *mut nativeChannelTypeFeatures {
1189 assert!(self.is_owned);
1190 let ret = ObjOps::untweak_ptr(self.inner);
1191 self.inner = core::ptr::null_mut();
1195 /// Create a blank Features with no features set
1198 pub extern "C" fn InitFeatures_empty() -> crate::lightning::ln::features::InitFeatures {
1199 let mut ret = lightning::ln::features::InitFeatures::empty();
1200 crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1203 /// Creates a Features with the bits set which are known by the implementation
1206 pub extern "C" fn InitFeatures_known() -> crate::lightning::ln::features::InitFeatures {
1207 let mut ret = lightning::ln::features::InitFeatures::known();
1208 crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1211 /// Returns true if this `Features` object contains unknown feature flags which are set as
1215 pub extern "C" fn InitFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::InitFeatures) -> bool {
1216 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1220 /// Create a blank Features with no features set
1223 pub extern "C" fn NodeFeatures_empty() -> crate::lightning::ln::features::NodeFeatures {
1224 let mut ret = lightning::ln::features::NodeFeatures::empty();
1225 crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1228 /// Creates a Features with the bits set which are known by the implementation
1231 pub extern "C" fn NodeFeatures_known() -> crate::lightning::ln::features::NodeFeatures {
1232 let mut ret = lightning::ln::features::NodeFeatures::known();
1233 crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1236 /// Returns true if this `Features` object contains unknown feature flags which are set as
1240 pub extern "C" fn NodeFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::NodeFeatures) -> bool {
1241 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1245 /// Create a blank Features with no features set
1248 pub extern "C" fn ChannelFeatures_empty() -> crate::lightning::ln::features::ChannelFeatures {
1249 let mut ret = lightning::ln::features::ChannelFeatures::empty();
1250 crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1253 /// Creates a Features with the bits set which are known by the implementation
1256 pub extern "C" fn ChannelFeatures_known() -> crate::lightning::ln::features::ChannelFeatures {
1257 let mut ret = lightning::ln::features::ChannelFeatures::known();
1258 crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1261 /// Returns true if this `Features` object contains unknown feature flags which are set as
1265 pub extern "C" fn ChannelFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::ChannelFeatures) -> bool {
1266 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1270 /// Create a blank Features with no features set
1273 pub extern "C" fn InvoiceFeatures_empty() -> crate::lightning::ln::features::InvoiceFeatures {
1274 let mut ret = lightning::ln::features::InvoiceFeatures::empty();
1275 crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1278 /// Creates a Features with the bits set which are known by the implementation
1281 pub extern "C" fn InvoiceFeatures_known() -> crate::lightning::ln::features::InvoiceFeatures {
1282 let mut ret = lightning::ln::features::InvoiceFeatures::known();
1283 crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1286 /// Returns true if this `Features` object contains unknown feature flags which are set as
1290 pub extern "C" fn InvoiceFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::InvoiceFeatures) -> bool {
1291 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1295 /// Create a blank Features with no features set
1298 pub extern "C" fn ChannelTypeFeatures_empty() -> crate::lightning::ln::features::ChannelTypeFeatures {
1299 let mut ret = lightning::ln::features::ChannelTypeFeatures::empty();
1300 crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1303 /// Creates a Features with the bits set which are known by the implementation
1306 pub extern "C" fn ChannelTypeFeatures_known() -> crate::lightning::ln::features::ChannelTypeFeatures {
1307 let mut ret = lightning::ln::features::ChannelTypeFeatures::known();
1308 crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true }
1311 /// Returns true if this `Features` object contains unknown feature flags which are set as
1315 pub extern "C" fn ChannelTypeFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::ChannelTypeFeatures) -> bool {
1316 let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits();
1321 /// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
1322 pub extern "C" fn InitFeatures_write(obj: &crate::lightning::ln::features::InitFeatures) -> crate::c_types::derived::CVec_u8Z {
1323 crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1326 pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1327 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInitFeatures) })
1330 /// Read a InitFeatures from a byte array, created by InitFeatures_write
1331 pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
1332 let res: Result<lightning::ln::features::InitFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1333 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1337 /// Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
1338 pub extern "C" fn ChannelFeatures_write(obj: &crate::lightning::ln::features::ChannelFeatures) -> crate::c_types::derived::CVec_u8Z {
1339 crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1342 pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1343 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelFeatures) })
1346 /// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
1347 pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
1348 let res: Result<lightning::ln::features::ChannelFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1349 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1353 /// Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
1354 pub extern "C" fn NodeFeatures_write(obj: &crate::lightning::ln::features::NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
1355 crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1358 pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1359 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeFeatures) })
1362 /// Read a NodeFeatures from a byte array, created by NodeFeatures_write
1363 pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ {
1364 let res: Result<lightning::ln::features::NodeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1365 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1369 /// Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
1370 pub extern "C" fn InvoiceFeatures_write(obj: &crate::lightning::ln::features::InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z {
1371 crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1374 pub(crate) extern "C" fn InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1375 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceFeatures) })
1378 /// Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
1379 pub extern "C" fn InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InvoiceFeaturesDecodeErrorZ {
1380 let res: Result<lightning::ln::features::InvoiceFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1381 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };
1385 /// Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
1386 pub extern "C" fn ChannelTypeFeatures_write(obj: &crate::lightning::ln::features::ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z {
1387 crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
1390 pub(crate) extern "C" fn ChannelTypeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
1391 crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelTypeFeatures) })
1394 /// Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
1395 pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTypeFeaturesDecodeErrorZ {
1396 let res: Result<lightning::ln::features::ChannelTypeFeatures, lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj(ser);
1397 let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() };