6 namespace org { namespace ldk { namespace structs {
10 * A pong message to be sent or received from a peer
12 public class Pong : CommonBase {
13 internal Pong(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.Pong_free(ptr); }
19 * The pong packet size.
20 * This field is not sent on the wire. byteslen zeros are sent.
22 public short get_byteslen() {
23 short ret = bindings.Pong_get_byteslen(this.ptr);
29 * The pong packet size.
30 * This field is not sent on the wire. byteslen zeros are sent.
32 public void set_byteslen(short val) {
33 bindings.Pong_set_byteslen(this.ptr, val);
39 * Constructs a new Pong given each field
41 public static Pong of(short byteslen_arg) {
42 long ret = bindings.Pong_new(byteslen_arg);
43 GC.KeepAlive(byteslen_arg);
44 if (ret >= 0 && ret <= 4096) { return null; }
45 org.ldk.structs.Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Pong(null, ret); }
46 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
50 internal long clone_ptr() {
51 long ret = bindings.Pong_clone_ptr(this.ptr);
57 * Creates a copy of the Pong
60 long ret = bindings.Pong_clone(this.ptr);
62 if (ret >= 0 && ret <= 4096) { return null; }
63 org.ldk.structs.Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Pong(null, ret); }
64 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
69 * Checks if two Pongs contain equal inner contents.
70 * This ignores pointers and is_owned flags and looks at the values in fields.
71 * Two objects with NULL inner values will be considered "equal" here.
73 public bool eq(org.ldk.structs.Pong b) {
74 bool ret = bindings.Pong_eq(this.ptr, b == null ? 0 : b.ptr);
77 if (this != null) { this.ptrs_to.AddLast(b); };
81 public override bool Equals(object o) {
82 if (!(o is Pong)) return false;
83 return this.eq((Pong)o);
86 * Serialize the Pong object into a byte array which can be read by Pong_read
88 public byte[] write() {
89 byte[] ret = bindings.Pong_write(this.ptr);
95 * Read a Pong from a byte array, created by Pong_write
97 public static Result_PongDecodeErrorZ read(byte[] ser) {
98 long ret = bindings.Pong_read(ser);
100 if (ret >= 0 && ret <= 4096) { return null; }
101 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);