e4f97698df2d0b1bc75d03070910c06658aef4a2
[ldk-java] / c_sharp / src / org / ldk / structs / ReplyChannelRange.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 reply_channel_range message is a reply to a query_channel_range
11  * message. Multiple reply_channel_range messages can be sent in reply
12  * to a single query_channel_range message. The query recipient makes a
13  * best effort to respond based on their local network view which may
14  * not be a perfect view of the network. The short_channel_ids in the
15  * reply are encoded. We only support encoding_type=0 uncompressed
16  * serialization and do not support encoding_type=1 zlib serialization.
17  */
18 public class ReplyChannelRange : CommonBase {
19         internal ReplyChannelRange(object _dummy, long ptr) : base(ptr) { }
20         ~ReplyChannelRange() {
21                 if (ptr != 0) { bindings.ReplyChannelRange_free(ptr); }
22         }
23
24         /**
25          * The genesis hash of the blockchain being queried
26          */
27         public byte[] get_chain_hash() {
28                 byte[] ret = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
29                 GC.KeepAlive(this);
30                 return ret;
31         }
32
33         /**
34          * The genesis hash of the blockchain being queried
35          */
36         public void set_chain_hash(byte[] val) {
37                 bindings.ReplyChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
38                 GC.KeepAlive(this);
39                 GC.KeepAlive(val);
40         }
41
42         /**
43          * The height of the first block in the range of the reply
44          */
45         public int get_first_blocknum() {
46                 int ret = bindings.ReplyChannelRange_get_first_blocknum(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * The height of the first block in the range of the reply
53          */
54         public void set_first_blocknum(int val) {
55                 bindings.ReplyChannelRange_set_first_blocknum(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * The number of blocks included in the range of the reply
62          */
63         public int get_number_of_blocks() {
64                 int ret = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr);
65                 GC.KeepAlive(this);
66                 return ret;
67         }
68
69         /**
70          * The number of blocks included in the range of the reply
71          */
72         public void set_number_of_blocks(int val) {
73                 bindings.ReplyChannelRange_set_number_of_blocks(this.ptr, val);
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * True when this is the final reply for a query
80          */
81         public bool get_sync_complete() {
82                 bool ret = bindings.ReplyChannelRange_get_sync_complete(this.ptr);
83                 GC.KeepAlive(this);
84                 return ret;
85         }
86
87         /**
88          * True when this is the final reply for a query
89          */
90         public void set_sync_complete(bool val) {
91                 bindings.ReplyChannelRange_set_sync_complete(this.ptr, val);
92                 GC.KeepAlive(this);
93                 GC.KeepAlive(val);
94         }
95
96         /**
97          * The short_channel_ids in the channel range
98          * 
99          * Returns a copy of the field.
100          */
101         public long[] get_short_channel_ids() {
102                 long[] ret = bindings.ReplyChannelRange_get_short_channel_ids(this.ptr);
103                 GC.KeepAlive(this);
104                 return ret;
105         }
106
107         /**
108          * The short_channel_ids in the channel range
109          */
110         public void set_short_channel_ids(long[] val) {
111                 bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, val);
112                 GC.KeepAlive(this);
113                 GC.KeepAlive(val);
114         }
115
116         /**
117          * Constructs a new ReplyChannelRange given each field
118          */
119         public static ReplyChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg, bool sync_complete_arg, long[] short_channel_ids_arg) {
120                 long ret = bindings.ReplyChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg);
121                 GC.KeepAlive(chain_hash_arg);
122                 GC.KeepAlive(first_blocknum_arg);
123                 GC.KeepAlive(number_of_blocks_arg);
124                 GC.KeepAlive(sync_complete_arg);
125                 GC.KeepAlive(short_channel_ids_arg);
126                 if (ret >= 0 && ret <= 4096) { return null; }
127                 org.ldk.structs.ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyChannelRange(null, ret); }
128                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
129                 return ret_hu_conv;
130         }
131
132         internal long clone_ptr() {
133                 long ret = bindings.ReplyChannelRange_clone_ptr(this.ptr);
134                 GC.KeepAlive(this);
135                 return ret;
136         }
137
138         /**
139          * Creates a copy of the ReplyChannelRange
140          */
141         public ReplyChannelRange clone() {
142                 long ret = bindings.ReplyChannelRange_clone(this.ptr);
143                 GC.KeepAlive(this);
144                 if (ret >= 0 && ret <= 4096) { return null; }
145                 org.ldk.structs.ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyChannelRange(null, ret); }
146                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
147                 return ret_hu_conv;
148         }
149
150         /**
151          * Checks if two ReplyChannelRanges contain equal inner contents.
152          * This ignores pointers and is_owned flags and looks at the values in fields.
153          * Two objects with NULL inner values will be considered "equal" here.
154          */
155         public bool eq(org.ldk.structs.ReplyChannelRange b) {
156                 bool ret = bindings.ReplyChannelRange_eq(this.ptr, b == null ? 0 : b.ptr);
157                 GC.KeepAlive(this);
158                 GC.KeepAlive(b);
159                 if (this != null) { this.ptrs_to.AddLast(b); };
160                 return ret;
161         }
162
163         public override bool Equals(object o) {
164                 if (!(o is ReplyChannelRange)) return false;
165                 return this.eq((ReplyChannelRange)o);
166         }
167         /**
168          * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
169          */
170         public static Result_ReplyChannelRangeDecodeErrorZ read(byte[] ser) {
171                 long ret = bindings.ReplyChannelRange_read(ser);
172                 GC.KeepAlive(ser);
173                 if (ret >= 0 && ret <= 4096) { return null; }
174                 Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret);
175                 return ret_hu_conv;
176         }
177
178         /**
179          * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
180          */
181         public byte[] write() {
182                 byte[] ret = bindings.ReplyChannelRange_write(this.ptr);
183                 GC.KeepAlive(this);
184                 return ret;
185         }
186
187 }
188 } } }