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 ChannelId get_channel_id() {
22 long ret = bindings.Stfu_get_channel_id(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
26 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31 * The channel ID where quiescence is intended
33 public void set_channel_id(org.ldk.structs.ChannelId val) {
34 bindings.Stfu_set_channel_id(this.ptr, val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * Initiator flag, 1 if initiating, 0 if replying to an stfu.
43 public byte get_initiator() {
44 byte ret = bindings.Stfu_get_initiator(this.ptr);
50 * Initiator flag, 1 if initiating, 0 if replying to an stfu.
52 public void set_initiator(byte val) {
53 bindings.Stfu_set_initiator(this.ptr, val);
59 * Constructs a new Stfu given each field
61 public static Stfu of(org.ldk.structs.ChannelId channel_id_arg, byte initiator_arg) {
62 long ret = bindings.Stfu_new(channel_id_arg.ptr, initiator_arg);
63 GC.KeepAlive(channel_id_arg);
64 GC.KeepAlive(initiator_arg);
65 if (ret >= 0 && ret <= 4096) { return null; }
66 org.ldk.structs.Stfu ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Stfu(null, ret); }
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
72 internal long clone_ptr() {
73 long ret = bindings.Stfu_clone_ptr(this.ptr);
79 * Creates a copy of the Stfu
82 long ret = bindings.Stfu_clone(this.ptr);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.Stfu ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Stfu(null, ret); }
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91 * Checks if two Stfus contain equal inner contents.
92 * This ignores pointers and is_owned flags and looks at the values in fields.
93 * Two objects with NULL inner values will be considered "equal" here.
95 public bool eq(org.ldk.structs.Stfu b) {
96 bool ret = bindings.Stfu_eq(this.ptr, b.ptr);
99 if (this != null) { this.ptrs_to.AddLast(b); };
103 public override bool Equals(object o) {
104 if (!(o is Stfu)) return false;
105 return this.eq((Stfu)o);
108 * Serialize the Stfu object into a byte array which can be read by Stfu_read
110 public byte[] write() {
111 long ret = bindings.Stfu_write(this.ptr);
113 if (ret >= 0 && ret <= 4096) { return null; }
114 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
119 * Read a Stfu from a byte array, created by Stfu_write
121 public static Result_StfuDecodeErrorZ read(byte[] ser) {
122 long ret = bindings.Stfu_read(InternalUtils.encodeUint8Array(ser));
124 if (ret >= 0 && ret <= 4096) { return null; }
125 Result_StfuDecodeErrorZ ret_hu_conv = Result_StfuDecodeErrorZ.constr_from_ptr(ret);