6 namespace org { namespace ldk { namespace structs {
10 * An stfu (quiescence) message to be sent by or received from the stfu initiator.
12 public class Stfu : CommonBase {
13 internal Stfu(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.Stfu_free(ptr); }
19 * The channel ID where quiescence is intended
21 public byte[] get_channel_id() {
22 long ret = bindings.Stfu_get_channel_id(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
30 * The channel ID where quiescence is intended
32 public void set_channel_id(byte[] val) {
33 bindings.Stfu_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
39 * Initiator flag, 1 if initiating, 0 if replying to an stfu.
41 public byte get_initiator() {
42 byte ret = bindings.Stfu_get_initiator(this.ptr);
48 * Initiator flag, 1 if initiating, 0 if replying to an stfu.
50 public void set_initiator(byte val) {
51 bindings.Stfu_set_initiator(this.ptr, val);
57 * Constructs a new Stfu given each field
59 public static Stfu of(byte[] channel_id_arg, byte initiator_arg) {
60 long ret = bindings.Stfu_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), initiator_arg);
61 GC.KeepAlive(channel_id_arg);
62 GC.KeepAlive(initiator_arg);
63 if (ret >= 0 && ret <= 4096) { return null; }
64 org.ldk.structs.Stfu ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Stfu(null, ret); }
65 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
69 internal long clone_ptr() {
70 long ret = bindings.Stfu_clone_ptr(this.ptr);
76 * Creates a copy of the Stfu
79 long ret = bindings.Stfu_clone(this.ptr);
81 if (ret >= 0 && ret <= 4096) { return null; }
82 org.ldk.structs.Stfu ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Stfu(null, ret); }
83 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
88 * Checks if two Stfus contain equal inner contents.
89 * This ignores pointers and is_owned flags and looks at the values in fields.
90 * Two objects with NULL inner values will be considered "equal" here.
92 public bool eq(org.ldk.structs.Stfu b) {
93 bool ret = bindings.Stfu_eq(this.ptr, b == null ? 0 : b.ptr);
96 if (this != null) { this.ptrs_to.AddLast(b); };
100 public override bool Equals(object o) {
101 if (!(o is Stfu)) return false;
102 return this.eq((Stfu)o);
105 * Serialize the Stfu object into a byte array which can be read by Stfu_read
107 public byte[] write() {
108 long ret = bindings.Stfu_write(this.ptr);
110 if (ret >= 0 && ret <= 4096) { return null; }
111 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
116 * Read a Stfu from a byte array, created by Stfu_write
118 public static Result_StfuDecodeErrorZ read(byte[] ser) {
119 long ret = bindings.Stfu_read(InternalUtils.encodeUint8Array(ser));
121 if (ret >= 0 && ret <= 4096) { return null; }
122 Result_StfuDecodeErrorZ ret_hu_conv = Result_StfuDecodeErrorZ.constr_from_ptr(ret);