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