[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / GossipTimestampFilter.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 [`gossip_timestamp_filter`] message is used by a node to request
11  * gossip relay for messages in the requested time range when the
12  * `gossip_queries` feature has been negotiated.
13  * 
14  * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
15  */
16 public class GossipTimestampFilter : CommonBase {
17         internal GossipTimestampFilter(object _dummy, long ptr) : base(ptr) { }
18         ~GossipTimestampFilter() {
19                 if (ptr != 0) { bindings.GossipTimestampFilter_free(ptr); }
20         }
21
22         /**
23          * The genesis hash of the blockchain for channel and node information
24          */
25         public byte[] get_chain_hash() {
26                 byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr);
27                 GC.KeepAlive(this);
28                 return ret;
29         }
30
31         /**
32          * The genesis hash of the blockchain for channel and node information
33          */
34         public void set_chain_hash(byte[] val) {
35                 bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The starting unix timestamp
42          */
43         public int get_first_timestamp() {
44                 int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * The starting unix timestamp
51          */
52         public void set_first_timestamp(int val) {
53                 bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The range of information in seconds
60          */
61         public int get_timestamp_range() {
62                 int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * The range of information in seconds
69          */
70         public void set_timestamp_range(int val) {
71                 bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val);
72                 GC.KeepAlive(this);
73                 GC.KeepAlive(val);
74         }
75
76         /**
77          * Constructs a new GossipTimestampFilter given each field
78          */
79         public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
80                 long ret = bindings.GossipTimestampFilter_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_timestamp_arg, timestamp_range_arg);
81                 GC.KeepAlive(chain_hash_arg);
82                 GC.KeepAlive(first_timestamp_arg);
83                 GC.KeepAlive(timestamp_range_arg);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
87                 return ret_hu_conv;
88         }
89
90         internal long clone_ptr() {
91                 long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr);
92                 GC.KeepAlive(this);
93                 return ret;
94         }
95
96         /**
97          * Creates a copy of the GossipTimestampFilter
98          */
99         public GossipTimestampFilter clone() {
100                 long ret = bindings.GossipTimestampFilter_clone(this.ptr);
101                 GC.KeepAlive(this);
102                 if (ret >= 0 && ret <= 4096) { return null; }
103                 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
104                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105                 return ret_hu_conv;
106         }
107
108         /**
109          * Checks if two GossipTimestampFilters 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.GossipTimestampFilter b) {
114                 bool ret = bindings.GossipTimestampFilter_eq(this.ptr, b == null ? 0 : 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 GossipTimestampFilter)) return false;
123                 return this.eq((GossipTimestampFilter)o);
124         }
125         /**
126          * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
127          */
128         public byte[] write() {
129                 byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
130                 GC.KeepAlive(this);
131                 return ret;
132         }
133
134         /**
135          * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
136          */
137         public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) {
138                 long ret = bindings.GossipTimestampFilter_read(ser);
139                 GC.KeepAlive(ser);
140                 if (ret >= 0 && ret <= 4096) { return null; }
141                 Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);
142                 return ret_hu_conv;
143         }
144
145 }
146 } } }