X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FOnionMessagePath.cs;fp=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FOnionMessagePath.cs;h=fca88d9716f9f5ea06d97c24baa72eaa08d4bb83;hb=c6777737ea14e7814b0fa7d6fe16536f31d4a82b;hp=0000000000000000000000000000000000000000;hpb=ee72c84d4bf9e2404e02fe20155efb502ceaee1b;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/OnionMessagePath.cs b/c_sharp/src/org/ldk/structs/OnionMessagePath.cs new file mode 100644 index 00000000..fca88d97 --- /dev/null +++ b/c_sharp/src/org/ldk/structs/OnionMessagePath.cs @@ -0,0 +1,93 @@ +using org.ldk.impl; +using org.ldk.enums; +using org.ldk.util; +using System; + +namespace org { namespace ldk { namespace structs { + + +/** + * A path for sending an [`msgs::OnionMessage`]. + */ +public class OnionMessagePath : CommonBase { + internal OnionMessagePath(object _dummy, long ptr) : base(ptr) { } + ~OnionMessagePath() { + if (ptr != 0) { bindings.OnionMessagePath_free(ptr); } + } + + /** + * Nodes on the path between the sender and the destination. + * + * Returns a copy of the field. + */ + public byte[][] get_intermediate_nodes() { + byte[][] ret = bindings.OnionMessagePath_get_intermediate_nodes(this.ptr); + GC.KeepAlive(this); + return ret; + } + + /** + * Nodes on the path between the sender and the destination. + */ + public void set_intermediate_nodes(byte[][] val) { + bindings.OnionMessagePath_set_intermediate_nodes(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_8 => InternalUtils.check_arr_len(val_conv_8, 33)) : null); + GC.KeepAlive(this); + GC.KeepAlive(val); + } + + /** + * The recipient of the message. + */ + public Destination get_destination() { + long ret = bindings.OnionMessagePath_get_destination(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); }; + return ret_hu_conv; + } + + /** + * The recipient of the message. + */ + public void set_destination(org.ldk.structs.Destination val) { + bindings.OnionMessagePath_set_destination(this.ptr, val.ptr); + GC.KeepAlive(this); + GC.KeepAlive(val); + if (this != null) { this.ptrs_to.AddLast(val); }; + } + + /** + * Constructs a new OnionMessagePath given each field + */ + public static OnionMessagePath of(byte[][] intermediate_nodes_arg, org.ldk.structs.Destination destination_arg) { + long ret = bindings.OnionMessagePath_new(intermediate_nodes_arg != null ? InternalUtils.mapArray(intermediate_nodes_arg, intermediate_nodes_arg_conv_8 => InternalUtils.check_arr_len(intermediate_nodes_arg_conv_8, 33)) : null, destination_arg.ptr); + GC.KeepAlive(intermediate_nodes_arg); + GC.KeepAlive(destination_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.OnionMessagePath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessagePath(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(destination_arg); }; + return ret_hu_conv; + } + + internal long clone_ptr() { + long ret = bindings.OnionMessagePath_clone_ptr(this.ptr); + GC.KeepAlive(this); + return ret; + } + + /** + * Creates a copy of the OnionMessagePath + */ + public OnionMessagePath clone() { + long ret = bindings.OnionMessagePath_clone(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.OnionMessagePath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessagePath(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); }; + return ret_hu_conv; + } + +} +} } }