6 namespace org { namespace ldk { namespace structs {
9 * Either [`P2PGossipSync`] or [`RapidGossipSync`].
11 public class GossipSync : CommonBase {
12 protected GossipSync(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.GossipSync_free(ptr); }
17 internal static GossipSync constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKGossipSync_ty_from_ptr(ptr);
20 case 0: return new GossipSync_P2P(ptr);
21 case 1: return new GossipSync_Rapid(ptr);
22 case 2: return new GossipSync_None(ptr);
24 throw new ArgumentException("Impossible enum variant");
28 /** A GossipSync of type P2P */
29 public class GossipSync_P2P : GossipSync {
30 public P2PGossipSync p2p;
31 internal GossipSync_P2P(long ptr) : base(null, ptr) {
32 long p2p = bindings.LDKGossipSync_P2P_get_p2p(ptr);
33 org.ldk.structs.P2PGossipSync p2p_hu_conv = null; if (p2p < 0 || p2p > 4096) { p2p_hu_conv = new org.ldk.structs.P2PGossipSync(null, p2p); }
34 if (p2p_hu_conv != null) { p2p_hu_conv.ptrs_to.AddLast(this); };
35 this.p2p = p2p_hu_conv;
38 /** A GossipSync of type Rapid */
39 public class GossipSync_Rapid : GossipSync {
40 public RapidGossipSync rapid;
41 internal GossipSync_Rapid(long ptr) : base(null, ptr) {
42 long rapid = bindings.LDKGossipSync_Rapid_get_rapid(ptr);
43 org.ldk.structs.RapidGossipSync rapid_hu_conv = null; if (rapid < 0 || rapid > 4096) { rapid_hu_conv = new org.ldk.structs.RapidGossipSync(null, rapid); }
44 if (rapid_hu_conv != null) { rapid_hu_conv.ptrs_to.AddLast(this); };
45 this.rapid = rapid_hu_conv;
48 /** A GossipSync of type None */
49 public class GossipSync_None : GossipSync {
50 internal GossipSync_None(long ptr) : base(null, ptr) {
54 * Utility method to constructs a new P2P-variant GossipSync
56 public static GossipSync p2_p(org.ldk.structs.P2PGossipSync a) {
57 long ret = bindings.GossipSync_p2_p(a.ptr);
59 if (ret >= 0 && ret <= 4096) { return null; }
60 org.ldk.structs.GossipSync ret_hu_conv = org.ldk.structs.GossipSync.constr_from_ptr(ret);
61 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
62 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
67 * Utility method to constructs a new Rapid-variant GossipSync
69 public static GossipSync rapid(org.ldk.structs.RapidGossipSync a) {
70 long ret = bindings.GossipSync_rapid(a.ptr);
72 if (ret >= 0 && ret <= 4096) { return null; }
73 org.ldk.structs.GossipSync ret_hu_conv = org.ldk.structs.GossipSync.constr_from_ptr(ret);
74 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
75 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
80 * Utility method to constructs a new None-variant GossipSync
82 public static GossipSync none() {
83 long ret = bindings.GossipSync_none();
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.GossipSync ret_hu_conv = org.ldk.structs.GossipSync.constr_from_ptr(ret);
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };