6 namespace org { namespace ldk { namespace structs {
10 * A [`warning`] message to be sent to or received from a peer.
12 * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
14 public class WarningMessage : CommonBase {
15 internal WarningMessage(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.WarningMessage_free(ptr); }
21 * The channel ID involved in the warning.
23 * All-0s indicates a warning unrelated to a specific channel.
25 public byte[] get_channel_id() {
26 byte[] ret = bindings.WarningMessage_get_channel_id(this.ptr);
32 * The channel ID involved in the warning.
34 * All-0s indicates a warning unrelated to a specific channel.
36 public void set_channel_id(byte[] val) {
37 bindings.WarningMessage_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
43 * A possibly human-readable warning description.
45 * The string should be sanitized before it is used (e.g. emitted to logs or printed to
46 * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
47 * the terminal emulator or the logging subsystem.
49 public string get_data() {
50 string ret = bindings.WarningMessage_get_data(this.ptr);
56 * A possibly human-readable warning description.
58 * The string should be sanitized before it is used (e.g. emitted to logs or printed to
59 * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
60 * the terminal emulator or the logging subsystem.
62 public void set_data(string val) {
63 bindings.WarningMessage_set_data(this.ptr, val);
69 * Constructs a new WarningMessage given each field
71 public static WarningMessage of(byte[] channel_id_arg, string data_arg) {
72 long ret = bindings.WarningMessage_new(InternalUtils.check_arr_len(channel_id_arg, 32), data_arg);
73 GC.KeepAlive(channel_id_arg);
74 GC.KeepAlive(data_arg);
75 if (ret >= 0 && ret <= 4096) { return null; }
76 org.ldk.structs.WarningMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.WarningMessage(null, ret); }
77 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
81 internal long clone_ptr() {
82 long ret = bindings.WarningMessage_clone_ptr(this.ptr);
88 * Creates a copy of the WarningMessage
90 public WarningMessage clone() {
91 long ret = bindings.WarningMessage_clone(this.ptr);
93 if (ret >= 0 && ret <= 4096) { return null; }
94 org.ldk.structs.WarningMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.WarningMessage(null, ret); }
95 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
100 * Checks if two WarningMessages contain equal inner contents.
101 * This ignores pointers and is_owned flags and looks at the values in fields.
102 * Two objects with NULL inner values will be considered "equal" here.
104 public bool eq(org.ldk.structs.WarningMessage b) {
105 bool ret = bindings.WarningMessage_eq(this.ptr, b == null ? 0 : b.ptr);
108 if (this != null) { this.ptrs_to.AddLast(b); };
112 public override bool Equals(object o) {
113 if (!(o is WarningMessage)) return false;
114 return this.eq((WarningMessage)o);
117 * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
119 public byte[] write() {
120 byte[] ret = bindings.WarningMessage_write(this.ptr);
126 * Read a WarningMessage from a byte array, created by WarningMessage_write
128 public static Result_WarningMessageDecodeErrorZ read(byte[] ser) {
129 long ret = bindings.WarningMessage_read(ser);
131 if (ret >= 0 && ret <= 4096) { return null; }
132 Result_WarningMessageDecodeErrorZ ret_hu_conv = Result_WarningMessageDecodeErrorZ.constr_from_ptr(ret);