1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A channel_reestablish message to be sent or received from a peer
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelReestablish extends CommonBase {
16 ChannelReestablish(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ChannelReestablish_free(ptr); }
26 public byte[] get_channel_id() {
27 byte[] ret = bindings.ChannelReestablish_get_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
35 public void set_channel_id(byte[] val) {
36 bindings.ChannelReestablish_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * The next commitment number for the sender
44 public long get_next_local_commitment_number() {
45 long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr);
46 Reference.reachabilityFence(this);
51 * The next commitment number for the sender
53 public void set_next_local_commitment_number(long val) {
54 bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val);
55 Reference.reachabilityFence(this);
56 Reference.reachabilityFence(val);
60 * The next commitment number for the recipient
62 public long get_next_remote_commitment_number() {
63 long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr);
64 Reference.reachabilityFence(this);
69 * The next commitment number for the recipient
71 public void set_next_remote_commitment_number(long val) {
72 bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val);
73 Reference.reachabilityFence(this);
74 Reference.reachabilityFence(val);
78 long ret = bindings.ChannelReestablish_clone_ptr(this.ptr);
79 Reference.reachabilityFence(this);
84 * Creates a copy of the ChannelReestablish
86 public ChannelReestablish clone() {
87 long ret = bindings.ChannelReestablish_clone(this.ptr);
88 Reference.reachabilityFence(this);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
96 * Checks if two ChannelReestablishs contain equal inner contents.
97 * This ignores pointers and is_owned flags and looks at the values in fields.
98 * Two objects with NULL inner values will be considered "equal" here.
100 public boolean eq(ChannelReestablish b) {
101 boolean ret = bindings.ChannelReestablish_eq(this.ptr, b == null ? 0 : b.ptr);
102 Reference.reachabilityFence(this);
103 Reference.reachabilityFence(b);
104 if (this != null) { this.ptrs_to.add(b); };
108 @Override public boolean equals(Object o) {
109 if (!(o instanceof ChannelReestablish)) return false;
110 return this.eq((ChannelReestablish)o);
113 * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
115 public byte[] write() {
116 byte[] ret = bindings.ChannelReestablish_write(this.ptr);
117 Reference.reachabilityFence(this);
122 * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
124 public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) {
125 long ret = bindings.ChannelReestablish_read(ser);
126 Reference.reachabilityFence(ser);
127 if (ret >= 0 && ret <= 4096) { return null; }
128 Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret);