Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / Ping.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * A ping message to be sent or received from a peer
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class Ping extends CommonBase {
15         Ping(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.Ping_free(ptr); }
20         }
21
22         /**
23          * The desired response length
24          */
25         public short get_ponglen() {
26                 short ret = bindings.Ping_get_ponglen(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * The desired response length
32          */
33         public void set_ponglen(short val) {
34                 bindings.Ping_set_ponglen(this.ptr, val);
35         }
36
37         /**
38          * The ping packet size.
39          * This field is not sent on the wire. byteslen zeros are sent.
40          */
41         public short get_byteslen() {
42                 short ret = bindings.Ping_get_byteslen(this.ptr);
43                 return ret;
44         }
45
46         /**
47          * The ping packet size.
48          * This field is not sent on the wire. byteslen zeros are sent.
49          */
50         public void set_byteslen(short val) {
51                 bindings.Ping_set_byteslen(this.ptr, val);
52         }
53
54         /**
55          * Constructs a new Ping given each field
56          */
57         public static Ping of(short ponglen_arg, short byteslen_arg) {
58                 long ret = bindings.Ping_new(ponglen_arg, byteslen_arg);
59                 if (ret >= 0 && ret <= 4096) { return null; }
60                 Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Ping(null, ret); }
61                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Creates a copy of the Ping
67          */
68         public Ping clone() {
69                 long ret = bindings.Ping_clone(this.ptr);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Ping(null, ret); }
72                 ret_hu_conv.ptrs_to.add(this);
73                 return ret_hu_conv;
74         }
75
76         /**
77          * Serialize the Ping object into a byte array which can be read by Ping_read
78          */
79         public byte[] write() {
80                 byte[] ret = bindings.Ping_write(this.ptr);
81                 return ret;
82         }
83
84         /**
85          * Read a Ping from a byte array, created by Ping_write
86          */
87         public static Result_PingDecodeErrorZ read(byte[] ser) {
88                 long ret = bindings.Ping_read(ser);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret);
91                 return ret_hu_conv;
92         }
93
94 }