7 namespace org { namespace ldk { namespace structs {
11 /** An implementation of OnionMessageContents */
12 public interface OnionMessageContentsInterface {
13 /**Returns the TLV type identifying the message contents. MUST be >= 64.
16 /**Serialize the object into a byte array
19 /**Return a human-readable "debug" string describing this object
25 * The contents of an onion message.
27 public class OnionMessageContents : CommonBase {
28 internal bindings.LDKOnionMessageContents bindings_instance;
29 internal long instance_idx;
31 internal OnionMessageContents(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
32 ~OnionMessageContents() {
33 if (ptr != 0) { bindings.OnionMessageContents_free(ptr); }
36 private class LDKOnionMessageContentsHolder { internal OnionMessageContents held; }
37 private class LDKOnionMessageContentsImpl : bindings.LDKOnionMessageContents {
38 internal LDKOnionMessageContentsImpl(OnionMessageContentsInterface arg, LDKOnionMessageContentsHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
39 private OnionMessageContentsInterface arg;
40 private LDKOnionMessageContentsHolder impl_holder;
41 public long tlv_type() {
42 long ret = arg.tlv_type();
47 byte[] ret = arg.write();
49 long result = InternalUtils.encodeUint8Array(ret);
52 public long debug_str() {
53 string ret = arg.debug_str();
55 long result = InternalUtils.encodeString(ret);
60 /** Creates a new instance of OnionMessageContents from a given implementation */
61 public static OnionMessageContents new_impl(OnionMessageContentsInterface arg) {
62 LDKOnionMessageContentsHolder impl_holder = new LDKOnionMessageContentsHolder();
63 LDKOnionMessageContentsImpl impl = new LDKOnionMessageContentsImpl(arg, impl_holder);
64 long[] ptr_idx = bindings.LDKOnionMessageContents_new(impl);
66 impl_holder.held = new OnionMessageContents(null, ptr_idx[0]);
67 impl_holder.held.instance_idx = ptr_idx[1];
68 impl_holder.held.bindings_instance = impl;
69 return impl_holder.held;
73 * Returns the TLV type identifying the message contents. MUST be >= 64.
75 public long tlv_type() {
76 long ret = bindings.OnionMessageContents_tlv_type(this.ptr);
82 * Serialize the object into a byte array
84 public byte[] write() {
85 long ret = bindings.OnionMessageContents_write(this.ptr);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
93 * Return a human-readable "debug" string describing this object
95 public string debug_str() {
96 long ret = bindings.OnionMessageContents_debug_str(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 string ret_conv = InternalUtils.decodeString(ret);
103 internal long clone_ptr() {
104 long ret = bindings.OnionMessageContents_clone_ptr(this.ptr);
110 * Creates a copy of a OnionMessageContents
112 public OnionMessageContents clone() {
113 long ret = bindings.OnionMessageContents_clone(this.ptr);
115 if (ret >= 0 && ret <= 4096) { return null; }
116 OnionMessageContents ret_hu_conv = new OnionMessageContents(null, ret);
117 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };