[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / OnionMessageContents.cs
1
2 using org.ldk.impl;
3 using org.ldk.enums;
4 using org.ldk.util;
5 using System;
6
7 namespace org { namespace ldk { namespace structs {
8
9
10
11 /** An implementation of OnionMessageContents */
12 public interface OnionMessageContentsInterface {
13         /**Returns the TLV type identifying the message contents. MUST be >= 64.
14          */
15         long tlv_type();
16         /**Serialize the object into a byte array
17          */
18         byte[] write();
19         /**Return a human-readable "debug" string describing this object
20          */
21         string debug_str();
22 }
23
24 /**
25  * The contents of an onion message.
26  */
27 public class OnionMessageContents : CommonBase {
28         internal bindings.LDKOnionMessageContents bindings_instance;
29         internal long instance_idx;
30
31         internal OnionMessageContents(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
32         ~OnionMessageContents() {
33                 if (ptr != 0) { bindings.OnionMessageContents_free(ptr); }
34         }
35
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();
43                                 GC.KeepAlive(arg);
44                         return ret;
45                 }
46                 public long write() {
47                         byte[] ret = arg.write();
48                                 GC.KeepAlive(arg);
49                         long result = InternalUtils.encodeUint8Array(ret);
50                         return result;
51                 }
52                 public long debug_str() {
53                         string ret = arg.debug_str();
54                                 GC.KeepAlive(arg);
55                         long result = InternalUtils.encodeString(ret);
56                         return result;
57                 }
58         }
59
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);
65
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;
70         }
71
72         /**
73          * Returns the TLV type identifying the message contents. MUST be >= 64.
74          */
75         public long tlv_type() {
76                 long ret = bindings.OnionMessageContents_tlv_type(this.ptr);
77                 GC.KeepAlive(this);
78                 return ret;
79         }
80
81         /**
82          * Serialize the object into a byte array
83          */
84         public byte[] write() {
85                 long ret = bindings.OnionMessageContents_write(this.ptr);
86                 GC.KeepAlive(this);
87                 if (ret >= 0 && ret <= 4096) { return null; }
88                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
89                 return ret_conv;
90         }
91
92         /**
93          * Return a human-readable "debug" string describing this object
94          */
95         public string debug_str() {
96                 long ret = bindings.OnionMessageContents_debug_str(this.ptr);
97                 GC.KeepAlive(this);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 string ret_conv = InternalUtils.decodeString(ret);
100                 return ret_conv;
101         }
102
103         internal long clone_ptr() {
104                 long ret = bindings.OnionMessageContents_clone_ptr(this.ptr);
105                 GC.KeepAlive(this);
106                 return ret;
107         }
108
109         /**
110          * Creates a copy of a OnionMessageContents
111          */
112         public OnionMessageContents clone() {
113                 long ret = bindings.OnionMessageContents_clone(this.ptr);
114                 GC.KeepAlive(this);
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); };
118                 return ret_hu_conv;
119         }
120
121 }
122 } } }