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 ChannelMessageHandler extends CommonBase {
10 ChannelMessageHandler(Object _dummy, long ptr) { super(ptr); }
11 public ChannelMessageHandler(bindings.LDKChannelMessageHandler arg, bindings.LDKMessageSendEventsProvider MessageSendEventsProvider) {
12 super(bindings.LDKChannelMessageHandler_new(arg, MessageSendEventsProvider));
13 this.ptrs_to.add(arg);
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
17 bindings.ChannelMessageHandler_free(ptr); super.finalize();
20 // Skipped ChannelMessageHandler_handle_open_channel
21 // Skipped ChannelMessageHandler_handle_accept_channel
22 public void handle_funding_created(byte[] their_node_id, FundingCreated msg) {
23 bindings.ChannelMessageHandler_handle_funding_created(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
24 this.ptrs_to.add(msg);
27 public void handle_funding_signed(byte[] their_node_id, FundingSigned msg) {
28 bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
29 this.ptrs_to.add(msg);
32 public void handle_funding_locked(byte[] their_node_id, FundingLocked msg) {
33 bindings.ChannelMessageHandler_handle_funding_locked(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
34 this.ptrs_to.add(msg);
37 public void handle_shutdown(byte[] their_node_id, Shutdown msg) {
38 bindings.ChannelMessageHandler_handle_shutdown(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
39 this.ptrs_to.add(msg);
42 public void handle_closing_signed(byte[] their_node_id, ClosingSigned msg) {
43 bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
44 this.ptrs_to.add(msg);
47 public void handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg) {
48 bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
49 this.ptrs_to.add(msg);
52 public void handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg) {
53 bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
54 this.ptrs_to.add(msg);
57 public void handle_update_fail_htlc(byte[] their_node_id, UpdateFailHTLC msg) {
58 bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
59 this.ptrs_to.add(msg);
62 public void handle_update_fail_malformed_htlc(byte[] their_node_id, UpdateFailMalformedHTLC msg) {
63 bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
64 this.ptrs_to.add(msg);
67 public void handle_commitment_signed(byte[] their_node_id, CommitmentSigned msg) {
68 bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
69 this.ptrs_to.add(msg);
72 public void handle_revoke_and_ack(byte[] their_node_id, RevokeAndACK msg) {
73 bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
74 this.ptrs_to.add(msg);
77 public void handle_update_fee(byte[] their_node_id, UpdateFee msg) {
78 bindings.ChannelMessageHandler_handle_update_fee(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
79 this.ptrs_to.add(msg);
82 public void handle_announcement_signatures(byte[] their_node_id, AnnouncementSignatures msg) {
83 bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
84 this.ptrs_to.add(msg);
87 public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) {
88 bindings.ChannelMessageHandler_peer_disconnected(this.ptr, their_node_id, no_connection_possible);
91 public void peer_connected(byte[] their_node_id, Init msg) {
92 bindings.ChannelMessageHandler_peer_connected(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
93 this.ptrs_to.add(msg);
96 public void handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg) {
97 bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
98 this.ptrs_to.add(msg);
101 public void handle_error(byte[] their_node_id, ErrorMessage msg) {
102 bindings.ChannelMessageHandler_handle_error(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1);
103 this.ptrs_to.add(msg);