From: Matt Corallo Date: Fri, 28 Aug 2020 00:16:23 +0000 (-0400) Subject: Compiles with fn calls, even if the call types are bogus X-Git-Tag: v0.0.1~163 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=44b02619502b7c950515434c418f85214a2b5995;p=ldk-java Compiles with fn calls, even if the call types are bogus --- diff --git a/genbindings.py b/genbindings.py index 79f91060..c03d033a 100755 --- a/genbindings.py +++ b/genbindings.py @@ -21,35 +21,43 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg if fn_arg.startswith("void"): java_ty = "void" c_ty = "void" - fn_arg = fn_arg.strip("void ") + fn_arg = fn_arg[4:].strip() elif fn_arg.startswith("bool"): java_ty = "boolean" c_ty = "jboolean" - fn_arg = fn_arg.strip("bool ") + fn_arg = fn_arg[4:].strip() elif fn_arg.startswith("uint8_t"): java_ty = "byte" c_ty = "jbyte" - fn_arg = fn_arg.strip("uint8_t ") + fn_arg = fn_arg[7:].strip() elif fn_arg.startswith("uint32_t"): java_ty = "int" c_ty = "jint" - fn_arg = fn_arg.strip("uint32_t ") + fn_arg = fn_arg[8:].strip() elif fn_arg.startswith("uint64_t"): java_ty = "long" c_ty = "jlong" - fn_arg = fn_arg.strip("uint64_t ") + fn_arg = fn_arg[8:].strip() else: ma = var_ty_regex.match(fn_arg) java_ty = "long" c_ty = "jlong" - fn_arg = ma.group(2) + fn_arg = ma.group(2).strip() is_ptr = True + if fn_arg.startswith(" *") or fn_arg.startswith("*"): + fn_arg = fn_arg.replace("*", "").strip() + is_ptr = True + c_ty = "jlong" + java_ty = "long" + var_is_arr = var_is_arr_regex.match(fn_arg) if var_is_arr is not None or ret_arr_len is not None: java_ty = java_ty + "[]" c_ty = c_ty + "Array" - return (java_ty, c_ty, is_ptr) + if var_is_arr is not None: + return (java_ty, c_ty, is_ptr, var_is_arr.group(1)) + return (java_ty, c_ty, is_ptr, fn_arg) def map_type(fn_arg, print_void, ret_arr_len, is_free): fn_arg = fn_arg.strip() @@ -58,7 +66,7 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg if fn_arg.startswith("const "): fn_arg = fn_arg[6:] - (java_ty, c_ty, is_ptr) = java_c_types(fn_arg, ret_arr_len) + (java_ty, c_ty, is_ptr, _) = java_c_types(fn_arg, ret_arr_len) is_ptr_to_obj = None if fn_arg.startswith("void"): if not print_void: @@ -214,7 +222,7 @@ public class bindings { const_val_regex = re.compile("^extern const ([A-Za-z_0-9]*) ([A-Za-z_0-9]*);$") line_indicates_opaque_regex = re.compile("^ bool _underlying_ref;$") - line_indicates_trait_regex = re.compile("^ ([A-Za-z_0-9]* \*?)\(\*([A-Za-z_0-9]*)\)\((const )?void \*this_arg.*\);$") + line_indicates_trait_regex = re.compile("^ ([A-Za-z_0-9]* \*?)\(\*([A-Za-z_0-9]*)\)\((const )?void \*this_arg(.*)\);$") assert(line_indicates_trait_regex.match(" uintptr_t (*send_data)(void *this_arg, LDKu8slice data, bool resume_read);")) assert(line_indicates_trait_regex.match(" LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);")) assert(line_indicates_trait_regex.match(" void *(*clone)(const void *this_arg);")) @@ -268,22 +276,60 @@ public class bindings { out_java.write("\tpublic interface " + struct_name + " {\n") for fn_line in trait_fn_lines: if fn_line.group(2) != "free" and fn_line.group(2) != "clone": - (java_ty, c_ty, is_ptr) = java_c_types(fn_line.group(1), None) - - out_java.write("\t\t " + java_ty + " " + fn_line.group(2) + "(/* TODO */);\n") - - out_c.write(c_ty + " " + fn_line.group(2) + "_jcall(void* this_arg/* TODO */) {\n") - out_c.write("\t" + struct_name + "_JCalls *arg = (" + struct_name + "_JCalls*) this_arg;\n") - out_c.write("\treturn (*arg->env)->Call" + java_ty.title() + "Method(arg->env, arg->o, arg->" + fn_line.group(2) + "_meth);\n"); + (java_ty, c_ty, is_ptr, _) = java_c_types(fn_line.group(1), None) + + out_java.write("\t\t " + java_ty + " " + fn_line.group(2) + "(") + is_const = fn_line.group(3) is not None + #if not is_ptr: + # out_c.write(c_ty + " " + fn_line.group(2) + "_jcall(") + #else: + out_c.write(fn_line.group(1) + fn_line.group(2) + "_jcall(") + if is_const: + out_c.write("const void* this_arg") + else: + out_c.write("void* this_arg") + + #arg_names = [] + for idx, arg in enumerate(fn_line.group(4).split(',')): + if arg == "": + continue + if idx >= 2: + out_java.write(", ") + out_c.write(", ") + #arg_names.append(map_type(arg, True, None, False)) + out_c.write(arg.strip()) + (arg_java_ty, arg_c_ty, arg_is_ptr, arg_name) = java_c_types(arg, None) + out_java.write(arg_java_ty + " " + arg_name) + + out_java.write(");\n") + out_c.write(") {\n") + out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") + + if not is_ptr: + out_c.write("\treturn (*j_calls->env)->Call" + java_ty.title() + "Method(j_calls->env, j_calls->o, j_calls->" + fn_line.group(2) + "_meth") + else: + out_c.write("\t" + fn_line.group(1).strip() + "* ret = (" + fn_line.group(1).strip() + "*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->" + fn_line.group(2) + "_meth"); + for arg in fn_line.group(4).split(','): + if arg == "": + continue + (arg_java_ty, arg_c_ty, arg_is_ptr, arg_name) = java_c_types(arg, None) + # TODO: Run conversion here! + out_c.write(", " + arg_name) + out_c.write(");\n"); + + if is_ptr: + out_c.write("\t" + fn_line.group(1).strip() + " res = *ret;\n") + out_c.write("\tfree(ret);\n") + out_c.write("\treturn res;\n") out_c.write("}\n") elif fn_line.group(2) == "free": out_c.write("void " + struct_name + "_JCalls_free(void* this_arg) {\n") - out_c.write("\t" + struct_name + "_JCalls *arg = (" + struct_name + "_JCalls*) this_arg;\n") - out_c.write("\t(*arg->env)->DeleteGlobalRef(arg->env, arg->o);\n") - out_c.write("\tfree(arg);\n") + out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") + out_c.write("\t(*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);\n") + out_c.write("\tfree(j_calls);\n") out_c.write("}\n") elif fn_line.group(2) == "clone": - out_c.write("void* " + struct_name + "_JCalls_clone(void* this_arg) {\n") + out_c.write("void* " + struct_name + "_JCalls_clone(const void* this_arg) {\n") out_c.write("\t" + struct_name + "_JCalls *ret = malloc(sizeof(" + struct_name + "_JCalls));\n") out_c.write("\tmemcpy(ret, this_arg, sizeof(" + struct_name + "_JCalls));\n") out_c.write("\treturn ret;\n") diff --git a/genbindings.sh b/genbindings.sh index a84ce4dd..b7b70bd4 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -8,4 +8,4 @@ set -e ./genbindings.py "$1/lightning-c-bindings/include/lightning.h" src/main/java/org/ldk/impl/bindings.java src/main/jni/bindings.c javac -h src/main/jni src/main/java/org/ldk/impl/bindings.java rm src/main/java/org/ldk/impl/bindings*.class -clang -Wall -Wno-incompatible-pointer-types -flto -fuse-ld=lld -O2 -o liblightningjni.so -shared -fPIC -Wno-pointer-sign -Isrc/main/jni -I"$1/lightning-c-bindings/include/" $2 src/main/jni/bindings.c "$1"/target/debug/liblightning.a +clang -Wall -flto -fuse-ld=lld -O2 -o liblightningjni.so -shared -fPIC -Wno-pointer-sign -Isrc/main/jni -I"$1/lightning-c-bindings/include/" $2 src/main/jni/bindings.c "$1"/target/debug/liblightning.a diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index e96e4c2e..64f8d6a5 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -6,104 +6,104 @@ public class bindings { } public interface LDKMessageSendEventsProvider { - long get_and_clear_pending_msg_events(/* TODO */); + long get_and_clear_pending_msg_events(); } public static native long LDKMessageSendEventsProvider_new(LDKMessageSendEventsProvider impl); public interface LDKEventsProvider { - long get_and_clear_pending_events(/* TODO */); + long get_and_clear_pending_events(); } public static native long LDKEventsProvider_new(LDKEventsProvider impl); public interface LDKLogger { - void log(/* TODO */); + void log(long record); } public static native long LDKLogger_new(LDKLogger impl); public interface LDKChainWatchInterface { - void install_watch_tx(/* TODO */); - void install_watch_outpoint(/* TODO */); - void watch_all_txn(/* TODO */); - long get_chain_utxo(/* TODO */); - long filter_block(/* TODO */); - long reentered(/* TODO */); + void install_watch_tx(byte[] txid, long script_pub_key); + void install_watch_outpoint(long outpoint, long out_script); + void watch_all_txn(); + long get_chain_utxo(long genesis_hash, long unspent_tx_output_identifier); + long filter_block(long block); + long reentered(); } public static native long LDKChainWatchInterface_new(LDKChainWatchInterface impl); public interface LDKBroadcasterInterface { - void broadcast_transaction(/* TODO */); + void broadcast_transaction(long tx); } public static native long LDKBroadcasterInterface_new(LDKBroadcasterInterface impl); public interface LDKChainListener { - void block_connected(/* TODO */); - void block_disconnected(/* TODO */); + void block_connected(byte[] header, int height, long txn_matched, long indexes_of_txn_matched); + void block_disconnected(byte[] header, int disconnected_height); } public static native long LDKChainListener_new(LDKChainListener impl); public interface LDKFeeEstimator { - int get_est_sat_per_1000_weight(/* TODO */); + int get_est_sat_per_1000_weight(long confirmation_target); } public static native long LDKFeeEstimator_new(LDKFeeEstimator impl); public interface LDKChannelKeys { - long get_per_commitment_point(/* TODO */); - long release_commitment_secret(/* TODO */); - long key_derivation_params(/* TODO */); - long sign_remote_commitment(/* TODO */); - long sign_local_commitment(/* TODO */); - long sign_local_commitment_htlc_transactions(/* TODO */); - long sign_justice_transaction(/* TODO */); - long sign_remote_htlc_transaction(/* TODO */); - long sign_closing_transaction(/* TODO */); - long sign_channel_announcement(/* TODO */); - void on_accept(/* TODO */); + long get_per_commitment_point(long idx); + long release_commitment_secret(long idx); + long key_derivation_params(); + long sign_remote_commitment(int feerate_per_kw, long commitment_tx, long keys, long htlcs); + long sign_local_commitment(long local_commitment_tx); + long sign_local_commitment_htlc_transactions(long local_commitment_tx); + long sign_justice_transaction(long justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); + long sign_remote_htlc_transaction(long htlc_tx, long input, long amount, long per_commitment_point, long htlc); + long sign_closing_transaction(long closing_tx); + long sign_channel_announcement(long msg); + void on_accept(long channel_points, long remote_to_self_delay, long local_to_self_delay); } public static native long LDKChannelKeys_new(LDKChannelKeys impl); public interface LDKKeysInterface { - long get_node_secret(/* TODO */); - long get_destination_script(/* TODO */); - long get_shutdown_pubkey(/* TODO */); - long get_channel_keys(/* TODO */); - long get_secure_random_bytes(/* TODO */); + long get_node_secret(); + long get_destination_script(); + long get_shutdown_pubkey(); + long get_channel_keys(boolean inbound, long channel_value_satoshis); + long get_secure_random_bytes(); } public static native long LDKKeysInterface_new(LDKKeysInterface impl); public interface LDKManyChannelMonitor { - long add_monitor(/* TODO */); - long update_monitor(/* TODO */); - long get_and_clear_pending_monitor_events(/* TODO */); + long add_monitor(long funding_txo, long monitor); + long update_monitor(long funding_txo, long monitor); + long get_and_clear_pending_monitor_events(); } public static native long LDKManyChannelMonitor_new(LDKManyChannelMonitor impl); public interface LDKChannelMessageHandler { - void handle_open_channel(/* TODO */); - void handle_accept_channel(/* TODO */); - void handle_funding_created(/* TODO */); - void handle_funding_signed(/* TODO */); - void handle_funding_locked(/* TODO */); - void handle_shutdown(/* TODO */); - void handle_closing_signed(/* TODO */); - void handle_update_add_htlc(/* TODO */); - void handle_update_fulfill_htlc(/* TODO */); - void handle_update_fail_htlc(/* TODO */); - void handle_update_fail_malformed_htlc(/* TODO */); - void handle_commitment_signed(/* TODO */); - void handle_revoke_and_ack(/* TODO */); - void handle_update_fee(/* TODO */); - void handle_announcement_signatures(/* TODO */); - void peer_disconnected(/* TODO */); - void peer_connected(/* TODO */); - void handle_channel_reestablish(/* TODO */); - void handle_error(/* TODO */); + void handle_open_channel(long their_node_id, long their_features, long msg); + void handle_accept_channel(long their_node_id, long their_features, long msg); + void handle_funding_created(long their_node_id, long msg); + void handle_funding_signed(long their_node_id, long msg); + void handle_funding_locked(long their_node_id, long msg); + void handle_shutdown(long their_node_id, long msg); + void handle_closing_signed(long their_node_id, long msg); + void handle_update_add_htlc(long their_node_id, long msg); + void handle_update_fulfill_htlc(long their_node_id, long msg); + void handle_update_fail_htlc(long their_node_id, long msg); + void handle_update_fail_malformed_htlc(long their_node_id, long msg); + void handle_commitment_signed(long their_node_id, long msg); + void handle_revoke_and_ack(long their_node_id, long msg); + void handle_update_fee(long their_node_id, long msg); + void handle_announcement_signatures(long their_node_id, long msg); + void peer_disconnected(long their_node_id, boolean no_connection_possible); + void peer_connected(long their_node_id, long msg); + void handle_channel_reestablish(long their_node_id, long msg); + void handle_error(long their_node_id, long msg); } public static native long LDKChannelMessageHandler_new(LDKChannelMessageHandler impl); public interface LDKRoutingMessageHandler { - long handle_node_announcement(/* TODO */); - long handle_channel_announcement(/* TODO */); - long handle_channel_update(/* TODO */); - void handle_htlc_fail_channel_update(/* TODO */); - long get_next_channel_announcements(/* TODO */); - long get_next_node_announcements(/* TODO */); - boolean should_request_full_sync(/* TODO */); + long handle_node_announcement(long msg); + long handle_channel_announcement(long msg); + long handle_channel_update(long msg); + void handle_htlc_fail_channel_update(long update); + long get_next_channel_announcements(long starting_point, byte batch_amount); + long get_next_node_announcements(long starting_point, byte batch_amount); + boolean should_request_full_sync(long node_id); } public static native long LDKRoutingMessageHandler_new(LDKRoutingMessageHandler impl); public interface LDKSocketDescriptor { - long send_data(/* TODO */); - void disconnect_socket(/* TODO */); - boolean eq(/* TODO */); - long hash(/* TODO */); + long send_data(long data, boolean resume_read); + void disconnect_socket(); + boolean eq(long other_arg); + long hash(); } public static native long LDKSocketDescriptor_new(LDKSocketDescriptor impl); /// extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ); diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 0e7acb27..cc4fb231 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -10,14 +10,17 @@ typedef struct LDKMessageSendEventsProvider_JCalls { jobject o; jmethodID get_and_clear_pending_msg_events_meth; } LDKMessageSendEventsProvider_JCalls; -jlong get_and_clear_pending_msg_events_jcall(void* this_arg/* TODO */) { - LDKMessageSendEventsProvider_JCalls *arg = (LDKMessageSendEventsProvider_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_and_clear_pending_msg_events_meth); +LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) { + LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; + LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_and_clear_pending_msg_events_meth); + LDKCVec_MessageSendEventZ res = *ret; + free(ret); + return res; } void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) { - LDKMessageSendEventsProvider_JCalls *arg = (LDKMessageSendEventsProvider_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -40,14 +43,17 @@ typedef struct LDKEventsProvider_JCalls { jobject o; jmethodID get_and_clear_pending_events_meth; } LDKEventsProvider_JCalls; -jlong get_and_clear_pending_events_jcall(void* this_arg/* TODO */) { - LDKEventsProvider_JCalls *arg = (LDKEventsProvider_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_and_clear_pending_events_meth); +LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) { + LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; + LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_and_clear_pending_events_meth); + LDKCVec_EventZ res = *ret; + free(ret); + return res; } void LDKEventsProvider_JCalls_free(void* this_arg) { - LDKEventsProvider_JCalls *arg = (LDKEventsProvider_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -70,14 +76,14 @@ typedef struct LDKLogger_JCalls { jobject o; jmethodID log_meth; } LDKLogger_JCalls; -void log_jcall(void* this_arg/* TODO */) { - LDKLogger_JCalls *arg = (LDKLogger_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->log_meth); +void log_jcall(const void* this_arg, const char *record) { + LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->log_meth, record); } void LDKLogger_JCalls_free(void* this_arg) { - LDKLogger_JCalls *arg = (LDKLogger_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -105,34 +111,43 @@ typedef struct LDKChainWatchInterface_JCalls { jmethodID filter_block_meth; jmethodID reentered_meth; } LDKChainWatchInterface_JCalls; -void install_watch_tx_jcall(void* this_arg/* TODO */) { - LDKChainWatchInterface_JCalls *arg = (LDKChainWatchInterface_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->install_watch_tx_meth); -} -void install_watch_outpoint_jcall(void* this_arg/* TODO */) { - LDKChainWatchInterface_JCalls *arg = (LDKChainWatchInterface_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->install_watch_outpoint_meth); -} -void watch_all_txn_jcall(void* this_arg/* TODO */) { - LDKChainWatchInterface_JCalls *arg = (LDKChainWatchInterface_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->watch_all_txn_meth); -} -jlong get_chain_utxo_jcall(void* this_arg/* TODO */) { - LDKChainWatchInterface_JCalls *arg = (LDKChainWatchInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_chain_utxo_meth); -} -jlong filter_block_jcall(void* this_arg/* TODO */) { - LDKChainWatchInterface_JCalls *arg = (LDKChainWatchInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->filter_block_meth); -} -jlong reentered_jcall(void* this_arg/* TODO */) { - LDKChainWatchInterface_JCalls *arg = (LDKChainWatchInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->reentered_meth); +void install_watch_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key) { + LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->install_watch_tx_meth, txid, script_pub_key); +} +void install_watch_outpoint_jcall(const void* this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice out_script) { + LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->install_watch_outpoint_meth, outpoint, out_script); +} +void watch_all_txn_jcall(const void* this_arg) { + LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->watch_all_txn_meth); +} +LDKCResult_C2Tuple_Scriptu64ZChainErrorZ get_chain_utxo_jcall(const void* this_arg, LDKThirtyTwoBytes genesis_hash, uint64_t unspent_tx_output_identifier) { + LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg; + LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* ret = (LDKCResult_C2Tuple_Scriptu64ZChainErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_chain_utxo_meth, genesis_hash, unspent_tx_output_identifier); + LDKCResult_C2Tuple_Scriptu64ZChainErrorZ res = *ret; + free(ret); + return res; +} +LDKCVec_usizeZ filter_block_jcall(const void* this_arg, LDKu8slice block) { + LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg; + LDKCVec_usizeZ* ret = (LDKCVec_usizeZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->filter_block_meth, block); + LDKCVec_usizeZ res = *ret; + free(ret); + return res; +} +uintptr_t reentered_jcall(const void* this_arg) { + LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg; + uintptr_t* ret = (uintptr_t*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->reentered_meth); + uintptr_t res = *ret; + free(ret); + return res; } void LDKChainWatchInterface_JCalls_free(void* this_arg) { - LDKChainWatchInterface_JCalls *arg = (LDKChainWatchInterface_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChainWatchInterface_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -170,14 +185,14 @@ typedef struct LDKBroadcasterInterface_JCalls { jobject o; jmethodID broadcast_transaction_meth; } LDKBroadcasterInterface_JCalls; -void broadcast_transaction_jcall(void* this_arg/* TODO */) { - LDKBroadcasterInterface_JCalls *arg = (LDKBroadcasterInterface_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->broadcast_transaction_meth); +void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) { + LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->broadcast_transaction_meth, tx); } void LDKBroadcasterInterface_JCalls_free(void* this_arg) { - LDKBroadcasterInterface_JCalls *arg = (LDKBroadcasterInterface_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -201,18 +216,18 @@ typedef struct LDKChainListener_JCalls { jmethodID block_connected_meth; jmethodID block_disconnected_meth; } LDKChainListener_JCalls; -void block_connected_jcall(void* this_arg/* TODO */) { - LDKChainListener_JCalls *arg = (LDKChainListener_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->block_connected_meth); +void block_connected_jcall(const void* this_arg, const uint8_t (*header)[80], uint32_t height, LDKCVec_TransactionZ txn_matched, LDKusizeslice indexes_of_txn_matched) { + LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->block_connected_meth, header, height, txn_matched, indexes_of_txn_matched); } -void block_disconnected_jcall(void* this_arg/* TODO */) { - LDKChainListener_JCalls *arg = (LDKChainListener_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->block_disconnected_meth); +void block_disconnected_jcall(const void* this_arg, const uint8_t (*header)[80], uint32_t disconnected_height) { + LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->block_disconnected_meth, header, disconnected_height); } void LDKChainListener_JCalls_free(void* this_arg) { - LDKChainListener_JCalls *arg = (LDKChainListener_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChainListener_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -238,14 +253,14 @@ typedef struct LDKFeeEstimator_JCalls { jobject o; jmethodID get_est_sat_per_1000_weight_meth; } LDKFeeEstimator_JCalls; -jint get_est_sat_per_1000_weight_jcall(void* this_arg/* TODO */) { - LDKFeeEstimator_JCalls *arg = (LDKFeeEstimator_JCalls*) this_arg; - return (*arg->env)->CallIntMethod(arg->env, arg->o, arg->get_est_sat_per_1000_weight_meth); +uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) { + LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg; + return (*j_calls->env)->CallIntMethod(j_calls->env, j_calls->o, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target); } void LDKFeeEstimator_JCalls_free(void* this_arg) { - LDKFeeEstimator_JCalls *arg = (LDKFeeEstimator_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -278,59 +293,89 @@ typedef struct LDKChannelKeys_JCalls { jmethodID sign_channel_announcement_meth; jmethodID on_accept_meth; } LDKChannelKeys_JCalls; -jlong get_per_commitment_point_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_per_commitment_point_meth); -} -jlong release_commitment_secret_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->release_commitment_secret_meth); -} -jlong key_derivation_params_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->key_derivation_params_meth); -} -jlong sign_remote_commitment_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->sign_remote_commitment_meth); -} -jlong sign_local_commitment_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->sign_local_commitment_meth); -} -jlong sign_local_commitment_htlc_transactions_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->sign_local_commitment_htlc_transactions_meth); -} -jlong sign_justice_transaction_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->sign_justice_transaction_meth); -} -jlong sign_remote_htlc_transaction_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->sign_remote_htlc_transaction_meth); -} -jlong sign_closing_transaction_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->sign_closing_transaction_meth); -} -jlong sign_channel_announcement_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->sign_channel_announcement_meth); -} -void on_accept_jcall(void* this_arg/* TODO */) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->on_accept_meth); -} -void* LDKChannelKeys_JCalls_clone(void* this_arg) { +LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKPublicKey* ret = (LDKPublicKey*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_per_commitment_point_meth, idx); + LDKPublicKey res = *ret; + free(ret); + return res; +} +LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->release_commitment_secret_meth, idx); + LDKThirtyTwoBytes res = *ret; + free(ret); + return res; +} +LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->key_derivation_params_meth); + LDKC2Tuple_u64u64Z res = *ret; + free(ret); + return res; +} +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_remote_commitment_jcall(const void* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_remote_commitment_meth, feerate_per_kw, commitment_tx, keys, htlcs); + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret; + free(ret); + return res; +} +LDKCResult_SignatureNoneZ sign_local_commitment_jcall(const void* this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_local_commitment_meth, local_commitment_tx); + LDKCResult_SignatureNoneZ res = *ret; + free(ret); + return res; +} +LDKCResult_CVec_SignatureZNoneZ sign_local_commitment_htlc_transactions_jcall(const void* this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_local_commitment_htlc_transactions_meth, local_commitment_tx); + LDKCResult_CVec_SignatureZNoneZ res = *ret; + free(ret); + return res; +} +LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_justice_transaction_meth, justice_tx, input, amount, per_commitment_key, htlc); + LDKCResult_SignatureNoneZ res = *ret; + free(ret); + return res; +} +LDKCResult_SignatureNoneZ sign_remote_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_remote_htlc_transaction_meth, htlc_tx, input, amount, per_commitment_point, htlc); + LDKCResult_SignatureNoneZ res = *ret; + free(ret); + return res; +} +LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_closing_transaction_meth, closing_tx); + LDKCResult_SignatureNoneZ res = *ret; + free(ret); + return res; +} +LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_channel_announcement_meth, msg); + LDKCResult_SignatureNoneZ res = *ret; + free(ret); + return res; +} +void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t remote_to_self_delay, uint16_t local_to_self_delay) { + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->on_accept_meth, channel_points, remote_to_self_delay, local_to_self_delay); +} +void* LDKChannelKeys_JCalls_clone(const void* this_arg) { LDKChannelKeys_JCalls *ret = malloc(sizeof(LDKChannelKeys_JCalls)); memcpy(ret, this_arg, sizeof(LDKChannelKeys_JCalls)); return ret; } void LDKChannelKeys_JCalls_free(void* this_arg) { - LDKChannelKeys_JCalls *arg = (LDKChannelKeys_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -388,30 +433,45 @@ typedef struct LDKKeysInterface_JCalls { jmethodID get_channel_keys_meth; jmethodID get_secure_random_bytes_meth; } LDKKeysInterface_JCalls; -jlong get_node_secret_jcall(void* this_arg/* TODO */) { - LDKKeysInterface_JCalls *arg = (LDKKeysInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_node_secret_meth); -} -jlong get_destination_script_jcall(void* this_arg/* TODO */) { - LDKKeysInterface_JCalls *arg = (LDKKeysInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_destination_script_meth); -} -jlong get_shutdown_pubkey_jcall(void* this_arg/* TODO */) { - LDKKeysInterface_JCalls *arg = (LDKKeysInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_shutdown_pubkey_meth); -} -jlong get_channel_keys_jcall(void* this_arg/* TODO */) { - LDKKeysInterface_JCalls *arg = (LDKKeysInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_channel_keys_meth); -} -jlong get_secure_random_bytes_jcall(void* this_arg/* TODO */) { - LDKKeysInterface_JCalls *arg = (LDKKeysInterface_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_secure_random_bytes_meth); +LDKSecretKey get_node_secret_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + LDKSecretKey* ret = (LDKSecretKey*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_node_secret_meth); + LDKSecretKey res = *ret; + free(ret); + return res; +} +LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_destination_script_meth); + LDKCVec_u8Z res = *ret; + free(ret); + return res; +} +LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + LDKPublicKey* ret = (LDKPublicKey*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_shutdown_pubkey_meth); + LDKPublicKey res = *ret; + free(ret); + return res; +} +LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + LDKChannelKeys* ret = (LDKChannelKeys*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis); + LDKChannelKeys res = *ret; + free(ret); + return res; +} +LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_secure_random_bytes_meth); + LDKThirtyTwoBytes res = *ret; + free(ret); + return res; } void LDKKeysInterface_JCalls_free(void* this_arg) { - LDKKeysInterface_JCalls *arg = (LDKKeysInterface_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -448,22 +508,31 @@ typedef struct LDKManyChannelMonitor_JCalls { jmethodID update_monitor_meth; jmethodID get_and_clear_pending_monitor_events_meth; } LDKManyChannelMonitor_JCalls; -jlong add_monitor_jcall(void* this_arg/* TODO */) { - LDKManyChannelMonitor_JCalls *arg = (LDKManyChannelMonitor_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->add_monitor_meth); -} -jlong update_monitor_jcall(void* this_arg/* TODO */) { - LDKManyChannelMonitor_JCalls *arg = (LDKManyChannelMonitor_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->update_monitor_meth); -} -jlong get_and_clear_pending_monitor_events_jcall(void* this_arg/* TODO */) { - LDKManyChannelMonitor_JCalls *arg = (LDKManyChannelMonitor_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_and_clear_pending_monitor_events_meth); +LDKCResult_NoneChannelMonitorUpdateErrZ add_monitor_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { + LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg; + LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->add_monitor_meth, funding_txo, monitor); + LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret; + free(ret); + return res; +} +LDKCResult_NoneChannelMonitorUpdateErrZ update_monitor_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor) { + LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg; + LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->update_monitor_meth, funding_txo, monitor); + LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret; + free(ret); + return res; +} +LDKCVec_MonitorEventZ get_and_clear_pending_monitor_events_jcall(const void* this_arg) { + LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg; + LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_and_clear_pending_monitor_events_meth); + LDKCVec_MonitorEventZ res = *ret; + free(ret); + return res; } void LDKManyChannelMonitor_JCalls_free(void* this_arg) { - LDKManyChannelMonitor_JCalls *arg = (LDKManyChannelMonitor_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKManyChannelMonitor_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -510,86 +579,86 @@ typedef struct LDKChannelMessageHandler_JCalls { jmethodID handle_channel_reestablish_meth; jmethodID handle_error_meth; } LDKChannelMessageHandler_JCalls; -void handle_open_channel_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_open_channel_meth); +void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_open_channel_meth, their_node_id, their_features, msg); } -void handle_accept_channel_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_accept_channel_meth); +void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_accept_channel_meth, their_node_id, their_features, msg); } -void handle_funding_created_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_funding_created_meth); +void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_funding_created_meth, their_node_id, msg); } -void handle_funding_signed_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_funding_signed_meth); +void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_funding_signed_meth, their_node_id, msg); } -void handle_funding_locked_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_funding_locked_meth); +void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_funding_locked_meth, their_node_id, msg); } -void handle_shutdown_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_shutdown_meth); +void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_shutdown_meth, their_node_id, msg); } -void handle_closing_signed_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_closing_signed_meth); +void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_closing_signed_meth, their_node_id, msg); } -void handle_update_add_htlc_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_update_add_htlc_meth); +void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_add_htlc_meth, their_node_id, msg); } -void handle_update_fulfill_htlc_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_update_fulfill_htlc_meth); +void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fulfill_htlc_meth, their_node_id, msg); } -void handle_update_fail_htlc_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_update_fail_htlc_meth); +void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fail_htlc_meth, their_node_id, msg); } -void handle_update_fail_malformed_htlc_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_update_fail_malformed_htlc_meth); +void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id, msg); } -void handle_commitment_signed_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_commitment_signed_meth); +void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_commitment_signed_meth, their_node_id, msg); } -void handle_revoke_and_ack_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_revoke_and_ack_meth); +void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_revoke_and_ack_meth, their_node_id, msg); } -void handle_update_fee_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_update_fee_meth); +void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fee_meth, their_node_id, msg); } -void handle_announcement_signatures_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_announcement_signatures_meth); +void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_announcement_signatures_meth, their_node_id, msg); } -void peer_disconnected_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->peer_disconnected_meth); +void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->peer_disconnected_meth, their_node_id, no_connection_possible); } -void peer_connected_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->peer_connected_meth); +void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->peer_connected_meth, their_node_id, msg); } -void handle_channel_reestablish_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_channel_reestablish_meth); +void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_channel_reestablish_meth, their_node_id, msg); } -void handle_error_jcall(void* this_arg/* TODO */) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_error_meth); +void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_error_meth, their_node_id, msg); } void LDKChannelMessageHandler_JCalls_free(void* this_arg) { - LDKChannelMessageHandler_JCalls *arg = (LDKChannelMessageHandler_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -672,38 +741,53 @@ typedef struct LDKRoutingMessageHandler_JCalls { jmethodID get_next_node_announcements_meth; jmethodID should_request_full_sync_meth; } LDKRoutingMessageHandler_JCalls; -jlong handle_node_announcement_jcall(void* this_arg/* TODO */) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->handle_node_announcement_meth); -} -jlong handle_channel_announcement_jcall(void* this_arg/* TODO */) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->handle_channel_announcement_meth); -} -jlong handle_channel_update_jcall(void* this_arg/* TODO */) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->handle_channel_update_meth); -} -void handle_htlc_fail_channel_update_jcall(void* this_arg/* TODO */) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->handle_htlc_fail_channel_update_meth); -} -jlong get_next_channel_announcements_jcall(void* this_arg/* TODO */) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_next_channel_announcements_meth); -} -jlong get_next_node_announcements_jcall(void* this_arg/* TODO */) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->get_next_node_announcements_meth); -} -jboolean should_request_full_sync_jcall(void* this_arg/* TODO */) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - return (*arg->env)->CallBooleanMethod(arg->env, arg->o, arg->should_request_full_sync_meth); +LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->handle_node_announcement_meth, msg); + LDKCResult_boolLightningErrorZ res = *ret; + free(ret); + return res; +} +LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->handle_channel_announcement_meth, msg); + LDKCResult_boolLightningErrorZ res = *ret; + free(ret); + return res; +} +LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->handle_channel_update_meth, msg); + LDKCResult_boolLightningErrorZ res = *ret; + free(ret); + return res; +} +void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_htlc_fail_channel_update_meth, update); +} +LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); + LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret; + free(ret); + return res; +} +LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_next_node_announcements_meth, starting_point, batch_amount); + LDKCVec_NodeAnnouncementZ res = *ret; + free(ret); + return res; +} +bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + return (*j_calls->env)->CallBooleanMethod(j_calls->env, j_calls->o, j_calls->should_request_full_sync_meth, node_id); } void LDKRoutingMessageHandler_JCalls_free(void* this_arg) { - LDKRoutingMessageHandler_JCalls *arg = (LDKRoutingMessageHandler_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o); @@ -747,31 +831,34 @@ typedef struct LDKSocketDescriptor_JCalls { jmethodID eq_meth; jmethodID hash_meth; } LDKSocketDescriptor_JCalls; -jlong send_data_jcall(void* this_arg/* TODO */) { - LDKSocketDescriptor_JCalls *arg = (LDKSocketDescriptor_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->send_data_meth); -} -void disconnect_socket_jcall(void* this_arg/* TODO */) { - LDKSocketDescriptor_JCalls *arg = (LDKSocketDescriptor_JCalls*) this_arg; - return (*arg->env)->CallVoidMethod(arg->env, arg->o, arg->disconnect_socket_meth); -} -jboolean eq_jcall(void* this_arg/* TODO */) { - LDKSocketDescriptor_JCalls *arg = (LDKSocketDescriptor_JCalls*) this_arg; - return (*arg->env)->CallBooleanMethod(arg->env, arg->o, arg->eq_meth); -} -jlong hash_jcall(void* this_arg/* TODO */) { - LDKSocketDescriptor_JCalls *arg = (LDKSocketDescriptor_JCalls*) this_arg; - return (*arg->env)->CallLongMethod(arg->env, arg->o, arg->hash_meth); -} -void* LDKSocketDescriptor_JCalls_clone(void* this_arg) { +uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) { + LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; + uintptr_t* ret = (uintptr_t*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->send_data_meth, data, resume_read); + uintptr_t res = *ret; + free(ret); + return res; +} +void disconnect_socket_jcall(void* this_arg) { + LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; + return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->disconnect_socket_meth); +} +bool eq_jcall(const void* this_arg, const void *other_arg) { + LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; + return (*j_calls->env)->CallBooleanMethod(j_calls->env, j_calls->o, j_calls->eq_meth, other_arg); +} +uint64_t hash_jcall(const void* this_arg) { + LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; + return (*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->hash_meth); +} +void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) { LDKSocketDescriptor_JCalls *ret = malloc(sizeof(LDKSocketDescriptor_JCalls)); memcpy(ret, this_arg, sizeof(LDKSocketDescriptor_JCalls)); return ret; } void LDKSocketDescriptor_JCalls_free(void* this_arg) { - LDKSocketDescriptor_JCalls *arg = (LDKSocketDescriptor_JCalls*) this_arg; - (*arg->env)->DeleteGlobalRef(arg->env, arg->o); - free(arg); + LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; + (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o); + free(j_calls); } JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) { jclass c = (*env)->GetObjectClass(env, o);