a733a8077c3b87378f27539918939bf9b9a0db91
[ldk-java] / c_sharp / src / org / ldk / structs / UpdateFailHTLC.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_htlc message to be sent or received from a peer
11  */
12 public class UpdateFailHTLC : CommonBase {
13         internal UpdateFailHTLC(object _dummy, long ptr) : base(ptr) { }
14         ~UpdateFailHTLC() {
15                 if (ptr != 0) { bindings.UpdateFailHTLC_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public byte[] get_channel_id() {
22                 byte[] ret = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * The channel ID
29          */
30         public void set_channel_id(byte[] val) {
31                 bindings.UpdateFailHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * The HTLC ID
38          */
39         public long get_htlc_id() {
40                 long ret = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
41                 GC.KeepAlive(this);
42                 return ret;
43         }
44
45         /**
46          * The HTLC ID
47          */
48         public void set_htlc_id(long val) {
49                 bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val);
50                 GC.KeepAlive(this);
51                 GC.KeepAlive(val);
52         }
53
54         internal long clone_ptr() {
55                 long ret = bindings.UpdateFailHTLC_clone_ptr(this.ptr);
56                 GC.KeepAlive(this);
57                 return ret;
58         }
59
60         /**
61          * Creates a copy of the UpdateFailHTLC
62          */
63         public UpdateFailHTLC clone() {
64                 long ret = bindings.UpdateFailHTLC_clone(this.ptr);
65                 GC.KeepAlive(this);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 org.ldk.structs.UpdateFailHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFailHTLC(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 UpdateFailHTLCs 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.UpdateFailHTLC b) {
78                 bool ret = bindings.UpdateFailHTLC_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 UpdateFailHTLC)) return false;
87                 return this.eq((UpdateFailHTLC)o);
88         }
89         /**
90          * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
91          */
92         public byte[] write() {
93                 byte[] ret = bindings.UpdateFailHTLC_write(this.ptr);
94                 GC.KeepAlive(this);
95                 return ret;
96         }
97
98         /**
99          * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
100          */
101         public static Result_UpdateFailHTLCDecodeErrorZ read(byte[] ser) {
102                 long ret = bindings.UpdateFailHTLC_read(ser);
103                 GC.KeepAlive(ser);
104                 if (ret >= 0 && ret <= 4096) { return null; }
105                 Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret);
106                 return ret_hu_conv;
107         }
108
109 }
110 } } }