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