6 namespace org { namespace ldk { namespace structs {
9 * An error in decoding a message or struct.
11 public class DecodeError : CommonBase {
12 protected DecodeError(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.DecodeError_free(ptr); }
17 internal static DecodeError constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKDecodeError_ty_from_ptr(ptr);
20 case 0: return new DecodeError_UnknownVersion(ptr);
21 case 1: return new DecodeError_UnknownRequiredFeature(ptr);
22 case 2: return new DecodeError_InvalidValue(ptr);
23 case 3: return new DecodeError_ShortRead(ptr);
24 case 4: return new DecodeError_BadLengthDescriptor(ptr);
25 case 5: return new DecodeError_Io(ptr);
26 case 6: return new DecodeError_UnsupportedCompression(ptr);
28 throw new ArgumentException("Impossible enum variant");
32 /** A DecodeError of type UnknownVersion */
33 public class DecodeError_UnknownVersion : DecodeError {
34 internal DecodeError_UnknownVersion(long ptr) : base(null, ptr) {
37 /** A DecodeError of type UnknownRequiredFeature */
38 public class DecodeError_UnknownRequiredFeature : DecodeError {
39 internal DecodeError_UnknownRequiredFeature(long ptr) : base(null, ptr) {
42 /** A DecodeError of type InvalidValue */
43 public class DecodeError_InvalidValue : DecodeError {
44 internal DecodeError_InvalidValue(long ptr) : base(null, ptr) {
47 /** A DecodeError of type ShortRead */
48 public class DecodeError_ShortRead : DecodeError {
49 internal DecodeError_ShortRead(long ptr) : base(null, ptr) {
52 /** A DecodeError of type BadLengthDescriptor */
53 public class DecodeError_BadLengthDescriptor : DecodeError {
54 internal DecodeError_BadLengthDescriptor(long ptr) : base(null, ptr) {
57 /** A DecodeError of type Io */
58 public class DecodeError_Io : DecodeError {
60 internal DecodeError_Io(long ptr) : base(null, ptr) {
61 this.io = bindings.LDKDecodeError_Io_get_io(ptr);
64 /** A DecodeError of type UnsupportedCompression */
65 public class DecodeError_UnsupportedCompression : DecodeError {
66 internal DecodeError_UnsupportedCompression(long ptr) : base(null, ptr) {
69 internal long clone_ptr() {
70 long ret = bindings.DecodeError_clone_ptr(this.ptr);
76 * Creates a copy of the DecodeError
78 public DecodeError clone() {
79 long ret = bindings.DecodeError_clone(this.ptr);
81 if (ret >= 0 && ret <= 4096) { return null; }
82 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
83 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
88 * Utility method to constructs a new UnknownVersion-variant DecodeError
90 public static DecodeError unknown_version() {
91 long ret = bindings.DecodeError_unknown_version();
92 if (ret >= 0 && ret <= 4096) { return null; }
93 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
99 * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
101 public static DecodeError unknown_required_feature() {
102 long ret = bindings.DecodeError_unknown_required_feature();
103 if (ret >= 0 && ret <= 4096) { return null; }
104 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
105 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
110 * Utility method to constructs a new InvalidValue-variant DecodeError
112 public static DecodeError invalid_value() {
113 long ret = bindings.DecodeError_invalid_value();
114 if (ret >= 0 && ret <= 4096) { return null; }
115 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
116 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
121 * Utility method to constructs a new ShortRead-variant DecodeError
123 public static DecodeError short_read() {
124 long ret = bindings.DecodeError_short_read();
125 if (ret >= 0 && ret <= 4096) { return null; }
126 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
127 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
132 * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
134 public static DecodeError bad_length_descriptor() {
135 long ret = bindings.DecodeError_bad_length_descriptor();
136 if (ret >= 0 && ret <= 4096) { return null; }
137 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
138 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
143 * Utility method to constructs a new Io-variant DecodeError
145 public static DecodeError io(IOError a) {
146 long ret = bindings.DecodeError_io(a);
148 if (ret >= 0 && ret <= 4096) { return null; }
149 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
150 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
155 * Utility method to constructs a new UnsupportedCompression-variant DecodeError
157 public static DecodeError unsupported_compression() {
158 long ret = bindings.DecodeError_unsupported_compression();
159 if (ret >= 0 && ret <= 4096) { return null; }
160 org.ldk.structs.DecodeError ret_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(ret);
161 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
166 * Checks if two DecodeErrors contain equal inner contents.
167 * This ignores pointers and is_owned flags and looks at the values in fields.
169 public bool eq(org.ldk.structs.DecodeError b) {
170 bool ret = bindings.DecodeError_eq(this.ptr, b == null ? 0 : b.ptr);
176 public override bool Equals(object o) {
177 if (!(o is DecodeError)) return false;
178 return this.eq((DecodeError)o);