6 namespace org { namespace ldk { namespace structs {
10 * The unsigned part of a [`node_announcement`] message.
12 * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
14 public class UnsignedNodeAnnouncement : CommonBase {
15 internal UnsignedNodeAnnouncement(object _dummy, long ptr) : base(ptr) { }
16 ~UnsignedNodeAnnouncement() {
17 if (ptr != 0) { bindings.UnsignedNodeAnnouncement_free(ptr); }
21 * The advertised features
23 public NodeFeatures get_features() {
24 long ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
33 * The advertised features
35 public void set_features(org.ldk.structs.NodeFeatures val) {
36 bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * A strictly monotonic announcement counter, with gaps allowed
45 public int get_timestamp() {
46 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
52 * A strictly monotonic announcement counter, with gaps allowed
54 public void set_timestamp(int val) {
55 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
61 * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
64 public NodeId get_node_id() {
65 long ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
74 * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
77 public void set_node_id(org.ldk.structs.NodeId val) {
78 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val == null ? 0 : val.ptr);
81 if (this != null) { this.ptrs_to.AddLast(val); };
85 * An RGB color for UI purposes
87 public byte[] get_rgb() {
88 long ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
90 if (ret >= 0 && ret <= 4096) { return null; }
91 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
96 * An RGB color for UI purposes
98 public void set_rgb(byte[] val) {
99 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 3)));
105 * An alias, for UI purposes.
107 * This should be sanitized before use. There is no guarantee of uniqueness.
109 public NodeAlias get_alias() {
110 long ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
112 if (ret >= 0 && ret <= 4096) { return null; }
113 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
114 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
119 * An alias, for UI purposes.
121 * This should be sanitized before use. There is no guarantee of uniqueness.
123 public void set_alias(org.ldk.structs.NodeAlias val) {
124 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val == null ? 0 : val.ptr);
127 if (this != null) { this.ptrs_to.AddLast(val); };
131 * List of addresses on which this node is reachable
133 * Returns a copy of the field.
135 public SocketAddress[] get_addresses() {
136 long ret = bindings.UnsignedNodeAnnouncement_get_addresses(this.ptr);
138 if (ret >= 0 && ret <= 4096) { return null; }
139 int ret_conv_15_len = InternalUtils.getArrayLength(ret);
140 SocketAddress[] ret_conv_15_arr = new SocketAddress[ret_conv_15_len];
141 for (int p = 0; p < ret_conv_15_len; p++) {
142 long ret_conv_15 = InternalUtils.getU64ArrayElem(ret, p);
143 org.ldk.structs.SocketAddress ret_conv_15_hu_conv = org.ldk.structs.SocketAddress.constr_from_ptr(ret_conv_15);
144 if (ret_conv_15_hu_conv != null) { ret_conv_15_hu_conv.ptrs_to.AddLast(this); };
145 ret_conv_15_arr[p] = ret_conv_15_hu_conv;
147 bindings.free_buffer(ret);
148 return ret_conv_15_arr;
152 * List of addresses on which this node is reachable
154 public void set_addresses(SocketAddress[] val) {
155 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(val, val_conv_15 => val_conv_15.ptr)));
158 foreach (SocketAddress val_conv_15 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_15); }; };
161 internal long clone_ptr() {
162 long ret = bindings.UnsignedNodeAnnouncement_clone_ptr(this.ptr);
168 * Creates a copy of the UnsignedNodeAnnouncement
170 public UnsignedNodeAnnouncement clone() {
171 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
173 if (ret >= 0 && ret <= 4096) { return null; }
174 org.ldk.structs.UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedNodeAnnouncement(null, ret); }
175 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
180 * Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement.
183 long ret = bindings.UnsignedNodeAnnouncement_hash(this.ptr);
188 public override int GetHashCode() {
189 return (int)this.hash();
192 * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
193 * This ignores pointers and is_owned flags and looks at the values in fields.
194 * Two objects with NULL inner values will be considered "equal" here.
196 public bool eq(org.ldk.structs.UnsignedNodeAnnouncement b) {
197 bool ret = bindings.UnsignedNodeAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
200 if (this != null) { this.ptrs_to.AddLast(b); };
204 public override bool Equals(object o) {
205 if (!(o is UnsignedNodeAnnouncement)) return false;
206 return this.eq((UnsignedNodeAnnouncement)o);
209 * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
211 public byte[] write() {
212 long ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
214 if (ret >= 0 && ret <= 4096) { return null; }
215 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
220 * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
222 public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) {
223 long ret = bindings.UnsignedNodeAnnouncement_read(InternalUtils.encodeUint8Array(ser));
225 if (ret >= 0 && ret <= 4096) { return null; }
226 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);