-static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
- LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
- atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
- return (void*) this_arg;
-}
-static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (void* ctx_TODO, jobject o, jobject MessageSendEventsProvider) {
- jclass c = (*env)->GetObjectClass(env, o);
- CHECK(c != NULL);
- LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
- atomic_init(&calls->refcnt, 1);
- DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
- calls->o = (*env)->NewWeakGlobalRef(env, o);
- calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
- CHECK(calls->handle_open_channel_meth != NULL);
- calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
- CHECK(calls->handle_accept_channel_meth != NULL);
- calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
- CHECK(calls->handle_funding_created_meth != NULL);
- calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
- CHECK(calls->handle_funding_signed_meth != NULL);
- calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
- CHECK(calls->handle_funding_locked_meth != NULL);
- calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
- CHECK(calls->handle_shutdown_meth != NULL);
- calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
- CHECK(calls->handle_closing_signed_meth != NULL);
- calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
- CHECK(calls->handle_update_add_htlc_meth != NULL);
- calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
- CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
- calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
- CHECK(calls->handle_update_fail_htlc_meth != NULL);
- calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
- CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
- calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
- CHECK(calls->handle_commitment_signed_meth != NULL);
- calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
- CHECK(calls->handle_revoke_and_ack_meth != NULL);
- calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
- CHECK(calls->handle_update_fee_meth != NULL);
- calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
- CHECK(calls->handle_announcement_signatures_meth != NULL);
- calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
- CHECK(calls->peer_disconnected_meth != NULL);
- calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
- CHECK(calls->peer_connected_meth != NULL);
- calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
- CHECK(calls->handle_channel_reestablish_meth != NULL);
- calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
- CHECK(calls->handle_error_meth != NULL);
-
- LDKChannelMessageHandler ret = {
- .this_arg = (void*) calls,
- .handle_open_channel = handle_open_channel_jcall,
- .handle_accept_channel = handle_accept_channel_jcall,
- .handle_funding_created = handle_funding_created_jcall,
- .handle_funding_signed = handle_funding_signed_jcall,
- .handle_funding_locked = handle_funding_locked_jcall,
- .handle_shutdown = handle_shutdown_jcall,
- .handle_closing_signed = handle_closing_signed_jcall,
- .handle_update_add_htlc = handle_update_add_htlc_jcall,
- .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
- .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
- .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
- .handle_commitment_signed = handle_commitment_signed_jcall,
- .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
- .handle_update_fee = handle_update_fee_jcall,
- .handle_announcement_signatures = handle_announcement_signatures_jcall,
- .peer_disconnected = peer_disconnected_jcall,
- .peer_connected = peer_connected_jcall,
- .handle_channel_reestablish = handle_channel_reestablish_jcall,
- .handle_error = handle_error_jcall,
- .free = LDKChannelMessageHandler_JCalls_free,
- .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
- };
- calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
- return ret;
-}
-long LDKChannelMessageHandler_1new (void* ctx_TODO, jobject o, jobject MessageSendEventsProvider) {
- LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
- return (long)res_ptr;
-}
-jobject LDKChannelMessageHandler_1get_1obj_1from_1jcalls (void* ctx_TODO, uint32_t val) {
- jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
- CHECK(ret != NULL);
- return ret;
-}