ad19b4d9f6eac65c879cd24c424661bd485be00d
[ldk-java] / c_sharp / src / org / ldk / structs / PeerHandleError.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  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
11  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
12  * descriptor.
13  */
14 public class PeerHandleError : CommonBase {
15         internal PeerHandleError(object _dummy, long ptr) : base(ptr) { }
16         ~PeerHandleError() {
17                 if (ptr != 0) { bindings.PeerHandleError_free(ptr); }
18         }
19
20         /**
21          * Used to indicate that we probably can't make any future connections to this peer (e.g.
22          * because we required features that our peer was missing, or vice versa).
23          * 
24          * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
25          * any channels with this peer or check for new versions of LDK.
26          * 
27          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
28          */
29         public bool get_no_connection_possible() {
30                 bool ret = bindings.PeerHandleError_get_no_connection_possible(this.ptr);
31                 GC.KeepAlive(this);
32                 return ret;
33         }
34
35         /**
36          * Used to indicate that we probably can't make any future connections to this peer (e.g.
37          * because we required features that our peer was missing, or vice versa).
38          * 
39          * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
40          * any channels with this peer or check for new versions of LDK.
41          * 
42          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
43          */
44         public void set_no_connection_possible(bool val) {
45                 bindings.PeerHandleError_set_no_connection_possible(this.ptr, val);
46                 GC.KeepAlive(this);
47                 GC.KeepAlive(val);
48         }
49
50         /**
51          * Constructs a new PeerHandleError given each field
52          */
53         public static PeerHandleError of(bool no_connection_possible_arg) {
54                 long ret = bindings.PeerHandleError_new(no_connection_possible_arg);
55                 GC.KeepAlive(no_connection_possible_arg);
56                 if (ret >= 0 && ret <= 4096) { return null; }
57                 org.ldk.structs.PeerHandleError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PeerHandleError(null, ret); }
58                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
59                 return ret_hu_conv;
60         }
61
62         internal long clone_ptr() {
63                 long ret = bindings.PeerHandleError_clone_ptr(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * Creates a copy of the PeerHandleError
70          */
71         public PeerHandleError clone() {
72                 long ret = bindings.PeerHandleError_clone(this.ptr);
73                 GC.KeepAlive(this);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 org.ldk.structs.PeerHandleError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PeerHandleError(null, ret); }
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
77                 return ret_hu_conv;
78         }
79
80 }
81 } } }