[C#] Check in initial 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 or received from a peer
11  */
12 public class Pong : CommonBase {
13         internal Pong(object _dummy, long ptr) : base(ptr) { }
14         ~Pong() {
15                 if (ptr != 0) { bindings.Pong_free(ptr); }
16         }
17
18         /**
19          * The pong packet size.
20          * This field is not sent on the wire. byteslen zeros are sent.
21          */
22         public short get_byteslen() {
23                 short ret = bindings.Pong_get_byteslen(this.ptr);
24                 GC.KeepAlive(this);
25                 return ret;
26         }
27
28         /**
29          * The pong packet size.
30          * This field is not sent on the wire. byteslen zeros are sent.
31          */
32         public void set_byteslen(short val) {
33                 bindings.Pong_set_byteslen(this.ptr, val);
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * Constructs a new Pong given each field
40          */
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); };
47                 return ret_hu_conv;
48         }
49
50         internal long clone_ptr() {
51                 long ret = bindings.Pong_clone_ptr(this.ptr);
52                 GC.KeepAlive(this);
53                 return ret;
54         }
55
56         /**
57          * Creates a copy of the Pong
58          */
59         public Pong clone() {
60                 long ret = bindings.Pong_clone(this.ptr);
61                 GC.KeepAlive(this);
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); };
65                 return ret_hu_conv;
66         }
67
68         /**
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.
72          */
73         public bool eq(org.ldk.structs.Pong b) {
74                 bool ret = bindings.Pong_eq(this.ptr, b == null ? 0 : b.ptr);
75                 GC.KeepAlive(this);
76                 GC.KeepAlive(b);
77                 if (this != null) { this.ptrs_to.AddLast(b); };
78                 return ret;
79         }
80
81         public override bool Equals(object o) {
82                 if (!(o is Pong)) return false;
83                 return this.eq((Pong)o);
84         }
85         /**
86          * Serialize the Pong object into a byte array which can be read by Pong_read
87          */
88         public byte[] write() {
89                 byte[] ret = bindings.Pong_write(this.ptr);
90                 GC.KeepAlive(this);
91                 return ret;
92         }
93
94         /**
95          * Read a Pong from a byte array, created by Pong_write
96          */
97         public static Result_PongDecodeErrorZ read(byte[] ser) {
98                 long ret = bindings.Pong_read(ser);
99                 GC.KeepAlive(ser);
100                 if (ret >= 0 && ret <= 4096) { return null; }
101                 Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret);
102                 return ret_hu_conv;
103         }
104
105 }
106 } } }