6 namespace org { namespace ldk { namespace structs {
10 * Details about a node in the network, known from the network announcement.
12 public class NodeInfo : CommonBase {
13 internal NodeInfo(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.NodeInfo_free(ptr); }
19 * All valid channels a node has announced
21 * Returns a copy of the field.
23 public long[] get_channels() {
24 long ret = bindings.NodeInfo_get_channels(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 long[] ret_conv = InternalUtils.decodeUint64Array(ret);
32 * All valid channels a node has announced
34 public void set_channels(long[] val) {
35 bindings.NodeInfo_set_channels(this.ptr, InternalUtils.encodeUint64Array(val));
41 * More information about a node from node_announcement.
42 * Optional because we store a Node entry after learning about it from
43 * a channel announcement, but before receiving a node announcement.
45 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47 public NodeAnnouncementInfo get_announcement_info() {
48 long ret = bindings.NodeInfo_get_announcement_info(this.ptr);
50 if (ret >= 0 && ret <= 4096) { return null; }
51 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
52 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
57 * More information about a node from node_announcement.
58 * Optional because we store a Node entry after learning about it from
59 * a channel announcement, but before receiving a node announcement.
61 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
63 public void set_announcement_info(org.ldk.structs.NodeAnnouncementInfo val) {
64 bindings.NodeInfo_set_announcement_info(this.ptr, val == null ? 0 : val.ptr);
67 if (this != null) { this.ptrs_to.AddLast(val); };
71 * Constructs a new NodeInfo given each field
73 * Note that announcement_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
75 public static NodeInfo of(long[] channels_arg, org.ldk.structs.NodeAnnouncementInfo announcement_info_arg) {
76 long ret = bindings.NodeInfo_new(InternalUtils.encodeUint64Array(channels_arg), announcement_info_arg == null ? 0 : announcement_info_arg.ptr);
77 GC.KeepAlive(channels_arg);
78 GC.KeepAlive(announcement_info_arg);
79 if (ret >= 0 && ret <= 4096) { return null; }
80 org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); }
81 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
82 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(announcement_info_arg); };
86 internal long clone_ptr() {
87 long ret = bindings.NodeInfo_clone_ptr(this.ptr);
93 * Creates a copy of the NodeInfo
95 public NodeInfo clone() {
96 long ret = bindings.NodeInfo_clone(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); }
100 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105 * Checks if two NodeInfos contain equal inner contents.
106 * This ignores pointers and is_owned flags and looks at the values in fields.
107 * Two objects with NULL inner values will be considered "equal" here.
109 public bool eq(org.ldk.structs.NodeInfo b) {
110 bool ret = bindings.NodeInfo_eq(this.ptr, b.ptr);
113 if (this != null) { this.ptrs_to.AddLast(b); };
117 public override bool Equals(object o) {
118 if (!(o is NodeInfo)) return false;
119 return this.eq((NodeInfo)o);
122 * Returns whether the node has only announced Tor addresses.
124 public bool is_tor_only() {
125 bool ret = bindings.NodeInfo_is_tor_only(this.ptr);
131 * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
133 public byte[] write() {
134 long ret = bindings.NodeInfo_write(this.ptr);
136 if (ret >= 0 && ret <= 4096) { return null; }
137 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
142 * Read a NodeInfo from a byte array, created by NodeInfo_write
144 public static Result_NodeInfoDecodeErrorZ read(byte[] ser) {
145 long ret = bindings.NodeInfo_read(InternalUtils.encodeUint8Array(ser));
147 if (ret >= 0 && ret <= 4096) { return null; }
148 Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret);