fdd108e6023bde44fb3c0c6367abf88a211d2f1f
[ldk-java] / c_sharp / src / org / ldk / structs / NodeFeatures.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Features used within a `node_announcement` message.
11  */
12 public class NodeFeatures : CommonBase {
13         internal NodeFeatures(object _dummy, long ptr) : base(ptr) { }
14         ~NodeFeatures() {
15                 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
16         }
17
18         /**
19          * Checks if two NodeFeaturess contain equal inner contents.
20          * This ignores pointers and is_owned flags and looks at the values in fields.
21          * Two objects with NULL inner values will be considered "equal" here.
22          */
23         public bool eq(org.ldk.structs.NodeFeatures b) {
24                 bool ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
25                 GC.KeepAlive(this);
26                 GC.KeepAlive(b);
27                 if (this != null) { this.ptrs_to.AddLast(b); };
28                 return ret;
29         }
30
31         public override bool Equals(object o) {
32                 if (!(o is NodeFeatures)) return false;
33                 return this.eq((NodeFeatures)o);
34         }
35         internal long clone_ptr() {
36                 long ret = bindings.NodeFeatures_clone_ptr(this.ptr);
37                 GC.KeepAlive(this);
38                 return ret;
39         }
40
41         /**
42          * Creates a copy of the NodeFeatures
43          */
44         public NodeFeatures clone() {
45                 long ret = bindings.NodeFeatures_clone(this.ptr);
46                 GC.KeepAlive(this);
47                 if (ret >= 0 && ret <= 4096) { return null; }
48                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
49                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
50                 return ret_hu_conv;
51         }
52
53         /**
54          * Create a blank Features with no features set
55          */
56         public static NodeFeatures empty() {
57                 long ret = bindings.NodeFeatures_empty();
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
60                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Returns true if this `Features` object contains unknown feature flags which are set as
66          * \"required\".
67          */
68         public bool requires_unknown_bits() {
69                 bool ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
70                 GC.KeepAlive(this);
71                 return ret;
72         }
73
74         /**
75          * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
76          */
77         public byte[] write() {
78                 byte[] ret = bindings.NodeFeatures_write(this.ptr);
79                 GC.KeepAlive(this);
80                 return ret;
81         }
82
83         /**
84          * Read a NodeFeatures from a byte array, created by NodeFeatures_write
85          */
86         public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
87                 long ret = bindings.NodeFeatures_read(ser);
88                 GC.KeepAlive(ser);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
91                 return ret_hu_conv;
92         }
93
94         /**
95          * Set this feature as optional.
96          */
97         public void set_data_loss_protect_optional() {
98                 bindings.NodeFeatures_set_data_loss_protect_optional(this.ptr);
99                 GC.KeepAlive(this);
100         }
101
102         /**
103          * Set this feature as required.
104          */
105         public void set_data_loss_protect_required() {
106                 bindings.NodeFeatures_set_data_loss_protect_required(this.ptr);
107                 GC.KeepAlive(this);
108         }
109
110         /**
111          * Checks if this feature is supported.
112          */
113         public bool supports_data_loss_protect() {
114                 bool ret = bindings.NodeFeatures_supports_data_loss_protect(this.ptr);
115                 GC.KeepAlive(this);
116                 return ret;
117         }
118
119         /**
120          * Checks if this feature is required.
121          */
122         public bool requires_data_loss_protect() {
123                 bool ret = bindings.NodeFeatures_requires_data_loss_protect(this.ptr);
124                 GC.KeepAlive(this);
125                 return ret;
126         }
127
128         /**
129          * Set this feature as optional.
130          */
131         public void set_upfront_shutdown_script_optional() {
132                 bindings.NodeFeatures_set_upfront_shutdown_script_optional(this.ptr);
133                 GC.KeepAlive(this);
134         }
135
136         /**
137          * Set this feature as required.
138          */
139         public void set_upfront_shutdown_script_required() {
140                 bindings.NodeFeatures_set_upfront_shutdown_script_required(this.ptr);
141                 GC.KeepAlive(this);
142         }
143
144         /**
145          * Checks if this feature is supported.
146          */
147         public bool supports_upfront_shutdown_script() {
148                 bool ret = bindings.NodeFeatures_supports_upfront_shutdown_script(this.ptr);
149                 GC.KeepAlive(this);
150                 return ret;
151         }
152
153         /**
154          * Checks if this feature is required.
155          */
156         public bool requires_upfront_shutdown_script() {
157                 bool ret = bindings.NodeFeatures_requires_upfront_shutdown_script(this.ptr);
158                 GC.KeepAlive(this);
159                 return ret;
160         }
161
162         /**
163          * Set this feature as optional.
164          */
165         public void set_gossip_queries_optional() {
166                 bindings.NodeFeatures_set_gossip_queries_optional(this.ptr);
167                 GC.KeepAlive(this);
168         }
169
170         /**
171          * Set this feature as required.
172          */
173         public void set_gossip_queries_required() {
174                 bindings.NodeFeatures_set_gossip_queries_required(this.ptr);
175                 GC.KeepAlive(this);
176         }
177
178         /**
179          * Checks if this feature is supported.
180          */
181         public bool supports_gossip_queries() {
182                 bool ret = bindings.NodeFeatures_supports_gossip_queries(this.ptr);
183                 GC.KeepAlive(this);
184                 return ret;
185         }
186
187         /**
188          * Checks if this feature is required.
189          */
190         public bool requires_gossip_queries() {
191                 bool ret = bindings.NodeFeatures_requires_gossip_queries(this.ptr);
192                 GC.KeepAlive(this);
193                 return ret;
194         }
195
196         /**
197          * Set this feature as optional.
198          */
199         public void set_variable_length_onion_optional() {
200                 bindings.NodeFeatures_set_variable_length_onion_optional(this.ptr);
201                 GC.KeepAlive(this);
202         }
203
204         /**
205          * Set this feature as required.
206          */
207         public void set_variable_length_onion_required() {
208                 bindings.NodeFeatures_set_variable_length_onion_required(this.ptr);
209                 GC.KeepAlive(this);
210         }
211
212         /**
213          * Checks if this feature is supported.
214          */
215         public bool supports_variable_length_onion() {
216                 bool ret = bindings.NodeFeatures_supports_variable_length_onion(this.ptr);
217                 GC.KeepAlive(this);
218                 return ret;
219         }
220
221         /**
222          * Checks if this feature is required.
223          */
224         public bool requires_variable_length_onion() {
225                 bool ret = bindings.NodeFeatures_requires_variable_length_onion(this.ptr);
226                 GC.KeepAlive(this);
227                 return ret;
228         }
229
230         /**
231          * Set this feature as optional.
232          */
233         public void set_static_remote_key_optional() {
234                 bindings.NodeFeatures_set_static_remote_key_optional(this.ptr);
235                 GC.KeepAlive(this);
236         }
237
238         /**
239          * Set this feature as required.
240          */
241         public void set_static_remote_key_required() {
242                 bindings.NodeFeatures_set_static_remote_key_required(this.ptr);
243                 GC.KeepAlive(this);
244         }
245
246         /**
247          * Checks if this feature is supported.
248          */
249         public bool supports_static_remote_key() {
250                 bool ret = bindings.NodeFeatures_supports_static_remote_key(this.ptr);
251                 GC.KeepAlive(this);
252                 return ret;
253         }
254
255         /**
256          * Checks if this feature is required.
257          */
258         public bool requires_static_remote_key() {
259                 bool ret = bindings.NodeFeatures_requires_static_remote_key(this.ptr);
260                 GC.KeepAlive(this);
261                 return ret;
262         }
263
264         /**
265          * Set this feature as optional.
266          */
267         public void set_payment_secret_optional() {
268                 bindings.NodeFeatures_set_payment_secret_optional(this.ptr);
269                 GC.KeepAlive(this);
270         }
271
272         /**
273          * Set this feature as required.
274          */
275         public void set_payment_secret_required() {
276                 bindings.NodeFeatures_set_payment_secret_required(this.ptr);
277                 GC.KeepAlive(this);
278         }
279
280         /**
281          * Checks if this feature is supported.
282          */
283         public bool supports_payment_secret() {
284                 bool ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
285                 GC.KeepAlive(this);
286                 return ret;
287         }
288
289         /**
290          * Checks if this feature is required.
291          */
292         public bool requires_payment_secret() {
293                 bool ret = bindings.NodeFeatures_requires_payment_secret(this.ptr);
294                 GC.KeepAlive(this);
295                 return ret;
296         }
297
298         /**
299          * Set this feature as optional.
300          */
301         public void set_basic_mpp_optional() {
302                 bindings.NodeFeatures_set_basic_mpp_optional(this.ptr);
303                 GC.KeepAlive(this);
304         }
305
306         /**
307          * Set this feature as required.
308          */
309         public void set_basic_mpp_required() {
310                 bindings.NodeFeatures_set_basic_mpp_required(this.ptr);
311                 GC.KeepAlive(this);
312         }
313
314         /**
315          * Checks if this feature is supported.
316          */
317         public bool supports_basic_mpp() {
318                 bool ret = bindings.NodeFeatures_supports_basic_mpp(this.ptr);
319                 GC.KeepAlive(this);
320                 return ret;
321         }
322
323         /**
324          * Checks if this feature is required.
325          */
326         public bool requires_basic_mpp() {
327                 bool ret = bindings.NodeFeatures_requires_basic_mpp(this.ptr);
328                 GC.KeepAlive(this);
329                 return ret;
330         }
331
332         /**
333          * Set this feature as optional.
334          */
335         public void set_wumbo_optional() {
336                 bindings.NodeFeatures_set_wumbo_optional(this.ptr);
337                 GC.KeepAlive(this);
338         }
339
340         /**
341          * Set this feature as required.
342          */
343         public void set_wumbo_required() {
344                 bindings.NodeFeatures_set_wumbo_required(this.ptr);
345                 GC.KeepAlive(this);
346         }
347
348         /**
349          * Checks if this feature is supported.
350          */
351         public bool supports_wumbo() {
352                 bool ret = bindings.NodeFeatures_supports_wumbo(this.ptr);
353                 GC.KeepAlive(this);
354                 return ret;
355         }
356
357         /**
358          * Checks if this feature is required.
359          */
360         public bool requires_wumbo() {
361                 bool ret = bindings.NodeFeatures_requires_wumbo(this.ptr);
362                 GC.KeepAlive(this);
363                 return ret;
364         }
365
366         /**
367          * Set this feature as optional.
368          */
369         public void set_shutdown_any_segwit_optional() {
370                 bindings.NodeFeatures_set_shutdown_any_segwit_optional(this.ptr);
371                 GC.KeepAlive(this);
372         }
373
374         /**
375          * Set this feature as required.
376          */
377         public void set_shutdown_any_segwit_required() {
378                 bindings.NodeFeatures_set_shutdown_any_segwit_required(this.ptr);
379                 GC.KeepAlive(this);
380         }
381
382         /**
383          * Checks if this feature is supported.
384          */
385         public bool supports_shutdown_anysegwit() {
386                 bool ret = bindings.NodeFeatures_supports_shutdown_anysegwit(this.ptr);
387                 GC.KeepAlive(this);
388                 return ret;
389         }
390
391         /**
392          * Checks if this feature is required.
393          */
394         public bool requires_shutdown_anysegwit() {
395                 bool ret = bindings.NodeFeatures_requires_shutdown_anysegwit(this.ptr);
396                 GC.KeepAlive(this);
397                 return ret;
398         }
399
400         /**
401          * Set this feature as optional.
402          */
403         public void set_onion_messages_optional() {
404                 bindings.NodeFeatures_set_onion_messages_optional(this.ptr);
405                 GC.KeepAlive(this);
406         }
407
408         /**
409          * Set this feature as required.
410          */
411         public void set_onion_messages_required() {
412                 bindings.NodeFeatures_set_onion_messages_required(this.ptr);
413                 GC.KeepAlive(this);
414         }
415
416         /**
417          * Checks if this feature is supported.
418          */
419         public bool supports_onion_messages() {
420                 bool ret = bindings.NodeFeatures_supports_onion_messages(this.ptr);
421                 GC.KeepAlive(this);
422                 return ret;
423         }
424
425         /**
426          * Checks if this feature is required.
427          */
428         public bool requires_onion_messages() {
429                 bool ret = bindings.NodeFeatures_requires_onion_messages(this.ptr);
430                 GC.KeepAlive(this);
431                 return ret;
432         }
433
434         /**
435          * Set this feature as optional.
436          */
437         public void set_channel_type_optional() {
438                 bindings.NodeFeatures_set_channel_type_optional(this.ptr);
439                 GC.KeepAlive(this);
440         }
441
442         /**
443          * Set this feature as required.
444          */
445         public void set_channel_type_required() {
446                 bindings.NodeFeatures_set_channel_type_required(this.ptr);
447                 GC.KeepAlive(this);
448         }
449
450         /**
451          * Checks if this feature is supported.
452          */
453         public bool supports_channel_type() {
454                 bool ret = bindings.NodeFeatures_supports_channel_type(this.ptr);
455                 GC.KeepAlive(this);
456                 return ret;
457         }
458
459         /**
460          * Checks if this feature is required.
461          */
462         public bool requires_channel_type() {
463                 bool ret = bindings.NodeFeatures_requires_channel_type(this.ptr);
464                 GC.KeepAlive(this);
465                 return ret;
466         }
467
468         /**
469          * Set this feature as optional.
470          */
471         public void set_scid_privacy_optional() {
472                 bindings.NodeFeatures_set_scid_privacy_optional(this.ptr);
473                 GC.KeepAlive(this);
474         }
475
476         /**
477          * Set this feature as required.
478          */
479         public void set_scid_privacy_required() {
480                 bindings.NodeFeatures_set_scid_privacy_required(this.ptr);
481                 GC.KeepAlive(this);
482         }
483
484         /**
485          * Checks if this feature is supported.
486          */
487         public bool supports_scid_privacy() {
488                 bool ret = bindings.NodeFeatures_supports_scid_privacy(this.ptr);
489                 GC.KeepAlive(this);
490                 return ret;
491         }
492
493         /**
494          * Checks if this feature is required.
495          */
496         public bool requires_scid_privacy() {
497                 bool ret = bindings.NodeFeatures_requires_scid_privacy(this.ptr);
498                 GC.KeepAlive(this);
499                 return ret;
500         }
501
502         /**
503          * Set this feature as optional.
504          */
505         public void set_zero_conf_optional() {
506                 bindings.NodeFeatures_set_zero_conf_optional(this.ptr);
507                 GC.KeepAlive(this);
508         }
509
510         /**
511          * Set this feature as required.
512          */
513         public void set_zero_conf_required() {
514                 bindings.NodeFeatures_set_zero_conf_required(this.ptr);
515                 GC.KeepAlive(this);
516         }
517
518         /**
519          * Checks if this feature is supported.
520          */
521         public bool supports_zero_conf() {
522                 bool ret = bindings.NodeFeatures_supports_zero_conf(this.ptr);
523                 GC.KeepAlive(this);
524                 return ret;
525         }
526
527         /**
528          * Checks if this feature is required.
529          */
530         public bool requires_zero_conf() {
531                 bool ret = bindings.NodeFeatures_requires_zero_conf(this.ptr);
532                 GC.KeepAlive(this);
533                 return ret;
534         }
535
536         /**
537          * Set this feature as optional.
538          */
539         public void set_keysend_optional() {
540                 bindings.NodeFeatures_set_keysend_optional(this.ptr);
541                 GC.KeepAlive(this);
542         }
543
544         /**
545          * Set this feature as required.
546          */
547         public void set_keysend_required() {
548                 bindings.NodeFeatures_set_keysend_required(this.ptr);
549                 GC.KeepAlive(this);
550         }
551
552         /**
553          * Checks if this feature is supported.
554          */
555         public bool supports_keysend() {
556                 bool ret = bindings.NodeFeatures_supports_keysend(this.ptr);
557                 GC.KeepAlive(this);
558                 return ret;
559         }
560
561         /**
562          * Checks if this feature is required.
563          */
564         public bool requires_keysend() {
565                 bool ret = bindings.NodeFeatures_requires_keysend(this.ptr);
566                 GC.KeepAlive(this);
567                 return ret;
568         }
569
570 }
571 } } }