[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Pong.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 [`pong`] message to be sent to or received from a peer.
11  * 
12  * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
13  */
14 public class Pong : CommonBase {
15         internal Pong(object _dummy, long ptr) : base(ptr) { }
16         ~Pong() {
17                 if (ptr != 0) { bindings.Pong_free(ptr); }
18         }
19
20         /**
21          * The pong packet size.
22          * 
23          * This field is not sent on the wire. byteslen zeros are sent.
24          */
25         public short get_byteslen() {
26                 short ret = bindings.Pong_get_byteslen(this.ptr);
27                 GC.KeepAlive(this);
28                 return ret;
29         }
30
31         /**
32          * The pong packet size.
33          * 
34          * This field is not sent on the wire. byteslen zeros are sent.
35          */
36         public void set_byteslen(short val) {
37                 bindings.Pong_set_byteslen(this.ptr, val);
38                 GC.KeepAlive(this);
39                 GC.KeepAlive(val);
40         }
41
42         /**
43          * Constructs a new Pong given each field
44          */
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); };
51                 return ret_hu_conv;
52         }
53
54         internal long clone_ptr() {
55                 long ret = bindings.Pong_clone_ptr(this.ptr);
56                 GC.KeepAlive(this);
57                 return ret;
58         }
59
60         /**
61          * Creates a copy of the Pong
62          */
63         public Pong clone() {
64                 long ret = bindings.Pong_clone(this.ptr);
65                 GC.KeepAlive(this);
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); };
69                 return ret_hu_conv;
70         }
71
72         /**
73          * Checks if two Pongs contain equal inner contents.
74          * This ignores pointers and is_owned flags and looks at the values in fields.
75          * Two objects with NULL inner values will be considered "equal" here.
76          */
77         public bool eq(org.ldk.structs.Pong b) {
78                 bool ret = bindings.Pong_eq(this.ptr, b == null ? 0 : b.ptr);
79                 GC.KeepAlive(this);
80                 GC.KeepAlive(b);
81                 if (this != null) { this.ptrs_to.AddLast(b); };
82                 return ret;
83         }
84
85         public override bool Equals(object o) {
86                 if (!(o is Pong)) return false;
87                 return this.eq((Pong)o);
88         }
89         /**
90          * Serialize the Pong object into a byte array which can be read by Pong_read
91          */
92         public byte[] write() {
93                 long ret = bindings.Pong_write(this.ptr);
94                 GC.KeepAlive(this);
95                 if (ret >= 0 && ret <= 4096) { return null; }
96                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
97                 return ret_conv;
98         }
99
100         /**
101          * Read a Pong from a byte array, created by Pong_write
102          */
103         public static Result_PongDecodeErrorZ read(byte[] ser) {
104                 long ret = bindings.Pong_read(InternalUtils.encodeUint8Array(ser));
105                 GC.KeepAlive(ser);
106                 if (ret >= 0 && ret <= 4096) { return null; }
107                 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);
108                 return ret_hu_conv;
109         }
110
111 }
112 } } }