[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Ping.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * A [`ping`] message to be sent to or received from a peer.
11  * 
12  * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
13  */
14 public class Ping : CommonBase {
15         internal Ping(object _dummy, long ptr) : base(ptr) { }
16         ~Ping() {
17                 if (ptr != 0) { bindings.Ping_free(ptr); }
18         }
19
20         /**
21          * The desired response length.
22          */
23         public short get_ponglen() {
24                 short ret = bindings.Ping_get_ponglen(this.ptr);
25                 GC.KeepAlive(this);
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                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * The ping packet size.
40          * 
41          * This field is not sent on the wire. byteslen zeros are sent.
42          */
43         public short get_byteslen() {
44                 short ret = bindings.Ping_get_byteslen(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * The ping packet size.
51          * 
52          * This field is not sent on the wire. byteslen zeros are sent.
53          */
54         public void set_byteslen(short val) {
55                 bindings.Ping_set_byteslen(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * Constructs a new Ping given each field
62          */
63         public static Ping of(short ponglen_arg, short byteslen_arg) {
64                 long ret = bindings.Ping_new(ponglen_arg, byteslen_arg);
65                 GC.KeepAlive(ponglen_arg);
66                 GC.KeepAlive(byteslen_arg);
67                 if (ret >= 0 && ret <= 4096) { return null; }
68                 org.ldk.structs.Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Ping(null, ret); }
69                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70                 return ret_hu_conv;
71         }
72
73         internal long clone_ptr() {
74                 long ret = bindings.Ping_clone_ptr(this.ptr);
75                 GC.KeepAlive(this);
76                 return ret;
77         }
78
79         /**
80          * Creates a copy of the Ping
81          */
82         public Ping clone() {
83                 long ret = bindings.Ping_clone(this.ptr);
84                 GC.KeepAlive(this);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 org.ldk.structs.Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Ping(null, ret); }
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
88                 return ret_hu_conv;
89         }
90
91         /**
92          * Checks if two Pings contain equal inner contents.
93          * This ignores pointers and is_owned flags and looks at the values in fields.
94          * Two objects with NULL inner values will be considered "equal" here.
95          */
96         public bool eq(org.ldk.structs.Ping b) {
97                 bool ret = bindings.Ping_eq(this.ptr, b == null ? 0 : b.ptr);
98                 GC.KeepAlive(this);
99                 GC.KeepAlive(b);
100                 if (this != null) { this.ptrs_to.AddLast(b); };
101                 return ret;
102         }
103
104         public override bool Equals(object o) {
105                 if (!(o is Ping)) return false;
106                 return this.eq((Ping)o);
107         }
108         /**
109          * Serialize the Ping object into a byte array which can be read by Ping_read
110          */
111         public byte[] write() {
112                 long ret = bindings.Ping_write(this.ptr);
113                 GC.KeepAlive(this);
114                 if (ret >= 0 && ret <= 4096) { return null; }
115                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
116                 return ret_conv;
117         }
118
119         /**
120          * Read a Ping from a byte array, created by Ping_write
121          */
122         public static Result_PingDecodeErrorZ read(byte[] ser) {
123                 long ret = bindings.Ping_read(InternalUtils.encodeUint8Array(ser));
124                 GC.KeepAlive(ser);
125                 if (ret >= 0 && ret <= 4096) { return null; }
126                 Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret);
127                 return ret_hu_conv;
128         }
129
130 }
131 } } }