6 namespace org { namespace ldk { namespace structs {
10 * BOLT 4 onion packet including hop data for the next peer.
12 public class TrampolineOnionPacket : CommonBase {
13 internal TrampolineOnionPacket(object _dummy, long ptr) : base(ptr) { }
14 ~TrampolineOnionPacket() {
15 if (ptr != 0) { bindings.TrampolineOnionPacket_free(ptr); }
19 * Bolt 04 version number
21 public byte get_version() {
22 byte ret = bindings.TrampolineOnionPacket_get_version(this.ptr);
28 * Bolt 04 version number
30 public void set_version(byte val) {
31 bindings.TrampolineOnionPacket_set_version(this.ptr, val);
37 * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data
39 public byte[] get_public_key() {
40 long ret = bindings.TrampolineOnionPacket_get_public_key(this.ptr);
42 if (ret >= 0 && ret <= 4096) { return null; }
43 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
48 * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data
50 public void set_public_key(byte[] val) {
51 bindings.TrampolineOnionPacket_set_public_key(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
57 * Encrypted payload for the next hop
59 * Returns a copy of the field.
61 public byte[] get_hop_data() {
62 long ret = bindings.TrampolineOnionPacket_get_hop_data(this.ptr);
64 if (ret >= 0 && ret <= 4096) { return null; }
65 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
70 * Encrypted payload for the next hop
72 public void set_hop_data(byte[] val) {
73 bindings.TrampolineOnionPacket_set_hop_data(this.ptr, InternalUtils.encodeUint8Array(val));
79 * HMAC to verify the integrity of hop_data
81 public byte[] get_hmac() {
82 long ret = bindings.TrampolineOnionPacket_get_hmac(this.ptr);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
90 * HMAC to verify the integrity of hop_data
92 public void set_hmac(byte[] val) {
93 bindings.TrampolineOnionPacket_set_hmac(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
99 * Constructs a new TrampolineOnionPacket given each field
101 public static TrampolineOnionPacket of(byte version_arg, byte[] public_key_arg, byte[] hop_data_arg, byte[] hmac_arg) {
102 long ret = bindings.TrampolineOnionPacket_new(version_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(public_key_arg, 33)), InternalUtils.encodeUint8Array(hop_data_arg), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(hmac_arg, 32)));
103 GC.KeepAlive(version_arg);
104 GC.KeepAlive(public_key_arg);
105 GC.KeepAlive(hop_data_arg);
106 GC.KeepAlive(hmac_arg);
107 if (ret >= 0 && ret <= 4096) { return null; }
108 org.ldk.structs.TrampolineOnionPacket ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TrampolineOnionPacket(null, ret); }
109 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
113 internal long clone_ptr() {
114 long ret = bindings.TrampolineOnionPacket_clone_ptr(this.ptr);
120 * Creates a copy of the TrampolineOnionPacket
122 public TrampolineOnionPacket clone() {
123 long ret = bindings.TrampolineOnionPacket_clone(this.ptr);
125 if (ret >= 0 && ret <= 4096) { return null; }
126 org.ldk.structs.TrampolineOnionPacket ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TrampolineOnionPacket(null, ret); }
127 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
132 * Generates a non-cryptographic 64-bit hash of the TrampolineOnionPacket.
135 long ret = bindings.TrampolineOnionPacket_hash(this.ptr);
140 public override int GetHashCode() {
141 return (int)this.hash();
144 * Checks if two TrampolineOnionPackets contain equal inner contents.
145 * This ignores pointers and is_owned flags and looks at the values in fields.
146 * Two objects with NULL inner values will be considered "equal" here.
148 public bool eq(org.ldk.structs.TrampolineOnionPacket b) {
149 bool ret = bindings.TrampolineOnionPacket_eq(this.ptr, b.ptr);
152 if (this != null) { this.ptrs_to.AddLast(b); };
156 public override bool Equals(object o) {
157 if (!(o is TrampolineOnionPacket)) return false;
158 return this.eq((TrampolineOnionPacket)o);
161 * Serialize the TrampolineOnionPacket object into a byte array which can be read by TrampolineOnionPacket_read
163 public byte[] write() {
164 long ret = bindings.TrampolineOnionPacket_write(this.ptr);
166 if (ret >= 0 && ret <= 4096) { return null; }
167 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);