X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FMessageSendEvent.java;h=e1a703df0a3914ba197cde9ae59e04d7f2b80429;hb=c3ae2d6897e5a809459c8d9a72a4b3aa0052c8c8;hp=8a58fe14738eaf89706009fa9cee434851bc92a3;hpb=0ddbeb5d1cddaa1d89cad2a63548434b2e1e227a;p=ldk-java diff --git a/src/main/java/org/ldk/structs/MessageSendEvent.java b/src/main/java/org/ldk/structs/MessageSendEvent.java index 8a58fe14..e1a703df 100644 --- a/src/main/java/org/ldk/structs/MessageSendEvent.java +++ b/src/main/java/org/ldk/structs/MessageSendEvent.java @@ -5,6 +5,12 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * An event generated by ChannelManager which indicates a message should be sent to a peer (or + * broadcast to most peers). + * These events are handled by PeerManager::process_events if you are using a PeerManager. + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class MessageSendEvent extends CommonBase { private MessageSendEvent(Object _dummy, long ptr) { super(ptr); } @@ -63,6 +69,15 @@ public class MessageSendEvent extends CommonBase { if (raw_val.getClass() == bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate.class) { return new PaymentFailureNetworkUpdate(ptr, (bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate)raw_val); } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelRangeQuery.class) { + return new SendChannelRangeQuery(ptr, (bindings.LDKMessageSendEvent.SendChannelRangeQuery)raw_val); + } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShortIdsQuery.class) { + return new SendShortIdsQuery(ptr, (bindings.LDKMessageSendEvent.SendShortIdsQuery)raw_val); + } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendReplyChannelRange.class) { + return new SendReplyChannelRange(ptr, (bindings.LDKMessageSendEvent.SendReplyChannelRange)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -74,6 +89,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; AcceptChannel msg_hu_conv = new AcceptChannel(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -85,6 +101,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; OpenChannel msg_hu_conv = new OpenChannel(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -96,6 +113,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; FundingCreated msg_hu_conv = new FundingCreated(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -107,6 +125,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; FundingSigned msg_hu_conv = new FundingSigned(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -118,6 +137,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; FundingLocked msg_hu_conv = new FundingLocked(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -129,6 +149,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; AnnouncementSignatures msg_hu_conv = new AnnouncementSignatures(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -140,6 +161,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long updates = obj.updates; CommitmentUpdate updates_hu_conv = new CommitmentUpdate(null, updates); + updates_hu_conv.ptrs_to.add(this); this.updates = updates_hu_conv; } } @@ -151,6 +173,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; RevokeAndACK msg_hu_conv = new RevokeAndACK(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -162,6 +185,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; ClosingSigned msg_hu_conv = new ClosingSigned(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -173,6 +197,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; Shutdown msg_hu_conv = new Shutdown(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -184,6 +209,7 @@ public class MessageSendEvent extends CommonBase { this.node_id = obj.node_id; long msg = obj.msg; ChannelReestablish msg_hu_conv = new ChannelReestablish(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -194,9 +220,11 @@ public class MessageSendEvent extends CommonBase { super(null, ptr); long msg = obj.msg; ChannelAnnouncement msg_hu_conv = new ChannelAnnouncement(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; long update_msg = obj.update_msg; ChannelUpdate update_msg_hu_conv = new ChannelUpdate(null, update_msg); + update_msg_hu_conv.ptrs_to.add(this); this.update_msg = update_msg_hu_conv; } } @@ -206,6 +234,7 @@ public class MessageSendEvent extends CommonBase { super(null, ptr); long msg = obj.msg; NodeAnnouncement msg_hu_conv = new NodeAnnouncement(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -215,6 +244,7 @@ public class MessageSendEvent extends CommonBase { super(null, ptr); long msg = obj.msg; ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg); + msg_hu_conv.ptrs_to.add(this); this.msg = msg_hu_conv; } } @@ -240,4 +270,50 @@ public class MessageSendEvent extends CommonBase { this.update = update_hu_conv; } } + public final static class SendChannelRangeQuery extends MessageSendEvent { + public final byte[] node_id; + public final QueryChannelRange msg; + private SendChannelRangeQuery(long ptr, bindings.LDKMessageSendEvent.SendChannelRangeQuery obj) { + super(null, ptr); + this.node_id = obj.node_id; + long msg = obj.msg; + QueryChannelRange msg_hu_conv = new QueryChannelRange(null, msg); + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } + } + public final static class SendShortIdsQuery extends MessageSendEvent { + public final byte[] node_id; + public final QueryShortChannelIds msg; + private SendShortIdsQuery(long ptr, bindings.LDKMessageSendEvent.SendShortIdsQuery obj) { + super(null, ptr); + this.node_id = obj.node_id; + long msg = obj.msg; + QueryShortChannelIds msg_hu_conv = new QueryShortChannelIds(null, msg); + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } + } + public final static class SendReplyChannelRange extends MessageSendEvent { + public final byte[] node_id; + public final ReplyChannelRange msg; + private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) { + super(null, ptr); + this.node_id = obj.node_id; + long msg = obj.msg; + ReplyChannelRange msg_hu_conv = new ReplyChannelRange(null, msg); + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } + } + /** + * Creates a copy of the MessageSendEvent + */ + public MessageSendEvent clone() { + long ret = bindings.MessageSendEvent_clone(this.ptr); + MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + }