1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class MessageSendEvent extends CommonBase {
10 private MessageSendEvent(Object _dummy, long ptr) { super(ptr); }
11 @Override @SuppressWarnings("deprecation")
12 protected void finalize() throws Throwable {
14 if (ptr != 0) { bindings.MessageSendEvent_free(ptr); }
16 static MessageSendEvent constr_from_ptr(long ptr) {
17 bindings.LDKMessageSendEvent raw_val = bindings.LDKMessageSendEvent_ref_from_ptr(ptr);
18 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAcceptChannel.class) {
19 return new SendAcceptChannel(ptr, (bindings.LDKMessageSendEvent.SendAcceptChannel)raw_val);
21 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendOpenChannel.class) {
22 return new SendOpenChannel(ptr, (bindings.LDKMessageSendEvent.SendOpenChannel)raw_val);
24 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingCreated.class) {
25 return new SendFundingCreated(ptr, (bindings.LDKMessageSendEvent.SendFundingCreated)raw_val);
27 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingSigned.class) {
28 return new SendFundingSigned(ptr, (bindings.LDKMessageSendEvent.SendFundingSigned)raw_val);
30 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendFundingLocked.class) {
31 return new SendFundingLocked(ptr, (bindings.LDKMessageSendEvent.SendFundingLocked)raw_val);
33 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendAnnouncementSignatures.class) {
34 return new SendAnnouncementSignatures(ptr, (bindings.LDKMessageSendEvent.SendAnnouncementSignatures)raw_val);
36 if (raw_val.getClass() == bindings.LDKMessageSendEvent.UpdateHTLCs.class) {
37 return new UpdateHTLCs(ptr, (bindings.LDKMessageSendEvent.UpdateHTLCs)raw_val);
39 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendRevokeAndACK.class) {
40 return new SendRevokeAndACK(ptr, (bindings.LDKMessageSendEvent.SendRevokeAndACK)raw_val);
42 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendClosingSigned.class) {
43 return new SendClosingSigned(ptr, (bindings.LDKMessageSendEvent.SendClosingSigned)raw_val);
45 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShutdown.class) {
46 return new SendShutdown(ptr, (bindings.LDKMessageSendEvent.SendShutdown)raw_val);
48 if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelReestablish.class) {
49 return new SendChannelReestablish(ptr, (bindings.LDKMessageSendEvent.SendChannelReestablish)raw_val);
51 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement.class) {
52 return new BroadcastChannelAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement)raw_val);
54 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement.class) {
55 return new BroadcastNodeAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement)raw_val);
57 if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelUpdate.class) {
58 return new BroadcastChannelUpdate(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelUpdate)raw_val);
60 if (raw_val.getClass() == bindings.LDKMessageSendEvent.HandleError.class) {
61 return new HandleError(ptr, (bindings.LDKMessageSendEvent.HandleError)raw_val);
63 if (raw_val.getClass() == bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate.class) {
64 return new PaymentFailureNetworkUpdate(ptr, (bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate)raw_val);
66 assert false; return null; // Unreachable without extending the (internal) bindings interface
69 public final static class SendAcceptChannel extends MessageSendEvent {
70 public final byte[] node_id;
71 public final AcceptChannel msg;
72 private SendAcceptChannel(long ptr, bindings.LDKMessageSendEvent.SendAcceptChannel obj) {
74 this.node_id = obj.node_id;
76 AcceptChannel msg_hu_conv = new AcceptChannel(null, msg);
77 this.msg = msg_hu_conv;
80 public final static class SendOpenChannel extends MessageSendEvent {
81 public final byte[] node_id;
82 public final OpenChannel msg;
83 private SendOpenChannel(long ptr, bindings.LDKMessageSendEvent.SendOpenChannel obj) {
85 this.node_id = obj.node_id;
87 OpenChannel msg_hu_conv = new OpenChannel(null, msg);
88 this.msg = msg_hu_conv;
91 public final static class SendFundingCreated extends MessageSendEvent {
92 public final byte[] node_id;
93 public final FundingCreated msg;
94 private SendFundingCreated(long ptr, bindings.LDKMessageSendEvent.SendFundingCreated obj) {
96 this.node_id = obj.node_id;
98 FundingCreated msg_hu_conv = new FundingCreated(null, msg);
99 this.msg = msg_hu_conv;
102 public final static class SendFundingSigned extends MessageSendEvent {
103 public final byte[] node_id;
104 public final FundingSigned msg;
105 private SendFundingSigned(long ptr, bindings.LDKMessageSendEvent.SendFundingSigned obj) {
107 this.node_id = obj.node_id;
109 FundingSigned msg_hu_conv = new FundingSigned(null, msg);
110 this.msg = msg_hu_conv;
113 public final static class SendFundingLocked extends MessageSendEvent {
114 public final byte[] node_id;
115 public final FundingLocked msg;
116 private SendFundingLocked(long ptr, bindings.LDKMessageSendEvent.SendFundingLocked obj) {
118 this.node_id = obj.node_id;
120 FundingLocked msg_hu_conv = new FundingLocked(null, msg);
121 this.msg = msg_hu_conv;
124 public final static class SendAnnouncementSignatures extends MessageSendEvent {
125 public final byte[] node_id;
126 public final AnnouncementSignatures msg;
127 private SendAnnouncementSignatures(long ptr, bindings.LDKMessageSendEvent.SendAnnouncementSignatures obj) {
129 this.node_id = obj.node_id;
131 AnnouncementSignatures msg_hu_conv = new AnnouncementSignatures(null, msg);
132 this.msg = msg_hu_conv;
135 public final static class UpdateHTLCs extends MessageSendEvent {
136 public final byte[] node_id;
137 public final CommitmentUpdate updates;
138 private UpdateHTLCs(long ptr, bindings.LDKMessageSendEvent.UpdateHTLCs obj) {
140 this.node_id = obj.node_id;
141 long updates = obj.updates;
142 CommitmentUpdate updates_hu_conv = new CommitmentUpdate(null, updates);
143 this.updates = updates_hu_conv;
146 public final static class SendRevokeAndACK extends MessageSendEvent {
147 public final byte[] node_id;
148 public final RevokeAndACK msg;
149 private SendRevokeAndACK(long ptr, bindings.LDKMessageSendEvent.SendRevokeAndACK obj) {
151 this.node_id = obj.node_id;
153 RevokeAndACK msg_hu_conv = new RevokeAndACK(null, msg);
154 this.msg = msg_hu_conv;
157 public final static class SendClosingSigned extends MessageSendEvent {
158 public final byte[] node_id;
159 public final ClosingSigned msg;
160 private SendClosingSigned(long ptr, bindings.LDKMessageSendEvent.SendClosingSigned obj) {
162 this.node_id = obj.node_id;
164 ClosingSigned msg_hu_conv = new ClosingSigned(null, msg);
165 this.msg = msg_hu_conv;
168 public final static class SendShutdown extends MessageSendEvent {
169 public final byte[] node_id;
170 public final Shutdown msg;
171 private SendShutdown(long ptr, bindings.LDKMessageSendEvent.SendShutdown obj) {
173 this.node_id = obj.node_id;
175 Shutdown msg_hu_conv = new Shutdown(null, msg);
176 this.msg = msg_hu_conv;
179 public final static class SendChannelReestablish extends MessageSendEvent {
180 public final byte[] node_id;
181 public final ChannelReestablish msg;
182 private SendChannelReestablish(long ptr, bindings.LDKMessageSendEvent.SendChannelReestablish obj) {
184 this.node_id = obj.node_id;
186 ChannelReestablish msg_hu_conv = new ChannelReestablish(null, msg);
187 this.msg = msg_hu_conv;
190 public final static class BroadcastChannelAnnouncement extends MessageSendEvent {
191 public final ChannelAnnouncement msg;
192 public final ChannelUpdate update_msg;
193 private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) {
196 ChannelAnnouncement msg_hu_conv = new ChannelAnnouncement(null, msg);
197 this.msg = msg_hu_conv;
198 long update_msg = obj.update_msg;
199 ChannelUpdate update_msg_hu_conv = new ChannelUpdate(null, update_msg);
200 this.update_msg = update_msg_hu_conv;
203 public final static class BroadcastNodeAnnouncement extends MessageSendEvent {
204 public final NodeAnnouncement msg;
205 private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) {
208 NodeAnnouncement msg_hu_conv = new NodeAnnouncement(null, msg);
209 this.msg = msg_hu_conv;
212 public final static class BroadcastChannelUpdate extends MessageSendEvent {
213 public final ChannelUpdate msg;
214 private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) {
217 ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
218 this.msg = msg_hu_conv;
221 public final static class HandleError extends MessageSendEvent {
222 public final byte[] node_id;
223 public final ErrorAction action;
224 private HandleError(long ptr, bindings.LDKMessageSendEvent.HandleError obj) {
226 this.node_id = obj.node_id;
227 long action = obj.action;
228 ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action);
229 action_hu_conv.ptrs_to.add(this);
230 this.action = action_hu_conv;
233 public final static class PaymentFailureNetworkUpdate extends MessageSendEvent {
234 public final HTLCFailChannelUpdate update;
235 private PaymentFailureNetworkUpdate(long ptr, bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate obj) {
237 long update = obj.update;
238 HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
239 update_hu_conv.ptrs_to.add(this);
240 this.update = update_hu_conv;