6 namespace org { namespace ldk { namespace structs {
10 * A warning message to be sent or received from a peer
12 public class WarningMessage : CommonBase {
13 internal WarningMessage(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.WarningMessage_free(ptr); }
19 * The channel ID involved in the warning.
21 * All-0s indicates a warning unrelated to a specific channel.
23 public byte[] get_channel_id() {
24 byte[] ret = bindings.WarningMessage_get_channel_id(this.ptr);
30 * The channel ID involved in the warning.
32 * All-0s indicates a warning unrelated to a specific channel.
34 public void set_channel_id(byte[] val) {
35 bindings.WarningMessage_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
41 * A possibly human-readable warning description.
42 * The string should be sanitized before it is used (e.g. emitted to logs or printed to
43 * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
44 * the terminal emulator or the logging subsystem.
46 public string get_data() {
47 string ret = bindings.WarningMessage_get_data(this.ptr);
53 * A possibly human-readable warning description.
54 * The string should be sanitized before it is used (e.g. emitted to logs or printed to
55 * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
56 * the terminal emulator or the logging subsystem.
58 public void set_data(string val) {
59 bindings.WarningMessage_set_data(this.ptr, val);
65 * Constructs a new WarningMessage given each field
67 public static WarningMessage of(byte[] channel_id_arg, string data_arg) {
68 long ret = bindings.WarningMessage_new(InternalUtils.check_arr_len(channel_id_arg, 32), data_arg);
69 GC.KeepAlive(channel_id_arg);
70 GC.KeepAlive(data_arg);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.WarningMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.WarningMessage(null, ret); }
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
77 internal long clone_ptr() {
78 long ret = bindings.WarningMessage_clone_ptr(this.ptr);
84 * Creates a copy of the WarningMessage
86 public WarningMessage clone() {
87 long ret = bindings.WarningMessage_clone(this.ptr);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.WarningMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.WarningMessage(null, ret); }
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
96 * Checks if two WarningMessages contain equal inner contents.
97 * This ignores pointers and is_owned flags and looks at the values in fields.
98 * Two objects with NULL inner values will be considered "equal" here.
100 public bool eq(org.ldk.structs.WarningMessage b) {
101 bool ret = bindings.WarningMessage_eq(this.ptr, b == null ? 0 : b.ptr);
104 if (this != null) { this.ptrs_to.AddLast(b); };
108 public override bool Equals(object o) {
109 if (!(o is WarningMessage)) return false;
110 return this.eq((WarningMessage)o);
113 * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
115 public byte[] write() {
116 byte[] ret = bindings.WarningMessage_write(this.ptr);
122 * Read a WarningMessage from a byte array, created by WarningMessage_write
124 public static Result_WarningMessageDecodeErrorZ read(byte[] ser) {
125 long ret = bindings.WarningMessage_read(ser);
127 if (ret >= 0 && ret <= 4096) { return null; }
128 Result_WarningMessageDecodeErrorZ ret_hu_conv = Result_WarningMessageDecodeErrorZ.constr_from_ptr(ret);