[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelTypeFeatures.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 the channel_type field in an OpenChannel message.
11  * 
12  * A channel is always of some known \"type\", describing the transaction formats used and the exact
13  * semantics of our interaction with our peer.
14  * 
15  * Note that because a channel is a specific type which is proposed by the opener and accepted by
16  * the counterparty, only required features are allowed here.
17  * 
18  * This is serialized differently from other feature types - it is not prefixed by a length, and
19  * thus must only appear inside a TLV where its length is known in advance.
20  */
21 public class ChannelTypeFeatures : CommonBase {
22         internal ChannelTypeFeatures(object _dummy, long ptr) : base(ptr) { }
23         ~ChannelTypeFeatures() {
24                 if (ptr != 0) { bindings.ChannelTypeFeatures_free(ptr); }
25         }
26
27         /**
28          * Checks if two ChannelTypeFeaturess contain equal inner contents.
29          * This ignores pointers and is_owned flags and looks at the values in fields.
30          * Two objects with NULL inner values will be considered "equal" here.
31          */
32         public bool eq(org.ldk.structs.ChannelTypeFeatures b) {
33                 bool ret = bindings.ChannelTypeFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(b);
36                 if (this != null) { this.ptrs_to.AddLast(b); };
37                 return ret;
38         }
39
40         public override bool Equals(object o) {
41                 if (!(o is ChannelTypeFeatures)) return false;
42                 return this.eq((ChannelTypeFeatures)o);
43         }
44         internal long clone_ptr() {
45                 long ret = bindings.ChannelTypeFeatures_clone_ptr(this.ptr);
46                 GC.KeepAlive(this);
47                 return ret;
48         }
49
50         /**
51          * Creates a copy of the ChannelTypeFeatures
52          */
53         public ChannelTypeFeatures clone() {
54                 long ret = bindings.ChannelTypeFeatures_clone(this.ptr);
55                 GC.KeepAlive(this);
56                 if (ret >= 0 && ret <= 4096) { return null; }
57                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
58                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
59                 return ret_hu_conv;
60         }
61
62         /**
63          * Create a blank Features with no features set
64          */
65         public static ChannelTypeFeatures empty() {
66                 long ret = bindings.ChannelTypeFeatures_empty();
67                 if (ret >= 0 && ret <= 4096) { return null; }
68                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
69                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70                 return ret_hu_conv;
71         }
72
73         /**
74          * Returns true if this `Features` object contains unknown feature flags which are set as
75          * \"required\".
76          */
77         public bool requires_unknown_bits() {
78                 bool ret = bindings.ChannelTypeFeatures_requires_unknown_bits(this.ptr);
79                 GC.KeepAlive(this);
80                 return ret;
81         }
82
83         /**
84          * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
85          */
86         public byte[] write() {
87                 byte[] ret = bindings.ChannelTypeFeatures_write(this.ptr);
88                 GC.KeepAlive(this);
89                 return ret;
90         }
91
92         /**
93          * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
94          */
95         public static Result_ChannelTypeFeaturesDecodeErrorZ read(byte[] ser) {
96                 long ret = bindings.ChannelTypeFeatures_read(ser);
97                 GC.KeepAlive(ser);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret);
100                 return ret_hu_conv;
101         }
102
103         /**
104          * Set this feature as optional.
105          */
106         public void set_static_remote_key_optional() {
107                 bindings.ChannelTypeFeatures_set_static_remote_key_optional(this.ptr);
108                 GC.KeepAlive(this);
109         }
110
111         /**
112          * Set this feature as required.
113          */
114         public void set_static_remote_key_required() {
115                 bindings.ChannelTypeFeatures_set_static_remote_key_required(this.ptr);
116                 GC.KeepAlive(this);
117         }
118
119         /**
120          * Checks if this feature is supported.
121          */
122         public bool supports_static_remote_key() {
123                 bool ret = bindings.ChannelTypeFeatures_supports_static_remote_key(this.ptr);
124                 GC.KeepAlive(this);
125                 return ret;
126         }
127
128         /**
129          * Checks if this feature is required.
130          */
131         public bool requires_static_remote_key() {
132                 bool ret = bindings.ChannelTypeFeatures_requires_static_remote_key(this.ptr);
133                 GC.KeepAlive(this);
134                 return ret;
135         }
136
137         /**
138          * Set this feature as optional.
139          */
140         public void set_scid_privacy_optional() {
141                 bindings.ChannelTypeFeatures_set_scid_privacy_optional(this.ptr);
142                 GC.KeepAlive(this);
143         }
144
145         /**
146          * Set this feature as required.
147          */
148         public void set_scid_privacy_required() {
149                 bindings.ChannelTypeFeatures_set_scid_privacy_required(this.ptr);
150                 GC.KeepAlive(this);
151         }
152
153         /**
154          * Checks if this feature is supported.
155          */
156         public bool supports_scid_privacy() {
157                 bool ret = bindings.ChannelTypeFeatures_supports_scid_privacy(this.ptr);
158                 GC.KeepAlive(this);
159                 return ret;
160         }
161
162         /**
163          * Checks if this feature is required.
164          */
165         public bool requires_scid_privacy() {
166                 bool ret = bindings.ChannelTypeFeatures_requires_scid_privacy(this.ptr);
167                 GC.KeepAlive(this);
168                 return ret;
169         }
170
171         /**
172          * Set this feature as optional.
173          */
174         public void set_zero_conf_optional() {
175                 bindings.ChannelTypeFeatures_set_zero_conf_optional(this.ptr);
176                 GC.KeepAlive(this);
177         }
178
179         /**
180          * Set this feature as required.
181          */
182         public void set_zero_conf_required() {
183                 bindings.ChannelTypeFeatures_set_zero_conf_required(this.ptr);
184                 GC.KeepAlive(this);
185         }
186
187         /**
188          * Checks if this feature is supported.
189          */
190         public bool supports_zero_conf() {
191                 bool ret = bindings.ChannelTypeFeatures_supports_zero_conf(this.ptr);
192                 GC.KeepAlive(this);
193                 return ret;
194         }
195
196         /**
197          * Checks if this feature is required.
198          */
199         public bool requires_zero_conf() {
200                 bool ret = bindings.ChannelTypeFeatures_requires_zero_conf(this.ptr);
201                 GC.KeepAlive(this);
202                 return ret;
203         }
204
205 }
206 } } }