[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / BlindedHop.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
11  * by outside observers and thus can be used to hide the identity of the recipient.
12  */
13 public class BlindedHop : CommonBase {
14         internal BlindedHop(object _dummy, long ptr) : base(ptr) { }
15         ~BlindedHop() {
16                 if (ptr != 0) { bindings.BlindedHop_free(ptr); }
17         }
18
19         internal long clone_ptr() {
20                 long ret = bindings.BlindedHop_clone_ptr(this.ptr);
21                 GC.KeepAlive(this);
22                 return ret;
23         }
24
25         /**
26          * Creates a copy of the BlindedHop
27          */
28         public BlindedHop clone() {
29                 long ret = bindings.BlindedHop_clone(this.ptr);
30                 GC.KeepAlive(this);
31                 if (ret >= 0 && ret <= 4096) { return null; }
32                 org.ldk.structs.BlindedHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHop(null, ret); }
33                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
34                 return ret_hu_conv;
35         }
36
37         /**
38          * Generates a non-cryptographic 64-bit hash of the BlindedHop.
39          */
40         public long hash() {
41                 long ret = bindings.BlindedHop_hash(this.ptr);
42                 GC.KeepAlive(this);
43                 return ret;
44         }
45
46         public override int GetHashCode() {
47                 return (int)this.hash();
48         }
49         /**
50          * Checks if two BlindedHops contain equal inner contents.
51          * This ignores pointers and is_owned flags and looks at the values in fields.
52          * Two objects with NULL inner values will be considered "equal" here.
53          */
54         public bool eq(org.ldk.structs.BlindedHop b) {
55                 bool ret = bindings.BlindedHop_eq(this.ptr, b == null ? 0 : b.ptr);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(b);
58                 if (this != null) { this.ptrs_to.AddLast(b); };
59                 return ret;
60         }
61
62         public override bool Equals(object o) {
63                 if (!(o is BlindedHop)) return false;
64                 return this.eq((BlindedHop)o);
65         }
66         /**
67          * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
68          */
69         public byte[] write() {
70                 byte[] ret = bindings.BlindedHop_write(this.ptr);
71                 GC.KeepAlive(this);
72                 return ret;
73         }
74
75         /**
76          * Read a BlindedHop from a byte array, created by BlindedHop_write
77          */
78         public static Result_BlindedHopDecodeErrorZ read(byte[] ser) {
79                 long ret = bindings.BlindedHop_read(ser);
80                 GC.KeepAlive(ser);
81                 if (ret >= 0 && ret <= 4096) { return null; }
82                 Result_BlindedHopDecodeErrorZ ret_hu_conv = Result_BlindedHopDecodeErrorZ.constr_from_ptr(ret);
83                 return ret_hu_conv;
84         }
85
86 }
87 } } }