4ad07c9a7a4eeed41a31fb4dba41ec5b1aabcb79
[ldk-java] / src / main / java / org / ldk / structs / ChannelMessageHandler.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
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);
14         }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 bindings.ChannelMessageHandler_free(ptr); super.finalize();
18         }
19
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);
25         }
26
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);
30         }
31
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);
35         }
36
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);
40         }
41
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);
45         }
46
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);
50         }
51
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);
55         }
56
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);
60         }
61
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);
65         }
66
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);
70         }
71
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);
75         }
76
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);
80         }
81
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);
85         }
86
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);
89         }
90
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);
94         }
95
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);
99         }
100
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);
104         }
105
106 }