6 namespace org { namespace ldk { namespace structs {
9 * Errors that may occur when [sending an onion message].
11 * [sending an onion message]: OnionMessenger::send_onion_message
13 public class SendError : CommonBase {
14 protected SendError(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.SendError_free(ptr); }
19 internal static SendError constr_from_ptr(long ptr) {
20 long raw_ty = bindings.LDKSendError_ty_from_ptr(ptr);
22 case 0: return new SendError_Secp256k1(ptr);
23 case 1: return new SendError_TooBigPacket(ptr);
24 case 2: return new SendError_TooFewBlindedHops(ptr);
25 case 3: return new SendError_InvalidFirstHop(ptr);
26 case 4: return new SendError_InvalidMessage(ptr);
27 case 5: return new SendError_BufferFull(ptr);
28 case 6: return new SendError_GetNodeIdFailed(ptr);
29 case 7: return new SendError_BlindedPathAdvanceFailed(ptr);
31 throw new ArgumentException("Impossible enum variant");
35 /** A SendError of type Secp256k1 */
36 public class SendError_Secp256k1 : SendError {
37 public Secp256k1Error secp256k1;
38 internal SendError_Secp256k1(long ptr) : base(null, ptr) {
39 this.secp256k1 = bindings.LDKSendError_Secp256k1_get_secp256k1(ptr);
42 /** A SendError of type TooBigPacket */
43 public class SendError_TooBigPacket : SendError {
44 internal SendError_TooBigPacket(long ptr) : base(null, ptr) {
47 /** A SendError of type TooFewBlindedHops */
48 public class SendError_TooFewBlindedHops : SendError {
49 internal SendError_TooFewBlindedHops(long ptr) : base(null, ptr) {
52 /** A SendError of type InvalidFirstHop */
53 public class SendError_InvalidFirstHop : SendError {
54 internal SendError_InvalidFirstHop(long ptr) : base(null, ptr) {
57 /** A SendError of type InvalidMessage */
58 public class SendError_InvalidMessage : SendError {
59 internal SendError_InvalidMessage(long ptr) : base(null, ptr) {
62 /** A SendError of type BufferFull */
63 public class SendError_BufferFull : SendError {
64 internal SendError_BufferFull(long ptr) : base(null, ptr) {
67 /** A SendError of type GetNodeIdFailed */
68 public class SendError_GetNodeIdFailed : SendError {
69 internal SendError_GetNodeIdFailed(long ptr) : base(null, ptr) {
72 /** A SendError of type BlindedPathAdvanceFailed */
73 public class SendError_BlindedPathAdvanceFailed : SendError {
74 internal SendError_BlindedPathAdvanceFailed(long ptr) : base(null, ptr) {
77 internal long clone_ptr() {
78 long ret = bindings.SendError_clone_ptr(this.ptr);
84 * Creates a copy of the SendError
86 public SendError clone() {
87 long ret = bindings.SendError_clone(this.ptr);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
96 * Utility method to constructs a new Secp256k1-variant SendError
98 public static SendError secp256k1(Secp256k1Error a) {
99 long ret = bindings.SendError_secp256k1(a);
101 if (ret >= 0 && ret <= 4096) { return null; }
102 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
103 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
108 * Utility method to constructs a new TooBigPacket-variant SendError
110 public static SendError too_big_packet() {
111 long ret = bindings.SendError_too_big_packet();
112 if (ret >= 0 && ret <= 4096) { return null; }
113 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
114 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
119 * Utility method to constructs a new TooFewBlindedHops-variant SendError
121 public static SendError too_few_blinded_hops() {
122 long ret = bindings.SendError_too_few_blinded_hops();
123 if (ret >= 0 && ret <= 4096) { return null; }
124 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
125 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
130 * Utility method to constructs a new InvalidFirstHop-variant SendError
132 public static SendError invalid_first_hop() {
133 long ret = bindings.SendError_invalid_first_hop();
134 if (ret >= 0 && ret <= 4096) { return null; }
135 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
136 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
141 * Utility method to constructs a new InvalidMessage-variant SendError
143 public static SendError invalid_message() {
144 long ret = bindings.SendError_invalid_message();
145 if (ret >= 0 && ret <= 4096) { return null; }
146 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
147 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
152 * Utility method to constructs a new BufferFull-variant SendError
154 public static SendError buffer_full() {
155 long ret = bindings.SendError_buffer_full();
156 if (ret >= 0 && ret <= 4096) { return null; }
157 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
158 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
163 * Utility method to constructs a new GetNodeIdFailed-variant SendError
165 public static SendError get_node_id_failed() {
166 long ret = bindings.SendError_get_node_id_failed();
167 if (ret >= 0 && ret <= 4096) { return null; }
168 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
169 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
174 * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
176 public static SendError blinded_path_advance_failed() {
177 long ret = bindings.SendError_blinded_path_advance_failed();
178 if (ret >= 0 && ret <= 4096) { return null; }
179 org.ldk.structs.SendError ret_hu_conv = org.ldk.structs.SendError.constr_from_ptr(ret);
180 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
185 * Checks if two SendErrors contain equal inner contents.
186 * This ignores pointers and is_owned flags and looks at the values in fields.
188 public bool eq(org.ldk.structs.SendError b) {
189 bool ret = bindings.SendError_eq(this.ptr, b == null ? 0 : b.ptr);
195 public override bool Equals(object o) {
196 if (!(o is SendError)) return false;
197 return this.eq((SendError)o);