[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Hostname.cs
index 4a7bc42d28db12cc404ffbd44713e8a6a2d410a6..0d5840edc02c5889c5ee02f96c43354c6cdb8038 100644 (file)
@@ -11,7 +11,9 @@ namespace org { namespace ldk { namespace structs {
  * Only the character set and length will be validated.
  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
  * Its length is guaranteed to be representable by a single byte.
- * This serialization is used by BOLT 7 hostnames.
+ * This serialization is used by [`BOLT 7`] hostnames.
+ * 
+ * [`BOLT 7`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md
  */
 public class Hostname : CommonBase {
        internal Hostname(object _dummy, long ptr) : base(ptr) { }
@@ -37,6 +39,18 @@ public class Hostname : CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Generates a non-cryptographic 64-bit hash of the Hostname.
+        */
+       public long hash() {
+               long ret = bindings.Hostname_hash(this.ptr);
+               GC.KeepAlive(this);
+               return ret;
+       }
+
+       public override int GetHashCode() {
+               return (int)this.hash();
+       }
        /**
         * Checks if two Hostnames contain equal inner contents.
         * This ignores pointers and is_owned flags and looks at the values in fields.
@@ -63,5 +77,27 @@ public class Hostname : CommonBase {
                return ret;
        }
 
+       /**
+        * Serialize the Hostname object into a byte array which can be read by Hostname_read
+        */
+       public byte[] write() {
+               long ret = bindings.Hostname_write(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
+       }
+
+       /**
+        * Read a Hostname from a byte array, created by Hostname_write
+        */
+       public static Result_HostnameDecodeErrorZ read(byte[] ser) {
+               long ret = bindings.Hostname_read(InternalUtils.encodeUint8Array(ser));
+               GC.KeepAlive(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_HostnameDecodeErrorZ ret_hu_conv = Result_HostnameDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
 }
 } } }