+static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
+ LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = RouteHop_clone(&orig->data[i]);
+ }
+ return ret;
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CVec_1RouteHopZZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
+ LDKCVec_CVec_RouteHopZZ *vec = (LDKCVec_CVec_RouteHopZZ*)ptr;
+ return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVec_RouteHopZ));
+}
+static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
+ LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
+ }
+ return ret;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
+ return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
+ CHECK(val->result_ok);
+ LDKRoute res_var = (*val->contents.result);
+ CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long res_ref = (long)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long err_ref = (long)err_var.inner & ~1;
+ return err_ref;
+}
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
+ LDKCVec_RouteHintZ *vec = (LDKCVec_RouteHintZ*)ptr;
+ jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
+ jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
+ for (size_t i = 0; i < vec->datalen; i++) {
+ CHECK((((long)vec->data[i].inner) & 1) == 0);
+ ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
+ return ret;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
+ LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
+ ret->datalen = (*env)->GetArrayLength(env, elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
+ jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ jlong arr_elem = java_elems[i];
+ LDKRouteHint arr_elem_conv;
+ arr_elem_conv.inner = (void*)(arr_elem & (~1));
+ arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
+ if (arr_elem_conv.inner != NULL)
+ arr_elem_conv = RouteHint_clone(&arr_elem_conv);
+ ret->data[i] = arr_elem_conv;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
+ }
+ return (long)ret;
+}
+static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
+ LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = RouteHint_clone(&orig->data[i]);
+ }
+ return ret;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
+ return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
+ CHECK(val->result_ok);
+ LDKRoute res_var = (*val->contents.result);
+ CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long res_ref = (long)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
+ CHECK(!val->result_ok);
+ LDKLightningError err_var = (*val->contents.err);
+ CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long err_ref = (long)err_var.inner & ~1;
+ return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
+ return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
+ CHECK(val->result_ok);
+ LDKRoutingFees res_var = (*val->contents.result);
+ CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long res_ref = (long)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long err_ref = (long)err_var.inner & ~1;
+ return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
+ return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
+ CHECK(val->result_ok);
+ LDKNodeAnnouncementInfo res_var = (*val->contents.result);
+ CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long res_ref = (long)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long err_ref = (long)err_var.inner & ~1;
+ return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
+ return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
+ CHECK(val->result_ok);
+ LDKNodeInfo res_var = (*val->contents.result);
+ CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long res_ref = (long)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long err_ref = (long)err_var.inner & ~1;
+ return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
+ return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
+ CHECK(val->result_ok);
+ LDKNetworkGraph res_var = (*val->contents.result);
+ CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long res_ref = (long)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
+ LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long err_ref = (long)err_var.inner & ~1;
+ return err_ref;
+}
+typedef struct LDKMessageSendEventsProvider_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID get_and_clear_pending_msg_events_meth;
+} LDKMessageSendEventsProvider_JCalls;
+LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ JNIEnv *_env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
+ jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
+ CHECK(obj != NULL);
+ jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
+ LDKCVec_MessageSendEventZ arg_constr;
+ arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
+ if (arg_constr.datalen > 0)
+ arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
+ else
+ arg_constr.data = NULL;
+ long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
+ for (size_t s = 0; s < arg_constr.datalen; s++) {
+ long arr_conv_18 = arg_vals[s];
+ LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
+ FREE((void*)arr_conv_18);
+ arg_constr.data[s] = arr_conv_18_conv;
+ }
+ (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
+ return arg_constr;
+}
+static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ FREE(j_calls);
+ }
+}
+static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ return (void*) this_arg;
+}
+static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
+ CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
+
+ LDKMessageSendEventsProvider ret = {
+ .this_arg = (void*) calls,
+ .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
+ .free = LDKMessageSendEventsProvider_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
+ LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
+ return (long)res_ptr;
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
+ jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
+ CHECK(ret != NULL);
+ return ret;
+}
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
+ LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
+ LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
+ jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
+ jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
+ for (size_t s = 0; s < ret_var.datalen; s++) {
+ LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+ *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
+ long arr_conv_18_ref = (long)arr_conv_18_copy;
+ ret_arr_ptr[s] = arr_conv_18_ref;
+ }
+ (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+typedef struct LDKEventsProvider_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID get_and_clear_pending_events_meth;
+} LDKEventsProvider_JCalls;
+LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
+ LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
+ JNIEnv *_env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
+ jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
+ CHECK(obj != NULL);
+ jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
+ LDKCVec_EventZ arg_constr;
+ arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
+ if (arg_constr.datalen > 0)
+ arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
+ else
+ arg_constr.data = NULL;
+ long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
+ for (size_t h = 0; h < arg_constr.datalen; h++) {
+ long arr_conv_7 = arg_vals[h];
+ LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
+ FREE((void*)arr_conv_7);
+ arg_constr.data[h] = arr_conv_7_conv;
+ }
+ (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
+ return arg_constr;
+}
+static void LDKEventsProvider_JCalls_free(void* this_arg) {
+ LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ FREE(j_calls);
+ }
+}
+static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
+ LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ return (void*) this_arg;
+}
+static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
+ CHECK(calls->get_and_clear_pending_events_meth != NULL);
+
+ LDKEventsProvider ret = {
+ .this_arg = (void*) calls,
+ .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
+ .free = LDKEventsProvider_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
+ LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *res_ptr = LDKEventsProvider_init(env, _a, o);
+ return (long)res_ptr;
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
+ jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
+ CHECK(ret != NULL);
+ return ret;
+}
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
+ LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
+ LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
+ jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
+ jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
+ for (size_t h = 0; h < ret_var.datalen; h++) {
+ LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
+ long arr_conv_7_ref = (long)arr_conv_7_copy;
+ ret_arr_ptr[h] = arr_conv_7_ref;
+ }
+ (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+typedef struct LDKAccess_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID get_utxo_meth;
+} LDKAccess_JCalls;
+LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ JNIEnv *_env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
+ jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
+ (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
+ jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
+ CHECK(obj != NULL);
+ LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+ LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
+ FREE((void*)ret);
+ return ret_conv;
+}
+static void LDKAccess_JCalls_free(void* this_arg) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ FREE(j_calls);
+ }
+}
+static void* LDKAccess_JCalls_clone(const void* this_arg) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ return (void*) this_arg;
+}
+static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
+ CHECK(calls->get_utxo_meth != NULL);
+
+ LDKAccess ret = {
+ .this_arg = (void*) calls,
+ .get_utxo = get_utxo_jcall,
+ .free = LDKAccess_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
+ LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *res_ptr = LDKAccess_init(env, _a, o);
+ return (long)res_ptr;
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
+ jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
+ CHECK(ret != NULL);
+ return ret;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray genesis_hash, jlong short_channel_id) {
+ LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
+ unsigned char genesis_hash_arr[32];
+ CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
+ (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
+ unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
+ LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
+ *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
+ return (long)ret_conv;
+}
+
+typedef struct LDKFilter_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID register_tx_meth;
+ jmethodID register_output_meth;
+} LDKFilter_JCalls;
+void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ JNIEnv *_env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
+ jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
+ (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
+ LDKu8slice script_pubkey_var = script_pubkey;
+ jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
+ (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
+ jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
+ CHECK(obj != NULL);
+ return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
+}
+void register_output_jcall(const void* this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ JNIEnv *_env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
+ LDKOutPoint outpoint_var = *outpoint;
+ if (outpoint->inner != NULL)
+ outpoint_var = OutPoint_clone(outpoint);
+ CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long outpoint_ref = (long)outpoint_var.inner;
+ if (outpoint_var.is_owned) {
+ outpoint_ref |= 1;
+ }
+ LDKu8slice script_pubkey_var = script_pubkey;
+ jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
+ (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
+ jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
+ CHECK(obj != NULL);
+ return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
+}
+static void LDKFilter_JCalls_free(void* this_arg) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ FREE(j_calls);
+ }
+}
+static void* LDKFilter_JCalls_clone(const void* this_arg) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ return (void*) this_arg;
+}
+static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
+ CHECK(calls->register_tx_meth != NULL);
+ calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
+ CHECK(calls->register_output_meth != NULL);
+
+ LDKFilter ret = {
+ .this_arg = (void*) calls,
+ .register_tx = register_tx_jcall,
+ .register_output = register_output_jcall,
+ .free = LDKFilter_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
+ LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *res_ptr = LDKFilter_init(env, _a, o);
+ return (long)res_ptr;
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
+ jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
+ CHECK(ret != NULL);
+ return ret;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
+ LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
+ unsigned char txid_arr[32];
+ CHECK((*_env)->GetArrayLength (_env, txid) == 32);
+ (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
+ unsigned char (*txid_ref)[32] = &txid_arr;
+ LDKu8slice script_pubkey_ref;
+ script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
+ script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
+ (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
+ (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
+ LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
+ LDKOutPoint outpoint_conv;
+ outpoint_conv.inner = (void*)(outpoint & (~1));
+ outpoint_conv.is_owned = false;
+ LDKu8slice script_pubkey_ref;
+ script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
+ script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
+ (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
+ (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
+}
+
+typedef struct LDKPersist_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID persist_new_channel_meth;
+ jmethodID update_persisted_channel_meth;
+} LDKPersist_JCalls;
+LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
+ JNIEnv *_env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
+ LDKOutPoint id_var = id;
+ CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long id_ref = (long)id_var.inner;
+ if (id_var.is_owned) {
+ id_ref |= 1;
+ }
+ LDKChannelMonitor data_var = *data;
+ // Warning: we may need a move here but can't clone!
+ CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long data_ref = (long)data_var.inner;
+ if (data_var.is_owned) {
+ data_ref |= 1;
+ }
+ jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
+ CHECK(obj != NULL);
+ LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
+ LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
+ FREE((void*)ret);
+ return ret_conv;
+}
+LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
+ JNIEnv *_env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
+ LDKOutPoint id_var = id;
+ CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long id_ref = (long)id_var.inner;
+ if (id_var.is_owned) {
+ id_ref |= 1;
+ }
+ LDKChannelMonitorUpdate update_var = *update;
+ if (update->inner != NULL)
+ update_var = ChannelMonitorUpdate_clone(update);
+ CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long update_ref = (long)update_var.inner;
+ if (update_var.is_owned) {
+ update_ref |= 1;
+ }
+ LDKChannelMonitor data_var = *data;
+ // Warning: we may need a move here but can't clone!
+ CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ long data_ref = (long)data_var.inner;
+ if (data_var.is_owned) {
+ data_ref |= 1;
+ }
+ jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
+ CHECK(obj != NULL);
+ LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
+ LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
+ FREE((void*)ret);
+ return ret_conv;
+}
+static void LDKPersist_JCalls_free(void* this_arg) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ FREE(j_calls);
+ }
+}
+static void* LDKPersist_JCalls_clone(const void* this_arg) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ return (void*) this_arg;
+}
+static inline LDKPersist LDKPersist_init (JNIEnv * env, jclass _a, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
+ CHECK(calls->persist_new_channel_meth != NULL);
+ calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
+ CHECK(calls->update_persisted_channel_meth != NULL);
+
+ LDKPersist ret = {
+ .this_arg = (void*) calls,
+ .persist_new_channel = persist_new_channel_jcall,
+ .update_persisted_channel = update_persisted_channel_jcall,
+ .free = LDKPersist_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new (JNIEnv * env, jclass _a, jobject o) {
+ LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
+ *res_ptr = LDKPersist_init(env, _a, o);
+ return (long)res_ptr;
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPersist_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
+ jobject ret = (*env)->NewLocalRef(env, ((LDKPersist_JCalls*)val)->o);
+ CHECK(ret != NULL);
+ return ret;
+}
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong id, jlong data) {
+ LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
+ LDKOutPoint id_conv;
+ id_conv.inner = (void*)(id & (~1));
+ id_conv.is_owned = (id & 1) || (id == 0);
+ if (id_conv.inner != NULL)
+ id_conv = OutPoint_clone(&id_conv);
+ LDKChannelMonitor data_conv;
+ data_conv.inner = (void*)(data & (~1));
+ data_conv.is_owned = false;
+ LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
+ *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
+ return (long)ret_conv;
+}
+
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong id, jlong update, jlong data) {
+ LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
+ LDKOutPoint id_conv;
+ id_conv.inner = (void*)(id & (~1));
+ id_conv.is_owned = (id & 1) || (id == 0);
+ if (id_conv.inner != NULL)
+ id_conv = OutPoint_clone(&id_conv);
+ LDKChannelMonitorUpdate update_conv;
+ update_conv.inner = (void*)(update & (~1));
+ update_conv.is_owned = false;
+ LDKChannelMonitor data_conv;
+ data_conv.inner = (void*)(data & (~1));
+ data_conv.is_owned = false;
+ LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
+ *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
+ return (long)ret_conv;
+}
+