25ea1879609988925517d821bd340d8436569de6
[ldk-java] / c_sharp / src / org / ldk / structs / QueryShortChannelIds.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 query_short_channel_ids message is used to query a peer for
11  * routing gossip messages related to one or more short_channel_ids.
12  * The query recipient will reply with the latest, if available,
13  * channel_announcement, channel_update and node_announcement messages
14  * it maintains for the requested short_channel_ids followed by a
15  * reply_short_channel_ids_end message. The short_channel_ids sent in
16  * this query are encoded. We only support encoding_type=0 uncompressed
17  * serialization and do not support encoding_type=1 zlib serialization.
18  */
19 public class QueryShortChannelIds : CommonBase {
20         internal QueryShortChannelIds(object _dummy, long ptr) : base(ptr) { }
21         ~QueryShortChannelIds() {
22                 if (ptr != 0) { bindings.QueryShortChannelIds_free(ptr); }
23         }
24
25         /**
26          * The genesis hash of the blockchain being queried
27          */
28         public byte[] get_chain_hash() {
29                 byte[] ret = bindings.QueryShortChannelIds_get_chain_hash(this.ptr);
30                 GC.KeepAlive(this);
31                 return ret;
32         }
33
34         /**
35          * The genesis hash of the blockchain being queried
36          */
37         public void set_chain_hash(byte[] val) {
38                 bindings.QueryShortChannelIds_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
39                 GC.KeepAlive(this);
40                 GC.KeepAlive(val);
41         }
42
43         /**
44          * The short_channel_ids that are being queried
45          * 
46          * Returns a copy of the field.
47          */
48         public long[] get_short_channel_ids() {
49                 long[] ret = bindings.QueryShortChannelIds_get_short_channel_ids(this.ptr);
50                 GC.KeepAlive(this);
51                 return ret;
52         }
53
54         /**
55          * The short_channel_ids that are being queried
56          */
57         public void set_short_channel_ids(long[] val) {
58                 bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, val);
59                 GC.KeepAlive(this);
60                 GC.KeepAlive(val);
61         }
62
63         /**
64          * Constructs a new QueryShortChannelIds given each field
65          */
66         public static QueryShortChannelIds of(byte[] chain_hash_arg, long[] short_channel_ids_arg) {
67                 long ret = bindings.QueryShortChannelIds_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_ids_arg);
68                 GC.KeepAlive(chain_hash_arg);
69                 GC.KeepAlive(short_channel_ids_arg);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 org.ldk.structs.QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, ret); }
72                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
73                 return ret_hu_conv;
74         }
75
76         internal long clone_ptr() {
77                 long ret = bindings.QueryShortChannelIds_clone_ptr(this.ptr);
78                 GC.KeepAlive(this);
79                 return ret;
80         }
81
82         /**
83          * Creates a copy of the QueryShortChannelIds
84          */
85         public QueryShortChannelIds clone() {
86                 long ret = bindings.QueryShortChannelIds_clone(this.ptr);
87                 GC.KeepAlive(this);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 org.ldk.structs.QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, ret); }
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91                 return ret_hu_conv;
92         }
93
94         /**
95          * Checks if two QueryShortChannelIdss contain equal inner contents.
96          * This ignores pointers and is_owned flags and looks at the values in fields.
97          * Two objects with NULL inner values will be considered "equal" here.
98          */
99         public bool eq(org.ldk.structs.QueryShortChannelIds b) {
100                 bool ret = bindings.QueryShortChannelIds_eq(this.ptr, b == null ? 0 : b.ptr);
101                 GC.KeepAlive(this);
102                 GC.KeepAlive(b);
103                 if (this != null) { this.ptrs_to.AddLast(b); };
104                 return ret;
105         }
106
107         public override bool Equals(object o) {
108                 if (!(o is QueryShortChannelIds)) return false;
109                 return this.eq((QueryShortChannelIds)o);
110         }
111         /**
112          * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
113          */
114         public static Result_QueryShortChannelIdsDecodeErrorZ read(byte[] ser) {
115                 long ret = bindings.QueryShortChannelIds_read(ser);
116                 GC.KeepAlive(ser);
117                 if (ret >= 0 && ret <= 4096) { return null; }
118                 Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret);
119                 return ret_hu_conv;
120         }
121
122         /**
123          * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
124          */
125         public byte[] write() {
126                 byte[] ret = bindings.QueryShortChannelIds_write(this.ptr);
127                 GC.KeepAlive(this);
128                 return ret;
129         }
130
131 }
132 } } }