[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / UpdateFailMalformedHTLC.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  * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer.
11  * 
12  * [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
13  */
14 public class UpdateFailMalformedHTLC : CommonBase {
15         internal UpdateFailMalformedHTLC(object _dummy, long ptr) : base(ptr) { }
16         ~UpdateFailMalformedHTLC() {
17                 if (ptr != 0) { bindings.UpdateFailMalformedHTLC_free(ptr); }
18         }
19
20         /**
21          * The channel ID
22          */
23         public ChannelId get_channel_id() {
24                 long ret = bindings.UpdateFailMalformedHTLC_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
28                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
29                 return ret_hu_conv;
30         }
31
32         /**
33          * The channel ID
34          */
35         public void set_channel_id(org.ldk.structs.ChannelId val) {
36                 bindings.UpdateFailMalformedHTLC_set_channel_id(this.ptr, val.ptr);
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39                 if (this != null) { this.ptrs_to.AddLast(val); };
40         }
41
42         /**
43          * The HTLC ID
44          */
45         public long get_htlc_id() {
46                 long ret = bindings.UpdateFailMalformedHTLC_get_htlc_id(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * The HTLC ID
53          */
54         public void set_htlc_id(long val) {
55                 bindings.UpdateFailMalformedHTLC_set_htlc_id(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * The failure code
62          */
63         public short get_failure_code() {
64                 short ret = bindings.UpdateFailMalformedHTLC_get_failure_code(this.ptr);
65                 GC.KeepAlive(this);
66                 return ret;
67         }
68
69         /**
70          * The failure code
71          */
72         public void set_failure_code(short val) {
73                 bindings.UpdateFailMalformedHTLC_set_failure_code(this.ptr, val);
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         internal long clone_ptr() {
79                 long ret = bindings.UpdateFailMalformedHTLC_clone_ptr(this.ptr);
80                 GC.KeepAlive(this);
81                 return ret;
82         }
83
84         /**
85          * Creates a copy of the UpdateFailMalformedHTLC
86          */
87         public UpdateFailMalformedHTLC clone() {
88                 long ret = bindings.UpdateFailMalformedHTLC_clone(this.ptr);
89                 GC.KeepAlive(this);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 org.ldk.structs.UpdateFailMalformedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFailMalformedHTLC(null, ret); }
92                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
93                 return ret_hu_conv;
94         }
95
96         /**
97          * Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC.
98          */
99         public long hash() {
100                 long ret = bindings.UpdateFailMalformedHTLC_hash(this.ptr);
101                 GC.KeepAlive(this);
102                 return ret;
103         }
104
105         public override int GetHashCode() {
106                 return (int)this.hash();
107         }
108         /**
109          * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
110          * This ignores pointers and is_owned flags and looks at the values in fields.
111          * Two objects with NULL inner values will be considered "equal" here.
112          */
113         public bool eq(org.ldk.structs.UpdateFailMalformedHTLC b) {
114                 bool ret = bindings.UpdateFailMalformedHTLC_eq(this.ptr, b.ptr);
115                 GC.KeepAlive(this);
116                 GC.KeepAlive(b);
117                 if (this != null) { this.ptrs_to.AddLast(b); };
118                 return ret;
119         }
120
121         public override bool Equals(object o) {
122                 if (!(o is UpdateFailMalformedHTLC)) return false;
123                 return this.eq((UpdateFailMalformedHTLC)o);
124         }
125         /**
126          * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
127          */
128         public byte[] write() {
129                 long ret = bindings.UpdateFailMalformedHTLC_write(this.ptr);
130                 GC.KeepAlive(this);
131                 if (ret >= 0 && ret <= 4096) { return null; }
132                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
133                 return ret_conv;
134         }
135
136         /**
137          * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
138          */
139         public static Result_UpdateFailMalformedHTLCDecodeErrorZ read(byte[] ser) {
140                 long ret = bindings.UpdateFailMalformedHTLC_read(InternalUtils.encodeUint8Array(ser));
141                 GC.KeepAlive(ser);
142                 if (ret >= 0 && ret <= 4096) { return null; }
143                 Result_UpdateFailMalformedHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailMalformedHTLCDecodeErrorZ.constr_from_ptr(ret);
144                 return ret_hu_conv;
145         }
146
147 }
148 } } }