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 == null ? 0 : 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 byte[] ret = bindings.NodeAnnouncementInfo_get_rgb(this.ptr);
70 * Color assigned to the node
72 public void set_rgb(byte[] val) {
73 bindings.NodeAnnouncementInfo_set_rgb(this.ptr, InternalUtils.check_arr_len(val, 3));
79 * Moniker assigned to the node.
80 * May be invalid or malicious (eg control chars),
81 * should not be exposed to the user.
83 public NodeAlias get_alias() {
84 long ret = bindings.NodeAnnouncementInfo_get_alias(this.ptr);
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); };
93 * Moniker assigned to the node.
94 * May be invalid or malicious (eg control chars),
95 * should not be exposed to the user.
97 public void set_alias(org.ldk.structs.NodeAlias val) {
98 bindings.NodeAnnouncementInfo_set_alias(this.ptr, val == null ? 0 : val.ptr);
101 if (this != null) { this.ptrs_to.AddLast(val); };
105 * Internet-level addresses via which one can connect to the node
107 * Returns a copy of the field.
109 public NetAddress[] get_addresses() {
110 long[] ret = bindings.NodeAnnouncementInfo_get_addresses(this.ptr);
112 int ret_conv_12_len = ret.Length;
113 NetAddress[] ret_conv_12_arr = new NetAddress[ret_conv_12_len];
114 for (int m = 0; m < ret_conv_12_len; m++) {
115 long ret_conv_12 = ret[m];
116 org.ldk.structs.NetAddress ret_conv_12_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret_conv_12);
117 if (ret_conv_12_hu_conv != null) { ret_conv_12_hu_conv.ptrs_to.AddLast(this); };
118 ret_conv_12_arr[m] = ret_conv_12_hu_conv;
120 return ret_conv_12_arr;
124 * Internet-level addresses via which one can connect to the node
126 public void set_addresses(NetAddress[] val) {
127 bindings.NodeAnnouncementInfo_set_addresses(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_12 => val_conv_12.ptr) : null);
133 * An initial announcement of the node
134 * Mostly redundant with the data we store in fields explicitly.
135 * Everything else is useful only for sending out for initial routing sync.
136 * Not stored if contains excess data to prevent DoS.
138 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
140 public NodeAnnouncement get_announcement_message() {
141 long ret = bindings.NodeAnnouncementInfo_get_announcement_message(this.ptr);
143 if (ret >= 0 && ret <= 4096) { return null; }
144 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
145 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
150 * An initial announcement of the node
151 * Mostly redundant with the data we store in fields explicitly.
152 * Everything else is useful only for sending out for initial routing sync.
153 * Not stored if contains excess data to prevent DoS.
155 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
157 public void set_announcement_message(org.ldk.structs.NodeAnnouncement val) {
158 bindings.NodeAnnouncementInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr);
161 if (this != null) { this.ptrs_to.AddLast(val); };
165 * Constructs a new NodeAnnouncementInfo given each field
167 public static NodeAnnouncementInfo of(org.ldk.structs.NodeFeatures features_arg, int last_update_arg, byte[] rgb_arg, org.ldk.structs.NodeAlias alias_arg, NetAddress[] addresses_arg, org.ldk.structs.NodeAnnouncement announcement_message_arg) {
168 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, addresses_arg != null ? InternalUtils.mapArray(addresses_arg, addresses_arg_conv_12 => addresses_arg_conv_12.ptr) : null, announcement_message_arg == null ? 0 : announcement_message_arg.ptr);
169 GC.KeepAlive(features_arg);
170 GC.KeepAlive(last_update_arg);
171 GC.KeepAlive(rgb_arg);
172 GC.KeepAlive(alias_arg);
173 GC.KeepAlive(addresses_arg);
174 GC.KeepAlive(announcement_message_arg);
175 if (ret >= 0 && ret <= 4096) { return null; }
176 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
177 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
178 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(features_arg); };
179 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(alias_arg); };
180 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(announcement_message_arg); };
184 internal long clone_ptr() {
185 long ret = bindings.NodeAnnouncementInfo_clone_ptr(this.ptr);
191 * Creates a copy of the NodeAnnouncementInfo
193 public NodeAnnouncementInfo clone() {
194 long ret = bindings.NodeAnnouncementInfo_clone(this.ptr);
196 if (ret >= 0 && ret <= 4096) { return null; }
197 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
198 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
203 * Checks if two NodeAnnouncementInfos contain equal inner contents.
204 * This ignores pointers and is_owned flags and looks at the values in fields.
205 * Two objects with NULL inner values will be considered "equal" here.
207 public bool eq(org.ldk.structs.NodeAnnouncementInfo b) {
208 bool ret = bindings.NodeAnnouncementInfo_eq(this.ptr, b == null ? 0 : b.ptr);
211 if (this != null) { this.ptrs_to.AddLast(b); };
215 public override bool Equals(object o) {
216 if (!(o is NodeAnnouncementInfo)) return false;
217 return this.eq((NodeAnnouncementInfo)o);
220 * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
222 public byte[] write() {
223 byte[] ret = bindings.NodeAnnouncementInfo_write(this.ptr);
229 * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
231 public static Result_NodeAnnouncementInfoDecodeErrorZ read(byte[] ser) {
232 long ret = bindings.NodeAnnouncementInfo_read(ser);
234 if (ret >= 0 && ret <= 4096) { return null; }
235 Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret);