6 namespace org { namespace ldk { namespace structs {
10 * Information received in the latest node_announcement from this node.
12 public class NodeAnnouncementInfo : CommonBase {
13 internal NodeAnnouncementInfo(object _dummy, long ptr) : base(ptr) { }
14 ~NodeAnnouncementInfo() {
15 if (ptr != 0) { bindings.NodeAnnouncementInfo_free(ptr); }
19 * Protocol features the node announced support for
21 public NodeFeatures get_features() {
22 long ret = bindings.NodeAnnouncementInfo_get_features(this.ptr);
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); };
31 * Protocol features the node announced support for
33 public void set_features(org.ldk.structs.NodeFeatures val) {
34 bindings.NodeAnnouncementInfo_set_features(this.ptr, val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * When the last known update to the node state was issued.
42 * Value is opaque, as set in the announcement.
44 public int get_last_update() {
45 int ret = bindings.NodeAnnouncementInfo_get_last_update(this.ptr);
51 * When the last known update to the node state was issued.
52 * Value is opaque, as set in the announcement.
54 public void set_last_update(int val) {
55 bindings.NodeAnnouncementInfo_set_last_update(this.ptr, val);
61 * Color assigned to the node
63 public byte[] get_rgb() {
64 long ret = bindings.NodeAnnouncementInfo_get_rgb(this.ptr);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
72 * Color assigned to the node
74 public void set_rgb(byte[] val) {
75 bindings.NodeAnnouncementInfo_set_rgb(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 3)));
81 * Moniker assigned to the node.
82 * May be invalid or malicious (eg control chars),
83 * should not be exposed to the user.
85 public NodeAlias get_alias() {
86 long ret = bindings.NodeAnnouncementInfo_get_alias(this.ptr);
88 if (ret >= 0 && ret <= 4096) { return null; }
89 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
90 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
95 * Moniker assigned to the node.
96 * May be invalid or malicious (eg control chars),
97 * should not be exposed to the user.
99 public void set_alias(org.ldk.structs.NodeAlias val) {
100 bindings.NodeAnnouncementInfo_set_alias(this.ptr, val.ptr);
103 if (this != null) { this.ptrs_to.AddLast(val); };
107 * An initial announcement of the node
108 * Mostly redundant with the data we store in fields explicitly.
109 * Everything else is useful only for sending out for initial routing sync.
110 * Not stored if contains excess data to prevent DoS.
112 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
114 public NodeAnnouncement get_announcement_message() {
115 long ret = bindings.NodeAnnouncementInfo_get_announcement_message(this.ptr);
117 if (ret >= 0 && ret <= 4096) { return null; }
118 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
119 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
124 * An initial announcement of the node
125 * Mostly redundant with the data we store in fields explicitly.
126 * Everything else is useful only for sending out for initial routing sync.
127 * Not stored if contains excess data to prevent DoS.
129 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
131 public void set_announcement_message(org.ldk.structs.NodeAnnouncement val) {
132 bindings.NodeAnnouncementInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr);
135 if (this != null) { this.ptrs_to.AddLast(val); };
139 * Constructs a new NodeAnnouncementInfo given each field
141 * Note that announcement_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
143 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) {
144 long ret = bindings.NodeAnnouncementInfo_new(features_arg.ptr, last_update_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(rgb_arg, 3)), alias_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr);
145 GC.KeepAlive(features_arg);
146 GC.KeepAlive(last_update_arg);
147 GC.KeepAlive(rgb_arg);
148 GC.KeepAlive(alias_arg);
149 GC.KeepAlive(announcement_message_arg);
150 if (ret >= 0 && ret <= 4096) { return null; }
151 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
152 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
153 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(features_arg); };
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(alias_arg); };
155 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(announcement_message_arg); };
159 internal long clone_ptr() {
160 long ret = bindings.NodeAnnouncementInfo_clone_ptr(this.ptr);
166 * Creates a copy of the NodeAnnouncementInfo
168 public NodeAnnouncementInfo clone() {
169 long ret = bindings.NodeAnnouncementInfo_clone(this.ptr);
171 if (ret >= 0 && ret <= 4096) { return null; }
172 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
173 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
178 * Checks if two NodeAnnouncementInfos contain equal inner contents.
179 * This ignores pointers and is_owned flags and looks at the values in fields.
180 * Two objects with NULL inner values will be considered "equal" here.
182 public bool eq(org.ldk.structs.NodeAnnouncementInfo b) {
183 bool ret = bindings.NodeAnnouncementInfo_eq(this.ptr, b.ptr);
186 if (this != null) { this.ptrs_to.AddLast(b); };
190 public override bool Equals(object o) {
191 if (!(o is NodeAnnouncementInfo)) return false;
192 return this.eq((NodeAnnouncementInfo)o);
195 * Internet-level addresses via which one can connect to the node
197 public SocketAddress[] addresses() {
198 long ret = bindings.NodeAnnouncementInfo_addresses(this.ptr);
200 if (ret >= 0 && ret <= 4096) { return null; }
201 int ret_conv_15_len = InternalUtils.getArrayLength(ret);
202 SocketAddress[] ret_conv_15_arr = new SocketAddress[ret_conv_15_len];
203 for (int p = 0; p < ret_conv_15_len; p++) {
204 long ret_conv_15 = InternalUtils.getU64ArrayElem(ret, p);
205 org.ldk.structs.SocketAddress ret_conv_15_hu_conv = org.ldk.structs.SocketAddress.constr_from_ptr(ret_conv_15);
206 if (ret_conv_15_hu_conv != null) { ret_conv_15_hu_conv.ptrs_to.AddLast(this); };
207 ret_conv_15_arr[p] = ret_conv_15_hu_conv;
209 bindings.free_buffer(ret);
210 return ret_conv_15_arr;
214 * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
216 public byte[] write() {
217 long ret = bindings.NodeAnnouncementInfo_write(this.ptr);
219 if (ret >= 0 && ret <= 4096) { return null; }
220 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
225 * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
227 public static Result_NodeAnnouncementInfoDecodeErrorZ read(byte[] ser) {
228 long ret = bindings.NodeAnnouncementInfo_read(InternalUtils.encodeUint8Array(ser));
230 if (ret >= 0 && ret <= 4096) { return null; }
231 Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret);