6 namespace org { namespace ldk { namespace structs {
9 * Result of successfully [sending an onion message].
11 * [sending an onion message]: OnionMessenger::send_onion_message
13 public class SendSuccess : CommonBase {
14 protected SendSuccess(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.SendSuccess_free(ptr); }
19 internal static SendSuccess constr_from_ptr(long ptr) {
20 long raw_ty = bindings.LDKSendSuccess_ty_from_ptr(ptr);
22 case 0: return new SendSuccess_Buffered(ptr);
23 case 1: return new SendSuccess_BufferedAwaitingConnection(ptr);
25 throw new ArgumentException("Impossible enum variant");
29 /** A SendSuccess of type Buffered */
30 public class SendSuccess_Buffered : SendSuccess {
31 internal SendSuccess_Buffered(long ptr) : base(null, ptr) {
34 /** A SendSuccess of type BufferedAwaitingConnection */
35 public class SendSuccess_BufferedAwaitingConnection : SendSuccess {
36 public byte[] buffered_awaiting_connection;
37 internal SendSuccess_BufferedAwaitingConnection(long ptr) : base(null, ptr) {
38 long buffered_awaiting_connection = bindings.LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(ptr);
39 byte[] buffered_awaiting_connection_conv = InternalUtils.decodeUint8Array(buffered_awaiting_connection);
40 this.buffered_awaiting_connection = buffered_awaiting_connection_conv;
43 internal long clone_ptr() {
44 long ret = bindings.SendSuccess_clone_ptr(this.ptr);
50 * Creates a copy of the SendSuccess
52 public SendSuccess clone() {
53 long ret = bindings.SendSuccess_clone(this.ptr);
55 if (ret >= 0 && ret <= 4096) { return null; }
56 org.ldk.structs.SendSuccess ret_hu_conv = org.ldk.structs.SendSuccess.constr_from_ptr(ret);
57 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
62 * Utility method to constructs a new Buffered-variant SendSuccess
64 public static SendSuccess buffered() {
65 long ret = bindings.SendSuccess_buffered();
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.SendSuccess ret_hu_conv = org.ldk.structs.SendSuccess.constr_from_ptr(ret);
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
73 * Utility method to constructs a new BufferedAwaitingConnection-variant SendSuccess
75 public static SendSuccess buffered_awaiting_connection(byte[] a) {
76 long ret = bindings.SendSuccess_buffered_awaiting_connection(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a, 33)));
78 if (ret >= 0 && ret <= 4096) { return null; }
79 org.ldk.structs.SendSuccess ret_hu_conv = org.ldk.structs.SendSuccess.constr_from_ptr(ret);
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85 * Checks if two SendSuccesss contain equal inner contents.
86 * This ignores pointers and is_owned flags and looks at the values in fields.
88 public bool eq(org.ldk.structs.SendSuccess b) {
89 bool ret = bindings.SendSuccess_eq(this.ptr, b == null ? 0 : b.ptr);
95 public override bool Equals(object o) {
96 if (!(o is SendSuccess)) return false;
97 return this.eq((SendSuccess)o);