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
22 * The contents of an onion message.
24 public class OnionMessageContents : CommonBase {
25 internal bindings.LDKOnionMessageContents bindings_instance;
26 internal long instance_idx;
28 internal OnionMessageContents(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
29 ~OnionMessageContents() {
30 if (ptr != 0) { bindings.OnionMessageContents_free(ptr); }
33 private class LDKOnionMessageContentsHolder { internal OnionMessageContents held; }
34 private class LDKOnionMessageContentsImpl : bindings.LDKOnionMessageContents {
35 internal LDKOnionMessageContentsImpl(OnionMessageContentsInterface arg, LDKOnionMessageContentsHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
36 private OnionMessageContentsInterface arg;
37 private LDKOnionMessageContentsHolder impl_holder;
38 public long tlv_type() {
39 long ret = arg.tlv_type();
44 byte[] ret = arg.write();
46 long result = InternalUtils.encodeUint8Array(ret);
51 /** Creates a new instance of OnionMessageContents from a given implementation */
52 public static OnionMessageContents new_impl(OnionMessageContentsInterface arg) {
53 LDKOnionMessageContentsHolder impl_holder = new LDKOnionMessageContentsHolder();
54 LDKOnionMessageContentsImpl impl = new LDKOnionMessageContentsImpl(arg, impl_holder);
55 long[] ptr_idx = bindings.LDKOnionMessageContents_new(impl);
57 impl_holder.held = new OnionMessageContents(null, ptr_idx[0]);
58 impl_holder.held.instance_idx = ptr_idx[1];
59 impl_holder.held.bindings_instance = impl;
60 return impl_holder.held;
64 * Returns the TLV type identifying the message contents. MUST be >= 64.
66 public long tlv_type() {
67 long ret = bindings.OnionMessageContents_tlv_type(this.ptr);
73 * Serialize the object into a byte array
75 public byte[] write() {
76 long ret = bindings.OnionMessageContents_write(this.ptr);
78 if (ret >= 0 && ret <= 4096) { return null; }
79 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
83 internal long clone_ptr() {
84 long ret = bindings.OnionMessageContents_clone_ptr(this.ptr);
90 * Creates a copy of a OnionMessageContents
92 public OnionMessageContents clone() {
93 long ret = bindings.OnionMessageContents_clone(this.ptr);
95 if (ret >= 0 && ret <= 4096) { return null; }
96 OnionMessageContents ret_hu_conv = new OnionMessageContents(null, ret);
97 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };