[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / NodeAnnouncementInfo.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  * Information received in the latest node_announcement from this node.
11  */
12 public class NodeAnnouncementInfo : CommonBase {
13         internal NodeAnnouncementInfo(object _dummy, long ptr) : base(ptr) { }
14         ~NodeAnnouncementInfo() {
15                 if (ptr != 0) { bindings.NodeAnnouncementInfo_free(ptr); }
16         }
17
18         /**
19          * Protocol features the node announced support for
20          */
21         public NodeFeatures get_features() {
22                 long ret = bindings.NodeAnnouncementInfo_get_features(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
26                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
27                 return ret_hu_conv;
28         }
29
30         /**
31          * Protocol features the node announced support for
32          */
33         public void set_features(org.ldk.structs.NodeFeatures val) {
34                 bindings.NodeAnnouncementInfo_set_features(this.ptr, val == null ? 0 : val.ptr);
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37                 if (this != null) { this.ptrs_to.AddLast(val); };
38         }
39
40         /**
41          * When the last known update to the node state was issued.
42          * Value is opaque, as set in the announcement.
43          */
44         public int get_last_update() {
45                 int ret = bindings.NodeAnnouncementInfo_get_last_update(this.ptr);
46                 GC.KeepAlive(this);
47                 return ret;
48         }
49
50         /**
51          * When the last known update to the node state was issued.
52          * Value is opaque, as set in the announcement.
53          */
54         public void set_last_update(int val) {
55                 bindings.NodeAnnouncementInfo_set_last_update(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * Color assigned to the node
62          */
63         public byte[] get_rgb() {
64                 byte[] ret = bindings.NodeAnnouncementInfo_get_rgb(this.ptr);
65                 GC.KeepAlive(this);
66                 return ret;
67         }
68
69         /**
70          * Color assigned to the node
71          */
72         public void set_rgb(byte[] val) {
73                 bindings.NodeAnnouncementInfo_set_rgb(this.ptr, InternalUtils.check_arr_len(val, 3));
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * Moniker assigned to the node.
80          * May be invalid or malicious (eg control chars),
81          * should not be exposed to the user.
82          */
83         public NodeAlias get_alias() {
84                 long ret = bindings.NodeAnnouncementInfo_get_alias(this.ptr);
85                 GC.KeepAlive(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
88                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
89                 return ret_hu_conv;
90         }
91
92         /**
93          * Moniker assigned to the node.
94          * May be invalid or malicious (eg control chars),
95          * should not be exposed to the user.
96          */
97         public void set_alias(org.ldk.structs.NodeAlias val) {
98                 bindings.NodeAnnouncementInfo_set_alias(this.ptr, val == null ? 0 : val.ptr);
99                 GC.KeepAlive(this);
100                 GC.KeepAlive(val);
101                 if (this != null) { this.ptrs_to.AddLast(val); };
102         }
103
104         /**
105          * An initial announcement of the node
106          * Mostly redundant with the data we store in fields explicitly.
107          * Everything else is useful only for sending out for initial routing sync.
108          * Not stored if contains excess data to prevent DoS.
109          * 
110          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
111          */
112         public NodeAnnouncement get_announcement_message() {
113                 long ret = bindings.NodeAnnouncementInfo_get_announcement_message(this.ptr);
114                 GC.KeepAlive(this);
115                 if (ret >= 0 && ret <= 4096) { return null; }
116                 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
117                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
118                 return ret_hu_conv;
119         }
120
121         /**
122          * An initial announcement of the node
123          * Mostly redundant with the data we store in fields explicitly.
124          * Everything else is useful only for sending out for initial routing sync.
125          * Not stored if contains excess data to prevent DoS.
126          * 
127          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
128          */
129         public void set_announcement_message(org.ldk.structs.NodeAnnouncement val) {
130                 bindings.NodeAnnouncementInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr);
131                 GC.KeepAlive(this);
132                 GC.KeepAlive(val);
133                 if (this != null) { this.ptrs_to.AddLast(val); };
134         }
135
136         /**
137          * Constructs a new NodeAnnouncementInfo given each field
138          */
139         public static NodeAnnouncementInfo of(org.ldk.structs.NodeFeatures features_arg, int last_update_arg, byte[] rgb_arg, org.ldk.structs.NodeAlias alias_arg, org.ldk.structs.NodeAnnouncement announcement_message_arg) {
140                 long ret = bindings.NodeAnnouncementInfo_new(features_arg == null ? 0 : features_arg.ptr, last_update_arg, InternalUtils.check_arr_len(rgb_arg, 3), alias_arg == null ? 0 : alias_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr);
141                 GC.KeepAlive(features_arg);
142                 GC.KeepAlive(last_update_arg);
143                 GC.KeepAlive(rgb_arg);
144                 GC.KeepAlive(alias_arg);
145                 GC.KeepAlive(announcement_message_arg);
146                 if (ret >= 0 && ret <= 4096) { return null; }
147                 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
148                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
149                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(features_arg); };
150                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(alias_arg); };
151                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(announcement_message_arg); };
152                 return ret_hu_conv;
153         }
154
155         internal long clone_ptr() {
156                 long ret = bindings.NodeAnnouncementInfo_clone_ptr(this.ptr);
157                 GC.KeepAlive(this);
158                 return ret;
159         }
160
161         /**
162          * Creates a copy of the NodeAnnouncementInfo
163          */
164         public NodeAnnouncementInfo clone() {
165                 long ret = bindings.NodeAnnouncementInfo_clone(this.ptr);
166                 GC.KeepAlive(this);
167                 if (ret >= 0 && ret <= 4096) { return null; }
168                 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
169                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
170                 return ret_hu_conv;
171         }
172
173         /**
174          * Checks if two NodeAnnouncementInfos contain equal inner contents.
175          * This ignores pointers and is_owned flags and looks at the values in fields.
176          * Two objects with NULL inner values will be considered "equal" here.
177          */
178         public bool eq(org.ldk.structs.NodeAnnouncementInfo b) {
179                 bool ret = bindings.NodeAnnouncementInfo_eq(this.ptr, b == null ? 0 : b.ptr);
180                 GC.KeepAlive(this);
181                 GC.KeepAlive(b);
182                 if (this != null) { this.ptrs_to.AddLast(b); };
183                 return ret;
184         }
185
186         public override bool Equals(object o) {
187                 if (!(o is NodeAnnouncementInfo)) return false;
188                 return this.eq((NodeAnnouncementInfo)o);
189         }
190         /**
191          * Internet-level addresses via which one can connect to the node
192          */
193         public NetAddress[] addresses() {
194                 long[] ret = bindings.NodeAnnouncementInfo_addresses(this.ptr);
195                 GC.KeepAlive(this);
196                 int ret_conv_12_len = ret.Length;
197                 NetAddress[] ret_conv_12_arr = new NetAddress[ret_conv_12_len];
198                 for (int m = 0; m < ret_conv_12_len; m++) {
199                         long ret_conv_12 = ret[m];
200                         org.ldk.structs.NetAddress ret_conv_12_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret_conv_12);
201                         if (ret_conv_12_hu_conv != null) { ret_conv_12_hu_conv.ptrs_to.AddLast(this); };
202                         ret_conv_12_arr[m] = ret_conv_12_hu_conv;
203                 }
204                 return ret_conv_12_arr;
205         }
206
207         /**
208          * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
209          */
210         public byte[] write() {
211                 byte[] ret = bindings.NodeAnnouncementInfo_write(this.ptr);
212                 GC.KeepAlive(this);
213                 return ret;
214         }
215
216         /**
217          * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
218          */
219         public static Result_NodeAnnouncementInfoDecodeErrorZ read(byte[] ser) {
220                 long ret = bindings.NodeAnnouncementInfo_read(ser);
221                 GC.KeepAlive(ser);
222                 if (ret >= 0 && ret <= 4096) { return null; }
223                 Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret);
224                 return ret_hu_conv;
225         }
226
227 }
228 } } }