6 namespace org { namespace ldk { namespace structs {
10 * A [`pong`] message to be sent to or received from a peer.
12 * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
14 public class Pong : CommonBase {
15 internal Pong(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.Pong_free(ptr); }
21 * The pong packet size.
23 * This field is not sent on the wire. byteslen zeros are sent.
25 public short get_byteslen() {
26 short ret = bindings.Pong_get_byteslen(this.ptr);
32 * The pong packet size.
34 * This field is not sent on the wire. byteslen zeros are sent.
36 public void set_byteslen(short val) {
37 bindings.Pong_set_byteslen(this.ptr, val);
43 * Constructs a new Pong given each field
45 public static Pong of(short byteslen_arg) {
46 long ret = bindings.Pong_new(byteslen_arg);
47 GC.KeepAlive(byteslen_arg);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Pong(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
54 internal long clone_ptr() {
55 long ret = bindings.Pong_clone_ptr(this.ptr);
61 * Creates a copy of the Pong
64 long ret = bindings.Pong_clone(this.ptr);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Pong(null, ret); }
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
73 * Generates a non-cryptographic 64-bit hash of the Pong.
76 long ret = bindings.Pong_hash(this.ptr);
81 public override int GetHashCode() {
82 return (int)this.hash();
85 * Checks if two Pongs contain equal inner contents.
86 * This ignores pointers and is_owned flags and looks at the values in fields.
87 * Two objects with NULL inner values will be considered "equal" here.
89 public bool eq(org.ldk.structs.Pong b) {
90 bool ret = bindings.Pong_eq(this.ptr, b == null ? 0 : b.ptr);
93 if (this != null) { this.ptrs_to.AddLast(b); };
97 public override bool Equals(object o) {
98 if (!(o is Pong)) return false;
99 return this.eq((Pong)o);
102 * Serialize the Pong object into a byte array which can be read by Pong_read
104 public byte[] write() {
105 long ret = bindings.Pong_write(this.ptr);
107 if (ret >= 0 && ret <= 4096) { return null; }
108 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
113 * Read a Pong from a byte array, created by Pong_write
115 public static Result_PongDecodeErrorZ read(byte[] ser) {
116 long ret = bindings.Pong_read(InternalUtils.encodeUint8Array(ser));
118 if (ret >= 0 && ret <= 4096) { return null; }
119 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);