X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInit.java;h=dd30adbae226724931c95ea7a7b3b22b685495ed;hb=b358c36fdbe1137bdf1bb786e30c8e14e2e5bc0f;hp=12236335695c3b8b28b94470fae1631ca5e88b0d;hpb=aa0e2aade37133339f4113a0cd7465b111f0a0d0;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index 12236335..dd30adba 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -5,6 +5,10 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * An init message to be sent or received from a peer + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Init extends CommonBase { Init(Object _dummy, long ptr) { super(ptr); } @@ -14,22 +18,59 @@ public class Init extends CommonBase { if (ptr != 0) { bindings.Init_free(ptr); } } - public static Init constructor_clone(Init orig) { - long ret = bindings.Init_clone(orig == null ? 0 : orig.ptr & ~1); + /** + * The relevant features which the sender supports + */ + public InitFeatures get_features() { + long ret = bindings.Init_get_features(this.ptr); + InitFeatures ret_hu_conv = new InitFeatures(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * The relevant features which the sender supports + */ + public void set_features(InitFeatures val) { + bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + /** + * Constructs a new Init given each field + */ + public static Init of(InitFeatures features_arg) { + long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1); Init ret_hu_conv = new Init(null, ret); - ret_hu_conv.ptrs_to.add(orig); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(features_arg); return ret_hu_conv; } - public byte[] write(Init obj) { - byte[] ret = bindings.Init_write(obj == null ? 0 : obj.ptr & ~1); - this.ptrs_to.add(obj); + /** + * Creates a copy of the Init + */ + public Init clone() { + long ret = bindings.Init_clone(this.ptr); + Init ret_hu_conv = new Init(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the Init object into a byte array which can be read by Init_read + */ + public byte[] write() { + byte[] ret = bindings.Init_write(this.ptr); return ret; } - public static Init constructor_read(byte[] ser) { + /** + * Read a Init from a byte array, created by Init_write + */ + public static Result_InitDecodeErrorZ read(byte[] ser) { long ret = bindings.Init_read(ser); - Init ret_hu_conv = new Init(null, ret); + Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }