6 namespace org { namespace ldk { namespace structs {
10 * An init message to be sent or received from a peer
12 public class Init : CommonBase {
13 internal Init(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.Init_free(ptr); }
19 * The relevant features which the sender supports
21 public InitFeatures get_features() {
22 long ret = bindings.Init_get_features(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
26 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31 * The relevant features which the sender supports
33 public void set_features(org.ldk.structs.InitFeatures val) {
34 bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * The receipient's network address. This adds the option to report a remote IP address
42 * back to a connecting peer using the init message. A node can decide to use that information
43 * to discover a potential update to its public IPv4 address (NAT) and use
44 * that for a node_announcement update message containing the new address.
46 public Option_NetAddressZ get_remote_network_address() {
47 long ret = bindings.Init_get_remote_network_address(this.ptr);
49 if (ret >= 0 && ret <= 4096) { return null; }
50 org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret);
51 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
56 * The receipient's network address. This adds the option to report a remote IP address
57 * back to a connecting peer using the init message. A node can decide to use that information
58 * to discover a potential update to its public IPv4 address (NAT) and use
59 * that for a node_announcement update message containing the new address.
61 public void set_remote_network_address(org.ldk.structs.Option_NetAddressZ val) {
62 bindings.Init_set_remote_network_address(this.ptr, val.ptr);
68 * Constructs a new Init given each field
70 public static Init of(org.ldk.structs.InitFeatures features_arg, org.ldk.structs.Option_NetAddressZ remote_network_address_arg) {
71 long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr, remote_network_address_arg.ptr);
72 GC.KeepAlive(features_arg);
73 GC.KeepAlive(remote_network_address_arg);
74 if (ret >= 0 && ret <= 4096) { return null; }
75 org.ldk.structs.Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Init(null, ret); }
76 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
77 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(features_arg); };
81 internal long clone_ptr() {
82 long ret = bindings.Init_clone_ptr(this.ptr);
88 * Creates a copy of the Init
91 long ret = bindings.Init_clone(this.ptr);
93 if (ret >= 0 && ret <= 4096) { return null; }
94 org.ldk.structs.Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Init(null, ret); }
95 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
100 * Checks if two Inits contain equal inner contents.
101 * This ignores pointers and is_owned flags and looks at the values in fields.
102 * Two objects with NULL inner values will be considered "equal" here.
104 public bool eq(org.ldk.structs.Init b) {
105 bool ret = bindings.Init_eq(this.ptr, b == null ? 0 : b.ptr);
108 if (this != null) { this.ptrs_to.AddLast(b); };
112 public override bool Equals(object o) {
113 if (!(o is Init)) return false;
114 return this.eq((Init)o);
117 * Serialize the Init object into a byte array which can be read by Init_read
119 public byte[] write() {
120 byte[] ret = bindings.Init_write(this.ptr);
126 * Read a Init from a byte array, created by Init_write
128 public static Result_InitDecodeErrorZ read(byte[] ser) {
129 long ret = bindings.Init_read(ser);
131 if (ret >= 0 && ret <= 4096) { return null; }
132 Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret);