6 namespace org { namespace ldk { namespace structs {
10 * An onion message to be sent or received from a peer
12 public class OnionMessage : CommonBase {
13 internal OnionMessage(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.OnionMessage_free(ptr); }
19 * Used in decrypting the onion packet's payload.
21 public byte[] get_blinding_point() {
22 byte[] ret = bindings.OnionMessage_get_blinding_point(this.ptr);
28 * Used in decrypting the onion packet's payload.
30 public void set_blinding_point(byte[] val) {
31 bindings.OnionMessage_set_blinding_point(this.ptr, InternalUtils.check_arr_len(val, 33));
36 internal long clone_ptr() {
37 long ret = bindings.OnionMessage_clone_ptr(this.ptr);
43 * Creates a copy of the OnionMessage
45 public OnionMessage clone() {
46 long ret = bindings.OnionMessage_clone(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.OnionMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessage(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
55 * Checks if two OnionMessages contain equal inner contents.
56 * This ignores pointers and is_owned flags and looks at the values in fields.
57 * Two objects with NULL inner values will be considered "equal" here.
59 public bool eq(org.ldk.structs.OnionMessage b) {
60 bool ret = bindings.OnionMessage_eq(this.ptr, b == null ? 0 : b.ptr);
63 if (this != null) { this.ptrs_to.AddLast(b); };
67 public override bool Equals(object o) {
68 if (!(o is OnionMessage)) return false;
69 return this.eq((OnionMessage)o);
72 * Read a OnionMessage from a byte array, created by OnionMessage_write
74 public static Result_OnionMessageDecodeErrorZ read(byte[] ser) {
75 long ret = bindings.OnionMessage_read(ser);
77 if (ret >= 0 && ret <= 4096) { return null; }
78 Result_OnionMessageDecodeErrorZ ret_hu_conv = Result_OnionMessageDecodeErrorZ.constr_from_ptr(ret);
83 * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
85 public byte[] write() {
86 byte[] ret = bindings.OnionMessage_write(this.ptr);