/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.2.1
 *
 * Do not make changes to this file unless you know what you are doing - modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */


#define SWIG_VERSION 0x040201
#define SWIGJAVA
#define SWIG_DIRECTORS

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__))
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__))
# else
#   define SWIGUNUSED
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if defined(__GNUC__)
#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#    ifndef GCC_HASCLASSVISIBILITY
#      define GCC_HASCLASSVISIBILITY
#    endif
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif

/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif

/* Intel's compiler complains if a variable which was never initialised is
 * cast to void, which is a common idiom which we use to indicate that we
 * are aware a variable isn't used.  So we just silence that warning.
 * See: https://github.com/swig/swig/issues/192 for more discussion.
 */
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif

#if defined(__cplusplus) && __cplusplus >=201103L
# define SWIG_NULLPTR nullptr
#else
# define SWIG_NULLPTR NULL
#endif 

/* -----------------------------------------------------------------------------
 * swigcompat.swg
 *
 * Macros to provide support compatibility with older C and C++ standards.
 * ----------------------------------------------------------------------------- */

/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF
 * if you're missing it.
 */
#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \
     (defined __cplusplus && __cplusplus >= 201103L) || \
     defined SWIG_HAVE_SNPRINTF) && \
    !defined SWIG_NO_SNPRINTF
# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A)
# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B)
#else
/* Fallback versions ignore the buffer size, but most of our uses either have a
 * fixed maximum possible size or dynamically allocate a buffer that's large
 * enough.
 */
# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A)
# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B)
#endif


#include <jni.h>
#include <stdlib.h>
#include <string.h>


/* Support for throwing Java exceptions */
typedef enum {
  SWIG_JavaOutOfMemoryError = 1,
  SWIG_JavaIOException,
  SWIG_JavaRuntimeException,
  SWIG_JavaIndexOutOfBoundsException,
  SWIG_JavaArithmeticException,
  SWIG_JavaIllegalArgumentException,
  SWIG_JavaNullPointerException,
  SWIG_JavaDirectorPureVirtual,
  SWIG_JavaUnknownError,
  SWIG_JavaIllegalStateException,
} SWIG_JavaExceptionCodes;

typedef struct {
  SWIG_JavaExceptionCodes code;
  const char *java_exception;
} SWIG_JavaExceptions_t;


static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
  jclass excep;
  static const SWIG_JavaExceptions_t java_exceptions[] = {
    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
    { SWIG_JavaIOException, "java/io/IOException" },
    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
    { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
    { SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" },
    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
  };
  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;

  while (except_ptr->code != code && except_ptr->code)
    except_ptr++;

  jenv->ExceptionClear();
  excep = jenv->FindClass(except_ptr->java_exception);
  if (excep)
    jenv->ThrowNew(excep, msg);
}


/* Contract support */

#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } } while (0)

/* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */
#define  SWIG_UnknownError    	   -1
#define  SWIG_IOError        	   -2
#define  SWIG_RuntimeError   	   -3
#define  SWIG_IndexError     	   -4
#define  SWIG_TypeError      	   -5
#define  SWIG_DivisionByZero 	   -6
#define  SWIG_OverflowError  	   -7
#define  SWIG_SyntaxError    	   -8
#define  SWIG_ValueError     	   -9
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
#define  SWIG_MemoryError    	   -12
#define  SWIG_NullReferenceError   -13


/* -----------------------------------------------------------------------------
 * director_common.swg
 *
 * This file contains support for director classes which is common between
 * languages.
 * ----------------------------------------------------------------------------- */

/*
  Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the
  'Swig' namespace. This could be useful for multi-modules projects.
*/
#ifdef SWIG_DIRECTOR_STATIC
/* Force anonymous (static) namespace */
#define Swig
#endif
/* -----------------------------------------------------------------------------
 * director.swg
 *
 * This file contains support for director classes so that Java proxy
 * methods can be called from C++.
 * ----------------------------------------------------------------------------- */

#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) || defined(DEBUG_DIRECTOR_THREAD_NAME)
#include <iostream>
#endif

#include <exception>

#if defined(SWIG_JAVA_USE_THREAD_NAME)

#if !defined(SWIG_JAVA_GET_THREAD_NAME)
namespace Swig {
  SWIGINTERN int GetThreadName(char *name, size_t len);
}

#if defined(__linux__)

#include <sys/prctl.h>
SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
  (void)len;
#if defined(PR_GET_NAME)
  return prctl(PR_GET_NAME, (unsigned long)name, 0, 0, 0);
#else
  (void)name;
  return 1;
#endif
}

#elif defined(__unix__) || defined(__APPLE__)

#include <pthread.h>
SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
  return pthread_getname_np(pthread_self(), name, len);
}

#else

SWIGINTERN int Swig::GetThreadName(char *name, size_t len) {
  (void)len;
  (void)name;
  return 1;
}
#endif

#endif

#endif

#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
#include <pthread.h>
#endif

namespace Swig {

  /* Java object wrapper */
  class JObjectWrapper {
  public:
    JObjectWrapper() : jthis_(SWIG_NULLPTR), weak_global_(true) {
    }

    ~JObjectWrapper() {
      jthis_ = SWIG_NULLPTR;
      weak_global_ = true;
    }

    bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) {
      if (!jthis_) {
        weak_global_ = weak_global || !mem_own; // hold as weak global if explicitly requested or not owned
        if (jobj)
          jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj);
#if defined(DEBUG_DIRECTOR_OWNED)
        std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl;
#endif
        return true;
      } else {
#if defined(DEBUG_DIRECTOR_OWNED)
        std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl;
#endif
        return false;
      }
    }

    jobject get(JNIEnv *jenv) const {
#if defined(DEBUG_DIRECTOR_OWNED)
      std::cout << "JObjectWrapper::get(";
      if (jthis_)
        std::cout << jthis_;
      else
        std::cout << "null";
      std::cout << ") -> return new local ref" << std::endl;
#endif
      return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_);
    }

    void release(JNIEnv *jenv) {
#if defined(DEBUG_DIRECTOR_OWNED)
      std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl;
#endif
      if (jthis_) {
        if (weak_global_) {
          if (jenv->IsSameObject(jthis_, SWIG_NULLPTR) == JNI_FALSE)
            jenv->DeleteWeakGlobalRef((jweak)jthis_);
        } else
          jenv->DeleteGlobalRef(jthis_);
      }

      jthis_ = SWIG_NULLPTR;
      weak_global_ = true;
    }

    /* Only call peek if you know what you are doing wrt to weak/global references */
    jobject peek() {
      return jthis_;
    }

    /* Java proxy releases ownership of C++ object, C++ object is now
       responsible for destruction (creates NewGlobalRef to pin Java proxy) */
    void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) {
      if (take_or_release) {  /* Java takes ownership of C++ object's lifetime. */
        if (!weak_global_) {
          jenv->DeleteGlobalRef(jthis_);
          jthis_ = jenv->NewWeakGlobalRef(jself);
          weak_global_ = true;
        }
      } else {
	/* Java releases ownership of C++ object's lifetime */
        if (weak_global_) {
          jenv->DeleteWeakGlobalRef((jweak)jthis_);
          jthis_ = jenv->NewGlobalRef(jself);
          weak_global_ = false;
        }
      }
    }

#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
    static void detach(void *jvm) {
      static_cast<JavaVM *>(jvm)->DetachCurrentThread();
    }

    static void make_detach_key() {
      pthread_key_create(&detach_key_, detach);
    }

    /* thread-local key to register a destructor */
    static pthread_key_t detach_key_;
#endif

  private:
    /* pointer to Java object */
    jobject jthis_;
    /* Local or global reference flag */
    bool weak_global_;
  };

#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
  pthread_key_t JObjectWrapper::detach_key_;
#endif

  /* Local JNI reference deleter */
  class LocalRefGuard {
    JNIEnv *jenv_;
    jobject jobj_;

    // non-copyable
    LocalRefGuard(const LocalRefGuard &);
    LocalRefGuard &operator=(const LocalRefGuard &);
  public:
    LocalRefGuard(JNIEnv *jenv, jobject jobj): jenv_(jenv), jobj_(jobj) {}
    ~LocalRefGuard() {
      if (jobj_)
        jenv_->DeleteLocalRef(jobj_);
    }
  };

  /* director base class */
  class Director {
    /* pointer to Java virtual machine */
    JavaVM *swig_jvm_;

  protected:
#if defined (_MSC_VER) && (_MSC_VER<1300)
    class JNIEnvWrapper;
    friend class JNIEnvWrapper;
#endif
    /* Utility class for managing the JNI environment */
    class JNIEnvWrapper {
      const Director *director_;
      JNIEnv *jenv_;
      int env_status;
    public:
      JNIEnvWrapper(const Director *director) : director_(director), jenv_(SWIG_NULLPTR), env_status(0) {
#if defined(__ANDROID__)
        JNIEnv **jenv = &jenv_;
#else
        void **jenv = (void **)&jenv_;
#endif
        env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2);
        JavaVMAttachArgs args;
        args.version = JNI_VERSION_1_2;
        args.group = SWIG_NULLPTR;
        args.name = SWIG_NULLPTR;
#if defined(SWIG_JAVA_USE_THREAD_NAME)
        char thread_name[64];  // MAX_TASK_COMM_LEN=16 is hard-coded in the Linux kernel and MacOS has MAXTHREADNAMESIZE=64.
        if (Swig::GetThreadName(thread_name, sizeof(thread_name)) == 0) {
          args.name = thread_name;
#if defined(DEBUG_DIRECTOR_THREAD_NAME)
          std::cout << "JNIEnvWrapper: thread name: " << thread_name << std::endl;
        } else {
          std::cout << "JNIEnvWrapper: Couldn't set Java thread name" << std::endl;
#endif
        }
#endif
#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON)
        // Attach a daemon thread to the JVM. Useful when the JVM should not wait for
        // the thread to exit upon shutdown. Only for jdk-1.4 and later.
        director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, &args);
#else
        director_->swig_jvm_->AttachCurrentThread(jenv, &args);
#endif

#if defined(SWIG_JAVA_DETACH_ON_THREAD_END)
        // At least on Android 6, detaching after every call causes a memory leak.
        // Instead, register a thread desructor and detach only when the thread ends.
        // See https://developer.android.com/training/articles/perf-jni#threads
        static pthread_once_t once = PTHREAD_ONCE_INIT;

        pthread_once(&once, JObjectWrapper::make_detach_key);
        pthread_setspecific(JObjectWrapper::detach_key_, director->swig_jvm_);
#endif
      }
      ~JNIEnvWrapper() {
#if !defined(SWIG_JAVA_DETACH_ON_THREAD_END) && !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD)
        // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call.
        // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak.
        if (env_status == JNI_EDETACHED)
          director_->swig_jvm_->DetachCurrentThread();
#endif
      }
      JNIEnv *getJNIEnv() const {
        return jenv_;
      }
    };

    struct SwigDirectorMethod {
      const char *name;
      const char *desc;
      jmethodID methid;
      SwigDirectorMethod(JNIEnv *jenv, jclass baseclass, const char *name, const char *desc) : name(name), desc(desc) {
        methid = jenv->GetMethodID(baseclass, name, desc);
      }
    };

    /* Java object wrapper */
    JObjectWrapper swig_self_;

    /* Disconnect director from Java object */
    void swig_disconnect_director_self(const char *disconn_method) {
      JNIEnvWrapper jnienv(this) ;
      JNIEnv *jenv = jnienv.getJNIEnv() ;
      jobject jobj = swig_self_.get(jenv);
      LocalRefGuard ref_deleter(jenv, jobj);
#if defined(DEBUG_DIRECTOR_OWNED)
      std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl;
#endif
      if (jobj && jenv->IsSameObject(jobj, SWIG_NULLPTR) == JNI_FALSE) {
        jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V");
        if (disconn_meth) {
#if defined(DEBUG_DIRECTOR_OWNED)
          std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl;
#endif
          jenv->CallVoidMethod(jobj, disconn_meth);
        }
      }
    }

    jclass swig_new_global_ref(JNIEnv *jenv, const char *classname) {
      jclass clz = jenv->FindClass(classname);
      return clz ? (jclass)jenv->NewGlobalRef(clz) : SWIG_NULLPTR;
    }

  public:
    Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) SWIG_NULLPTR), swig_self_() {
      /* Acquire the Java VM pointer */
      jenv->GetJavaVM(&swig_jvm_);
    }

    virtual ~Director() {
      JNIEnvWrapper jnienv(this) ;
      JNIEnv *jenv = jnienv.getJNIEnv() ;
      swig_self_.release(jenv);
    }

    bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) {
      return swig_self_.set(jenv, jself, mem_own, weak_global);
    }

    jobject swig_get_self(JNIEnv *jenv) const {
      return swig_self_.get(jenv);
    }

    // Change C++ object's ownership, relative to Java
    void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) {
      swig_self_.java_change_ownership(jenv, jself, take_or_release);
    }
  };

  // Zero initialized bool array
  template<size_t N> class BoolArray {
    bool array_[N];
  public:
    BoolArray() {
      memset(array_, 0, sizeof(array_));
    }
    bool& operator[](size_t n) {
      return array_[n];
    }
    bool operator[](size_t n) const {
      return array_[n];
    }
  };

  // Utility classes and functions for exception handling.

  // Simple holder for a Java string during exception handling, providing access to a c-style string
  class JavaString {
  public:
    JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(SWIG_NULLPTR) {
      if (jenv_ && jstr_)
	cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, SWIG_NULLPTR);
    }

    ~JavaString() {
      if (jenv_ && jstr_ && cstr_)
	jenv_->ReleaseStringUTFChars(jstr_, cstr_);
    }

    const char *c_str(const char *null_string = "null JavaString") const {
      return cstr_ ? cstr_ : null_string;
    }

  private:
    // non-copyable
    JavaString(const JavaString &);
    JavaString &operator=(const JavaString &);

    JNIEnv *jenv_;
    jstring jstr_;
    const char *cstr_;
  };

  // Helper class to extract the exception message from a Java throwable
  class JavaExceptionMessage {
  public:
    JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) {
    }

    // Return a C string of the exception message in the jthrowable passed in the constructor
    // If no message is available, null_string is return instead
    const char *message(const char *null_string = "Could not get exception message in JavaExceptionMessage") const {
      return message_.c_str(null_string);
    }

  private:
    // non-copyable
    JavaExceptionMessage(const JavaExceptionMessage &);
    JavaExceptionMessage &operator=(const JavaExceptionMessage &);

    // Get exception message by calling Java method Throwable.getMessage()
    static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) {
      jstring jmsg = SWIG_NULLPTR;
      if (jenv && throwable) {
	jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions
	jclass throwclz = jenv->GetObjectClass(throwable);
	if (throwclz) {
	  // All Throwable classes have a getMessage() method, so call it to extract the exception message
	  jmethodID getMessageMethodID = jenv->GetMethodID(throwclz, "getMessage", "()Ljava/lang/String;");
	  if (getMessageMethodID)
	    jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID);
	}
	if (jmsg == SWIG_NULLPTR && jenv->ExceptionCheck())
	  jenv->ExceptionClear();
      }
      return jmsg;
    }

    JavaString message_;
  };

  // C++ Exception class for handling Java exceptions thrown during a director method Java upcall
  class DirectorException : public std::exception {
  public:

    // Construct exception from a Java throwable
    DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(SWIG_NULLPTR), msg_(SWIG_NULLPTR) {

      // Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/')
      if (jenv && throwable) {
	jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions
	jclass throwclz = jenv->GetObjectClass(throwable);
	if (throwclz) {
	  jclass clzclz = jenv->GetObjectClass(throwclz);
	  if (clzclz) {
	    jmethodID getNameMethodID = jenv->GetMethodID(clzclz, "getName", "()Ljava/lang/String;");
	    if (getNameMethodID) {
	      jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID));
              // Copy strings, since there is no guarantee that jenv will be active when handled
              if (jstr_classname) {
                JavaString jsclassname(jenv, jstr_classname);
                const char *classname = jsclassname.c_str(SWIG_NULLPTR);
                if (classname)
                  classname_ = copypath(classname);
              }
	    }
	  }
	}
      }

      JavaExceptionMessage exceptionmsg(jenv, throwable);
      msg_ = copystr(exceptionmsg.message(SWIG_NULLPTR));
    }

    // More general constructor for handling as a java.lang.RuntimeException
    DirectorException(const char *msg) : jenv_(SWIG_NULLPTR), throwable_(SWIG_NULLPTR), classname_(SWIG_NULLPTR), msg_(msg ? copystr(msg) : SWIG_NULLPTR) {
    }

    ~DirectorException() throw() {
      delete[] classname_;
      delete[] msg_;
    }

    const char *what() const throw() {
      return msg_ ? msg_ : "Unspecified DirectorException message";
    }

    // Reconstruct and raise/throw the Java Exception that caused the DirectorException
    // Note that any error in the JNI exception handling results in a Java RuntimeException
    void throwException(JNIEnv *jenv) const {
      if (jenv) {
        if (jenv == jenv_ && throwable_) {
          // Throw original exception if not already pending
          jthrowable throwable = jenv->ExceptionOccurred();
          if (throwable && jenv->IsSameObject(throwable, throwable_) == JNI_FALSE) {
            jenv->ExceptionClear();
            throwable = SWIG_NULLPTR;
          }
          if (!throwable)
            jenv->Throw(throwable_);
        } else {
          // Try and reconstruct original exception, but original stacktrace is not reconstructed
          jenv->ExceptionClear();

          jmethodID ctorMethodID = SWIG_NULLPTR;
          jclass throwableclass = SWIG_NULLPTR;
          if (classname_) {
            throwableclass = jenv->FindClass(classname_);
            if (throwableclass)
              ctorMethodID = jenv->GetMethodID(throwableclass, "<init>", "(Ljava/lang/String;)V");
          }

          if (ctorMethodID) {
            jenv->ThrowNew(throwableclass, what());
          } else {
            SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what());
          }
        }
      }
    }

    // Deprecated - use throwException
    void raiseJavaException(JNIEnv *jenv) const {
      throwException(jenv);
    }

    // Create and throw the DirectorException
    static void raise(JNIEnv *jenv, jthrowable throwable) {
      throw DirectorException(jenv, throwable);
    }

  private:
    static char *copypath(const char *srcmsg) {
      char *target = copystr(srcmsg);
      for (char *c=target; *c; ++c) {
        if ('.' == *c)
          *c = '/';
      }
      return target;
    }

    static char *copystr(const char *srcmsg) {
      char *target = SWIG_NULLPTR;
      if (srcmsg) {
	size_t msglen = strlen(srcmsg) + 1;
	target = new char[msglen];
	strncpy(target, srcmsg, msglen);
      }
      return target;
    }

    JNIEnv *jenv_;
    jthrowable throwable_;
    const char *classname_;
    const char *msg_;
  };

  // Helper method to determine if a Java throwable matches a particular Java class type
  // Note side effect of clearing any pending exceptions
  SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) {
    bool matches = false;

    if (throwable && jenv && classname) {
      // Exceptions need to be cleared for correct behavior.
      // The caller of ExceptionMatches should restore pending exceptions if desired -
      // the caller already has the throwable.
      jenv->ExceptionClear();

      jclass clz = jenv->FindClass(classname);
      if (clz) {
	jclass classclz = jenv->GetObjectClass(clz);
	jmethodID isInstanceMethodID = jenv->GetMethodID(classclz, "isInstance", "(Ljava/lang/Object;)Z");
	if (isInstanceMethodID) {
	  matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0;
	}
      }

#if defined(DEBUG_DIRECTOR_EXCEPTION)
      if (jenv->ExceptionCheck()) {
        // Typically occurs when an invalid classname argument is passed resulting in a ClassNotFoundException
        JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred());
        std::cout << "Error: ExceptionMatches: class '" << classname << "' : " << exc.message() << std::endl;
      }
#endif
    }
    return matches;
  }
}

namespace Swig {
  namespace {
    jclass jclass_dittoffiJNI = NULL;
    jmethodID director_method_ids[125];
  }
}

#ifdef __cplusplus
#include <utility>
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
  struct SwigSmartPointer {
    T *ptr;
    SwigSmartPointer(T *p) : ptr(p) { }
    ~SwigSmartPointer() { delete ptr; }
    SwigSmartPointer& operator=(SwigSmartPointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
    void reset(T *p) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = p; }
  } pointer;
  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
  SwigValueWrapper() : pointer(0) { }
  SwigValueWrapper& operator=(const T& t) { SwigSmartPointer tmp(new T(t)); pointer = tmp; return *this; }
#if __cplusplus >=201103L
  SwigValueWrapper& operator=(T&& t) { SwigSmartPointer tmp(new T(std::move(t))); pointer = tmp; return *this; }
  operator T&&() const { return std::move(*pointer.ptr); }
#else
  operator T&() const { return *pointer.ptr; }
#endif
  T *operator&() const { return pointer.ptr; }
  static void reset(SwigValueWrapper& t, T *p) { t.pointer.reset(p); }
};

/*
 * SwigValueInit() is a generic initialisation solution as the following approach:
 * 
 *       T c_result = T();
 * 
 * doesn't compile for all types for example:
 * 
 *       unsigned int c_result = unsigned int();
 */
template <typename T> T SwigValueInit() {
  return T();
}

#if __cplusplus >=201103L
# define SWIG_STD_MOVE(OBJ) std::move(OBJ)
#else
# define SWIG_STD_MOVE(OBJ) OBJ
#endif

#endif


#ifdef __ANDROID__
#include <android/log.h>
#endif


#include "logger_cb.h"
#include "logger_export.h"
#include "ditto_transaction.h"


#include "mesh_java_interfaces.h"
#include <jni.h>

// Thread-local storage for the current JNIEnv, needed for the call to set the
// Android context
static __thread JNIEnv *current_env = NULL;

// Define a dummy struct inside here so it is visible in the generated code, and
// will be used as part of calling `ditto_sdk_transports_set_android_context
struct EnvMarker {};


#include <stdint.h>		// Use the C99 official header


bool dittoffi_set_android_context(EnvMarker, jobject context) {
    return ditto_sdk_transports_set_android_context(current_env, (void*)context);
}


SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
  SWIG_JavaExceptionCodes exception_code = SWIG_JavaUnknownError;
  switch(code) {
  case SWIG_MemoryError:
    exception_code = SWIG_JavaOutOfMemoryError;
    break;
  case SWIG_IOError:
    exception_code = SWIG_JavaIOException;
    break;
  case SWIG_SystemError:
  case SWIG_RuntimeError:
    exception_code = SWIG_JavaRuntimeException;
    break;
  case SWIG_OverflowError:
  case SWIG_IndexError:
    exception_code = SWIG_JavaIndexOutOfBoundsException;
    break;
  case SWIG_DivisionByZero:
    exception_code = SWIG_JavaArithmeticException;
    break;
  case SWIG_SyntaxError:
  case SWIG_ValueError:
  case SWIG_TypeError:
    exception_code = SWIG_JavaIllegalArgumentException;
    break;
  case SWIG_UnknownError:
  default:
    exception_code = SWIG_JavaUnknownError;
    break;
  }
  SWIG_JavaThrowException(jenv, exception_code, msg);
}


#include <typeinfo>
#include <stdexcept>


#define DITTO_LMDB_ENABLE 1
#include "attachment_observer_interfaces.h"
#include "bus.h"
#include "connection_request.h"
#include "crash_reporter.h"
#include "live_query_java_interfaces.h"
#include "presence.h"
#include "store_observer.h"

 extern "C" {
  slice_boxed_uint8_t get_id (
    CAttachment_t const * it)
  {
    return it->id;
  }

  // This apparently no-op functions relies on the out typemap to perform the conversion
  slice_boxed_uint8_t JavaOf_slice_boxed_uint8_t (
    slice_boxed_uint8_t const * it)
  {
    return *it;
  }
} 
 extern "C" {
  // This apparently no-op functions relies on the out typemap to perform the conversion
  slice_ref_uint8_t JavaOf_slice_ref_uint8_t (
    slice_ref_uint8_t const * it)
  {
    return *it;
  }
} 

  extern "C" {
    char const * get_collection_name_at_index(
      Vec_char_ptr_t const * coll_names,
      unsigned long int index
    ) {
      return coll_names->ptr[index];
    }

    slice_boxed_uint8_t take_buffer_at_index (
      Vec_slice_boxed_uint8_t const * ids,
      unsigned long int index)
    {
      slice_boxed_uint8_t ret = ids->ptr[index];
      ids->ptr[index] = {0};
      return ret;
    }

    // These two functions are used to make working with the live query FFI
    // easier from Java / Kotlin
    CDocument_t const * get_document_at_index (
      CDocument_t const * * docs,
      unsigned long int index)
    {
      if (docs == nullptr) {
        throw std::invalid_argument("docs pointer is null");
      }

      return docs[index];
    }

    size_t get_index_at (
      size_t *unsigned_long_ints,
      unsigned long index
    ) {
      return unsigned_long_ints[index];
    }
  }


static CDocument_t * *new_Ditto_DocumentHandle(void) { 
  return new CDocument_t *(); 
}

static CDocument_t * *copy_Ditto_DocumentHandle(CDocument_t * value) { 
  return new CDocument_t *(value); 
}

static void delete_Ditto_DocumentHandle(CDocument_t * *obj) { 
  delete obj; 
}

static void Ditto_DocumentHandle_assign(CDocument_t * *obj, CDocument_t * value) {
  *obj = value;
}

static CDocument_t * Ditto_DocumentHandle_value(CDocument_t * *obj) {
  return *obj;
}


static CReadTransaction_t * *new_Ditto_ReadTransactionHandle(void) { 
  return new CReadTransaction_t *(); 
}

static CReadTransaction_t * *copy_Ditto_ReadTransactionHandle(CReadTransaction_t * value) { 
  return new CReadTransaction_t *(value); 
}

static void delete_Ditto_ReadTransactionHandle(CReadTransaction_t * *obj) { 
  delete obj; 
}

static void Ditto_ReadTransactionHandle_assign(CReadTransaction_t * *obj, CReadTransaction_t * value) {
  *obj = value;
}

static CReadTransaction_t * Ditto_ReadTransactionHandle_value(CReadTransaction_t * *obj) {
  return *obj;
}


static CWriteTransaction_t * *new_Ditto_WriteTransactionHandle(void) { 
  return new CWriteTransaction_t *(); 
}

static CWriteTransaction_t * *copy_Ditto_WriteTransactionHandle(CWriteTransaction_t * value) { 
  return new CWriteTransaction_t *(value); 
}

static void delete_Ditto_WriteTransactionHandle(CWriteTransaction_t * *obj) { 
  delete obj; 
}

static void Ditto_WriteTransactionHandle_assign(CWriteTransaction_t * *obj, CWriteTransaction_t * value) {
  *obj = value;
}

static CWriteTransaction_t * Ditto_WriteTransactionHandle_value(CWriteTransaction_t * *obj) {
  return *obj;
}


static char * *new_Ditto_StringHandle(void) { 
  return new char *(); 
}

static char * *copy_Ditto_StringHandle(char * value) { 
  return new char *(value); 
}

static void delete_Ditto_StringHandle(char * *obj) { 
  delete obj; 
}

static void Ditto_StringHandle_assign(char * *obj, char * value) {
  *obj = value;
}

static char * Ditto_StringHandle_value(char * *obj) {
  return *obj;
}


static long long *new_Ditto_LongLongHandle(void) { 
  return new long long(); 
}

static long long *copy_Ditto_LongLongHandle(long long value) { 
  return new long long(value); 
}

static void delete_Ditto_LongLongHandle(long long *obj) { 
  delete obj; 
}

static void Ditto_LongLongHandle_assign(long long *obj, long long value) {
  *obj = value;
}

static long long Ditto_LongLongHandle_value(long long *obj) {
  return *obj;
}


static uint64_t *new_Ditto_U64Handle(void) { 
  return new uint64_t(); 
}

static uint64_t *copy_Ditto_U64Handle(uint64_t value) { 
  return new uint64_t(value); 
}

static void delete_Ditto_U64Handle(uint64_t *obj) { 
  delete obj; 
}

static void Ditto_U64Handle_assign(uint64_t *obj, uint64_t value) {
  *obj = value;
}

static uint64_t Ditto_U64Handle_value(uint64_t *obj) {
  return *obj;
}


static bool *new_Ditto_BoolHandle(void) { 
  return new bool(); 
}

static bool *copy_Ditto_BoolHandle(bool value) { 
  return new bool(value); 
}

static void delete_Ditto_BoolHandle(bool *obj) { 
  delete obj; 
}

static void Ditto_BoolHandle_assign(bool *obj, bool value) {
  *obj = value;
}

static bool Ditto_BoolHandle_value(bool *obj) {
  return *obj;
}

 extern "C" {
  slice_boxed_uint8_t * new_Ditto_CBOR (void)
  {
    return (slice_boxed_uint8_t *) malloc(sizeof(slice_boxed_uint8_t));
  }
  void delete_Ditto_CBOR (
    slice_boxed_uint8_t * it)
  {
    free((void *) it);
  }
} 

typedef COrderByParam_t COrderByParamArray;

SWIGINTERN COrderByParamArray *new_COrderByParamArray(size_t nelements){
  return new COrderByParam_t[nelements]();
}
SWIGINTERN void delete_COrderByParamArray(COrderByParamArray *self){
  delete [] self;
}
SWIGINTERN COrderByParam_t COrderByParamArray_getitem(COrderByParamArray *self,size_t index){
  return self[index];
}
SWIGINTERN void COrderByParamArray_setitem(COrderByParamArray *self,size_t index,COrderByParam_t value){
  self[index] = value;
}
SWIGINTERN COrderByParam_t *COrderByParamArray_cast(COrderByParamArray *self){
  return self;
}
SWIGINTERN COrderByParamArray *COrderByParamArray_frompointer(COrderByParam_t *t){
  return (COrderByParamArray *) t;
}
SWIGINTERN size_t slice_mut_uint8_getCapacity(slice_mut_uint8 *self){
		return self->len;
	}
SWIGINTERN size_t slice_mut_uint8_setValue(slice_mut_uint8 *self,char const value[],size_t valueLen){
		size_t len = (valueLen < self->len ? valueLen : self->len);
		memcpy(self->ptr, value, len);
		return len;
	}

#include <string.h>



/* ---------------------------------------------------
 * C++ director class methods
 * --------------------------------------------------- */

#include "dittoffi_java.h"

SwigDirector_Retainable::SwigDirector_Retainable(JNIEnv *jenv) : Retainable(), Swig::Director(jenv) {
}

SwigDirector_Retainable::~SwigDirector_Retainable() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_Retainable::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Retainable::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[0], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in Retainable::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_Retainable::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method Retainable::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[1], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in Retainable::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_Retainable::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/Retainable");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 2; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_LoggerCb::SwigDirector_LoggerCb(JNIEnv *jenv) : LoggerCb(), Swig::Director(jenv) {
}

SwigDirector_LoggerCb::~SwigDirector_LoggerCb() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_LoggerCb::ffiCustomLog(CLogLevel_t arg0,char const *arg1) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jarg0  ;
  jstring jarg1 = 0 ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method LoggerCb::ffiCustomLog.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jarg0 = (jint) arg0;
    jarg1 = 0;
    if (arg1) {
      jarg1 = jenv->NewStringUTF((const char *)arg1);
      if (!jarg1) return ;
    }
    Swig::LocalRefGuard arg1_refguard(jenv, jarg1);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[2], swigjobj, jarg0, jarg1);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LoggerCb::ffiCustomLog ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_LoggerCb::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/LoggerCb");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "ffiCustomLog", "(Llive/ditto/internal/swig/ffi/CLogLevel_t;Ljava/lang/String;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 1; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_RetainableContinuation::SwigDirector_RetainableContinuation(JNIEnv *jenv) : RetainableContinuation(), Swig::Director(jenv) {
}

SwigDirector_RetainableContinuation::~SwigDirector_RetainableContinuation() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_RetainableContinuation::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method RetainableContinuation::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[3], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in RetainableContinuation::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_RetainableContinuation::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method RetainableContinuation::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[4], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in RetainableContinuation::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_RetainableContinuation::invoke(dittoffi_result_uint64_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jresult  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method RetainableContinuation::invoke.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jresult = 0;
    *((dittoffi_result_uint64_t **)&jresult) = new dittoffi_result_uint64_t(SWIG_STD_MOVE(result)); 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[5], swigjobj, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in RetainableContinuation::invoke ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_RetainableContinuation::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/RetainableContinuation");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "invoke", "(Llive/ditto/internal/swig/ffi/dittoffi_result_uint64_t;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 3; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_TransactionCompletionContinuation::SwigDirector_TransactionCompletionContinuation(JNIEnv *jenv) : TransactionCompletionContinuation(), Swig::Director(jenv) {
}

SwigDirector_TransactionCompletionContinuation::~SwigDirector_TransactionCompletionContinuation() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_TransactionCompletionContinuation::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method TransactionCompletionContinuation::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[6], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in TransactionCompletionContinuation::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_TransactionCompletionContinuation::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method TransactionCompletionContinuation::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[7], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in TransactionCompletionContinuation::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_TransactionCompletionContinuation::invoke(dittoffi_result_dittoffi_transaction_completion_action_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jresult  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method TransactionCompletionContinuation::invoke.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jresult = 0;
    *((dittoffi_result_dittoffi_transaction_completion_action_t **)&jresult) = new dittoffi_result_dittoffi_transaction_completion_action_t(SWIG_STD_MOVE(result)); 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[8], swigjobj, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in TransactionCompletionContinuation::invoke ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_TransactionCompletionContinuation::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/TransactionCompletionContinuation");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "invoke", "(Llive/ditto/internal/swig/ffi/dittoffi_result_dittoffi_transaction_completion_action_t;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 3; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_TransactionExecuteContinuation::SwigDirector_TransactionExecuteContinuation(JNIEnv *jenv) : TransactionExecuteContinuation(), Swig::Director(jenv) {
}

SwigDirector_TransactionExecuteContinuation::~SwigDirector_TransactionExecuteContinuation() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_TransactionExecuteContinuation::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method TransactionExecuteContinuation::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[9], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in TransactionExecuteContinuation::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_TransactionExecuteContinuation::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method TransactionExecuteContinuation::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[10], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in TransactionExecuteContinuation::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_TransactionExecuteContinuation::invoke(dittoffi_result_dittoffi_query_result_ptr_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jresult  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method TransactionExecuteContinuation::invoke.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jresult = 0;
    *((dittoffi_result_dittoffi_query_result_ptr_t **)&jresult) = new dittoffi_result_dittoffi_query_result_ptr_t(SWIG_STD_MOVE(result)); 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[11], swigjobj, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in TransactionExecuteContinuation::invoke ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_TransactionExecuteContinuation::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/TransactionExecuteContinuation");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "invoke", "(Llive/ditto/internal/swig/ffi/dittoffi_result_dittoffi_query_result_ptr_t;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 3; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_BeginTransactionContinuation::SwigDirector_BeginTransactionContinuation(JNIEnv *jenv) : BeginTransactionContinuation(), Swig::Director(jenv) {
}

SwigDirector_BeginTransactionContinuation::~SwigDirector_BeginTransactionContinuation() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_BeginTransactionContinuation::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BeginTransactionContinuation::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[12], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BeginTransactionContinuation::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BeginTransactionContinuation::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BeginTransactionContinuation::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[13], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BeginTransactionContinuation::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BeginTransactionContinuation::invoke(dittoffi_result_dittoffi_transaction_ptr_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jresult  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BeginTransactionContinuation::invoke.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jresult = 0;
    *((dittoffi_result_dittoffi_transaction_ptr_t **)&jresult) = new dittoffi_result_dittoffi_transaction_ptr_t(SWIG_STD_MOVE(result)); 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[14], swigjobj, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BeginTransactionContinuation::invoke ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BeginTransactionContinuation::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/BeginTransactionContinuation");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "invoke", "(Llive/ditto/internal/swig/ffi/dittoffi_result_dittoffi_transaction_ptr_t;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 3; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_WifiAwareRust::SwigDirector_WifiAwareRust(JNIEnv *jenv) : WifiAwareRust(), Swig::Director(jenv) {
}

SwigDirector_WifiAwareRust::~SwigDirector_WifiAwareRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_WifiAwareRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[15], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[16], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientStartSearching(char const *hashed_app_name,char const *local_announce) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jhashed_app_name = 0 ;
  jstring jlocal_announce = 0 ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::clientStartSearching.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jhashed_app_name = 0;
    if (hashed_app_name) {
      jhashed_app_name = jenv->NewStringUTF((const char *)hashed_app_name);
      if (!jhashed_app_name) return ;
    }
    Swig::LocalRefGuard hashed_app_name_refguard(jenv, jhashed_app_name);
    jlocal_announce = 0;
    if (local_announce) {
      jlocal_announce = jenv->NewStringUTF((const char *)local_announce);
      if (!jlocal_announce) return ;
    }
    Swig::LocalRefGuard local_announce_refguard(jenv, jlocal_announce);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[17], swigjobj, jhashed_app_name, jlocal_announce);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientStartSearching ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientStopSearching() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[3]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::clientStopSearching.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[18], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientStopSearching ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientCreateNetwork(char const *announce) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  
  if (!swig_override[4]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::clientCreateNetwork.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[19], swigjobj, jannounce);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientCreateNetwork ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientUpdatePeer(char const *announce,ConnectState_t state) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  jint jstate  ;
  
  if (!swig_override[5]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::clientUpdatePeer.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jstate = (jint) state;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[20], swigjobj, jannounce, jstate);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientUpdatePeer ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::serverStartAdvertising(char const *announce,char const *hashed_app_name,uint16_t service_port) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  jstring jhashed_app_name = 0 ;
  jint jservice_port  ;
  
  if (!swig_override[6]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::serverStartAdvertising.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jhashed_app_name = 0;
    if (hashed_app_name) {
      jhashed_app_name = jenv->NewStringUTF((const char *)hashed_app_name);
      if (!jhashed_app_name) return ;
    }
    Swig::LocalRefGuard hashed_app_name_refguard(jenv, jhashed_app_name);
    jservice_port = (jint) service_port;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[21], swigjobj, jannounce, jhashed_app_name, jservice_port);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::serverStartAdvertising ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::serverStopAdvertising() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[7]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::serverStopAdvertising.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[22], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::serverStopAdvertising ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::serverUpdatePeer(char const *announce,ConnectState_t state) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  jint jstate  ;
  
  if (!swig_override[8]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::serverUpdatePeer.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jstate = (jint) state;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[23], swigjobj, jannounce, jstate);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::serverUpdatePeer ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::updateParameterU64(dittoffi_wifi_aware_system_parameter_u64 parameter,uint64_t value) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jparameter  ;
  jobject jvalue  ;
  
  if (!swig_override[9]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method WifiAwareRust::updateParameterU64.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jparameter = (jint) parameter;
    {
      jbyteArray ba = jenv->NewByteArray(9);
      jbyte* bae = jenv->GetByteArrayElements(ba, 0);
      jclass clazz = jenv->FindClass("java/math/BigInteger");
      jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
      jobject bigint;
      int swig_i;
      
      bae[0] = 0;
      for(swig_i=1; swig_i<9; swig_i++ ) {
        bae[swig_i] = (jbyte)(value>>8*(8-swig_i));
      }
      
      jenv->ReleaseByteArrayElements(ba, bae, 0);
      bigint = jenv->NewObject(clazz, mid, ba);
      jenv->DeleteLocalRef(ba);
      jvalue = bigint;
    }
    Swig::LocalRefGuard value_refguard(jenv, jvalue);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[24], swigjobj, jparameter, jvalue);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::updateParameterU64 ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::addWifiAwareTransport(CDitto *ditto) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto = 0 ;
  
  if (!swig_override[10]) {
    WifiAwareRust::addWifiAwareTransport(ditto);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto) = (CDitto *) ditto; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[25], swigjobj, jditto);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::addWifiAwareTransport ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::removeWifiAwareTransport() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[11]) {
    WifiAwareRust::removeWifiAwareTransport();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[26], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::removeWifiAwareTransport ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientPeerAppeared(char const *announce) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  
  if (!swig_override[12]) {
    WifiAwareRust::clientPeerAppeared(announce);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[27], swigjobj, jannounce);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientPeerAppeared ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientPeerDisappeared(char const *announce) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  
  if (!swig_override[13]) {
    WifiAwareRust::clientPeerDisappeared(announce);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[28], swigjobj, jannounce);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientPeerDisappeared ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientScanningStateChanged(OnlineState_t state,TransportCondition_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jstate  ;
  jint jresult  ;
  
  if (!swig_override[14]) {
    WifiAwareRust::clientScanningStateChanged(state,result);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jstate = (jint) state;
    jresult = (jint) result;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[29], swigjobj, jstate, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientScanningStateChanged ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientNetworkDidCreate(char const *announce,char const *hostname,uint16_t port) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  jstring jhostname = 0 ;
  jint jport  ;
  
  if (!swig_override[15]) {
    WifiAwareRust::clientNetworkDidCreate(announce,hostname,port);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jhostname = 0;
    if (hostname) {
      jhostname = jenv->NewStringUTF((const char *)hostname);
      if (!jhostname) return ;
    }
    Swig::LocalRefGuard hostname_refguard(jenv, jhostname);
    jport = (jint) port;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[30], swigjobj, jannounce, jhostname, jport);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientNetworkDidCreate ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::clientNetworkDidNotCreate(char const *announce) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jannounce = 0 ;
  
  if (!swig_override[16]) {
    WifiAwareRust::clientNetworkDidNotCreate(announce);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[31], swigjobj, jannounce);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::clientNetworkDidNotCreate ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::serverAdvertisingStateChanged(OnlineState_t state,TransportCondition_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jstate  ;
  jint jresult  ;
  
  if (!swig_override[17]) {
    WifiAwareRust::serverAdvertisingStateChanged(state,result);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jstate = (jint) state;
    jresult = (jint) result;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[32], swigjobj, jstate, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::serverAdvertisingStateChanged ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::serverNetworkScopeIdAdded(uint32_t scope_id) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jscope_id  ;
  
  if (!swig_override[18]) {
    WifiAwareRust::serverNetworkScopeIdAdded(scope_id);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jscope_id = (jlong) scope_id;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[33], swigjobj, jscope_id);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::serverNetworkScopeIdAdded ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::serverNetworkScopeIdRemoved(uint32_t scope_id) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jscope_id  ;
  
  if (!swig_override[19]) {
    WifiAwareRust::serverNetworkScopeIdRemoved(scope_id);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jscope_id = (jlong) scope_id;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[34], swigjobj, jscope_id);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::serverNetworkScopeIdRemoved ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::goOnlineRequest() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[20]) {
    WifiAwareRust::goOnlineRequest();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[35], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::goOnlineRequest ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::goOfflineRequest() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[21]) {
    WifiAwareRust::goOfflineRequest();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[36], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in WifiAwareRust::goOfflineRequest ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_WifiAwareRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/WifiAwareRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "clientStartSearching", "(Ljava/lang/String;Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "clientStopSearching", "()V"),
    SwigDirectorMethod(jenv, baseclass, "clientCreateNetwork", "(Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "clientUpdatePeer", "(Ljava/lang/String;Llive/ditto/internal/swig/ffi/ConnectState_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "serverStartAdvertising", "(Ljava/lang/String;Ljava/lang/String;I)V"),
    SwigDirectorMethod(jenv, baseclass, "serverStopAdvertising", "()V"),
    SwigDirectorMethod(jenv, baseclass, "serverUpdatePeer", "(Ljava/lang/String;Llive/ditto/internal/swig/ffi/ConnectState_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "updateParameterU64", "(Llive/ditto/internal/swig/ffi/dittoffi_wifi_aware_system_parameter_u64_t;Ljava/math/BigInteger;)V"),
    SwigDirectorMethod(jenv, baseclass, "addWifiAwareTransport", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;)V"),
    SwigDirectorMethod(jenv, baseclass, "removeWifiAwareTransport", "()V"),
    SwigDirectorMethod(jenv, baseclass, "clientPeerAppeared", "(Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "clientPeerDisappeared", "(Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "clientScanningStateChanged", "(Llive/ditto/internal/swig/ffi/OnlineState_t;Llive/ditto/internal/swig/ffi/TransportCondition_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "clientNetworkDidCreate", "(Ljava/lang/String;Ljava/lang/String;I)V"),
    SwigDirectorMethod(jenv, baseclass, "clientNetworkDidNotCreate", "(Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "serverAdvertisingStateChanged", "(Llive/ditto/internal/swig/ffi/OnlineState_t;Llive/ditto/internal/swig/ffi/TransportCondition_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "serverNetworkScopeIdAdded", "(J)V"),
    SwigDirectorMethod(jenv, baseclass, "serverNetworkScopeIdRemoved", "(J)V"),
    SwigDirectorMethod(jenv, baseclass, "goOnlineRequest", "()V"),
    SwigDirectorMethod(jenv, baseclass, "goOfflineRequest", "()V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 22; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_BluetoothLeRadioRust::SwigDirector_BluetoothLeRadioRust(JNIEnv *jenv) : BluetoothLeRadioRust(), Swig::Director(jenv) {
}

SwigDirector_BluetoothLeRadioRust::~SwigDirector_BluetoothLeRadioRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_BluetoothLeRadioRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[37], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[38], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::connectPeripheral(char const peripheralUuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jperipheralUuid  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::connectPeripheral.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return ;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[39], swigjobj, jperipheralUuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::connectPeripheral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::disconnectPeripheral(char const peripheralUuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jperipheralUuid  ;
  
  if (!swig_override[3]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::disconnectPeripheral.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return ;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[40], swigjobj, jperipheralUuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::disconnectPeripheral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

OnlineState_t SwigDirector_BluetoothLeRadioRust::getAdvertisingState() {
  OnlineState_t c_result = SwigValueInit< OnlineState_t >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[4]) {
    return BluetoothLeRadioRust::getAdvertisingState();
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[41], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (OnlineState_t)jresult; 
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::getAdvertisingState ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

OnlineState_t SwigDirector_BluetoothLeRadioRust::getScanningState() {
  OnlineState_t c_result = SwigValueInit< OnlineState_t >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[5]) {
    return BluetoothLeRadioRust::getScanningState();
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[42], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (OnlineState_t)jresult; 
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::getScanningState ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

SendResult_t SwigDirector_BluetoothLeRadioRust::notifyToCentral(BleDataType_t sendType,char const centralUuid[],size_t uuidLen,char const data[],size_t len) {
  SendResult_t c_result ;
  jlong jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jsendType  ;
  jbyteArray jcentralUuid  ;
  jbyteArray jdata  ;
  SendResult_t *argp ;
  
  if (!swig_override[6]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::notifyToCentral.");
    return c_result;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jsendType = (jint) sendType;
    jcentralUuid = 0;
    if (centralUuid) {
      jcentralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jcentralUuid) return c_result;
      jenv->SetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    }
    Swig::LocalRefGuard centralUuid_refguard(jenv, jcentralUuid);
    jdata = 0;
    if (data) {
      jdata = jenv->NewByteArray((jsize)len);
      if (!jdata) return c_result;
      jenv->SetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
    }
    Swig::LocalRefGuard data_refguard(jenv, jdata);
    jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[43], swigjobj, jsendType, jcentralUuid, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    argp = *(SendResult_t **)&jresult; 
    if (!argp) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type SendResult_t");
      return c_result;
    }
    c_result = *argp; 
    if (jcentralUuid && centralUuid) jenv->GetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    if (jdata && data) jenv->GetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::notifyToCentral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

void SwigDirector_BluetoothLeRadioRust::startAdvertising(char const serviceUuid[],size_t uuidLen,char *localName) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jserviceUuid  ;
  jstring jlocalName = 0 ;
  
  if (!swig_override[7]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::startAdvertising.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jserviceUuid = 0;
    if (serviceUuid) {
      jserviceUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jserviceUuid) return ;
      jenv->SetByteArrayRegion(jserviceUuid, 0, (jsize)uuidLen, (jbyte *)serviceUuid);
    }
    Swig::LocalRefGuard serviceUuid_refguard(jenv, jserviceUuid);
    jlocalName = 0;
    if (localName) {
      jlocalName = jenv->NewStringUTF((const char *)localName);
      if (!jlocalName) return ;
    }
    Swig::LocalRefGuard localName_refguard(jenv, jlocalName);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[44], swigjobj, jserviceUuid, jlocalName);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jserviceUuid && serviceUuid) jenv->GetByteArrayRegion(jserviceUuid, 0, (jsize)uuidLen, (jbyte *)serviceUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::startAdvertising ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::startScanning(char const serviceUuid[],size_t uuidLen,char *announce) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jserviceUuid  ;
  jstring jannounce = 0 ;
  
  if (!swig_override[8]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::startScanning.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jserviceUuid = 0;
    if (serviceUuid) {
      jserviceUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jserviceUuid) return ;
      jenv->SetByteArrayRegion(jserviceUuid, 0, (jsize)uuidLen, (jbyte *)serviceUuid);
    }
    Swig::LocalRefGuard serviceUuid_refguard(jenv, jserviceUuid);
    jannounce = 0;
    if (announce) {
      jannounce = jenv->NewStringUTF((const char *)announce);
      if (!jannounce) return ;
    }
    Swig::LocalRefGuard announce_refguard(jenv, jannounce);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[45], swigjobj, jserviceUuid, jannounce);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jserviceUuid && serviceUuid) jenv->GetByteArrayRegion(jserviceUuid, 0, (jsize)uuidLen, (jbyte *)serviceUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::startScanning ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::stopAdvertising() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[9]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::stopAdvertising.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[46], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::stopAdvertising ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::stopScanning() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[10]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::stopScanning.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[47], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::stopScanning ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

SendResult_t SwigDirector_BluetoothLeRadioRust::writeToPeripheral(BleDataType_t sendType,char const peripheralUuid[],size_t uuidLen,char const data[],size_t len) {
  SendResult_t c_result ;
  jlong jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jsendType  ;
  jbyteArray jperipheralUuid  ;
  jbyteArray jdata  ;
  SendResult_t *argp ;
  
  if (!swig_override[11]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::writeToPeripheral.");
    return c_result;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jsendType = (jint) sendType;
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return c_result;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jdata = 0;
    if (data) {
      jdata = jenv->NewByteArray((jsize)len);
      if (!jdata) return c_result;
      jenv->SetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
    }
    Swig::LocalRefGuard data_refguard(jenv, jdata);
    jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[48], swigjobj, jsendType, jperipheralUuid, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    argp = *(SendResult_t **)&jresult; 
    if (!argp) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type SendResult_t");
      return c_result;
    }
    c_result = *argp; 
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    if (jdata && data) jenv->GetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::writeToPeripheral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

bool SwigDirector_BluetoothLeRadioRust::appIsInForeground() {
  bool c_result = SwigValueInit< bool >() ;
  jboolean jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[12]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::appIsInForeground.");
    return c_result;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jresult = (jboolean) jenv->CallStaticBooleanMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[49], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = jresult ? true : false; 
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::appIsInForeground ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

int SwigDirector_BluetoothLeRadioRust::readL2capFromPeripheral(char const peripheralUuid[],size_t uuidLen,slice_mut_uint8_t data) {
  int c_result = SwigValueInit< int >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jperipheralUuid  ;
  jlong jdata  ;
  
  if (!swig_override[13]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::readL2capFromPeripheral.");
    return c_result;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return c_result;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jdata = 0;
    *((slice_mut_uint8_t **)&jdata) = new slice_mut_uint8_t(SWIG_STD_MOVE(data)); 
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[50], swigjobj, jperipheralUuid, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (int)jresult; 
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::readL2capFromPeripheral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

int SwigDirector_BluetoothLeRadioRust::sendL2capToPeripheral(char const peripheralUuid[],size_t uuidLen,char const data[],size_t len) {
  int c_result = SwigValueInit< int >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jperipheralUuid  ;
  jbyteArray jdata  ;
  
  if (!swig_override[14]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::sendL2capToPeripheral.");
    return c_result;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return c_result;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jdata = 0;
    if (data) {
      jdata = jenv->NewByteArray((jsize)len);
      if (!jdata) return c_result;
      jenv->SetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
    }
    Swig::LocalRefGuard data_refguard(jenv, jdata);
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[51], swigjobj, jperipheralUuid, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (int)jresult; 
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    if (jdata && data) jenv->GetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::sendL2capToPeripheral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

int SwigDirector_BluetoothLeRadioRust::readL2capFromCentral(char const centralUuid[],size_t uuidLen,slice_mut_uint8_t data) {
  int c_result = SwigValueInit< int >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jcentralUuid  ;
  jlong jdata  ;
  
  if (!swig_override[15]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::readL2capFromCentral.");
    return c_result;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jcentralUuid = 0;
    if (centralUuid) {
      jcentralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jcentralUuid) return c_result;
      jenv->SetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    }
    Swig::LocalRefGuard centralUuid_refguard(jenv, jcentralUuid);
    jdata = 0;
    *((slice_mut_uint8_t **)&jdata) = new slice_mut_uint8_t(SWIG_STD_MOVE(data)); 
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[52], swigjobj, jcentralUuid, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (int)jresult; 
    if (jcentralUuid && centralUuid) jenv->GetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::readL2capFromCentral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

int SwigDirector_BluetoothLeRadioRust::sendL2capToCentral(char const centralUuid[],size_t uuidLen,char const data[],size_t len) {
  int c_result = SwigValueInit< int >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jcentralUuid  ;
  jbyteArray jdata  ;
  
  if (!swig_override[16]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method BluetoothLeRadioRust::sendL2capToCentral.");
    return c_result;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jcentralUuid = 0;
    if (centralUuid) {
      jcentralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jcentralUuid) return c_result;
      jenv->SetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    }
    Swig::LocalRefGuard centralUuid_refguard(jenv, jcentralUuid);
    jdata = 0;
    if (data) {
      jdata = jenv->NewByteArray((jsize)len);
      if (!jdata) return c_result;
      jenv->SetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
    }
    Swig::LocalRefGuard data_refguard(jenv, jdata);
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[53], swigjobj, jcentralUuid, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (int)jresult; 
    if (jcentralUuid && centralUuid) jenv->GetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    if (jdata && data) jenv->GetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::sendL2capToCentral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

void SwigDirector_BluetoothLeRadioRust::addBleTransport(CDitto *ditto) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto = 0 ;
  
  if (!swig_override[17]) {
    BluetoothLeRadioRust::addBleTransport(ditto);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto) = (CDitto *) ditto; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[54], swigjobj, jditto);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::addBleTransport ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::dropBleTransport() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[18]) {
    BluetoothLeRadioRust::dropBleTransport();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[55], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::dropBleTransport ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::advertisementHeard(char const peripheralUuid[],size_t uuidLen,char const manufacturerData[],size_t manufacturerDataLen,bool manufacturerDataIncludesId,char *name,float rssi) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jperipheralUuid  ;
  jbyteArray jmanufacturerData  ;
  jboolean jmanufacturerDataIncludesId  ;
  jstring jname = 0 ;
  jfloat jrssi  ;
  
  if (!swig_override[19]) {
    BluetoothLeRadioRust::advertisementHeard(peripheralUuid,uuidLen,manufacturerData,manufacturerDataLen,manufacturerDataIncludesId,name,rssi);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return ;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jmanufacturerData = 0;
    if (manufacturerData) {
      jmanufacturerData = jenv->NewByteArray((jsize)manufacturerDataLen);
      if (!jmanufacturerData) return ;
      jenv->SetByteArrayRegion(jmanufacturerData, 0, (jsize)manufacturerDataLen, (jbyte *)manufacturerData);
    }
    Swig::LocalRefGuard manufacturerData_refguard(jenv, jmanufacturerData);
    jmanufacturerDataIncludesId = (jboolean) manufacturerDataIncludesId;
    jname = 0;
    if (name) {
      jname = jenv->NewStringUTF((const char *)name);
      if (!jname) return ;
    }
    Swig::LocalRefGuard name_refguard(jenv, jname);
    jrssi = (jfloat) rssi;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[56], swigjobj, jperipheralUuid, jmanufacturerData, jmanufacturerDataIncludesId, jname, jrssi);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    if (jmanufacturerData && manufacturerData) jenv->GetByteArrayRegion(jmanufacturerData, 0, (jsize)manufacturerDataLen, (jbyte *)manufacturerData);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::advertisementHeard ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::connectionStateChanged(char const peripheralUuid[],size_t uuidLen,ConnectState_t state,bool l2cap_available,int mtu) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jperipheralUuid  ;
  jint jstate  ;
  jboolean jl2cap_available  ;
  jint jmtu  ;
  
  if (!swig_override[20]) {
    BluetoothLeRadioRust::connectionStateChanged(peripheralUuid,uuidLen,state,l2cap_available,mtu);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return ;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jstate = (jint) state;
    jl2cap_available = (jboolean) l2cap_available;
    jmtu = (jint) mtu;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[57], swigjobj, jperipheralUuid, jstate, jl2cap_available, jmtu);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::connectionStateChanged ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::peripheralMtuUpdated(char const uuid[],size_t uuidLen,int mtu) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  jint jmtu  ;
  
  if (!swig_override[21]) {
    BluetoothLeRadioRust::peripheralMtuUpdated(uuid,uuidLen,mtu);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jmtu = (jint) mtu;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[58], swigjobj, juuid, jmtu);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::peripheralMtuUpdated ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::receivedFromPeripheral(char const peripheralUuid[],size_t uuidLen,BleDataType_t dataType,char const data[],size_t len) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jperipheralUuid  ;
  jint jdataType  ;
  jbyteArray jdata  ;
  
  if (!swig_override[22]) {
    BluetoothLeRadioRust::receivedFromPeripheral(peripheralUuid,uuidLen,dataType,data,len);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jperipheralUuid = 0;
    if (peripheralUuid) {
      jperipheralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jperipheralUuid) return ;
      jenv->SetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    }
    Swig::LocalRefGuard peripheralUuid_refguard(jenv, jperipheralUuid);
    jdataType = (jint) dataType;
    jdata = 0;
    if (data) {
      jdata = jenv->NewByteArray((jsize)len);
      if (!jdata) return ;
      jenv->SetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
    }
    Swig::LocalRefGuard data_refguard(jenv, jdata);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[59], swigjobj, jperipheralUuid, jdataType, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jperipheralUuid && peripheralUuid) jenv->GetByteArrayRegion(jperipheralUuid, 0, (jsize)uuidLen, (jbyte *)peripheralUuid);
    if (jdata && data) jenv->GetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::receivedFromPeripheral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::scanningStateChanged(OnlineState_t state,TransportCondition_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jstate  ;
  jint jresult  ;
  
  if (!swig_override[23]) {
    BluetoothLeRadioRust::scanningStateChanged(state,result);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jstate = (jint) state;
    jresult = (jint) result;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[60], swigjobj, jstate, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::scanningStateChanged ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::peripheralReadyToSend(char const uuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  
  if (!swig_override[24]) {
    BluetoothLeRadioRust::peripheralReadyToSend(uuid,uuidLen);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[61], swigjobj, juuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::peripheralReadyToSend ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::peripheralL2capReadyToSend(char const uuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  
  if (!swig_override[25]) {
    BluetoothLeRadioRust::peripheralL2capReadyToSend(uuid,uuidLen);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[62], swigjobj, juuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::peripheralL2capReadyToSend ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::peripheralL2capDataAvailable(char const uuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  
  if (!swig_override[26]) {
    BluetoothLeRadioRust::peripheralL2capDataAvailable(uuid,uuidLen);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[63], swigjobj, juuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::peripheralL2capDataAvailable ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::advertisingStateChanged(OnlineState_t state,TransportCondition_t result) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jstate  ;
  jint jresult  ;
  
  if (!swig_override[27]) {
    BluetoothLeRadioRust::advertisingStateChanged(state,result);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jstate = (jint) state;
    jresult = (jint) result;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[64], swigjobj, jstate, jresult);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::advertisingStateChanged ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::centralMtuUpdated(char const uuid[],size_t uuidLen,int mtu) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  jint jmtu  ;
  
  if (!swig_override[28]) {
    BluetoothLeRadioRust::centralMtuUpdated(uuid,uuidLen,mtu);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jmtu = (jint) mtu;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[65], swigjobj, juuid, jmtu);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::centralMtuUpdated ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::receivedFromCentral(char const centralUuid[],size_t uuidLen,BleDataType_t dataType,char const data[],size_t len) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jcentralUuid  ;
  jint jdataType  ;
  jbyteArray jdata  ;
  
  if (!swig_override[29]) {
    BluetoothLeRadioRust::receivedFromCentral(centralUuid,uuidLen,dataType,data,len);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jcentralUuid = 0;
    if (centralUuid) {
      jcentralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jcentralUuid) return ;
      jenv->SetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    }
    Swig::LocalRefGuard centralUuid_refguard(jenv, jcentralUuid);
    jdataType = (jint) dataType;
    jdata = 0;
    if (data) {
      jdata = jenv->NewByteArray((jsize)len);
      if (!jdata) return ;
      jenv->SetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
    }
    Swig::LocalRefGuard data_refguard(jenv, jdata);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[66], swigjobj, jcentralUuid, jdataType, jdata);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jcentralUuid && centralUuid) jenv->GetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    if (jdata && data) jenv->GetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::receivedFromCentral ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::centralFinishedConnecting(char const centralUuid[],size_t uuidLen,char const data[],size_t len,bool l2capAvailable,int mtu) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jcentralUuid  ;
  jbyteArray jdata  ;
  jboolean jl2capAvailable  ;
  jint jmtu  ;
  
  if (!swig_override[30]) {
    BluetoothLeRadioRust::centralFinishedConnecting(centralUuid,uuidLen,data,len,l2capAvailable,mtu);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jcentralUuid = 0;
    if (centralUuid) {
      jcentralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jcentralUuid) return ;
      jenv->SetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    }
    Swig::LocalRefGuard centralUuid_refguard(jenv, jcentralUuid);
    jdata = 0;
    if (data) {
      jdata = jenv->NewByteArray((jsize)len);
      if (!jdata) return ;
      jenv->SetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
    }
    Swig::LocalRefGuard data_refguard(jenv, jdata);
    jl2capAvailable = (jboolean) l2capAvailable;
    jmtu = (jint) mtu;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[67], swigjobj, jcentralUuid, jdata, jl2capAvailable, jmtu);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jcentralUuid && centralUuid) jenv->GetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    if (jdata && data) jenv->GetByteArrayRegion(jdata, 0, (jsize)len, (jbyte *)data);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::centralFinishedConnecting ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::centralUnsubscribed(char const centralUuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray jcentralUuid  ;
  
  if (!swig_override[31]) {
    BluetoothLeRadioRust::centralUnsubscribed(centralUuid,uuidLen);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jcentralUuid = 0;
    if (centralUuid) {
      jcentralUuid = jenv->NewByteArray((jsize)uuidLen);
      if (!jcentralUuid) return ;
      jenv->SetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
    }
    Swig::LocalRefGuard centralUuid_refguard(jenv, jcentralUuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[68], swigjobj, jcentralUuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (jcentralUuid && centralUuid) jenv->GetByteArrayRegion(jcentralUuid, 0, (jsize)uuidLen, (jbyte *)centralUuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::centralUnsubscribed ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::centralReadyToSend(char const uuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  
  if (!swig_override[32]) {
    BluetoothLeRadioRust::centralReadyToSend(uuid,uuidLen);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[69], swigjobj, juuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::centralReadyToSend ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::centralL2capReadyToSend(char const uuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  
  if (!swig_override[33]) {
    BluetoothLeRadioRust::centralL2capReadyToSend(uuid,uuidLen);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[70], swigjobj, juuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::centralL2capReadyToSend ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::centralL2capDataAvailable(char const uuid[],size_t uuidLen) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jbyteArray juuid  ;
  
  if (!swig_override[34]) {
    BluetoothLeRadioRust::centralL2capDataAvailable(uuid,uuidLen);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    juuid = 0;
    if (uuid) {
      juuid = jenv->NewByteArray((jsize)uuidLen);
      if (!juuid) return ;
      jenv->SetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
    }
    Swig::LocalRefGuard uuid_refguard(jenv, juuid);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[71], swigjobj, juuid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    if (juuid && uuid) jenv->GetByteArrayRegion(juuid, 0, (jsize)uuidLen, (jbyte *)uuid);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in BluetoothLeRadioRust::centralL2capDataAvailable ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_BluetoothLeRadioRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/BluetoothLeRadioRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "connectPeripheral", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "disconnectPeripheral", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "getAdvertisingState", "()Llive/ditto/internal/swig/ffi/OnlineState_t;"),
    SwigDirectorMethod(jenv, baseclass, "getScanningState", "()Llive/ditto/internal/swig/ffi/OnlineState_t;"),
    SwigDirectorMethod(jenv, baseclass, "notifyToCentral", "(Llive/ditto/internal/swig/ffi/BleDataType_t;[B[B)Llive/ditto/internal/swig/ffi/SendResult_t;"),
    SwigDirectorMethod(jenv, baseclass, "startAdvertising", "([BLjava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "startScanning", "([BLjava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "stopAdvertising", "()V"),
    SwigDirectorMethod(jenv, baseclass, "stopScanning", "()V"),
    SwigDirectorMethod(jenv, baseclass, "writeToPeripheral", "(Llive/ditto/internal/swig/ffi/BleDataType_t;[B[B)Llive/ditto/internal/swig/ffi/SendResult_t;"),
    SwigDirectorMethod(jenv, baseclass, "appIsInForeground", "()Z"),
    SwigDirectorMethod(jenv, baseclass, "readL2capFromPeripheral", "([BLlive/ditto/internal/swig/ffi/slice_mut_uint8_t;)I"),
    SwigDirectorMethod(jenv, baseclass, "sendL2capToPeripheral", "([B[B)I"),
    SwigDirectorMethod(jenv, baseclass, "readL2capFromCentral", "([BLlive/ditto/internal/swig/ffi/slice_mut_uint8_t;)I"),
    SwigDirectorMethod(jenv, baseclass, "sendL2capToCentral", "([B[B)I"),
    SwigDirectorMethod(jenv, baseclass, "addBleTransport", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;)V"),
    SwigDirectorMethod(jenv, baseclass, "dropBleTransport", "()V"),
    SwigDirectorMethod(jenv, baseclass, "advertisementHeard", "([B[BZLjava/lang/String;F)V"),
    SwigDirectorMethod(jenv, baseclass, "connectionStateChanged", "([BLlive/ditto/internal/swig/ffi/ConnectState_t;ZI)V"),
    SwigDirectorMethod(jenv, baseclass, "peripheralMtuUpdated", "([BI)V"),
    SwigDirectorMethod(jenv, baseclass, "receivedFromPeripheral", "([BLlive/ditto/internal/swig/ffi/BleDataType_t;[B)V"),
    SwigDirectorMethod(jenv, baseclass, "scanningStateChanged", "(Llive/ditto/internal/swig/ffi/OnlineState_t;Llive/ditto/internal/swig/ffi/TransportCondition_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "peripheralReadyToSend", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "peripheralL2capReadyToSend", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "peripheralL2capDataAvailable", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "advertisingStateChanged", "(Llive/ditto/internal/swig/ffi/OnlineState_t;Llive/ditto/internal/swig/ffi/TransportCondition_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "centralMtuUpdated", "([BI)V"),
    SwigDirectorMethod(jenv, baseclass, "receivedFromCentral", "([BLlive/ditto/internal/swig/ffi/BleDataType_t;[B)V"),
    SwigDirectorMethod(jenv, baseclass, "centralFinishedConnecting", "([B[BZI)V"),
    SwigDirectorMethod(jenv, baseclass, "centralUnsubscribed", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "centralReadyToSend", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "centralL2capReadyToSend", "([B)V"),
    SwigDirectorMethod(jenv, baseclass, "centralL2capDataAvailable", "([B)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 35; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_StatusRust::SwigDirector_StatusRust(JNIEnv *jenv) : StatusRust(), Swig::Director(jenv) {
}

SwigDirector_StatusRust::~SwigDirector_StatusRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_StatusRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method StatusRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[72], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StatusRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_StatusRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method StatusRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[73], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StatusRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_StatusRust::transportConditionDidChange(ConditionSource source,TransportCondition_t condition) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jint jsource  ;
  jint jcondition  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method StatusRust::transportConditionDidChange.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jsource = (jint) source;
    jcondition = (jint) condition;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[74], swigjobj, jsource, jcondition);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StatusRust::transportConditionDidChange ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_StatusRust::submit(CDitto *ditto) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto = 0 ;
  
  if (!swig_override[3]) {
    StatusRust::submit(ditto);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto) = (CDitto *) ditto; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[75], swigjobj, jditto);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StatusRust::submit ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_StatusRust::shutdown(CDitto *ditto) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto = 0 ;
  
  if (!swig_override[4]) {
    StatusRust::shutdown(ditto);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto) = (CDitto *) ditto; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[76], swigjobj, jditto);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StatusRust::shutdown ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_StatusRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/StatusRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "transportConditionDidChange", "(Llive/ditto/internal/swig/ffi/ConditionSource_t;Llive/ditto/internal/swig/ffi/TransportCondition_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "submit", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;)V"),
    SwigDirectorMethod(jenv, baseclass, "shutdown", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 5; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_LoginProviderRust::SwigDirector_LoginProviderRust(JNIEnv *jenv) : LoginProviderRust(), Swig::Director(jenv) {
}

SwigDirector_LoginProviderRust::~SwigDirector_LoginProviderRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_LoginProviderRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method LoginProviderRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[77], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LoginProviderRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_LoginProviderRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method LoginProviderRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[78], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LoginProviderRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_LoginProviderRust::authenticationExpiring(unsigned int time_remaining) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jtime_remaining  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method LoginProviderRust::authenticationExpiring.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jtime_remaining = (jlong) time_remaining;
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[79], swigjobj, jtime_remaining);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LoginProviderRust::authenticationExpiring ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_LoginProviderRust::submit() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[3]) {
    LoginProviderRust::submit();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[80], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LoginProviderRust::submit ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_LoginProviderRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/LoginProviderRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "authenticationExpiring", "(J)V"),
    SwigDirectorMethod(jenv, baseclass, "submit", "()V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 4; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_AuthenticationStatusHandlerRust::SwigDirector_AuthenticationStatusHandlerRust(JNIEnv *jenv) : AuthenticationStatusHandlerRust(), Swig::Director(jenv) {
}

SwigDirector_AuthenticationStatusHandlerRust::~SwigDirector_AuthenticationStatusHandlerRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_AuthenticationStatusHandlerRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AuthenticationStatusHandlerRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[81], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AuthenticationStatusHandlerRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AuthenticationStatusHandlerRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AuthenticationStatusHandlerRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[82], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AuthenticationStatusHandlerRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AuthenticationStatusHandlerRust::authenticationStatusUpdated(dittoffi_authentication_status_t *ffi_auth_status) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jffi_auth_status = 0 ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AuthenticationStatusHandlerRust::authenticationStatusUpdated.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((dittoffi_authentication_status_t **)&jffi_auth_status) = (dittoffi_authentication_status_t *) ffi_auth_status; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[83], swigjobj, jffi_auth_status);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AuthenticationStatusHandlerRust::authenticationStatusUpdated ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AuthenticationStatusHandlerRust::submit(CDitto *ditto) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto = 0 ;
  
  if (!swig_override[3]) {
    AuthenticationStatusHandlerRust::submit(ditto);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto) = (CDitto *) ditto; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[84], swigjobj, jditto);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AuthenticationStatusHandlerRust::submit ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AuthenticationStatusHandlerRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/AuthenticationStatusHandlerRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "authenticationStatusUpdated", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_dittoffi_authentication_status;)V"),
    SwigDirectorMethod(jenv, baseclass, "submit", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 4; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_DiskUsageObserverRust::SwigDirector_DiskUsageObserverRust(JNIEnv *jenv) : DiskUsageObserverRust(), Swig::Director(jenv) {
}

SwigDirector_DiskUsageObserverRust::~SwigDirector_DiskUsageObserverRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_DiskUsageObserverRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method DiskUsageObserverRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[85], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in DiskUsageObserverRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_DiskUsageObserverRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method DiskUsageObserverRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[86], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in DiskUsageObserverRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_DiskUsageObserverRust::diskUsageUpdated(slice_ref_uint8_t diskUsageBytes) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jdiskUsageBytes  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method DiskUsageObserverRust::diskUsageUpdated.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jdiskUsageBytes = 0;
    *((slice_ref_uint8_t **)&jdiskUsageBytes) = new slice_ref_uint8_t(SWIG_STD_MOVE(diskUsageBytes)); 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[87], swigjobj, jdiskUsageBytes);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in DiskUsageObserverRust::diskUsageUpdated ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_DiskUsageObserverRust::subscribe(CDitto *ditto) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto = 0 ;
  
  if (!swig_override[3]) {
    DiskUsageObserverRust::subscribe(ditto);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto) = (CDitto *) ditto; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[88], swigjobj, jditto);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in DiskUsageObserverRust::subscribe ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_DiskUsageObserverRust::stop() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[4]) {
    DiskUsageObserverRust::stop();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[89], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in DiskUsageObserverRust::stop ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_DiskUsageObserverRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/DiskUsageObserverRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "diskUsageUpdated", "(Llive/ditto/internal/swig/ffi/slice_ref_uint8_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "subscribe", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;)V"),
    SwigDirectorMethod(jenv, baseclass, "stop", "()V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 5; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_AttachmentObserverRust::SwigDirector_AttachmentObserverRust(JNIEnv *jenv) : AttachmentObserverRust(), Swig::Director(jenv) {
}

SwigDirector_AttachmentObserverRust::~SwigDirector_AttachmentObserverRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_AttachmentObserverRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AttachmentObserverRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[90], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AttachmentObserverRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AttachmentObserverRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AttachmentObserverRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[91], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AttachmentObserverRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AttachmentObserverRust::completedEventHandler(AttachmentHandle const *ah) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jah = 0 ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AttachmentObserverRust::completedEventHandler.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((AttachmentHandle **)&jah) = (AttachmentHandle *) ah; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[92], swigjobj, jah);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AttachmentObserverRust::completedEventHandler ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AttachmentObserverRust::progressEventHandler(uint64_t downloadedBytes,uint64_t totalBytes) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jobject jdownloadedBytes  ;
  jobject jtotalBytes  ;
  
  if (!swig_override[3]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AttachmentObserverRust::progressEventHandler.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    {
      jbyteArray ba = jenv->NewByteArray(9);
      jbyte* bae = jenv->GetByteArrayElements(ba, 0);
      jclass clazz = jenv->FindClass("java/math/BigInteger");
      jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
      jobject bigint;
      int swig_i;
      
      bae[0] = 0;
      for(swig_i=1; swig_i<9; swig_i++ ) {
        bae[swig_i] = (jbyte)(downloadedBytes>>8*(8-swig_i));
      }
      
      jenv->ReleaseByteArrayElements(ba, bae, 0);
      bigint = jenv->NewObject(clazz, mid, ba);
      jenv->DeleteLocalRef(ba);
      jdownloadedBytes = bigint;
    }
    Swig::LocalRefGuard downloadedBytes_refguard(jenv, jdownloadedBytes);
    {
      jbyteArray ba = jenv->NewByteArray(9);
      jbyte* bae = jenv->GetByteArrayElements(ba, 0);
      jclass clazz = jenv->FindClass("java/math/BigInteger");
      jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
      jobject bigint;
      int swig_i;
      
      bae[0] = 0;
      for(swig_i=1; swig_i<9; swig_i++ ) {
        bae[swig_i] = (jbyte)(totalBytes>>8*(8-swig_i));
      }
      
      jenv->ReleaseByteArrayElements(ba, bae, 0);
      bigint = jenv->NewObject(clazz, mid, ba);
      jenv->DeleteLocalRef(ba);
      jtotalBytes = bigint;
    }
    Swig::LocalRefGuard totalBytes_refguard(jenv, jtotalBytes);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[93], swigjobj, jdownloadedBytes, jtotalBytes);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AttachmentObserverRust::progressEventHandler ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_AttachmentObserverRust::deletedEventHandler() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[4]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method AttachmentObserverRust::deletedEventHandler.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[94], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AttachmentObserverRust::deletedEventHandler ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

CancelTokenResult_t SwigDirector_AttachmentObserverRust::resolve_attachment(CDitto *ditto_raw,unsigned char const *id_ptr,uintptr_t id_len) {
  CancelTokenResult_t c_result ;
  jlong jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto_raw = 0 ;
  jbyteArray jid_ptr = 0 ;
  CancelTokenResult_t *argp ;
  
  if (!swig_override[5]) {
    return AttachmentObserverRust::resolve_attachment(ditto_raw,id_ptr,id_len);
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto_raw) = (CDitto *) ditto_raw; 
    jid_ptr = 0;
    if (id_ptr) {
      jid_ptr = jenv->NewByteArray((jsize)id_len);
      if (!jid_ptr) return c_result;
      jenv->SetByteArrayRegion(jid_ptr, 0, (jsize)id_len, (jbyte *)id_ptr);
    }
    Swig::LocalRefGuard id_ptr_refguard(jenv, jid_ptr);
    jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[95], swigjobj, jditto_raw, jid_ptr);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    argp = *(CancelTokenResult_t **)&jresult; 
    if (!argp) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type CancelTokenResult_t");
      return c_result;
    }
    c_result = *argp; 
    if (jid_ptr && id_ptr) jenv->GetByteArrayRegion(jid_ptr, 0, (jsize)id_len, (jbyte *)id_ptr);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in AttachmentObserverRust::resolve_attachment ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

void SwigDirector_AttachmentObserverRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/AttachmentObserverRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "completedEventHandler", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_AttachmentHandle;)V"),
    SwigDirectorMethod(jenv, baseclass, "progressEventHandler", "(Ljava/math/BigInteger;Ljava/math/BigInteger;)V"),
    SwigDirectorMethod(jenv, baseclass, "deletedEventHandler", "()V"),
    SwigDirectorMethod(jenv, baseclass, "resolve_attachment", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;[B)Llive/ditto/internal/swig/ffi/CancelTokenResult_t;")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 6; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_ConnectionRequestHandlerRust::SwigDirector_ConnectionRequestHandlerRust(JNIEnv *jenv) : ConnectionRequestHandlerRust(), Swig::Director(jenv) {
}

SwigDirector_ConnectionRequestHandlerRust::~SwigDirector_ConnectionRequestHandlerRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_ConnectionRequestHandlerRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method ConnectionRequestHandlerRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[96], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in ConnectionRequestHandlerRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_ConnectionRequestHandlerRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method ConnectionRequestHandlerRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[97], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in ConnectionRequestHandlerRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_ConnectionRequestHandlerRust::eventHandler(dittoffi_connection_request_t *connection_request) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jconnection_request = 0 ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method ConnectionRequestHandlerRust::eventHandler.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((dittoffi_connection_request_t **)&jconnection_request) = (dittoffi_connection_request_t *) connection_request; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[98], swigjobj, jconnection_request);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in ConnectionRequestHandlerRust::eventHandler ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_ConnectionRequestHandlerRust::registerConnectionRequestHandler(CDitto *ditto_raw,ConnectionRequestHandlerRust *handler) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto_raw = 0 ;
  jlong jhandler = 0 ;
  
  if (!swig_override[3]) {
    ConnectionRequestHandlerRust::registerConnectionRequestHandler(ditto_raw,handler);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto_raw) = (CDitto *) ditto_raw; 
    *((ConnectionRequestHandlerRust **)&jhandler) = (ConnectionRequestHandlerRust *) handler; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[99], swigjobj, jditto_raw, jhandler);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in ConnectionRequestHandlerRust::registerConnectionRequestHandler ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_ConnectionRequestHandlerRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/ConnectionRequestHandlerRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "eventHandler", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_dittoffi_connection_request;)V"),
    SwigDirectorMethod(jenv, baseclass, "registerConnectionRequestHandler", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;Llive/ditto/internal/swig/ffi/ConnectionRequestHandlerRust;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 4; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_CrashReporterFfi::SwigDirector_CrashReporterFfi(JNIEnv *jenv) : CrashReporterFfi(), Swig::Director(jenv) {
}

SwigDirector_CrashReporterFfi::~SwigDirector_CrashReporterFfi() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_CrashReporterFfi::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method CrashReporterFfi::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[100], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in CrashReporterFfi::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_CrashReporterFfi::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method CrashReporterFfi::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[101], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in CrashReporterFfi::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_CrashReporterFfi::reportCrashKotlinImplementation(dittoffi_panic_t *panic) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jpanic = 0 ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method CrashReporterFfi::reportCrashKotlinImplementation.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((dittoffi_panic_t **)&jpanic) = (dittoffi_panic_t *) panic; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[102], swigjobj, jpanic);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in CrashReporterFfi::reportCrashKotlinImplementation ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_CrashReporterFfi::overrideCrashReporter(CDitto *ditto_raw) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto_raw = 0 ;
  
  if (!swig_override[3]) {
    CrashReporterFfi::overrideCrashReporter(ditto_raw);
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto_raw) = (CDitto *) ditto_raw; 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[103], swigjobj, jditto_raw);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in CrashReporterFfi::overrideCrashReporter ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_CrashReporterFfi::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/CrashReporterFfi");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "reportCrashKotlinImplementation", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_dittoffi_panic;)V"),
    SwigDirectorMethod(jenv, baseclass, "overrideCrashReporter", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;)V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 4; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_LiveQueryHandlerRust::SwigDirector_LiveQueryHandlerRust(JNIEnv *jenv) : LiveQueryHandlerRust(), Swig::Director(jenv) {
}

SwigDirector_LiveQueryHandlerRust::~SwigDirector_LiveQueryHandlerRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_LiveQueryHandlerRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method LiveQueryHandlerRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[104], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LiveQueryHandlerRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_LiveQueryHandlerRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method LiveQueryHandlerRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[105], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LiveQueryHandlerRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_LiveQueryHandlerRust::eventHandler(c_cb_params_t c_cb_params) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jc_cb_params  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method LiveQueryHandlerRust::eventHandler.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jc_cb_params = 0;
    *((c_cb_params_t **)&jc_cb_params) = new c_cb_params_t(SWIG_STD_MOVE(c_cb_params)); 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[106], swigjobj, jc_cb_params);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LiveQueryHandlerRust::eventHandler ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

I64Result_t SwigDirector_LiveQueryHandlerRust::registerLiveQuery(CDitto *ditto_raw,char const *coll_name,char const *query,unsigned char const *query_args_cbor,uintptr_t query_args_cbor_len,COrderByParam_t const *order_by,unsigned int order_by_len,int limit,unsigned int offset,LiveQueryAvailability_t lq_availability) {
  I64Result_t c_result ;
  jlong jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto_raw = 0 ;
  jstring jcoll_name = 0 ;
  jstring jquery = 0 ;
  jbyteArray jquery_args_cbor = 0 ;
  jlong jorder_by = 0 ;
  jlong jorder_by_len  ;
  jint jlimit  ;
  jlong joffset  ;
  jint jlq_availability  ;
  I64Result_t *argp ;
  
  if (!swig_override[3]) {
    return LiveQueryHandlerRust::registerLiveQuery(ditto_raw,coll_name,query,query_args_cbor,query_args_cbor_len,order_by,order_by_len,limit,offset,lq_availability);
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto_raw) = (CDitto *) ditto_raw; 
    jcoll_name = 0;
    if (coll_name) {
      jcoll_name = jenv->NewStringUTF((const char *)coll_name);
      if (!jcoll_name) return c_result;
    }
    Swig::LocalRefGuard coll_name_refguard(jenv, jcoll_name);
    jquery = 0;
    if (query) {
      jquery = jenv->NewStringUTF((const char *)query);
      if (!jquery) return c_result;
    }
    Swig::LocalRefGuard query_refguard(jenv, jquery);
    jquery_args_cbor = 0;
    if (query_args_cbor) {
      jquery_args_cbor = jenv->NewByteArray((jsize)query_args_cbor_len);
      if (!jquery_args_cbor) return c_result;
      jenv->SetByteArrayRegion(jquery_args_cbor, 0, (jsize)query_args_cbor_len, (jbyte *)query_args_cbor);
    }
    Swig::LocalRefGuard query_args_cbor_refguard(jenv, jquery_args_cbor);
    *((COrderByParam_t **)&jorder_by) = (COrderByParam_t *) order_by; 
    jorder_by_len = (jlong) order_by_len;
    jlimit = (jint) limit;
    joffset = (jlong) offset;
    jlq_availability = (jint) lq_availability;
    jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[107], swigjobj, jditto_raw, jcoll_name, jquery, jquery_args_cbor, jorder_by, jorder_by_len, jlimit, joffset, jlq_availability);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    argp = *(I64Result_t **)&jresult; 
    if (!argp) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type I64Result_t");
      return c_result;
    }
    c_result = *argp; 
    if (jquery_args_cbor && query_args_cbor) jenv->GetByteArrayRegion(jquery_args_cbor, 0, (jsize)query_args_cbor_len, (jbyte *)query_args_cbor);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LiveQueryHandlerRust::registerLiveQuery ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

int SwigDirector_LiveQueryHandlerRust::startLiveQuery(CDitto *ditto_raw,int64_t id) {
  int c_result = SwigValueInit< int >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto_raw = 0 ;
  jlong jid  ;
  
  if (!swig_override[4]) {
    return LiveQueryHandlerRust::startLiveQuery(ditto_raw,id);
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto_raw) = (CDitto *) ditto_raw; 
    jid = (jlong) id;
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[108], swigjobj, jditto_raw, jid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (int)jresult; 
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in LiveQueryHandlerRust::startLiveQuery ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

void SwigDirector_LiveQueryHandlerRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/LiveQueryHandlerRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "eventHandler", "(Llive/ditto/internal/swig/ffi/c_cb_params_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "registerLiveQuery", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;Ljava/lang/String;Ljava/lang/String;[BLlive/ditto/internal/swig/ffi/COrderByParam_t;JIJLlive/ditto/internal/swig/ffi/LiveQueryAvailability_t;)Llive/ditto/internal/swig/ffi/I64Result_t;"),
    SwigDirectorMethod(jenv, baseclass, "startLiveQuery", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;J)I")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 5; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_PresenceRust::SwigDirector_PresenceRust(JNIEnv *jenv,CDitto_t *ditto) : PresenceRust(ditto), Swig::Director(jenv) {
}

SwigDirector_PresenceRust::~SwigDirector_PresenceRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_PresenceRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method PresenceRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[109], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method PresenceRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[110], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::v1Callback(char const *const json) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jjson = 0 ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method PresenceRust::v1Callback.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jjson = 0;
    if (json) {
      jjson = jenv->NewStringUTF((const char *)json);
      if (!jjson) return ;
    }
    Swig::LocalRefGuard json_refguard(jenv, jjson);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[111], swigjobj, jjson);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::v1Callback ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::v2Callback(char const *const json) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jjson = 0 ;
  
  if (!swig_override[3]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method PresenceRust::v2Callback.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jjson = 0;
    if (json) {
      jjson = jenv->NewStringUTF((const char *)json);
      if (!jjson) return ;
    }
    Swig::LocalRefGuard json_refguard(jenv, jjson);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[112], swigjobj, jjson);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::v2Callback ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::v3Callback(char const *const json) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jstring jjson = 0 ;
  
  if (!swig_override[4]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method PresenceRust::v3Callback.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jjson = 0;
    if (json) {
      jjson = jenv->NewStringUTF((const char *)json);
      if (!jjson) return ;
    }
    Swig::LocalRefGuard json_refguard(jenv, jjson);
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[113], swigjobj, jjson);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::v3Callback ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::register_v1() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[5]) {
    PresenceRust::register_v1();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[114], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::register_v1 ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::register_v2() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[6]) {
    PresenceRust::register_v2();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[115], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::register_v2 ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::register_v3() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[7]) {
    PresenceRust::register_v3();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[116], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::register_v3 ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::requestV1Update() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[8]) {
    PresenceRust::requestV1Update();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[117], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::requestV1Update ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::requestV2Update() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[9]) {
    PresenceRust::requestV2Update();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[118], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::requestV2Update ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::requestV3Update() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[10]) {
    PresenceRust::requestV3Update();
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[119], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in PresenceRust::requestV3Update ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_PresenceRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/PresenceRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "v1Callback", "(Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "v2Callback", "(Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "v3Callback", "(Ljava/lang/String;)V"),
    SwigDirectorMethod(jenv, baseclass, "register_v1", "()V"),
    SwigDirectorMethod(jenv, baseclass, "register_v2", "()V"),
    SwigDirectorMethod(jenv, baseclass, "register_v3", "()V"),
    SwigDirectorMethod(jenv, baseclass, "requestV1Update", "()V"),
    SwigDirectorMethod(jenv, baseclass, "requestV2Update", "()V"),
    SwigDirectorMethod(jenv, baseclass, "requestV3Update", "()V")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 11; ++i) {
      swig_override[i] = derived;
    }
  }
}


SwigDirector_StoreObserverHandlerRust::SwigDirector_StoreObserverHandlerRust(JNIEnv *jenv) : StoreObserverHandlerRust(), Swig::Director(jenv) {
}

SwigDirector_StoreObserverHandlerRust::~SwigDirector_StoreObserverHandlerRust() {
  swig_disconnect_director_self("swigDirectorDisconnect");
}


void SwigDirector_StoreObserverHandlerRust::java_retain() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[0]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method StoreObserverHandlerRust::java_retain.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[120], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StoreObserverHandlerRust::java_retain ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_StoreObserverHandlerRust::java_release() {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  
  if (!swig_override[1]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method StoreObserverHandlerRust::java_release.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[121], swigjobj);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StoreObserverHandlerRust::java_release ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

void SwigDirector_StoreObserverHandlerRust::eventHandler(ChangeHandlerWithQueryResult_t c_cb_params) {
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jc_cb_params  ;
  
  if (!swig_override[2]) {
    SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method StoreObserverHandlerRust::eventHandler.");
    return;
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    jc_cb_params = 0;
    *((ChangeHandlerWithQueryResult_t **)&jc_cb_params) = new ChangeHandlerWithQueryResult_t(SWIG_STD_MOVE(c_cb_params)); 
    jenv->CallStaticVoidMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[122], swigjobj, jc_cb_params);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StoreObserverHandlerRust::eventHandler ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
}

dittoffi_result_int64_t SwigDirector_StoreObserverHandlerRust::registerStoreObserver(CDitto *ditto_raw,char const *query,unsigned char const *query_args_cbor,uintptr_t query_args_cbor_len,LiveQueryAvailability_t lq_availability) {
  dittoffi_result_int64_t c_result ;
  jlong jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto_raw = 0 ;
  jstring jquery = 0 ;
  jbyteArray jquery_args_cbor = 0 ;
  jint jlq_availability  ;
  dittoffi_result_int64_t *argp ;
  
  if (!swig_override[3]) {
    return StoreObserverHandlerRust::registerStoreObserver(ditto_raw,query,query_args_cbor,query_args_cbor_len,lq_availability);
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto_raw) = (CDitto *) ditto_raw; 
    jquery = 0;
    if (query) {
      jquery = jenv->NewStringUTF((const char *)query);
      if (!jquery) return c_result;
    }
    Swig::LocalRefGuard query_refguard(jenv, jquery);
    jquery_args_cbor = 0;
    if (query_args_cbor) {
      jquery_args_cbor = jenv->NewByteArray((jsize)query_args_cbor_len);
      if (!jquery_args_cbor) return c_result;
      jenv->SetByteArrayRegion(jquery_args_cbor, 0, (jsize)query_args_cbor_len, (jbyte *)query_args_cbor);
    }
    Swig::LocalRefGuard query_args_cbor_refguard(jenv, jquery_args_cbor);
    jlq_availability = (jint) lq_availability;
    jresult = (jlong) jenv->CallStaticLongMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[123], swigjobj, jditto_raw, jquery, jquery_args_cbor, jlq_availability);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    argp = *(dittoffi_result_int64_t **)&jresult; 
    if (!argp) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type dittoffi_result_int64_t");
      return c_result;
    }
    c_result = *argp; 
    if (jquery_args_cbor && query_args_cbor) jenv->GetByteArrayRegion(jquery_args_cbor, 0, (jsize)query_args_cbor_len, (jbyte *)query_args_cbor);
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StoreObserverHandlerRust::registerStoreObserver ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

int SwigDirector_StoreObserverHandlerRust::startLiveQuery(CDitto *ditto_raw,int64_t id) {
  int c_result = SwigValueInit< int >() ;
  jint jresult = 0 ;
  JNIEnvWrapper swigjnienv(this) ;
  JNIEnv * jenv = swigjnienv.getJNIEnv() ;
  jobject swigjobj = (jobject) NULL ;
  jlong jditto_raw = 0 ;
  jlong jid  ;
  
  if (!swig_override[4]) {
    return StoreObserverHandlerRust::startLiveQuery(ditto_raw,id);
  }
  swigjobj = swig_get_self(jenv);
  if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
    *((CDitto **)&jditto_raw) = (CDitto *) ditto_raw; 
    jid = (jlong) id;
    jresult = (jint) jenv->CallStaticIntMethod(Swig::jclass_dittoffiJNI, Swig::director_method_ids[124], swigjobj, jditto_raw, jid);
    jthrowable swigerror = jenv->ExceptionOccurred();
    if (swigerror) {
      Swig::DirectorException::raise(jenv, swigerror);
    }
    
    c_result = (int)jresult; 
  } else {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in StoreObserverHandlerRust::startLiveQuery ");
  }
  if (swigjobj) jenv->DeleteLocalRef(swigjobj);
  return c_result;
}

void SwigDirector_StoreObserverHandlerRust::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {
  static jclass baseclass = swig_new_global_ref(jenv, "live/ditto/internal/swig/ffi/StoreObserverHandlerRust");
  if (!baseclass) return;
  static SwigDirectorMethod methods[] = {
    SwigDirectorMethod(jenv, baseclass, "java_retain", "()V"),
    SwigDirectorMethod(jenv, baseclass, "java_release", "()V"),
    SwigDirectorMethod(jenv, baseclass, "eventHandler", "(Llive/ditto/internal/swig/ffi/ChangeHandlerWithQueryResult_t;)V"),
    SwigDirectorMethod(jenv, baseclass, "registerStoreObserver", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;Ljava/lang/String;[BLlive/ditto/internal/swig/ffi/LiveQueryAvailability_t;)Llive/ditto/internal/swig/ffi/dittoffi_result_int64_t;"),
    SwigDirectorMethod(jenv, baseclass, "startLiveQuery", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDitto;J)I")
  };
  
  if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {
    bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);
    for (int i = 0; i < 5; ++i) {
      swig_override[i] = derived;
    }
  }
}



#ifdef __cplusplus
extern "C" {
#endif

SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Retainable(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  Retainable *arg1 = (Retainable *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Retainable **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1java_1retain(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  Retainable *arg1 = (Retainable *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Retainable **)&jarg1; 
  (arg1)->java_retain();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1java_1release(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  Retainable *arg1 = (Retainable *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Retainable **)&jarg1; 
  
  try {
    (arg1)->java_release();
  } catch (Swig::DirectorException &e) {
    
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1is_1closing_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
  Retainable *arg1 = (Retainable *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Retainable **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  if (arg1) (arg1)->is_closing = arg2;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1is_1closing_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  Retainable *arg1 = (Retainable *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Retainable **)&jarg1; 
  result = (bool) ((arg1)->is_closing);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1invokeRetain(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void *arg1 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  Retainable::invokeRetain(arg1);
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1invokeVirtualPtrRetain(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  Erased_t *arg1 = (Erased_t *) 0 ;
  Erased_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Erased_t **)&jarg1; 
  result = (Erased_t *)Retainable::invokeVirtualPtrRetain((Erased const *)arg1);
  *(Erased_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1invokeRelease(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void *arg1 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  Retainable::invokeRelease(arg1);
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Retainable(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  Retainable *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (Retainable *)new SwigDirector_Retainable(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Retainable **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  Retainable *obj = *((Retainable **)&objarg);
  (void)jcls;
  SwigDirector_Retainable *director = static_cast<SwigDirector_Retainable *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Retainable_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  Retainable *obj = *((Retainable **)&objarg);
  SwigDirector_Retainable *director = dynamic_cast<SwigDirector_Retainable *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1LoggerCb(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  LoggerCb *arg1 = (LoggerCb *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(LoggerCb **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoggerCb_1ffiCustomLog(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) {
  LoggerCb *arg1 = (LoggerCb *) 0 ;
  CLogLevel_t arg2 ;
  char *arg3 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LoggerCb **)&jarg1; 
  arg2 = (CLogLevel_t)jarg2; 
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  (arg1)->ffiCustomLog(arg2,(char const *)arg3);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoggerCb_1registerCustomLogCb(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  LoggerCb *arg1 = (LoggerCb *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LoggerCb **)&jarg1; 
  (arg1)->registerCustomLogCb();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoggerCb_1unregisterCustomLogCb(JNIEnv *jenv, jclass jcls) {
  (void)jenv;
  (void)jcls;
  LoggerCb::unregisterCustomLogCb();
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1LoggerCb(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  LoggerCb *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LoggerCb *)new SwigDirector_LoggerCb(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(LoggerCb **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoggerCb_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  LoggerCb *obj = *((LoggerCb **)&objarg);
  (void)jcls;
  SwigDirector_LoggerCb *director = static_cast<SwigDirector_LoggerCb *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoggerCb_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  LoggerCb *obj = *((LoggerCb **)&objarg);
  SwigDirector_LoggerCb *director = dynamic_cast<SwigDirector_LoggerCb *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1RetainableContinuation(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  RetainableContinuation *arg1 = (RetainableContinuation *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(RetainableContinuation **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_RetainableContinuation_1invoke(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  RetainableContinuation *arg1 = (RetainableContinuation *) 0 ;
  dittoffi_result_uint64_t arg2 ;
  dittoffi_result_uint64_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(RetainableContinuation **)&jarg1; 
  argp2 = *(dittoffi_result_uint64_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_uint64_t");
    return ;
  }
  arg2 = *argp2; 
  (arg1)->invoke(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_RetainableContinuation_1invokeContinuation(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) (void *)0 ;
  dittoffi_result_uint64_t arg2 ;
  dittoffi_result_uint64_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  argp2 = *(dittoffi_result_uint64_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_uint64_t");
    return ;
  }
  arg2 = *argp2; 
  RetainableContinuation::invokeContinuation(arg1,SWIG_STD_MOVE(arg2));
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_RetainableContinuation_1intoFfi(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  RetainableContinuation *arg1 = (RetainableContinuation *) 0 ;
  BoxDynFnMut1_void_dittoffi_result_uint64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(RetainableContinuation **)&jarg1; 
  result = (arg1)->intoFfi();
  *(BoxDynFnMut1_void_dittoffi_result_uint64_t **)&jresult = new BoxDynFnMut1_void_dittoffi_result_uint64_t(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1RetainableContinuation(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  RetainableContinuation *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (RetainableContinuation *)new SwigDirector_RetainableContinuation(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(RetainableContinuation **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_RetainableContinuation_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  RetainableContinuation *obj = *((RetainableContinuation **)&objarg);
  (void)jcls;
  SwigDirector_RetainableContinuation *director = static_cast<SwigDirector_RetainableContinuation *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_RetainableContinuation_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  RetainableContinuation *obj = *((RetainableContinuation **)&objarg);
  SwigDirector_RetainableContinuation *director = dynamic_cast<SwigDirector_RetainableContinuation *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1TransactionCompletionContinuation(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransactionCompletionContinuation *arg1 = (TransactionCompletionContinuation *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransactionCompletionContinuation **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionCompletionContinuation_1invoke(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  TransactionCompletionContinuation *arg1 = (TransactionCompletionContinuation *) 0 ;
  dittoffi_result_dittoffi_transaction_completion_action_t arg2 ;
  dittoffi_result_dittoffi_transaction_completion_action_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(TransactionCompletionContinuation **)&jarg1; 
  argp2 = *(dittoffi_result_dittoffi_transaction_completion_action_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_dittoffi_transaction_completion_action_t");
    return ;
  }
  arg2 = *argp2; 
  (arg1)->invoke(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionCompletionContinuation_1invokeContinuationCompletion(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) (void *)0 ;
  dittoffi_result_dittoffi_transaction_completion_action_t arg2 ;
  dittoffi_result_dittoffi_transaction_completion_action_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  argp2 = *(dittoffi_result_dittoffi_transaction_completion_action_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_dittoffi_transaction_completion_action_t");
    return ;
  }
  arg2 = *argp2; 
  TransactionCompletionContinuation::invokeContinuationCompletion(arg1,SWIG_STD_MOVE(arg2));
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionCompletionContinuation_1intoFfi(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  TransactionCompletionContinuation *arg1 = (TransactionCompletionContinuation *) 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(TransactionCompletionContinuation **)&jarg1; 
  result = (arg1)->intoFfi();
  *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action_t **)&jresult = new BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action_t(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1TransactionCompletionContinuation(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  TransactionCompletionContinuation *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (TransactionCompletionContinuation *)new SwigDirector_TransactionCompletionContinuation(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(TransactionCompletionContinuation **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionCompletionContinuation_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  TransactionCompletionContinuation *obj = *((TransactionCompletionContinuation **)&objarg);
  (void)jcls;
  SwigDirector_TransactionCompletionContinuation *director = static_cast<SwigDirector_TransactionCompletionContinuation *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionCompletionContinuation_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  TransactionCompletionContinuation *obj = *((TransactionCompletionContinuation **)&objarg);
  SwigDirector_TransactionCompletionContinuation *director = dynamic_cast<SwigDirector_TransactionCompletionContinuation *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1TransactionExecuteContinuation(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransactionExecuteContinuation *arg1 = (TransactionExecuteContinuation *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransactionExecuteContinuation **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionExecuteContinuation_1invoke(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  TransactionExecuteContinuation *arg1 = (TransactionExecuteContinuation *) 0 ;
  dittoffi_result_dittoffi_query_result_ptr_t arg2 ;
  dittoffi_result_dittoffi_query_result_ptr_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(TransactionExecuteContinuation **)&jarg1; 
  argp2 = *(dittoffi_result_dittoffi_query_result_ptr_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_dittoffi_query_result_ptr_t");
    return ;
  }
  arg2 = *argp2; 
  (arg1)->invoke(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionExecuteContinuation_1invokeContinuationExecute(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) (void *)0 ;
  dittoffi_result_dittoffi_query_result_ptr_t arg2 ;
  dittoffi_result_dittoffi_query_result_ptr_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  argp2 = *(dittoffi_result_dittoffi_query_result_ptr_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_dittoffi_query_result_ptr_t");
    return ;
  }
  arg2 = *argp2; 
  TransactionExecuteContinuation::invokeContinuationExecute(arg1,SWIG_STD_MOVE(arg2));
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionExecuteContinuation_1intoFfi(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  TransactionExecuteContinuation *arg1 = (TransactionExecuteContinuation *) 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(TransactionExecuteContinuation **)&jarg1; 
  result = (arg1)->intoFfi();
  *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr_t **)&jresult = new BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr_t(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1TransactionExecuteContinuation(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  TransactionExecuteContinuation *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (TransactionExecuteContinuation *)new SwigDirector_TransactionExecuteContinuation(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(TransactionExecuteContinuation **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionExecuteContinuation_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  TransactionExecuteContinuation *obj = *((TransactionExecuteContinuation **)&objarg);
  (void)jcls;
  SwigDirector_TransactionExecuteContinuation *director = static_cast<SwigDirector_TransactionExecuteContinuation *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionExecuteContinuation_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  TransactionExecuteContinuation *obj = *((TransactionExecuteContinuation **)&objarg);
  SwigDirector_TransactionExecuteContinuation *director = dynamic_cast<SwigDirector_TransactionExecuteContinuation *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BeginTransactionContinuation(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BeginTransactionContinuation *arg1 = (BeginTransactionContinuation *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BeginTransactionContinuation **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BeginTransactionContinuation_1invoke(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  BeginTransactionContinuation *arg1 = (BeginTransactionContinuation *) 0 ;
  dittoffi_result_dittoffi_transaction_ptr_t arg2 ;
  dittoffi_result_dittoffi_transaction_ptr_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(BeginTransactionContinuation **)&jarg1; 
  argp2 = *(dittoffi_result_dittoffi_transaction_ptr_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_dittoffi_transaction_ptr_t");
    return ;
  }
  arg2 = *argp2; 
  (arg1)->invoke(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BeginTransactionContinuation_1invokeContinuation(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) (void *)0 ;
  dittoffi_result_dittoffi_transaction_ptr_t arg2 ;
  dittoffi_result_dittoffi_transaction_ptr_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  argp2 = *(dittoffi_result_dittoffi_transaction_ptr_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_result_dittoffi_transaction_ptr_t");
    return ;
  }
  arg2 = *argp2; 
  BeginTransactionContinuation::invokeContinuation(arg1,SWIG_STD_MOVE(arg2));
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BeginTransactionContinuation_1intoFfi(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BeginTransactionContinuation *arg1 = (BeginTransactionContinuation *) 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BeginTransactionContinuation **)&jarg1; 
  result = (arg1)->intoFfi();
  *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr_t **)&jresult = new BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr_t(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BeginTransactionContinuation(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BeginTransactionContinuation *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BeginTransactionContinuation *)new SwigDirector_BeginTransactionContinuation(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BeginTransactionContinuation **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BeginTransactionContinuation_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  BeginTransactionContinuation *obj = *((BeginTransactionContinuation **)&objarg);
  (void)jcls;
  SwigDirector_BeginTransactionContinuation *director = static_cast<SwigDirector_BeginTransactionContinuation *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BeginTransactionContinuation_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  BeginTransactionContinuation *obj = *((BeginTransactionContinuation **)&objarg);
  SwigDirector_BeginTransactionContinuation *director = dynamic_cast<SwigDirector_BeginTransactionContinuation *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1WifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(WifiAwareRust **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientStartSearching(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  (arg1)->clientStartSearching((char const *)arg2,(char const *)arg3);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientStopSearching(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->clientStopSearching();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientCreateNetwork(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  (arg1)->clientCreateNetwork((char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientUpdatePeer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  ConnectState_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = (ConnectState_t)jarg3; 
  (arg1)->clientUpdatePeer((char const *)arg2,arg3);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverStartAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  uint16_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  arg4 = (uint16_t)jarg4; 
  (arg1)->serverStartAdvertising((char const *)arg2,(char const *)arg3,arg4);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverStopAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->serverStopAdvertising();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverUpdatePeer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  ConnectState_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = (ConnectState_t)jarg3; 
  (arg1)->serverUpdatePeer((char const *)arg2,arg3);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1updateParameterU64(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jobject jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  dittoffi_wifi_aware_system_parameter_u64 arg2 ;
  uint64_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (dittoffi_wifi_aware_system_parameter_u64)jarg2; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg3) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg3);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg3 = 0;
    if (sz > 0) {
      arg3 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg3 = (arg3 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  (arg1)->updateParameterU64(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeClientStartSearching(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3) {
  void *arg1 = (void *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  WifiAwareRust::invokeClientStartSearching(arg1,(char const *)arg2,(char const *)arg3);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeClientStopSearching(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void *arg1 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  WifiAwareRust::invokeClientStopSearching(arg1);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeClientCreateNetwork(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  void *arg1 = (void *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  WifiAwareRust::invokeClientCreateNetwork(arg1,(char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeClientUpdatePeer(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jint jarg3) {
  void *arg1 = (void *) 0 ;
  char *arg2 = (char *) 0 ;
  ConnectState_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = (ConnectState_t)jarg3; 
  WifiAwareRust::invokeClientUpdatePeer(arg1,(char const *)arg2,arg3);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeServerStartAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jint jarg4) {
  void *arg1 = (void *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  uint16_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  arg4 = (uint16_t)jarg4; 
  WifiAwareRust::invokeServerStartAdvertising(arg1,(char const *)arg2,(char const *)arg3,arg4);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeServerStopAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void *arg1 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  WifiAwareRust::invokeServerStopAdvertising(arg1);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeServerUpdatePeer(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jint jarg3) {
  void *arg1 = (void *) 0 ;
  char *arg2 = (char *) 0 ;
  ConnectState_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = (ConnectState_t)jarg3; 
  WifiAwareRust::invokeServerUpdatePeer(arg1,(char const *)arg2,arg3);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1invokeUpdateParameterU64(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jobject jarg3) {
  void *arg1 = (void *) 0 ;
  dittoffi_wifi_aware_system_parameter_u64 arg2 ;
  uint64_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = (dittoffi_wifi_aware_system_parameter_u64)jarg2; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg3) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg3);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg3 = 0;
    if (sz > 0) {
      arg3 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg3 = (arg3 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  WifiAwareRust::invokeUpdateParameterU64(arg1,arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1addWifiAwareTransport(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->addWifiAwareTransport(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1addWifiAwareTransportSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->WifiAwareRust::addWifiAwareTransport(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1removeWifiAwareTransport(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->removeWifiAwareTransport();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1removeWifiAwareTransportSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->WifiAwareRust::removeWifiAwareTransport();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientPeerAppeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  (arg1)->clientPeerAppeared((char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientPeerAppearedSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  (arg1)->WifiAwareRust::clientPeerAppeared((char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientPeerDisappeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  (arg1)->clientPeerDisappeared((char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientPeerDisappearedSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  (arg1)->WifiAwareRust::clientPeerDisappeared((char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientScanningStateChanged(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->clientScanningStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientScanningStateChangedSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->WifiAwareRust::clientScanningStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientNetworkDidCreate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  uint16_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  arg4 = (uint16_t)jarg4; 
  (arg1)->clientNetworkDidCreate((char const *)arg2,(char const *)arg3,arg4);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientNetworkDidCreateSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  uint16_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  arg4 = (uint16_t)jarg4; 
  (arg1)->WifiAwareRust::clientNetworkDidCreate((char const *)arg2,(char const *)arg3,arg4);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientNetworkDidNotCreate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  (arg1)->clientNetworkDidNotCreate((char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1clientNetworkDidNotCreateSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  (arg1)->WifiAwareRust::clientNetworkDidNotCreate((char const *)arg2);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverAdvertisingStateChanged(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->serverAdvertisingStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverAdvertisingStateChangedSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->WifiAwareRust::serverAdvertisingStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverNetworkScopeIdAdded(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  (arg1)->serverNetworkScopeIdAdded(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverNetworkScopeIdAddedSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  (arg1)->WifiAwareRust::serverNetworkScopeIdAdded(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverNetworkScopeIdRemoved(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  (arg1)->serverNetworkScopeIdRemoved(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1serverNetworkScopeIdRemovedSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  (arg1)->WifiAwareRust::serverNetworkScopeIdRemoved(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1goOnlineRequest(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->goOnlineRequest();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1goOnlineRequestSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->WifiAwareRust::goOnlineRequest();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1goOfflineRequest(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->goOfflineRequest();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1goOfflineRequestSwigExplicitWifiAwareRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  (arg1)->WifiAwareRust::goOfflineRequest();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1transportHandle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  std::shared_ptr< TransportHandle_WifiAwarePlatformEvent_t > arg2 ;
  std::shared_ptr< TransportHandle_WifiAwarePlatformEvent_t > *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  argp2 = *(std::shared_ptr< TransportHandle_WifiAwarePlatformEvent_t > **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null std::shared_ptr< TransportHandle_WifiAwarePlatformEvent_t >");
    return ;
  }
  arg2 = *argp2; 
  if (arg1) (arg1)->transportHandle = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1transportHandle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareRust *arg1 = (WifiAwareRust *) 0 ;
  std::shared_ptr< TransportHandle_WifiAwarePlatformEvent_t > result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareRust **)&jarg1; 
  result =  ((arg1)->transportHandle);
  *(std::shared_ptr< TransportHandle_WifiAwarePlatformEvent_t > **)&jresult = new std::shared_ptr< TransportHandle_WifiAwarePlatformEvent_t >(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1WifiAwareRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  WifiAwareRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (WifiAwareRust *)new SwigDirector_WifiAwareRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(WifiAwareRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  WifiAwareRust *obj = *((WifiAwareRust **)&objarg);
  (void)jcls;
  SwigDirector_WifiAwareRust *director = static_cast<SwigDirector_WifiAwareRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  WifiAwareRust *obj = *((WifiAwareRust **)&objarg);
  SwigDirector_WifiAwareRust *director = dynamic_cast<SwigDirector_WifiAwareRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1connectPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->connectPeripheral((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1disconnectPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->disconnectPeripheral((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1getAdvertisingState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  result = (OnlineState_t)(arg1)->getAdvertisingState();
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1getAdvertisingStateSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  result = (OnlineState_t)(arg1)->BluetoothLeRadioRust::getAdvertisingState();
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1getScanningState(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  result = (OnlineState_t)(arg1)->getScanningState();
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1getScanningStateSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  result = (OnlineState_t)(arg1)->BluetoothLeRadioRust::getScanningState();
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1notifyToCentral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jbyteArray jarg3, jbyteArray jarg5) {
  jlong jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  BleDataType_t arg2 ;
  char *arg3 = (char *) (char *)0 ;
  size_t arg4 ;
  char *arg5 = (char *) (char *)0 ;
  size_t arg6 ;
  SendResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = (BleDataType_t)jarg2; 
  {
    if (jarg3) {
      arg3 = (char *) jenv->GetByteArrayElements(jarg3, 0);
      arg4 = (size_t) jenv->GetArrayLength(jarg3);
    } else {
      arg3 = 0;
      arg4 = 0;
    }
  }
  {
    if (jarg5) {
      arg5 = (char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (size_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  result = (arg1)->notifyToCentral(arg2,(char const (*))arg3,arg4,(char const (*))arg5,arg6);
  *(SendResult_t **)&jresult = new SendResult_t(result); 
  {
    if (jarg3) jenv->ReleaseByteArrayElements(jarg3, (jbyte *)arg3, 0);
  }
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  
  
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1startAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jstring jarg4) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return ;
  }
  (arg1)->startAdvertising((char const (*))arg2,arg3,arg4);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1startScanning(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jstring jarg4) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return ;
  }
  (arg1)->startScanning((char const (*))arg2,arg3,arg4);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1stopAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  (arg1)->stopAdvertising();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1stopScanning(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  (arg1)->stopScanning();
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1writeToPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jbyteArray jarg3, jbyteArray jarg5) {
  jlong jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  BleDataType_t arg2 ;
  char *arg3 = (char *) (char *)0 ;
  size_t arg4 ;
  char *arg5 = (char *) (char *)0 ;
  size_t arg6 ;
  SendResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = (BleDataType_t)jarg2; 
  {
    if (jarg3) {
      arg3 = (char *) jenv->GetByteArrayElements(jarg3, 0);
      arg4 = (size_t) jenv->GetArrayLength(jarg3);
    } else {
      arg3 = 0;
      arg4 = 0;
    }
  }
  {
    if (jarg5) {
      arg5 = (char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (size_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  result = (arg1)->writeToPeripheral(arg2,(char const (*))arg3,arg4,(char const (*))arg5,arg6);
  *(SendResult_t **)&jresult = new SendResult_t(result); 
  {
    if (jarg3) jenv->ReleaseByteArrayElements(jarg3, (jbyte *)arg3, 0);
  }
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  
  
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1appIsInForeground(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  result = (bool)(arg1)->appIsInForeground();
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1readL2capFromPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jlong jarg4, jobject jarg4_) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  slice_mut_uint8_t arg4 ;
  slice_mut_uint8_t *argp4 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg4_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  argp4 = *(slice_mut_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_mut_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  result = (int)(arg1)->readL2capFromPeripheral((char const (*))arg2,arg3,arg4);
  jresult = (jint)result; 
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1sendL2capToPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jbyteArray jarg4) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) (char *)0 ;
  size_t arg5 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  {
    if (jarg4) {
      arg4 = (char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (size_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  result = (int)(arg1)->sendL2capToPeripheral((char const (*))arg2,arg3,(char const (*))arg4,arg5);
  jresult = (jint)result; 
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  
  
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1readL2capFromCentral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jlong jarg4, jobject jarg4_) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  slice_mut_uint8_t arg4 ;
  slice_mut_uint8_t *argp4 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg4_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  argp4 = *(slice_mut_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_mut_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  result = (int)(arg1)->readL2capFromCentral((char const (*))arg2,arg3,arg4);
  jresult = (jint)result; 
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1sendL2capToCentral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jbyteArray jarg4) {
  jint jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) (char *)0 ;
  size_t arg5 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  {
    if (jarg4) {
      arg4 = (char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (size_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  result = (int)(arg1)->sendL2capToCentral((char const (*))arg2,arg3,(char const (*))arg4,arg5);
  jresult = (jint)result; 
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  
  
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeConnectPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  BluetoothLeRadioRust::invokeConnectPeripheral(arg1,(uint8_16_array_t const *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeDisconnectPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  BluetoothLeRadioRust::invokeDisconnectPeripheral(arg1,(uint8_16_array_t const *)arg2);
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeGetAdvertisingState(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  void *arg1 = (void *) 0 ;
  OnlineState_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  result = (OnlineState_t)BluetoothLeRadioRust::invokeGetAdvertisingState(arg1);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeGetScanningState(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  void *arg1 = (void *) 0 ;
  OnlineState_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  result = (OnlineState_t)BluetoothLeRadioRust::invokeGetScanningState(arg1);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeNotifyToCentral(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  void *arg1 = (void *) 0 ;
  BleDataType_t arg2 ;
  uint8_16_array_t *arg3 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_uint8_t *argp4 ;
  SendResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg3_;
  (void)jarg4_;
  arg1 = *(void **)&jarg1; 
  arg2 = (BleDataType_t)jarg2; 
  arg3 = *(uint8_16_array_t **)&jarg3; 
  argp4 = *(slice_ref_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  result = BluetoothLeRadioRust::invokeNotifyToCentral(arg1,arg2,(uint8_16_array_t const *)arg3,SWIG_STD_MOVE(arg4));
  *(SendResult_t **)&jresult = new SendResult_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeStartAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) {
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg3 ;
  slice_ref_uint8_t *argp3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  argp3 = *(slice_ref_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return ;
  }
  arg3 = *argp3; 
  BluetoothLeRadioRust::invokeStartAdvertising(arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeStartScanning(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) {
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg3 ;
  slice_ref_uint8_t *argp3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  argp3 = *(slice_ref_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return ;
  }
  arg3 = *argp3; 
  BluetoothLeRadioRust::invokeStartScanning(arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeStopAdvertising(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void *arg1 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  BluetoothLeRadioRust::invokeStopAdvertising(arg1);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeStopScanning(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void *arg1 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  BluetoothLeRadioRust::invokeStopScanning(arg1);
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeWriteToPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  void *arg1 = (void *) 0 ;
  BleDataType_t arg2 ;
  uint8_16_array_t *arg3 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_uint8_t *argp4 ;
  SendResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg3_;
  (void)jarg4_;
  arg1 = *(void **)&jarg1; 
  arg2 = (BleDataType_t)jarg2; 
  arg3 = *(uint8_16_array_t **)&jarg3; 
  argp4 = *(slice_ref_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  result = BluetoothLeRadioRust::invokeWriteToPeripheral(arg1,arg2,(uint8_16_array_t const *)arg3,SWIG_STD_MOVE(arg4));
  *(SendResult_t **)&jresult = new SendResult_t(result); 
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeAppIsInForeground(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  void *arg1 = (void *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  result = (bool)BluetoothLeRadioRust::invokeAppIsInForeground(arg1);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeReadL2capFromPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) {
  jint jresult = 0 ;
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_mut_uint8_t arg3 ;
  slice_mut_uint8_t *argp3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  argp3 = *(slice_mut_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_mut_uint8_t");
    return 0;
  }
  arg3 = *argp3; 
  result = (int)BluetoothLeRadioRust::invokeReadL2capFromPeripheral(arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3));
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeSendL2capToPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) {
  jint jresult = 0 ;
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg3 ;
  slice_ref_uint8_t *argp3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  argp3 = *(slice_ref_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return 0;
  }
  arg3 = *argp3; 
  result = (int)BluetoothLeRadioRust::invokeSendL2capToPeripheral(arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3));
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeReadL2capFromCentral(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) {
  jint jresult = 0 ;
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_mut_uint8_t arg3 ;
  slice_mut_uint8_t *argp3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  argp3 = *(slice_mut_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_mut_uint8_t");
    return 0;
  }
  arg3 = *argp3; 
  result = (int)BluetoothLeRadioRust::invokeReadL2capFromCentral(arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3));
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1invokeSendL2capToCentral(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) {
  jint jresult = 0 ;
  void *arg1 = (void *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg3 ;
  slice_ref_uint8_t *argp3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(void **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  argp3 = *(slice_ref_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return 0;
  }
  arg3 = *argp3; 
  result = (int)BluetoothLeRadioRust::invokeSendL2capToCentral(arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3));
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1addBleTransport(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->addBleTransport(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1addBleTransportSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->BluetoothLeRadioRust::addBleTransport(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1dropBleTransport(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  (arg1)->dropBleTransport();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1dropBleTransportSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  (arg1)->BluetoothLeRadioRust::dropBleTransport();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1advertisementHeard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jbyteArray jarg4, jboolean jarg6, jstring jarg7, jfloat jarg8) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) (char *)0 ;
  size_t arg5 ;
  bool arg6 ;
  char *arg7 = (char *) 0 ;
  float arg8 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  {
    if (jarg4) {
      arg4 = (char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (size_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  arg6 = jarg6 ? true : false; 
  arg7 = 0;
  if (jarg7) {
    arg7 = (char *)jenv->GetStringUTFChars(jarg7, 0);
    if (!arg7) return ;
  }
  arg8 = (float)jarg8; 
  (arg1)->advertisementHeard((char const (*))arg2,arg3,(char const (*))arg4,arg5,arg6,arg7,arg8);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  
  
  if (arg7) jenv->ReleaseStringUTFChars(jarg7, (const char *)arg7);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1advertisementHeardSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jbyteArray jarg4, jboolean jarg6, jstring jarg7, jfloat jarg8) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) (char *)0 ;
  size_t arg5 ;
  bool arg6 ;
  char *arg7 = (char *) 0 ;
  float arg8 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  {
    if (jarg4) {
      arg4 = (char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (size_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  arg6 = jarg6 ? true : false; 
  arg7 = 0;
  if (jarg7) {
    arg7 = (char *)jenv->GetStringUTFChars(jarg7, 0);
    if (!arg7) return ;
  }
  arg8 = (float)jarg8; 
  (arg1)->BluetoothLeRadioRust::advertisementHeard((char const (*))arg2,arg3,(char const (*))arg4,arg5,arg6,arg7,arg8);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  
  
  if (arg7) jenv->ReleaseStringUTFChars(jarg7, (const char *)arg7);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1connectionStateChanged(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4, jboolean jarg5, jint jarg6) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  ConnectState_t arg4 ;
  bool arg5 ;
  int arg6 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (ConnectState_t)jarg4; 
  arg5 = jarg5 ? true : false; 
  arg6 = (int)jarg6; 
  (arg1)->connectionStateChanged((char const (*))arg2,arg3,arg4,arg5,arg6);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1connectionStateChangedSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4, jboolean jarg5, jint jarg6) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  ConnectState_t arg4 ;
  bool arg5 ;
  int arg6 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (ConnectState_t)jarg4; 
  arg5 = jarg5 ? true : false; 
  arg6 = (int)jarg6; 
  (arg1)->BluetoothLeRadioRust::connectionStateChanged((char const (*))arg2,arg3,arg4,arg5,arg6);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralMtuUpdated(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  int arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (int)jarg4; 
  (arg1)->peripheralMtuUpdated((char const (*))arg2,arg3,arg4);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralMtuUpdatedSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  int arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (int)jarg4; 
  (arg1)->BluetoothLeRadioRust::peripheralMtuUpdated((char const (*))arg2,arg3,arg4);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1receivedFromPeripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4, jbyteArray jarg5) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  BleDataType_t arg4 ;
  char *arg5 = (char *) (char *)0 ;
  size_t arg6 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (BleDataType_t)jarg4; 
  {
    if (jarg5) {
      arg5 = (char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (size_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  (arg1)->receivedFromPeripheral((char const (*))arg2,arg3,arg4,(char const (*))arg5,arg6);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1receivedFromPeripheralSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4, jbyteArray jarg5) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  BleDataType_t arg4 ;
  char *arg5 = (char *) (char *)0 ;
  size_t arg6 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (BleDataType_t)jarg4; 
  {
    if (jarg5) {
      arg5 = (char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (size_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::receivedFromPeripheral((char const (*))arg2,arg3,arg4,(char const (*))arg5,arg6);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1scanningStateChanged(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->scanningStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1scanningStateChangedSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->BluetoothLeRadioRust::scanningStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralReadyToSend(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->peripheralReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralReadyToSendSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::peripheralReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralL2capReadyToSend(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->peripheralL2capReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralL2capReadyToSendSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::peripheralL2capReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralL2capDataAvailable(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->peripheralL2capDataAvailable((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1peripheralL2capDataAvailableSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::peripheralL2capDataAvailable((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1advertisingStateChanged(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->advertisingStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1advertisingStateChangedSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->BluetoothLeRadioRust::advertisingStateChanged(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralMtuUpdated(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  int arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (int)jarg4; 
  (arg1)->centralMtuUpdated((char const (*))arg2,arg3,arg4);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralMtuUpdatedSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  int arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (int)jarg4; 
  (arg1)->BluetoothLeRadioRust::centralMtuUpdated((char const (*))arg2,arg3,arg4);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1receivedFromCentral(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4, jbyteArray jarg5) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  BleDataType_t arg4 ;
  char *arg5 = (char *) (char *)0 ;
  size_t arg6 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (BleDataType_t)jarg4; 
  {
    if (jarg5) {
      arg5 = (char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (size_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  (arg1)->receivedFromCentral((char const (*))arg2,arg3,arg4,(char const (*))arg5,arg6);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1receivedFromCentralSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg4, jbyteArray jarg5) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  BleDataType_t arg4 ;
  char *arg5 = (char *) (char *)0 ;
  size_t arg6 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  arg4 = (BleDataType_t)jarg4; 
  {
    if (jarg5) {
      arg5 = (char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (size_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::receivedFromCentral((char const (*))arg2,arg3,arg4,(char const (*))arg5,arg6);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralFinishedConnecting(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jbyteArray jarg4, jboolean jarg6, jint jarg7) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) (char *)0 ;
  size_t arg5 ;
  bool arg6 ;
  int arg7 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  {
    if (jarg4) {
      arg4 = (char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (size_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  arg6 = jarg6 ? true : false; 
  arg7 = (int)jarg7; 
  (arg1)->centralFinishedConnecting((char const (*))arg2,arg3,(char const (*))arg4,arg5,arg6,arg7);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralFinishedConnectingSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jbyteArray jarg4, jboolean jarg6, jint jarg7) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  char *arg4 = (char *) (char *)0 ;
  size_t arg5 ;
  bool arg6 ;
  int arg7 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  {
    if (jarg4) {
      arg4 = (char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (size_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  arg6 = jarg6 ? true : false; 
  arg7 = (int)jarg7; 
  (arg1)->BluetoothLeRadioRust::centralFinishedConnecting((char const (*))arg2,arg3,(char const (*))arg4,arg5,arg6,arg7);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralUnsubscribed(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->centralUnsubscribed((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralUnsubscribedSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::centralUnsubscribed((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralReadyToSend(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->centralReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralReadyToSendSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::centralReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralL2capReadyToSend(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->centralL2capReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralL2capReadyToSendSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::centralL2capReadyToSend((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralL2capDataAvailable(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->centralL2capDataAvailable((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1centralL2capDataAvailableSwigExplicitBluetoothLeRadioRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  (arg1)->BluetoothLeRadioRust::centralL2capDataAvailable((char const (*))arg2,arg3);
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1transportHandle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  std::shared_ptr< TransportHandle_BlePlatformEvent_t > arg2 ;
  std::shared_ptr< TransportHandle_BlePlatformEvent_t > *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  argp2 = *(std::shared_ptr< TransportHandle_BlePlatformEvent_t > **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null std::shared_ptr< TransportHandle_BlePlatformEvent_t >");
    return ;
  }
  arg2 = *argp2; 
  if (arg1) (arg1)->transportHandle = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1transportHandle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BluetoothLeRadioRust *arg1 = (BluetoothLeRadioRust *) 0 ;
  std::shared_ptr< TransportHandle_BlePlatformEvent_t > result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BluetoothLeRadioRust **)&jarg1; 
  result =  ((arg1)->transportHandle);
  *(std::shared_ptr< TransportHandle_BlePlatformEvent_t > **)&jresult = new std::shared_ptr< TransportHandle_BlePlatformEvent_t >(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BluetoothLeRadioRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BluetoothLeRadioRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BluetoothLeRadioRust *)new SwigDirector_BluetoothLeRadioRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BluetoothLeRadioRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  BluetoothLeRadioRust *obj = *((BluetoothLeRadioRust **)&objarg);
  (void)jcls;
  SwigDirector_BluetoothLeRadioRust *director = static_cast<SwigDirector_BluetoothLeRadioRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  BluetoothLeRadioRust *obj = *((BluetoothLeRadioRust **)&objarg);
  SwigDirector_BluetoothLeRadioRust *director = dynamic_cast<SwigDirector_BluetoothLeRadioRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1StatusRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  StatusRust *arg1 = (StatusRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(StatusRust **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1transportConditionDidChange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) {
  StatusRust *arg1 = (StatusRust *) 0 ;
  ConditionSource arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StatusRust **)&jarg1; 
  arg2 = (ConditionSource)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  (arg1)->transportConditionDidChange(arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1invokeTransportConditionDidChange(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  void *arg1 = (void *) 0 ;
  ConditionSource arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = (ConditionSource)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  StatusRust::invokeTransportConditionDidChange(arg1,arg2,arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1submit(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  StatusRust *arg1 = (StatusRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StatusRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->submit(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1submitSwigExplicitStatusRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  StatusRust *arg1 = (StatusRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StatusRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->StatusRust::submit(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1shutdown(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  StatusRust *arg1 = (StatusRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StatusRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->shutdown(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1shutdownSwigExplicitStatusRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  StatusRust *arg1 = (StatusRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StatusRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->StatusRust::shutdown(arg2);
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1StatusRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  StatusRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (StatusRust *)new SwigDirector_StatusRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(StatusRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  StatusRust *obj = *((StatusRust **)&objarg);
  (void)jcls;
  SwigDirector_StatusRust *director = static_cast<SwigDirector_StatusRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  StatusRust *obj = *((StatusRust **)&objarg);
  SwigDirector_StatusRust *director = dynamic_cast<SwigDirector_StatusRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1LoginProviderRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  LoginProviderRust *arg1 = (LoginProviderRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(LoginProviderRust **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1authenticationExpiring(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  LoginProviderRust *arg1 = (LoginProviderRust *) 0 ;
  unsigned int arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LoginProviderRust **)&jarg1; 
  arg2 = (unsigned int)jarg2; 
  (arg1)->authenticationExpiring(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1invokeAuthenticationExpiring(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  void *arg1 = (void *) 0 ;
  unsigned int arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = (unsigned int)jarg2; 
  LoginProviderRust::invokeAuthenticationExpiring(arg1,arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1submit(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  LoginProviderRust *arg1 = (LoginProviderRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LoginProviderRust **)&jarg1; 
  (arg1)->submit();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1submitSwigExplicitLoginProviderRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  LoginProviderRust *arg1 = (LoginProviderRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LoginProviderRust **)&jarg1; 
  (arg1)->LoginProviderRust::submit();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1loginProviderPtr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  LoginProviderRust *arg1 = (LoginProviderRust *) 0 ;
  CLoginProvider *arg2 = (CLoginProvider *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LoginProviderRust **)&jarg1; 
  arg2 = *(CLoginProvider **)&jarg2; 
  if (arg1) (arg1)->loginProviderPtr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1loginProviderPtr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  LoginProviderRust *arg1 = (LoginProviderRust *) 0 ;
  CLoginProvider *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LoginProviderRust **)&jarg1; 
  result = (CLoginProvider *) ((arg1)->loginProviderPtr);
  *(CLoginProvider **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1LoginProviderRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  LoginProviderRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LoginProviderRust *)new SwigDirector_LoginProviderRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(LoginProviderRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  LoginProviderRust *obj = *((LoginProviderRust **)&objarg);
  (void)jcls;
  SwigDirector_LoginProviderRust *director = static_cast<SwigDirector_LoginProviderRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  LoginProviderRust *obj = *((LoginProviderRust **)&objarg);
  SwigDirector_LoginProviderRust *director = dynamic_cast<SwigDirector_LoginProviderRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1AuthenticationStatusHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  AuthenticationStatusHandlerRust *arg1 = (AuthenticationStatusHandlerRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(AuthenticationStatusHandlerRust **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AuthenticationStatusHandlerRust_1authenticationStatusUpdated(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AuthenticationStatusHandlerRust *arg1 = (AuthenticationStatusHandlerRust *) 0 ;
  dittoffi_authentication_status_t *arg2 = (dittoffi_authentication_status_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AuthenticationStatusHandlerRust **)&jarg1; 
  arg2 = *(dittoffi_authentication_status_t **)&jarg2; 
  (arg1)->authenticationStatusUpdated(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AuthenticationStatusHandlerRust_1invokeAuthenticationStatusUpdated(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  void *arg1 = (void *) 0 ;
  dittoffi_authentication_status_t *arg2 = (dittoffi_authentication_status_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = *(dittoffi_authentication_status_t **)&jarg2; 
  AuthenticationStatusHandlerRust::invokeAuthenticationStatusUpdated(arg1,arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AuthenticationStatusHandlerRust_1submit(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AuthenticationStatusHandlerRust *arg1 = (AuthenticationStatusHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AuthenticationStatusHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->submit(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AuthenticationStatusHandlerRust_1submitSwigExplicitAuthenticationStatusHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AuthenticationStatusHandlerRust *arg1 = (AuthenticationStatusHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AuthenticationStatusHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->AuthenticationStatusHandlerRust::submit(arg2);
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1AuthenticationStatusHandlerRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  AuthenticationStatusHandlerRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (AuthenticationStatusHandlerRust *)new SwigDirector_AuthenticationStatusHandlerRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AuthenticationStatusHandlerRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AuthenticationStatusHandlerRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  AuthenticationStatusHandlerRust *obj = *((AuthenticationStatusHandlerRust **)&objarg);
  (void)jcls;
  SwigDirector_AuthenticationStatusHandlerRust *director = static_cast<SwigDirector_AuthenticationStatusHandlerRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AuthenticationStatusHandlerRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  AuthenticationStatusHandlerRust *obj = *((AuthenticationStatusHandlerRust **)&objarg);
  SwigDirector_AuthenticationStatusHandlerRust *director = dynamic_cast<SwigDirector_AuthenticationStatusHandlerRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1DiskUsageObserverRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DiskUsageObserverRust *arg1 = (DiskUsageObserverRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DiskUsageObserverRust **)&jarg1; 
  delete arg1;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1diskUsageUpdated(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  DiskUsageObserverRust *arg1 = (DiskUsageObserverRust *) 0 ;
  slice_ref_uint8_t arg2 ;
  slice_ref_uint8_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(DiskUsageObserverRust **)&jarg1; 
  argp2 = *(slice_ref_uint8_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return ;
  }
  arg2 = *argp2; 
  (arg1)->diskUsageUpdated(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1invokeDiskUsageUpdated(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) 0 ;
  slice_ref_uint8_t arg2 ;
  slice_ref_uint8_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  argp2 = *(slice_ref_uint8_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_uint8_t");
    return ;
  }
  arg2 = *argp2; 
  DiskUsageObserverRust::invokeDiskUsageUpdated(arg1,SWIG_STD_MOVE(arg2));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  DiskUsageObserverRust *arg1 = (DiskUsageObserverRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DiskUsageObserverRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->subscribe(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1subscribeSwigExplicitDiskUsageObserverRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  DiskUsageObserverRust *arg1 = (DiskUsageObserverRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DiskUsageObserverRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  (arg1)->DiskUsageObserverRust::subscribe(arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1stop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  DiskUsageObserverRust *arg1 = (DiskUsageObserverRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DiskUsageObserverRust **)&jarg1; 
  (arg1)->stop();
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1stopSwigExplicitDiskUsageObserverRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  DiskUsageObserverRust *arg1 = (DiskUsageObserverRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DiskUsageObserverRust **)&jarg1; 
  (arg1)->DiskUsageObserverRust::stop();
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1DiskUsageObserverRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  DiskUsageObserverRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DiskUsageObserverRust *)new SwigDirector_DiskUsageObserverRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DiskUsageObserverRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  DiskUsageObserverRust *obj = *((DiskUsageObserverRust **)&objarg);
  (void)jcls;
  SwigDirector_DiskUsageObserverRust *director = static_cast<SwigDirector_DiskUsageObserverRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  DiskUsageObserverRust *obj = *((DiskUsageObserverRust **)&objarg);
  SwigDirector_DiskUsageObserverRust *director = dynamic_cast<SwigDirector_DiskUsageObserverRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1set_1android_1context(JNIEnv *jenv, jclass jcls, jobject jarg2) {
  jboolean jresult = 0 ;
  EnvMarker arg1 ;
  jobject arg2 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  {
    // This code runs inside the JNI wrapper, where 'jenv' is available.
    current_env = jenv;
  }
  arg2 = jarg2; 
  result = (bool)dittoffi_set_android_context(SWIG_STD_MOVE(arg1),SWIG_STD_MOVE(arg2));
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1LMDB_1ENABLE_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  result = (int)(1);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_get_1id(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jbyteArray jresult = 0 ;
  CAttachment_t *arg1 = (CAttachment_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CAttachment_t **)&jarg1; 
  {
    try {
      result = get_id((CAttachment const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_JavaOf_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jbyteArray jresult = 0 ;
  slice_boxed_uint8_t *arg1 = (slice_boxed_uint8_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_uint8_t **)&jarg1; 
  {
    try {
      result = JavaOf_slice_boxed_uint8_t((slice_boxed_uint8 const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_JavaOf_1slice_1ref_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jbyteArray jresult = 0 ;
  slice_ref_uint8_t *arg1 = (slice_ref_uint8_t *) 0 ;
  slice_ref_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_uint8_t **)&jarg1; 
  {
    try {
      result = JavaOf_slice_ref_uint8_t((slice_ref_uint8 const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_get_1collection_1name_1at_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  jstring jresult = 0 ;
  Vec_char_ptr_t *arg1 = (Vec_char_ptr_t *) 0 ;
  unsigned long arg2 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_char_ptr_t **)&jarg1; 
  arg2 = (unsigned long)jarg2; 
  {
    try {
      result = (char *)get_collection_name_at_index((Vec_char_ptr const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_take_1buffer_1at_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  jbyteArray jresult = 0 ;
  Vec_slice_boxed_uint8_t *arg1 = (Vec_slice_boxed_uint8_t *) 0 ;
  unsigned long arg2 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_slice_boxed_uint8_t **)&jarg1; 
  arg2 = (unsigned long)jarg2; 
  {
    try {
      result = take_buffer_at_index((Vec_slice_boxed_uint8 const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_get_1document_1at_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jlong jresult = 0 ;
  CDocument_t **arg1 = (CDocument_t **) 0 ;
  unsigned long arg2 ;
  CDocument_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t ***)&jarg1; 
  arg2 = (unsigned long)jarg2; 
  {
    try {
      result = (CDocument_t *)get_document_at_index((CDocument const **)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CDocument_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_get_1index_1at(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jlong jresult = 0 ;
  size_t *arg1 = (size_t *) 0 ;
  unsigned long arg2 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(size_t **)&jarg1; 
  arg2 = (unsigned long)jarg2; 
  {
    try {
      result = get_index_at(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1DocumentHandle(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CDocument_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CDocument_t **)new_Ditto_DocumentHandle();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CDocument_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_copy_1Ditto_1DocumentHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  CDocument_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  {
    try {
      result = (CDocument_t **)copy_Ditto_DocumentHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CDocument_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1DocumentHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDocument_t **arg1 = (CDocument_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t ***)&jarg1; 
  {
    try {
      delete_Ditto_DocumentHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1DocumentHandle_1assign(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CDocument_t **arg1 = (CDocument_t **) 0 ;
  CDocument_t *arg2 = (CDocument_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t ***)&jarg1; 
  arg2 = *(CDocument_t **)&jarg2; 
  {
    try {
      Ditto_DocumentHandle_assign(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1DocumentHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDocument_t **arg1 = (CDocument_t **) 0 ;
  CDocument_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t ***)&jarg1; 
  {
    try {
      result = (CDocument_t *)Ditto_DocumentHandle_value(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CDocument_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1ReadTransactionHandle(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CReadTransaction_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CReadTransaction_t **)new_Ditto_ReadTransactionHandle();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CReadTransaction_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_copy_1Ditto_1ReadTransactionHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CReadTransaction_t *arg1 = (CReadTransaction_t *) 0 ;
  CReadTransaction_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CReadTransaction_t **)&jarg1; 
  {
    try {
      result = (CReadTransaction_t **)copy_Ditto_ReadTransactionHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CReadTransaction_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1ReadTransactionHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CReadTransaction_t **arg1 = (CReadTransaction_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CReadTransaction_t ***)&jarg1; 
  {
    try {
      delete_Ditto_ReadTransactionHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1ReadTransactionHandle_1assign(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CReadTransaction_t **arg1 = (CReadTransaction_t **) 0 ;
  CReadTransaction_t *arg2 = (CReadTransaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CReadTransaction_t ***)&jarg1; 
  arg2 = *(CReadTransaction_t **)&jarg2; 
  {
    try {
      Ditto_ReadTransactionHandle_assign(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1ReadTransactionHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CReadTransaction_t **arg1 = (CReadTransaction_t **) 0 ;
  CReadTransaction_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CReadTransaction_t ***)&jarg1; 
  {
    try {
      result = (CReadTransaction_t *)Ditto_ReadTransactionHandle_value(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CReadTransaction_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1WriteTransactionHandle(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CWriteTransaction_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CWriteTransaction_t **)new_Ditto_WriteTransactionHandle();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CWriteTransaction_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_copy_1Ditto_1WriteTransactionHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CWriteTransaction_t *arg1 = (CWriteTransaction_t *) 0 ;
  CWriteTransaction_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CWriteTransaction_t **)&jarg1; 
  {
    try {
      result = (CWriteTransaction_t **)copy_Ditto_WriteTransactionHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CWriteTransaction_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1WriteTransactionHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CWriteTransaction_t **arg1 = (CWriteTransaction_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CWriteTransaction_t ***)&jarg1; 
  {
    try {
      delete_Ditto_WriteTransactionHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1WriteTransactionHandle_1assign(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CWriteTransaction_t **arg1 = (CWriteTransaction_t **) 0 ;
  CWriteTransaction_t *arg2 = (CWriteTransaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CWriteTransaction_t ***)&jarg1; 
  arg2 = *(CWriteTransaction_t **)&jarg2; 
  {
    try {
      Ditto_WriteTransactionHandle_assign(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1WriteTransactionHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CWriteTransaction_t **arg1 = (CWriteTransaction_t **) 0 ;
  CWriteTransaction_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CWriteTransaction_t ***)&jarg1; 
  {
    try {
      result = (CWriteTransaction_t *)Ditto_WriteTransactionHandle_value(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CWriteTransaction_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1StringHandle(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  char **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char **)new_Ditto_StringHandle();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(char ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_copy_1Ditto_1StringHandle(JNIEnv *jenv, jclass jcls, jstring jarg1) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  char **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  {
    try {
      result = (char **)copy_Ditto_StringHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(char ***)&jresult = result; 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1StringHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  char **arg1 = (char **) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(char ***)&jarg1; 
  {
    try {
      delete_Ditto_StringHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1StringHandle_1assign(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  char **arg1 = (char **) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(char ***)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      Ditto_StringHandle_assign(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1StringHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  char **arg1 = (char **) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(char ***)&jarg1; 
  {
    try {
      result = (char *)Ditto_StringHandle_value(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1LongLongHandle(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  long long *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (long long *)new_Ditto_LongLongHandle();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(long long **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_copy_1Ditto_1LongLongHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  long long arg1 ;
  long long *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (long long)jarg1; 
  {
    try {
      result = (long long *)copy_Ditto_LongLongHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(long long **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1LongLongHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  long long *arg1 = (long long *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(long long **)&jarg1; 
  {
    try {
      delete_Ditto_LongLongHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1LongLongHandle_1assign(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  long long *arg1 = (long long *) 0 ;
  long long arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(long long **)&jarg1; 
  arg2 = (long long)jarg2; 
  {
    try {
      Ditto_LongLongHandle_assign(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1LongLongHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  long long *arg1 = (long long *) 0 ;
  long long result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(long long **)&jarg1; 
  {
    try {
      result = (long long)Ditto_LongLongHandle_value(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1U64Handle(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  uint64_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (uint64_t *)new_Ditto_U64Handle();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(uint64_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_copy_1Ditto_1U64Handle(JNIEnv *jenv, jclass jcls, jobject jarg1) {
  jlong jresult = 0 ;
  uint64_t arg1 ;
  uint64_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg1) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return 0;
    }
    clazz = jenv->GetObjectClass(jarg1);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg1, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg1 = 0;
    if (sz > 0) {
      arg1 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg1 = (arg1 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    try {
      result = (uint64_t *)copy_Ditto_U64Handle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(uint64_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1U64Handle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  uint64_t *arg1 = (uint64_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(uint64_t **)&jarg1; 
  {
    try {
      delete_Ditto_U64Handle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1U64Handle_1assign(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) {
  uint64_t *arg1 = (uint64_t *) 0 ;
  uint64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(uint64_t **)&jarg1; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg2) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg2);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg2 = 0;
    if (sz > 0) {
      arg2 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg2 = (arg2 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    try {
      Ditto_U64Handle_assign(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jobject JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1U64Handle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jobject jresult = 0 ;
  uint64_t *arg1 = (uint64_t *) 0 ;
  uint64_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(uint64_t **)&jarg1; 
  {
    try {
      result = (uint64_t)Ditto_U64Handle_value(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    jbyteArray ba = jenv->NewByteArray(9);
    jbyte* bae = jenv->GetByteArrayElements(ba, 0);
    jclass clazz = jenv->FindClass("java/math/BigInteger");
    jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
    jobject bigint;
    int i;
    
    bae[0] = 0;
    for(i=1; i<9; i++ ) {
      bae[i] = (jbyte)(result>>8*(8-i));
    }
    
    jenv->ReleaseByteArrayElements(ba, bae, 0);
    bigint = jenv->NewObject(clazz, mid, ba);
    jenv->DeleteLocalRef(ba);
    jresult = bigint;
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1BoolHandle(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  bool *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (bool *)new_Ditto_BoolHandle();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(bool **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_copy_1Ditto_1BoolHandle(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
  jlong jresult = 0 ;
  bool arg1 ;
  bool *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = jarg1 ? true : false; 
  {
    try {
      result = (bool *)copy_Ditto_BoolHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(bool **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1BoolHandle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  bool *arg1 = (bool *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(bool **)&jarg1; 
  {
    try {
      delete_Ditto_BoolHandle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1BoolHandle_1assign(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) {
  bool *arg1 = (bool *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(bool **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  {
    try {
      Ditto_BoolHandle_assign(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Ditto_1BoolHandle_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  bool *arg1 = (bool *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(bool **)&jarg1; 
  {
    try {
      result = (bool)Ditto_BoolHandle_value(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Ditto_1CBOR(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_boxed_uint8_t *)new_Ditto_CBOR();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Ditto_1CBOR(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  slice_boxed_uint8_t *arg1 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_uint8_t **)&jarg1; 
  {
    try {
      delete_Ditto_CBOR(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1COrderByParamArray(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  size_t arg1 ;
  COrderByParamArray *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (size_t)jarg1; 
  {
    try {
      result = (COrderByParamArray *)new_COrderByParamArray(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(COrderByParamArray **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1COrderByParamArray(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  COrderByParamArray *arg1 = (COrderByParamArray *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(COrderByParamArray **)&jarg1; 
  {
    try {
      delete_COrderByParamArray(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParamArray_1getitem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  jlong jresult = 0 ;
  COrderByParamArray *arg1 = (COrderByParamArray *) 0 ;
  size_t arg2 ;
  COrderByParam_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(COrderByParamArray **)&jarg1; 
  arg2 = (size_t)jarg2; 
  {
    try {
      result = COrderByParamArray_getitem(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(COrderByParam_t **)&jresult = new COrderByParam_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParamArray_1setitem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jobject jarg3_) {
  COrderByParamArray *arg1 = (COrderByParamArray *) 0 ;
  size_t arg2 ;
  COrderByParam_t arg3 ;
  COrderByParam_t *argp3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg3_;
  arg1 = *(COrderByParamArray **)&jarg1; 
  arg2 = (size_t)jarg2; 
  argp3 = *(COrderByParam_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null COrderByParam_t");
    return ;
  }
  arg3 = *argp3; 
  {
    try {
      COrderByParamArray_setitem(arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParamArray_1cast(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  COrderByParamArray *arg1 = (COrderByParamArray *) 0 ;
  COrderByParam_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(COrderByParamArray **)&jarg1; 
  {
    try {
      result = (COrderByParam_t *)COrderByParamArray_cast(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(COrderByParam_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParamArray_1frompointer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  COrderByParam_t *arg1 = (COrderByParam_t *) 0 ;
  COrderByParamArray *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(COrderByParam_t **)&jarg1; 
  {
    try {
      result = (COrderByParamArray *)COrderByParamArray_frompointer(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(COrderByParamArray **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1AttachmentObserverRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  AttachmentObserverRust *arg1 = (AttachmentObserverRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(AttachmentObserverRust **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1completedEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AttachmentObserverRust *arg1 = (AttachmentObserverRust *) 0 ;
  AttachmentHandle *arg2 = (AttachmentHandle *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentObserverRust **)&jarg1; 
  arg2 = *(AttachmentHandle **)&jarg2; 
  {
    try {
      (arg1)->completedEventHandler((AttachmentHandle const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1progressEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2, jobject jarg3) {
  AttachmentObserverRust *arg1 = (AttachmentObserverRust *) 0 ;
  uint64_t arg2 ;
  uint64_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentObserverRust **)&jarg1; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg2) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg2);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg2 = 0;
    if (sz > 0) {
      arg2 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg2 = (arg2 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg3) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg3);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg3 = 0;
    if (sz > 0) {
      arg3 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg3 = (arg3 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    try {
      (arg1)->progressEventHandler(arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1deletedEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  AttachmentObserverRust *arg1 = (AttachmentObserverRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentObserverRust **)&jarg1; 
  {
    try {
      (arg1)->deletedEventHandler();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1invokeCompletedEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  void *arg1 = (void *) 0 ;
  AttachmentHandle *arg2 = (AttachmentHandle *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = *(AttachmentHandle **)&jarg2; 
  {
    try {
      AttachmentObserverRust::invokeCompletedEventHandler(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1invokeProgressEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2, jobject jarg3) {
  void *arg1 = (void *) 0 ;
  uint64_t arg2 ;
  uint64_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg2) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg2);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg2 = 0;
    if (sz > 0) {
      arg2 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg2 = (arg2 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg3) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg3);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg3 = 0;
    if (sz > 0) {
      arg3 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg3 = (arg3 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    try {
      AttachmentObserverRust::invokeProgressEventHandler(arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1invokeDeletedEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void *arg1 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  {
    try {
      AttachmentObserverRust::invokeDeletedEventHandler(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1resolve_1attachment(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jbyteArray jarg3) {
  jlong jresult = 0 ;
  AttachmentObserverRust *arg1 = (AttachmentObserverRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  unsigned char *arg3 = (unsigned char *) 0 ;
  uintptr_t arg4 ;
  CancelTokenResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentObserverRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  {
    if (jarg3) {
      arg3 = (unsigned char *) jenv->GetByteArrayElements(jarg3, 0);
      arg4 = (uintptr_t) jenv->GetArrayLength(jarg3);
    } else {
      arg3 = 0;
      arg4 = 0;
    }
  }
  {
    try {
      result = (arg1)->resolve_attachment(arg2,(unsigned char const *)arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CancelTokenResult_t **)&jresult = new CancelTokenResult_t(result); 
  {
    if (jarg3) jenv->ReleaseByteArrayElements(jarg3, (jbyte *)arg3, 0);
  }
  
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1resolve_1attachmentSwigExplicitAttachmentObserverRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jbyteArray jarg3) {
  jlong jresult = 0 ;
  AttachmentObserverRust *arg1 = (AttachmentObserverRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  unsigned char *arg3 = (unsigned char *) 0 ;
  uintptr_t arg4 ;
  CancelTokenResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentObserverRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  {
    if (jarg3) {
      arg3 = (unsigned char *) jenv->GetByteArrayElements(jarg3, 0);
      arg4 = (uintptr_t) jenv->GetArrayLength(jarg3);
    } else {
      arg3 = 0;
      arg4 = 0;
    }
  }
  {
    try {
      result = (arg1)->AttachmentObserverRust::resolve_attachment(arg2,(unsigned char const *)arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CancelTokenResult_t **)&jresult = new CancelTokenResult_t(result); 
  {
    if (jarg3) jenv->ReleaseByteArrayElements(jarg3, (jbyte *)arg3, 0);
  }
  
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1AttachmentObserverRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  AttachmentObserverRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (AttachmentObserverRust *)new SwigDirector_AttachmentObserverRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AttachmentObserverRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  AttachmentObserverRust *obj = *((AttachmentObserverRust **)&objarg);
  (void)jcls;
  SwigDirector_AttachmentObserverRust *director = static_cast<SwigDirector_AttachmentObserverRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  AttachmentObserverRust *obj = *((AttachmentObserverRust **)&objarg);
  SwigDirector_AttachmentObserverRust *director = dynamic_cast<SwigDirector_AttachmentObserverRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1ConnectionRequestHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  ConnectionRequestHandlerRust *arg1 = (ConnectionRequestHandlerRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(ConnectionRequestHandlerRust **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ConnectionRequestHandlerRust_1invokeEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  Erased_t *arg1 = (Erased_t *) 0 ;
  dittoffi_connection_request_t *arg2 = (dittoffi_connection_request_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Erased_t **)&jarg1; 
  arg2 = *(dittoffi_connection_request_t **)&jarg2; 
  {
    try {
      ConnectionRequestHandlerRust::invokeEventHandler((Erased const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ConnectionRequestHandlerRust_1eventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  ConnectionRequestHandlerRust *arg1 = (ConnectionRequestHandlerRust *) 0 ;
  dittoffi_connection_request_t *arg2 = (dittoffi_connection_request_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ConnectionRequestHandlerRust **)&jarg1; 
  arg2 = *(dittoffi_connection_request_t **)&jarg2; 
  {
    try {
      (arg1)->eventHandler(arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ConnectionRequestHandlerRust_1registerConnectionRequestHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jobject jarg3_) {
  ConnectionRequestHandlerRust *arg1 = (ConnectionRequestHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  ConnectionRequestHandlerRust *arg3 = (ConnectionRequestHandlerRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg3_;
  arg1 = *(ConnectionRequestHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = *(ConnectionRequestHandlerRust **)&jarg3; 
  {
    try {
      (arg1)->registerConnectionRequestHandler(arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ConnectionRequestHandlerRust_1registerConnectionRequestHandlerSwigExplicitConnectionRequestHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jobject jarg3_) {
  ConnectionRequestHandlerRust *arg1 = (ConnectionRequestHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  ConnectionRequestHandlerRust *arg3 = (ConnectionRequestHandlerRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg3_;
  arg1 = *(ConnectionRequestHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = *(ConnectionRequestHandlerRust **)&jarg3; 
  {
    try {
      (arg1)->ConnectionRequestHandlerRust::registerConnectionRequestHandler(arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1ConnectionRequestHandlerRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  ConnectionRequestHandlerRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (ConnectionRequestHandlerRust *)new SwigDirector_ConnectionRequestHandlerRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(ConnectionRequestHandlerRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ConnectionRequestHandlerRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  ConnectionRequestHandlerRust *obj = *((ConnectionRequestHandlerRust **)&objarg);
  (void)jcls;
  SwigDirector_ConnectionRequestHandlerRust *director = static_cast<SwigDirector_ConnectionRequestHandlerRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ConnectionRequestHandlerRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  ConnectionRequestHandlerRust *obj = *((ConnectionRequestHandlerRust **)&objarg);
  SwigDirector_ConnectionRequestHandlerRust *director = dynamic_cast<SwigDirector_ConnectionRequestHandlerRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1CrashReporterFfi(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CrashReporterFfi *arg1 = (CrashReporterFfi *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CrashReporterFfi **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CrashReporterFfi_1ffiInvokeReportCrashKotlinImplementation(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  void *arg1 = (void *) 0 ;
  dittoffi_panic_t *arg2 = (dittoffi_panic_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = *(dittoffi_panic_t **)&jarg2; 
  {
    try {
      CrashReporterFfi::ffiInvokeReportCrashKotlinImplementation(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CrashReporterFfi_1reportCrashKotlinImplementation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  CrashReporterFfi *arg1 = (CrashReporterFfi *) 0 ;
  dittoffi_panic_t *arg2 = (dittoffi_panic_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CrashReporterFfi **)&jarg1; 
  arg2 = *(dittoffi_panic_t **)&jarg2; 
  {
    try {
      (arg1)->reportCrashKotlinImplementation(arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CrashReporterFfi_1overrideCrashReporter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  CrashReporterFfi *arg1 = (CrashReporterFfi *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CrashReporterFfi **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  {
    try {
      (arg1)->overrideCrashReporter(arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CrashReporterFfi_1overrideCrashReporterSwigExplicitCrashReporterFfi(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  CrashReporterFfi *arg1 = (CrashReporterFfi *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CrashReporterFfi **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  {
    try {
      (arg1)->CrashReporterFfi::overrideCrashReporter(arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1CrashReporterFfi(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CrashReporterFfi *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CrashReporterFfi *)new SwigDirector_CrashReporterFfi(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CrashReporterFfi **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CrashReporterFfi_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  CrashReporterFfi *obj = *((CrashReporterFfi **)&objarg);
  (void)jcls;
  SwigDirector_CrashReporterFfi *director = static_cast<SwigDirector_CrashReporterFfi *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CrashReporterFfi_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  CrashReporterFfi *obj = *((CrashReporterFfi **)&objarg);
  SwigDirector_CrashReporterFfi *director = dynamic_cast<SwigDirector_CrashReporterFfi *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1LiveQueryHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  LiveQueryHandlerRust *arg1 = (LiveQueryHandlerRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(LiveQueryHandlerRust **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1eventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  LiveQueryHandlerRust *arg1 = (LiveQueryHandlerRust *) 0 ;
  c_cb_params_t arg2 ;
  c_cb_params_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(LiveQueryHandlerRust **)&jarg1; 
  argp2 = *(c_cb_params_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null c_cb_params_t");
    return ;
  }
  arg2 = *argp2; 
  {
    try {
      (arg1)->eventHandler(arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1invokeEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) 0 ;
  c_cb_params_t arg2 ;
  c_cb_params_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  argp2 = *(c_cb_params_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null c_cb_params_t");
    return ;
  }
  arg2 = *argp2; 
  {
    try {
      LiveQueryHandlerRust::invokeEventHandler(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1registerLiveQuery(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3, jstring jarg4, jbyteArray jarg5, jlong jarg7, jobject jarg7_, jlong jarg8, jint jarg9, jlong jarg10, jint jarg11) {
  jlong jresult = 0 ;
  LiveQueryHandlerRust *arg1 = (LiveQueryHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  char *arg3 = (char *) 0 ;
  char *arg4 = (char *) 0 ;
  unsigned char *arg5 = (unsigned char *) 0 ;
  uintptr_t arg6 ;
  COrderByParam_t *arg7 = (COrderByParam_t *) 0 ;
  unsigned int arg8 ;
  int arg9 ;
  unsigned int arg10 ;
  LiveQueryAvailability_t arg11 ;
  I64Result_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg7_;
  arg1 = *(LiveQueryHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5) {
      arg5 = (unsigned char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (uintptr_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  arg7 = *(COrderByParam_t **)&jarg7; 
  arg8 = (unsigned int)jarg8; 
  arg9 = (int)jarg9; 
  arg10 = (unsigned int)jarg10; 
  arg11 = (LiveQueryAvailability_t)jarg11; 
  {
    try {
      result = (arg1)->registerLiveQuery(arg2,(char const *)arg3,(char const *)arg4,(unsigned char const *)arg5,arg6,(COrderByParam_t const *)arg7,arg8,arg9,arg10,arg11);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(I64Result_t **)&jresult = new I64Result_t(result); 
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1registerLiveQuerySwigExplicitLiveQueryHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3, jstring jarg4, jbyteArray jarg5, jlong jarg7, jobject jarg7_, jlong jarg8, jint jarg9, jlong jarg10, jint jarg11) {
  jlong jresult = 0 ;
  LiveQueryHandlerRust *arg1 = (LiveQueryHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  char *arg3 = (char *) 0 ;
  char *arg4 = (char *) 0 ;
  unsigned char *arg5 = (unsigned char *) 0 ;
  uintptr_t arg6 ;
  COrderByParam_t *arg7 = (COrderByParam_t *) 0 ;
  unsigned int arg8 ;
  int arg9 ;
  unsigned int arg10 ;
  LiveQueryAvailability_t arg11 ;
  I64Result_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg7_;
  arg1 = *(LiveQueryHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5) {
      arg5 = (unsigned char *) jenv->GetByteArrayElements(jarg5, 0);
      arg6 = (uintptr_t) jenv->GetArrayLength(jarg5);
    } else {
      arg5 = 0;
      arg6 = 0;
    }
  }
  arg7 = *(COrderByParam_t **)&jarg7; 
  arg8 = (unsigned int)jarg8; 
  arg9 = (int)jarg9; 
  arg10 = (unsigned int)jarg10; 
  arg11 = (LiveQueryAvailability_t)jarg11; 
  {
    try {
      result = (arg1)->LiveQueryHandlerRust::registerLiveQuery(arg2,(char const *)arg3,(char const *)arg4,(unsigned char const *)arg5,arg6,(COrderByParam_t const *)arg7,arg8,arg9,arg10,arg11);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(I64Result_t **)&jresult = new I64Result_t(result); 
  {
    if (jarg5) jenv->ReleaseByteArrayElements(jarg5, (jbyte *)arg5, 0);
  }
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1startLiveQuery(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
  jint jresult = 0 ;
  LiveQueryHandlerRust *arg1 = (LiveQueryHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  int64_t arg3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LiveQueryHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = (int64_t)jarg3; 
  {
    try {
      result = (int)(arg1)->startLiveQuery(arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1startLiveQuerySwigExplicitLiveQueryHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
  jint jresult = 0 ;
  LiveQueryHandlerRust *arg1 = (LiveQueryHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  int64_t arg3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LiveQueryHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = (int64_t)jarg3; 
  {
    try {
      result = (int)(arg1)->LiveQueryHandlerRust::startLiveQuery(arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1LiveQueryHandlerRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  LiveQueryHandlerRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LiveQueryHandlerRust *)new SwigDirector_LiveQueryHandlerRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(LiveQueryHandlerRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  LiveQueryHandlerRust *obj = *((LiveQueryHandlerRust **)&objarg);
  (void)jcls;
  SwigDirector_LiveQueryHandlerRust *director = static_cast<SwigDirector_LiveQueryHandlerRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  LiveQueryHandlerRust *obj = *((LiveQueryHandlerRust **)&objarg);
  SwigDirector_LiveQueryHandlerRust *director = dynamic_cast<SwigDirector_LiveQueryHandlerRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1PresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  PresenceRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (PresenceRust *)new SwigDirector_PresenceRust(jenv,arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(PresenceRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1PresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1v1Callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      (arg1)->v1Callback((char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1v2Callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      (arg1)->v2Callback((char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1v3Callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      (arg1)->v3Callback((char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1invokeV1Callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  void *arg1 = (void *) (void *)0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      PresenceRust::invokeV1Callback(arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1invokeV2Callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  void *arg1 = (void *) (void *)0 ;
  char *arg2 = (char *) (char *)0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      PresenceRust::invokeV2Callback(arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1invokeV3Callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  void *arg1 = (void *) (void *)0 ;
  char *arg2 = (char *) (char *)0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      PresenceRust::invokeV3Callback(arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1register_1v1(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->register_v1();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1register_1v1SwigExplicitPresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->PresenceRust::register_v1();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1register_1v2(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->register_v2();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1register_1v2SwigExplicitPresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->PresenceRust::register_v2();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1register_1v3(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->register_v3();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1register_1v3SwigExplicitPresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->PresenceRust::register_v3();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1requestV1Update(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->requestV1Update();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1requestV1UpdateSwigExplicitPresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->PresenceRust::requestV1Update();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1requestV2Update(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->requestV2Update();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1requestV2UpdateSwigExplicitPresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->PresenceRust::requestV2Update();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1requestV3Update(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->requestV3Update();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1requestV3UpdateSwigExplicitPresenceRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  PresenceRust *arg1 = (PresenceRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(PresenceRust **)&jarg1; 
  {
    try {
      (arg1)->PresenceRust::requestV3Update();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  PresenceRust *obj = *((PresenceRust **)&objarg);
  (void)jcls;
  SwigDirector_PresenceRust *director = static_cast<SwigDirector_PresenceRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  PresenceRust *obj = *((PresenceRust **)&objarg);
  SwigDirector_PresenceRust *director = dynamic_cast<SwigDirector_PresenceRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1StoreObserverHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  StoreObserverHandlerRust *arg1 = (StoreObserverHandlerRust *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(StoreObserverHandlerRust **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1eventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  StoreObserverHandlerRust *arg1 = (StoreObserverHandlerRust *) 0 ;
  ChangeHandlerWithQueryResult_t arg2 ;
  ChangeHandlerWithQueryResult_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(StoreObserverHandlerRust **)&jarg1; 
  argp2 = *(ChangeHandlerWithQueryResult_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null ChangeHandlerWithQueryResult_t");
    return ;
  }
  arg2 = *argp2; 
  {
    try {
      (arg1)->eventHandler(arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1invokeEventHandler(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  void *arg1 = (void *) 0 ;
  ChangeHandlerWithQueryResult_t arg2 ;
  ChangeHandlerWithQueryResult_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(void **)&jarg1; 
  argp2 = *(ChangeHandlerWithQueryResult_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null ChangeHandlerWithQueryResult_t");
    return ;
  }
  arg2 = *argp2; 
  {
    try {
      StoreObserverHandlerRust::invokeEventHandler(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1registerStoreObserver(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3, jbyteArray jarg4, jint jarg6) {
  jlong jresult = 0 ;
  StoreObserverHandlerRust *arg1 = (StoreObserverHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  char *arg3 = (char *) 0 ;
  unsigned char *arg4 = (unsigned char *) 0 ;
  uintptr_t arg5 ;
  LiveQueryAvailability_t arg6 ;
  dittoffi_result_int64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StoreObserverHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4) {
      arg4 = (unsigned char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (uintptr_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  arg6 = (LiveQueryAvailability_t)jarg6; 
  {
    try {
      result = (arg1)->registerStoreObserver(arg2,(char const *)arg3,(unsigned char const *)arg4,arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_int64_t **)&jresult = new dittoffi_result_int64_t(result); 
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1registerStoreObserverSwigExplicitStoreObserverHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3, jbyteArray jarg4, jint jarg6) {
  jlong jresult = 0 ;
  StoreObserverHandlerRust *arg1 = (StoreObserverHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  char *arg3 = (char *) 0 ;
  unsigned char *arg4 = (unsigned char *) 0 ;
  uintptr_t arg5 ;
  LiveQueryAvailability_t arg6 ;
  dittoffi_result_int64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StoreObserverHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4) {
      arg4 = (unsigned char *) jenv->GetByteArrayElements(jarg4, 0);
      arg5 = (uintptr_t) jenv->GetArrayLength(jarg4);
    } else {
      arg4 = 0;
      arg5 = 0;
    }
  }
  arg6 = (LiveQueryAvailability_t)jarg6; 
  {
    try {
      result = (arg1)->StoreObserverHandlerRust::registerStoreObserver(arg2,(char const *)arg3,(unsigned char const *)arg4,arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_int64_t **)&jresult = new dittoffi_result_int64_t(result); 
  {
    if (jarg4) jenv->ReleaseByteArrayElements(jarg4, (jbyte *)arg4, 0);
  }
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1startLiveQuery(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
  jint jresult = 0 ;
  StoreObserverHandlerRust *arg1 = (StoreObserverHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  int64_t arg3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StoreObserverHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = (int64_t)jarg3; 
  {
    try {
      result = (int)(arg1)->startLiveQuery(arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1startLiveQuerySwigExplicitStoreObserverHandlerRust(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
  jint jresult = 0 ;
  StoreObserverHandlerRust *arg1 = (StoreObserverHandlerRust *) 0 ;
  CDitto *arg2 = (CDitto *) 0 ;
  int64_t arg3 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(StoreObserverHandlerRust **)&jarg1; 
  arg2 = *(CDitto **)&jarg2; 
  arg3 = (int64_t)jarg3; 
  {
    try {
      result = (int)(arg1)->StoreObserverHandlerRust::startLiveQuery(arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1StoreObserverHandlerRust(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  StoreObserverHandlerRust *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (StoreObserverHandlerRust *)new SwigDirector_StoreObserverHandlerRust(jenv);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(StoreObserverHandlerRust **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) {
  StoreObserverHandlerRust *obj = *((StoreObserverHandlerRust **)&objarg);
  (void)jcls;
  SwigDirector_StoreObserverHandlerRust *director = static_cast<SwigDirector_StoreObserverHandlerRust *>(obj);
  director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) {
  StoreObserverHandlerRust *obj = *((StoreObserverHandlerRust **)&objarg);
  SwigDirector_StoreObserverHandlerRust *director = dynamic_cast<SwigDirector_StoreObserverHandlerRust *>(obj);
  (void)jcls;
  if (director) {
    director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false);
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTOFFI_1TRANSPORTS_1BLE_1COMPANY_1ID_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  result = (int)(0);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTOFFI_1TRANSPORTS_1WIFI_1AWARE_1BACKGROUND_1MODE_1NAME_1get(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  result = (char *)("transports_wifi_aware_background_mode");
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTOFFI_1TRANSPORTS_1WIFI_1AWARE_1MAX_1ERROR_1COUNT_1NAME_1get(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  result = (char *)("transports_wifi_aware_max_error_count");
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTOFFI_1TRANSPORTS_1WIFI_1AWARE_1RECENT_1ERROR_1DURATION_1MS_1NAME_1get(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  result = (char *)("transports_wifi_aware_max_recent_error_duration_ms");
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1CRDT_1TYPE_1COUNTER_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoCrdtType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoCrdtType)DITTO_CRDT_TYPE_COUNTER;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1CRDT_1TYPE_1REGISTER_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoCrdtType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoCrdtType)DITTO_CRDT_TYPE_REGISTER;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1CRDT_1TYPE_1ATTACHMENT_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoCrdtType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoCrdtType)DITTO_CRDT_TYPE_ATTACHMENT;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1CRDT_1TYPE_1RGA_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoCrdtType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoCrdtType)DITTO_CRDT_TYPE_RGA;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1CRDT_1TYPE_1R_1W_1MAP_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoCrdtType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoCrdtType)DITTO_CRDT_TYPE_R_W_MAP;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1CRDT_1TYPE_1ST_1COUNTER_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoCrdtType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoCrdtType)DITTO_CRDT_TYPE_ST_COUNTER;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1CRDT_1TYPE_1A_1W_1SET_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoCrdtType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoCrdtType)DITTO_CRDT_TYPE_A_W_SET;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTOFFI_1TRANSPORT_1WIFI_1AWARE_1BACKGROUND_1MODE_1BEST_1EFFORT_1ON_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  dittoffi_transport_wifi_aware_background_mode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_transport_wifi_aware_background_mode)DITTOFFI_TRANSPORT_WIFI_AWARE_BACKGROUND_MODE_BEST_EFFORT_ON;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_auth_1server_1auth_1submit_1with_1error(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CAuthServerAuthRequest_t *arg1 = (CAuthServerAuthRequest_t *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CAuthServerAuthRequest_t **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  {
    try {
      auth_server_auth_submit_with_error(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1uint8_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_uint8 *arg1 = (slice_ref_uint8 *) 0 ;
  uint8_t *arg2 = (uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_uint8 **)&jarg1; 
  arg2 = *(uint8_t **)&jarg2; 
  if (arg1) (arg1)->ptr = (uint8_t const *)arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1uint8_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_uint8 *arg1 = (slice_ref_uint8 *) 0 ;
  uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_uint8 **)&jarg1; 
  result = (uint8_t *) ((arg1)->ptr);
  *(uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1uint8_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_uint8 *arg1 = (slice_ref_uint8 *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_uint8 **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1uint8_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_uint8 *arg1 = (slice_ref_uint8 *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_uint8 **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1ref_1uint8_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_ref_uint8 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_ref_uint8 *)new slice_ref_uint8();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_ref_uint8 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1ref_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_ref_uint8 *arg1 = (slice_ref_uint8 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_ref_uint8 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_auth_1server_1auth_1submit_1with_1success(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2) {
  CAuthServerAuthRequest_t *arg1 = (CAuthServerAuthRequest_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CAuthServerAuthRequest_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      auth_server_auth_submit_with_success(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_auth_1server_1refresh_1submit_1with_1error(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CAuthServerRefreshRequest_t *arg1 = (CAuthServerRefreshRequest_t *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CAuthServerRefreshRequest_t **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  {
    try {
      auth_server_refresh_submit_with_error(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_auth_1server_1refresh_1submit_1with_1success(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2) {
  CAuthServerRefreshRequest_t *arg1 = (CAuthServerRefreshRequest_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CAuthServerRefreshRequest_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      auth_server_refresh_submit_with_success(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1client_1connect_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jint jarg3) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  ConnectState_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = (ConnectState_t)jarg3; 
  {
    try {
      awdl_client_connect_state_changed((TransportHandle_AwdlPlatformEvent const *)arg1,(char const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1client_1data_1available(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      awdl_client_data_available((TransportHandle_AwdlPlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1client_1platform_1peer_1appeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      awdl_client_platform_peer_appeared((TransportHandle_AwdlPlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1client_1platform_1peer_1disappeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      awdl_client_platform_peer_disappeared((TransportHandle_AwdlPlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1client_1ready_1to_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      awdl_client_ready_to_send((TransportHandle_AwdlPlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1client_1scanning_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      awdl_client_scanning_state_changed((TransportHandle_AwdlPlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1server_1advertising_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      awdl_server_advertising_state_changed((TransportHandle_AwdlPlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1server_1connect_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jint jarg3) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  int64_t arg2 ;
  ConnectState_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  arg3 = (ConnectState_t)jarg3; 
  {
    try {
      awdl_server_connect_state_changed((TransportHandle_AwdlPlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1server_1data_1available(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      awdl_server_data_available((TransportHandle_AwdlPlatformEvent const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1server_1platform_1peer_1appeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      awdl_server_platform_peer_appeared((TransportHandle_AwdlPlatformEvent const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1server_1platform_1peer_1disappeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      awdl_server_platform_peer_disappeared((TransportHandle_AwdlPlatformEvent const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_awdl_1server_1ready_1to_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      awdl_server_ready_to_send((TransportHandle_AwdlPlatformEvent const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1advertising_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      ble_advertising_state_changed((TransportHandle_BlePlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_uint8_116_1array_1t_1idx_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  uint8_16_array_t *arg1 = (uint8_16_array_t *) 0 ;
  uint8_t *arg2 = (uint8_t *) (uint8_t *)0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(uint8_16_array_t **)&jarg1; 
  arg2 = *(uint8_t **)&jarg2; 
  {
    size_t ii;
    uint8_t *b = (uint8_t *) arg1->idx;
    for (ii = 0; ii < (size_t)16; ii++) b[ii] = *((uint8_t *) arg2 + ii);
  }
  
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_uint8_116_1array_1t_1idx_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  uint8_16_array_t *arg1 = (uint8_16_array_t *) 0 ;
  uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(uint8_16_array_t **)&jarg1; 
  result = (uint8_t *)(uint8_t *) ((arg1)->idx);
  *(uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1uint8_116_1array_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  uint8_16_array_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (uint8_16_array_t *)new uint8_16_array_t();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(uint8_16_array_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1uint8_116_1array_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  uint8_16_array_t *arg1 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(uint8_16_array_t **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1central_1finished_1connecting(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jbyteArray jarg3, jint jarg4, jlong jarg5) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg3 ;
  int32_t arg4 ;
  uint32_t arg5 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = (int32_t)jarg4; 
  arg5 = (uint32_t)jarg5; 
  {
    try {
      ble_central_finished_connecting((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3),arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1central_1l2cap_1data_1available(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    try {
      ble_central_l2cap_data_available((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1central_1l2cap_1ready_1to_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    try {
      ble_central_l2cap_ready_to_send((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1central_1mtu_1updated(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  uint32_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  arg3 = (uint32_t)jarg3; 
  {
    try {
      ble_central_mtu_updated((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1central_1ready_1to_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    try {
      ble_central_ready_to_send((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1central_1unsubscribed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    try {
      ble_central_unsubscribed((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1connection_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4, jlong jarg5) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  ConnectState_t arg3 ;
  int32_t arg4 ;
  uint32_t arg5 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  arg3 = (ConnectState_t)jarg3; 
  arg4 = (int32_t)jarg4; 
  arg5 = (uint32_t)jarg5; 
  {
    try {
      ble_connection_state_changed((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2,arg3,arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1peripheral_1l2cap_1data_1available(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    try {
      ble_peripheral_l2cap_data_available((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1peripheral_1l2cap_1ready_1to_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    try {
      ble_peripheral_l2cap_ready_to_send((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1peripheral_1mtu_1updated(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  uint32_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  arg3 = (uint32_t)jarg3; 
  {
    try {
      ble_peripheral_mtu_updated((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1peripheral_1ready_1to_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    try {
      ble_peripheral_ready_to_send((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BLE_1DATA_1TYPE_1ANNOUNCE_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  BleDataType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BleDataType)BLE_DATA_TYPE_ANNOUNCE;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BLE_1DATA_1TYPE_1MESH_1DATA_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  BleDataType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BleDataType)BLE_DATA_TYPE_MESH_DATA;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BLE_1DATA_1TYPE_1CONTROL_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  BleDataType result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BleDataType)BLE_DATA_TYPE_CONTROL;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1received_1from_1central(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jint jarg3, jbyteArray jarg4) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  BleDataType_t arg3 ;
  slice_ref_uint8_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  arg3 = (BleDataType_t)jarg3; 
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      ble_received_from_central((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1received_1from_1peripheral(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jint jarg3, jbyteArray jarg4) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  BleDataType_t arg3 ;
  slice_ref_uint8_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  arg3 = (BleDataType_t)jarg3; 
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      ble_received_from_peripheral((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ble_1scanning_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      ble_scanning_state_changed((TransportHandle_BlePlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1mut_1uint8_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_mut_uint8 *arg1 = (slice_mut_uint8 *) 0 ;
  uint8_t *arg2 = (uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_mut_uint8 **)&jarg1; 
  arg2 = *(uint8_t **)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1mut_1uint8_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_mut_uint8 *arg1 = (slice_mut_uint8 *) 0 ;
  uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_mut_uint8 **)&jarg1; 
  result = (uint8_t *) ((arg1)->ptr);
  *(uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1mut_1uint8_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_mut_uint8 *arg1 = (slice_mut_uint8 *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_mut_uint8 **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1mut_1uint8_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_mut_uint8 *arg1 = (slice_mut_uint8 *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_mut_uint8 **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1mut_1uint8_1t_1getCapacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_mut_uint8 *arg1 = (slice_mut_uint8 *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_mut_uint8 **)&jarg1; 
  result = slice_mut_uint8_getCapacity(arg1);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1mut_1uint8_1t_1setValue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2) {
  jlong jresult = 0 ;
  slice_mut_uint8 *arg1 = (slice_mut_uint8 *) 0 ;
  char *arg2 = (char *) (char *)0 ;
  size_t arg3 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_mut_uint8 **)&jarg1; 
  {
    if (jarg2) {
      arg2 = (char *) jenv->GetByteArrayElements(jarg2, 0);
      arg3 = (size_t) jenv->GetArrayLength(jarg2);
    } else {
      arg2 = 0;
      arg3 = 0;
    }
  }
  result = slice_mut_uint8_setValue(arg1,(char const (*))arg2,SWIG_STD_MOVE(arg3));
  jresult = (jlong)result; 
  {
    if (jarg2) jenv->ReleaseByteArrayElements(jarg2, (jbyte *)arg2, 0);
  }
  
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1mut_1uint8_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_mut_uint8 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_mut_uint8 *)new slice_mut_uint8();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_mut_uint8 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1mut_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_mut_uint8 *arg1 = (slice_mut_uint8 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_mut_uint8 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1start_1searching_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*arg2)(void *,char const *,char const *) = (void (*)(void *,char const *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *,char const *))&jarg2; 
  if (arg1) (arg1)->start_searching = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1start_1searching_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*result)(void *,char const *,char const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *,char const *)) ((arg1)->start_searching);
  *(void (**)(void *,char const *,char const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1stop_1searching_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_searching = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1stop_1searching_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_searching);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1request_1connect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*arg2)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *))&jarg2; 
  if (arg1) (arg1)->request_connect = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1request_1connect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*result)(void *,char const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *)) ((arg1)->request_connect);
  *(void (**)(void *,char const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1request_1disconnect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*arg2)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *))&jarg2; 
  if (arg1) (arg1)->request_disconnect = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1request_1disconnect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  void (*result)(void *,char const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *)) ((arg1)->request_disconnect);
  *(void (**)(void *,char const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1send_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  int32_t (*arg2)(void *,char const *,slice_ref_uint8_t) = (int32_t (*)(void *,char const *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,char const *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->send_data = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1send_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  int32_t (*result)(void *,char const *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,char const *,slice_ref_uint8_t)) ((arg1)->send_data);
  *(int32_t (**)(void *,char const *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1read_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  int32_t (*arg2)(void *,char const *,slice_mut_uint8_t) = (int32_t (*)(void *,char const *,slice_mut_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,char const *,slice_mut_uint8_t))&jarg2; 
  if (arg1) (arg1)->read_data = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlClientCallbacks_1t_1read_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  int32_t (*result)(void *,char const *,slice_mut_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,char const *,slice_mut_uint8_t)) ((arg1)->read_data);
  *(int32_t (**)(void *,char const *,slice_mut_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1AwdlClientCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  AwdlClientCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (AwdlClientCallbacks *)new AwdlClientCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AwdlClientCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1AwdlClientCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  AwdlClientCallbacks *arg1 = (AwdlClientCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(AwdlClientCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1start_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  void (*arg2)(void *,char const *,char const *) = (void (*)(void *,char const *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *,char const *))&jarg2; 
  if (arg1) (arg1)->start_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1start_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  void (*result)(void *,char const *,char const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *,char const *)) ((arg1)->start_advertising);
  *(void (**)(void *,char const *,char const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1stop_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1stop_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_advertising);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1request_1disconnect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  void (*arg2)(void *,int64_t) = (void (*)(void *,int64_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,int64_t))&jarg2; 
  if (arg1) (arg1)->request_disconnect = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1request_1disconnect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  void (*result)(void *,int64_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  result = (void (*)(void *,int64_t)) ((arg1)->request_disconnect);
  *(void (**)(void *,int64_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1send_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  int32_t (*arg2)(void *,int64_t,slice_ref_uint8_t) = (int32_t (*)(void *,int64_t,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,int64_t,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->send_data = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1send_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  int32_t (*result)(void *,int64_t,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,int64_t,slice_ref_uint8_t)) ((arg1)->send_data);
  *(int32_t (**)(void *,int64_t,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1read_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  int32_t (*arg2)(void *,int64_t,slice_mut_uint8_t) = (int32_t (*)(void *,int64_t,slice_mut_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,int64_t,slice_mut_uint8_t))&jarg2; 
  if (arg1) (arg1)->read_data = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AwdlServerCallbacks_1t_1read_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  int32_t (*result)(void *,int64_t,slice_mut_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,int64_t,slice_mut_uint8_t)) ((arg1)->read_data);
  *(int32_t (**)(void *,int64_t,slice_mut_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1AwdlServerCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  AwdlServerCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (AwdlServerCallbacks *)new AwdlServerCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AwdlServerCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1AwdlServerCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  AwdlServerCallbacks *arg1 = (AwdlServerCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(AwdlServerCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1add_1awdl_1transport(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jlong jarg4, jobject jarg4_, jlong jarg5, jlong jarg6, jlong jarg7) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  AwdlClientCallbacks_t arg2 ;
  void *arg3 = (void *) 0 ;
  AwdlServerCallbacks_t arg4 ;
  void *arg5 = (void *) 0 ;
  void (*arg6)(void *) = (void (*)(void *)) 0 ;
  void (*arg7)(void *) = (void (*)(void *)) 0 ;
  AwdlClientCallbacks_t *argp2 ;
  AwdlServerCallbacks_t *argp4 ;
  TransportHandle_AwdlPlatformEvent_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  argp2 = *(AwdlClientCallbacks_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null AwdlClientCallbacks_t");
    return 0;
  }
  arg2 = *argp2; 
  arg3 = *(void **)&jarg3; 
  argp4 = *(AwdlServerCallbacks_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null AwdlServerCallbacks_t");
    return 0;
  }
  arg4 = *argp4; 
  arg5 = *(void **)&jarg5; 
  arg6 = *(void (**)(void *))&jarg6; 
  arg7 = *(void (**)(void *))&jarg7; 
  {
    try {
      result = (TransportHandle_AwdlPlatformEvent_t *)ditto_add_awdl_transport((CDitto const *)arg1,SWIG_STD_MOVE(arg2),arg3,SWIG_STD_MOVE(arg4),arg5,arg6,arg7);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(TransportHandle_AwdlPlatformEvent_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_SendResult_1t_1accepted_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
  SendResult *arg1 = (SendResult *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(SendResult **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  if (arg1) (arg1)->accepted = arg2;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_SendResult_1t_1accepted_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  SendResult *arg1 = (SendResult *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(SendResult **)&jarg1; 
  result = (bool) ((arg1)->accepted);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_SendResult_1t_1wait_1for_1ready_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
  SendResult *arg1 = (SendResult *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(SendResult **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  if (arg1) (arg1)->wait_for_ready = arg2;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_SendResult_1t_1wait_1for_1ready_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  SendResult *arg1 = (SendResult *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(SendResult **)&jarg1; 
  result = (bool) ((arg1)->wait_for_ready);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1SendResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  SendResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (SendResult *)new SendResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(SendResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1SendResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  SendResult *arg1 = (SendResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(SendResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1start_1scanning_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*arg2)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = (void (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->start_scanning = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1start_1scanning_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*result)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (void (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) ((arg1)->start_scanning);
  *(void (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1stop_1scanning_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_scanning = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1stop_1scanning_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_scanning);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1scanning_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  OnlineState_t (*arg2)(void *) = (OnlineState_t (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(OnlineState_t (**)(void *))&jarg2; 
  if (arg1) (arg1)->scanning_state = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1scanning_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  OnlineState_t (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (OnlineState_t (*)(void *)) ((arg1)->scanning_state);
  *(OnlineState_t (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1connect_1peripheral_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*arg2)(void *,uint8_16_array_t const *) = (void (*)(void *,uint8_16_array_t const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,uint8_16_array_t const *))&jarg2; 
  if (arg1) (arg1)->connect_peripheral = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1connect_1peripheral_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*result)(void *,uint8_16_array_t const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (void (*)(void *,uint8_16_array_t const *)) ((arg1)->connect_peripheral);
  *(void (**)(void *,uint8_16_array_t const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1disconnect_1peripheral_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*arg2)(void *,uint8_16_array_t const *) = (void (*)(void *,uint8_16_array_t const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,uint8_16_array_t const *))&jarg2; 
  if (arg1) (arg1)->disconnect_peripheral = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1disconnect_1peripheral_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  void (*result)(void *,uint8_16_array_t const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (void (*)(void *,uint8_16_array_t const *)) ((arg1)->disconnect_peripheral);
  *(void (**)(void *,uint8_16_array_t const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1write_1to_1peripheral_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  SendResult_t (*arg2)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t) = (SendResult_t (*)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(SendResult_t (**)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->write_to_peripheral = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1write_1to_1peripheral_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  SendResult_t (*result)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (SendResult_t (*)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t)) ((arg1)->write_to_peripheral);
  *(SendResult_t (**)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1read_1l2cap_1from_1peripheral_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  int32_t (*arg2)(void *,uint8_16_array_t const *,slice_mut_uint8_t) = (int32_t (*)(void *,uint8_16_array_t const *,slice_mut_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,uint8_16_array_t const *,slice_mut_uint8_t))&jarg2; 
  if (arg1) (arg1)->read_l2cap_from_peripheral = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1read_1l2cap_1from_1peripheral_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  int32_t (*result)(void *,uint8_16_array_t const *,slice_mut_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,uint8_16_array_t const *,slice_mut_uint8_t)) ((arg1)->read_l2cap_from_peripheral);
  *(int32_t (**)(void *,uint8_16_array_t const *,slice_mut_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1send_1l2cap_1to_1peripheral_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  int32_t (*arg2)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = (int32_t (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->send_l2cap_to_peripheral = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleClientCallbacks_1t_1send_1l2cap_1to_1peripheral_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  int32_t (*result)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) ((arg1)->send_l2cap_to_peripheral);
  *(int32_t (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BleClientCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BleClientCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BleClientCallbacks *)new BleClientCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BleClientCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BleClientCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BleClientCallbacks *arg1 = (BleClientCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BleClientCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1start_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  void (*arg2)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = (void (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->start_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1start_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  void (*result)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  result = (void (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) ((arg1)->start_advertising);
  *(void (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1stop_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1stop_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_advertising);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1advertising_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  OnlineState_t (*arg2)(void *) = (OnlineState_t (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  arg2 = *(OnlineState_t (**)(void *))&jarg2; 
  if (arg1) (arg1)->advertising_state = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1advertising_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  OnlineState_t (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  result = (OnlineState_t (*)(void *)) ((arg1)->advertising_state);
  *(OnlineState_t (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1notify_1to_1central_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  SendResult_t (*arg2)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t) = (SendResult_t (*)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  arg2 = *(SendResult_t (**)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->notify_to_central = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1notify_1to_1central_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  SendResult_t (*result)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  result = (SendResult_t (*)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t)) ((arg1)->notify_to_central);
  *(SendResult_t (**)(void *,BleDataType_t,uint8_16_array_t const *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1read_1l2cap_1from_1central_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  int32_t (*arg2)(void *,uint8_16_array_t const *,slice_mut_uint8_t) = (int32_t (*)(void *,uint8_16_array_t const *,slice_mut_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,uint8_16_array_t const *,slice_mut_uint8_t))&jarg2; 
  if (arg1) (arg1)->read_l2cap_from_central = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1read_1l2cap_1from_1central_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  int32_t (*result)(void *,uint8_16_array_t const *,slice_mut_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,uint8_16_array_t const *,slice_mut_uint8_t)) ((arg1)->read_l2cap_from_central);
  *(int32_t (**)(void *,uint8_16_array_t const *,slice_mut_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1send_1l2cap_1to_1central_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  int32_t (*arg2)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = (int32_t (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  arg2 = *(int32_t (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->send_l2cap_to_central = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BleServerCallbacks_1t_1send_1l2cap_1to_1central_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  int32_t (*result)(void *,uint8_16_array_t const *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  result = (int32_t (*)(void *,uint8_16_array_t const *,slice_ref_uint8_t)) ((arg1)->send_l2cap_to_central);
  *(int32_t (**)(void *,uint8_16_array_t const *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BleServerCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BleServerCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BleServerCallbacks *)new BleServerCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BleServerCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BleServerCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BleServerCallbacks *arg1 = (BleServerCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BleServerCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1add_1ble_1transport(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jlong jarg4, jobject jarg4_, jlong jarg5, jlong jarg6, jlong jarg7) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  BleClientCallbacks_t arg2 ;
  void *arg3 = (void *) 0 ;
  BleServerCallbacks_t arg4 ;
  void *arg5 = (void *) 0 ;
  void (*arg6)(void *) = (void (*)(void *)) 0 ;
  void (*arg7)(void *) = (void (*)(void *)) 0 ;
  BleClientCallbacks_t *argp2 ;
  BleServerCallbacks_t *argp4 ;
  TransportHandle_BlePlatformEvent_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  argp2 = *(BleClientCallbacks_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null BleClientCallbacks_t");
    return 0;
  }
  arg2 = *argp2; 
  arg3 = *(void **)&jarg3; 
  argp4 = *(BleServerCallbacks_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null BleServerCallbacks_t");
    return 0;
  }
  arg4 = *argp4; 
  arg5 = *(void **)&jarg5; 
  arg6 = *(void (**)(void *))&jarg6; 
  arg7 = *(void (**)(void *))&jarg7; 
  {
    try {
      result = (TransportHandle_BlePlatformEvent_t *)ditto_add_ble_transport((CDitto const *)arg1,SWIG_STD_MOVE(arg2),arg3,SWIG_STD_MOVE(arg4),arg5,arg6,arg7);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(TransportHandle_BlePlatformEvent_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsClientCallbacks_1t_1start_1searching_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  MdnsClientCallbacks *arg1 = (MdnsClientCallbacks *) 0 ;
  void (*arg2)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *))&jarg2; 
  if (arg1) (arg1)->start_searching = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsClientCallbacks_1t_1start_1searching_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  MdnsClientCallbacks *arg1 = (MdnsClientCallbacks *) 0 ;
  void (*result)(void *,char const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsClientCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *)) ((arg1)->start_searching);
  *(void (**)(void *,char const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsClientCallbacks_1t_1stop_1searching_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  MdnsClientCallbacks *arg1 = (MdnsClientCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_searching = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsClientCallbacks_1t_1stop_1searching_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  MdnsClientCallbacks *arg1 = (MdnsClientCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsClientCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_searching);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsClientCallbacks_1t_1resolve_1service_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  MdnsClientCallbacks *arg1 = (MdnsClientCallbacks *) 0 ;
  void (*arg2)(void *,slice_ref_uint8_t) = (void (*)(void *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,slice_ref_uint8_t))&jarg2; 
  if (arg1) (arg1)->resolve_service = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsClientCallbacks_1t_1resolve_1service_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  MdnsClientCallbacks *arg1 = (MdnsClientCallbacks *) 0 ;
  void (*result)(void *,slice_ref_uint8_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsClientCallbacks **)&jarg1; 
  result = (void (*)(void *,slice_ref_uint8_t)) ((arg1)->resolve_service);
  *(void (**)(void *,slice_ref_uint8_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1MdnsClientCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  MdnsClientCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (MdnsClientCallbacks *)new MdnsClientCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(MdnsClientCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1MdnsClientCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  MdnsClientCallbacks *arg1 = (MdnsClientCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(MdnsClientCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsServerCallbacks_1t_1start_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  MdnsServerCallbacks *arg1 = (MdnsServerCallbacks *) 0 ;
  void (*arg2)(void *,char const *,char const *,uint16_t) = (void (*)(void *,char const *,char const *,uint16_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *,char const *,uint16_t))&jarg2; 
  if (arg1) (arg1)->start_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsServerCallbacks_1t_1start_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  MdnsServerCallbacks *arg1 = (MdnsServerCallbacks *) 0 ;
  void (*result)(void *,char const *,char const *,uint16_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsServerCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *,char const *,uint16_t)) ((arg1)->start_advertising);
  *(void (**)(void *,char const *,char const *,uint16_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsServerCallbacks_1t_1stop_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  MdnsServerCallbacks *arg1 = (MdnsServerCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_MdnsServerCallbacks_1t_1stop_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  MdnsServerCallbacks *arg1 = (MdnsServerCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(MdnsServerCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_advertising);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1MdnsServerCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  MdnsServerCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (MdnsServerCallbacks *)new MdnsServerCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(MdnsServerCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1MdnsServerCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  MdnsServerCallbacks *arg1 = (MdnsServerCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(MdnsServerCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1add_1mdns_1discovery(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jlong jarg5, jlong jarg6) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  MdnsClientCallbacks_t arg2 ;
  MdnsServerCallbacks_t arg3 ;
  void *arg4 = (void *) 0 ;
  void (*arg5)(void *) = (void (*)(void *)) 0 ;
  void (*arg6)(void *) = (void (*)(void *)) 0 ;
  MdnsClientCallbacks_t *argp2 ;
  MdnsServerCallbacks_t *argp3 ;
  TransportHandle_MdnsPlatformEvent_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(CDitto_t **)&jarg1; 
  argp2 = *(MdnsClientCallbacks_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null MdnsClientCallbacks_t");
    return 0;
  }
  arg2 = *argp2; 
  argp3 = *(MdnsServerCallbacks_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null MdnsServerCallbacks_t");
    return 0;
  }
  arg3 = *argp3; 
  arg4 = *(void **)&jarg4; 
  arg5 = *(void (**)(void *))&jarg5; 
  arg6 = *(void (**)(void *))&jarg6; 
  {
    try {
      result = (TransportHandle_MdnsPlatformEvent_t *)ditto_add_mdns_discovery((CDitto const *)arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3),arg4,arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(TransportHandle_MdnsPlatformEvent_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_QUERY_1SORT_1DIRECTION_1ASCENDING_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  QuerySortDirection result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (QuerySortDirection)QUERY_SORT_DIRECTION_ASCENDING;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParam_1t_1query_1c_1str_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  COrderByParam *arg1 = (COrderByParam *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(COrderByParam **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    if (arg2) {
      arg1->query_c_str = (char const *) (new char[strlen((const char *)arg2)+1]);
      strcpy((char *)arg1->query_c_str, (const char *)arg2);
    } else {
      arg1->query_c_str = 0;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParam_1t_1query_1c_1str_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jstring jresult = 0 ;
  COrderByParam *arg1 = (COrderByParam *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(COrderByParam **)&jarg1; 
  result = (char *) ((arg1)->query_c_str);
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParam_1t_1direction_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  COrderByParam *arg1 = (COrderByParam *) 0 ;
  QuerySortDirection_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(COrderByParam **)&jarg1; 
  arg2 = (QuerySortDirection_t)jarg2; 
  if (arg1) (arg1)->direction = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_COrderByParam_1t_1direction_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  COrderByParam *arg1 = (COrderByParam *) 0 ;
  QuerySortDirection_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(COrderByParam **)&jarg1; 
  result = (QuerySortDirection_t) ((arg1)->direction);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1COrderByParam_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  COrderByParam *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (COrderByParam *)new COrderByParam();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(COrderByParam **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1COrderByParam_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  COrderByParam *arg1 = (COrderByParam *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(COrderByParam **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1COrderByParam_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  slice_ref_COrderByParam *arg1 = (slice_ref_COrderByParam *) 0 ;
  COrderByParam_t *arg2 = (COrderByParam_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(slice_ref_COrderByParam **)&jarg1; 
  arg2 = *(COrderByParam_t **)&jarg2; 
  if (arg1) (arg1)->ptr = (COrderByParam_t const *)arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1COrderByParam_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_COrderByParam *arg1 = (slice_ref_COrderByParam *) 0 ;
  COrderByParam_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_COrderByParam **)&jarg1; 
  result = (COrderByParam_t *) ((arg1)->ptr);
  *(COrderByParam_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1COrderByParam_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_COrderByParam *arg1 = (slice_ref_COrderByParam *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_COrderByParam **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1COrderByParam_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_COrderByParam *arg1 = (slice_ref_COrderByParam *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_COrderByParam **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1ref_1COrderByParam_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_ref_COrderByParam *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_ref_COrderByParam *)new slice_ref_COrderByParam();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_ref_COrderByParam **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1ref_1COrderByParam_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_ref_COrderByParam *arg1 = (slice_ref_COrderByParam *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_ref_COrderByParam **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1add_1subscription(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jbyteArray jarg4, jobjectArray jarg5, jint jarg6, jlong jarg7) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_COrderByParam_t arg5 ;
  int32_t arg6 ;
  uint32_t arg7 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg5 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg5),
    };
    (&arg5)->ptr = (typeof((&arg5)->ptr)) calloc(sizeof(*(&arg5)->ptr), (&arg5)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg5)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg5, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg5)->ptr[i],
        (void *) cptr,
        sizeof((&arg5)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg5)->ptr is to be done within the `freearg` typemap
  }
  arg6 = (int32_t)jarg6; 
  arg7 = (uint32_t)jarg7; 
  {
    try {
      result = (int32_t)ditto_add_subscription((CDitto const *)arg1,(char const *)arg2,(char const *)arg3,SWIG_STD_MOVE(arg4),SWIG_STD_MOVE(arg5),arg6,arg7);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg5)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LegacySubscriptionHandleResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  LegacySubscriptionHandleResult *arg1 = (LegacySubscriptionHandleResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LegacySubscriptionHandleResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LegacySubscriptionHandleResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  LegacySubscriptionHandleResult *arg1 = (LegacySubscriptionHandleResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LegacySubscriptionHandleResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LegacySubscriptionHandleResult_1t_1handle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  LegacySubscriptionHandleResult *arg1 = (LegacySubscriptionHandleResult *) 0 ;
  LegacySubscriptionHandle_t *arg2 = (LegacySubscriptionHandle_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LegacySubscriptionHandleResult **)&jarg1; 
  arg2 = *(LegacySubscriptionHandle_t **)&jarg2; 
  if (arg1) (arg1)->handle = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LegacySubscriptionHandleResult_1t_1handle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  LegacySubscriptionHandleResult *arg1 = (LegacySubscriptionHandleResult *) 0 ;
  LegacySubscriptionHandle_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(LegacySubscriptionHandleResult **)&jarg1; 
  result = (LegacySubscriptionHandle_t *) ((arg1)->handle);
  *(LegacySubscriptionHandle_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1LegacySubscriptionHandleResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  LegacySubscriptionHandleResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LegacySubscriptionHandleResult *)new LegacySubscriptionHandleResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(LegacySubscriptionHandleResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1LegacySubscriptionHandleResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  LegacySubscriptionHandleResult *arg1 = (LegacySubscriptionHandleResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(LegacySubscriptionHandleResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1add_1subscription_1with_1easier_1unregistering(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jbyteArray jarg4, jobjectArray jarg5, jint jarg6, jlong jarg7) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_COrderByParam_t arg5 ;
  int32_t arg6 ;
  uint32_t arg7 ;
  LegacySubscriptionHandleResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg5 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg5),
    };
    (&arg5)->ptr = (typeof((&arg5)->ptr)) calloc(sizeof(*(&arg5)->ptr), (&arg5)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg5)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg5, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg5)->ptr[i],
        (void *) cptr,
        sizeof((&arg5)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg5)->ptr is to be done within the `freearg` typemap
  }
  arg6 = (int32_t)jarg6; 
  arg7 = (uint32_t)jarg7; 
  {
    try {
      result = ditto_add_subscription_with_easier_unregistering((CDitto const *)arg1,(char const *)arg2,(char const *)arg3,SWIG_STD_MOVE(arg4),SWIG_STD_MOVE(arg5),arg6,arg7);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(LegacySubscriptionHandleResult_t **)&jresult = new LegacySubscriptionHandleResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg5)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1start_1searching_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*arg2)(void *,char const *,char const *) = (void (*)(void *,char const *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *,char const *))&jarg2; 
  if (arg1) (arg1)->start_searching = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1start_1searching_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*result)(void *,char const *,char const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *,char const *)) ((arg1)->start_searching);
  *(void (**)(void *,char const *,char const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1stop_1searching_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_searching = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1stop_1searching_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_searching);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1create_1network_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*arg2)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *))&jarg2; 
  if (arg1) (arg1)->create_network = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1create_1network_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*result)(void *,char const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *)) ((arg1)->create_network);
  *(void (**)(void *,char const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1update_1peer_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*arg2)(void *,char const *,ConnectState_t) = (void (*)(void *,char const *,ConnectState_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *,ConnectState_t))&jarg2; 
  if (arg1) (arg1)->update_peer = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareClientCallbacks_1t_1update_1peer_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  void (*result)(void *,char const *,ConnectState_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *,ConnectState_t)) ((arg1)->update_peer);
  *(void (**)(void *,char const *,ConnectState_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1WifiAwareClientCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  WifiAwareClientCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (WifiAwareClientCallbacks *)new WifiAwareClientCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(WifiAwareClientCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1WifiAwareClientCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  WifiAwareClientCallbacks *arg1 = (WifiAwareClientCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(WifiAwareClientCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1start_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*arg2)(void *,char const *,char const *,uint16_t) = (void (*)(void *,char const *,char const *,uint16_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *,char const *,uint16_t))&jarg2; 
  if (arg1) (arg1)->start_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1start_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*result)(void *,char const *,char const *,uint16_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *,char const *,uint16_t)) ((arg1)->start_advertising);
  *(void (**)(void *,char const *,char const *,uint16_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1stop_1advertising_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->stop_advertising = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1stop_1advertising_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->stop_advertising);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1update_1peer_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*arg2)(void *,char const *,ConnectState_t) = (void (*)(void *,char const *,ConnectState_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,char const *,ConnectState_t))&jarg2; 
  if (arg1) (arg1)->update_peer = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1update_1peer_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*result)(void *,char const *,ConnectState_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  result = (void (*)(void *,char const *,ConnectState_t)) ((arg1)->update_peer);
  *(void (**)(void *,char const *,ConnectState_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1update_1parameter_1u64_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*arg2)(void *,dittoffi_wifi_aware_system_parameter_u64_t,uint64_t) = (void (*)(void *,dittoffi_wifi_aware_system_parameter_u64_t,uint64_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_wifi_aware_system_parameter_u64_t,uint64_t))&jarg2; 
  if (arg1) (arg1)->update_parameter_u64 = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareServerCallbacks_1t_1update_1parameter_1u64_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  void (*result)(void *,dittoffi_wifi_aware_system_parameter_u64_t,uint64_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  result = (void (*)(void *,dittoffi_wifi_aware_system_parameter_u64_t,uint64_t)) ((arg1)->update_parameter_u64);
  *(void (**)(void *,dittoffi_wifi_aware_system_parameter_u64_t,uint64_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1WifiAwareServerCallbacks_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  WifiAwareServerCallbacks *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (WifiAwareServerCallbacks *)new WifiAwareServerCallbacks();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(WifiAwareServerCallbacks **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1WifiAwareServerCallbacks_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  WifiAwareServerCallbacks *arg1 = (WifiAwareServerCallbacks *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(WifiAwareServerCallbacks **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1add_1wifi_1aware_1transport(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jlong jarg5, jlong jarg6) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  WifiAwareClientCallbacks_t arg2 ;
  WifiAwareServerCallbacks_t arg3 ;
  void *arg4 = (void *) 0 ;
  void (*arg5)(void *) = (void (*)(void *)) 0 ;
  void (*arg6)(void *) = (void (*)(void *)) 0 ;
  WifiAwareClientCallbacks_t *argp2 ;
  WifiAwareServerCallbacks_t *argp3 ;
  TransportHandle_WifiAwarePlatformEvent_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(CDitto_t **)&jarg1; 
  argp2 = *(WifiAwareClientCallbacks_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null WifiAwareClientCallbacks_t");
    return 0;
  }
  arg2 = *argp2; 
  argp3 = *(WifiAwareServerCallbacks_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null WifiAwareServerCallbacks_t");
    return 0;
  }
  arg3 = *argp3; 
  arg4 = *(void **)&jarg4; 
  arg5 = *(void (**)(void *))&jarg5; 
  arg6 = *(void (**)(void *))&jarg6; 
  {
    try {
      result = (TransportHandle_WifiAwarePlatformEvent_t *)ditto_add_wifi_aware_transport((CDitto const *)arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3),arg4,arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(TransportHandle_WifiAwarePlatformEvent_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1get_1app_1id(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (char *)ditto_auth_client_get_app_id((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jobject JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1get_1site_1id(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jobject jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  uint64_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (uint64_t)ditto_auth_client_get_site_id((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    jbyteArray ba = jenv->NewByteArray(9);
    jbyte* bae = jenv->GetByteArrayElements(ba, 0);
    jclass clazz = jenv->FindClass("java/math/BigInteger");
    jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
    jobject bigint;
    int i;
    
    bae[0] = 0;
    for(i=1; i<9; i++ ) {
      bae[i] = (jbyte)(result>>8*(8-i));
    }
    
    jenv->ReleaseByteArrayElements(ba, bae, 0);
    bigint = jenv->NewObject(clazz, mid, ba);
    jenv->DeleteLocalRef(ba);
    jresult = bigint;
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1is_1web_1valid(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (int32_t)ditto_auth_client_is_web_valid((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1login_1with_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jstring jarg4) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  char *arg4 = (char *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    try {
      result = (int32_t)ditto_auth_client_login_with_credentials(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1login_1with_1token(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    try {
      result = (int32_t)ditto_auth_client_login_with_token(arg1,(char const *)arg2,(char const *)arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxedCharPtrResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  BoxedCharPtrResult *arg1 = (BoxedCharPtrResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxedCharPtrResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxedCharPtrResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  BoxedCharPtrResult *arg1 = (BoxedCharPtrResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxedCharPtrResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxedCharPtrResult_1t_1c_1string_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  BoxedCharPtrResult *arg1 = (BoxedCharPtrResult *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxedCharPtrResult **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    delete [] arg1->c_string;
    if (arg2) {
      arg1->c_string = (char *) (new char[strlen((const char *)arg2)+1]);
      strcpy((char *)arg1->c_string, (const char *)arg2);
    } else {
      arg1->c_string = 0;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxedCharPtrResult_1t_1c_1string_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jstring jresult = 0 ;
  BoxedCharPtrResult *arg1 = (BoxedCharPtrResult *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxedCharPtrResult **)&jarg1; 
  result = (char *) ((arg1)->c_string);
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxedCharPtrResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxedCharPtrResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxedCharPtrResult *)new BoxedCharPtrResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxedCharPtrResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxedCharPtrResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxedCharPtrResult *arg1 = (BoxedCharPtrResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxedCharPtrResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1login_1with_1token_1and_1feedback(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  BoxedCharPtrResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    try {
      result = ditto_auth_client_login_with_token_and_feedback((CDitto const *)arg1,(char const *)arg2,(char const *)arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxedCharPtrResult_t **)&jresult = new BoxedCharPtrResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (int32_t)ditto_auth_client_logout((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1make_1login_1provider(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4) {
  jlong jresult = 0 ;
  void *arg1 = (void *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  void (*arg3)(void *) = (void (*)(void *)) 0 ;
  void (*arg4)(void *,uint32_t) = (void (*)(void *,uint32_t)) 0 ;
  CLoginProvider_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  arg3 = *(void (**)(void *))&jarg3; 
  arg4 = *(void (**)(void *,uint32_t))&jarg4; 
  {
    try {
      result = (CLoginProvider_t *)ditto_auth_client_make_login_provider(arg1,arg2,arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CLoginProvider_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1client_1user_1id(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (char *)ditto_auth_client_user_id((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  {
    if (result != NULL) {
      ditto_c_string_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1login_1provider_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CLoginProvider_t *arg1 = (CLoginProvider_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CLoginProvider_t **)&jarg1; 
  {
    try {
      ditto_auth_login_provider_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1auth_1set_1login_1provider(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  CLoginProvider_t *arg2 = (CLoginProvider_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(CLoginProvider_t **)&jarg2; 
  {
    try {
      ditto_auth_set_login_provider((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1awdl_1transport_1free_1handle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_AwdlPlatformEvent_t *arg1 = (TransportHandle_AwdlPlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_AwdlPlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_awdl_transport_free_handle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1ble_1transport_1free_1handle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_ble_transport_free_handle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1uint8_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_boxed_uint8 *arg1 = (slice_boxed_uint8 *) 0 ;
  uint8_t *arg2 = (uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_uint8 **)&jarg1; 
  arg2 = *(uint8_t **)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1uint8_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_boxed_uint8 *arg1 = (slice_boxed_uint8 *) 0 ;
  uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_uint8 **)&jarg1; 
  result = (uint8_t *) ((arg1)->ptr);
  *(uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1uint8_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_boxed_uint8 *arg1 = (slice_boxed_uint8 *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_uint8 **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1uint8_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_boxed_uint8 *arg1 = (slice_boxed_uint8 *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_uint8 **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_boxed_uint8 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_boxed_uint8 *)new slice_boxed_uint8();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_boxed_uint8 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_boxed_uint8 *arg1 = (slice_boxed_uint8 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_boxed_uint8 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1c_1bytes_1free(JNIEnv *jenv, jclass jcls, jbyteArray jarg1) {
  slice_boxed_uint8_t arg1 ;
  slice_boxed_uint8_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  argp1 = *(slice_boxed_uint8_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_boxed_uint8_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      ditto_c_bytes_free(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1c_1string_1free(JNIEnv *jenv, jclass jcls, jstring jarg1) {
  char *arg1 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return ;
  }
  {
    try {
      ditto_c_string_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1cancel(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DittoCancellable_t *arg1 = (DittoCancellable_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DittoCancellable_t **)&jarg1; 
  {
    try {
      ditto_cancel(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1cancel_1resolve_1attachment(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2, jobject jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  uint64_t arg3 ;
  uint32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg3) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return 0;
    }
    clazz = jenv->GetObjectClass(jarg3);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg3 = 0;
    if (sz > 0) {
      arg3 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg3 = (arg3 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    try {
      result = (uint32_t)ditto_cancel_resolve_attachment((CDitto const *)arg1,SWIG_STD_MOVE(arg2),arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CBORPathResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  CBORPathResult *arg1 = (CBORPathResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CBORPathResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CBORPathResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  CBORPathResult *arg1 = (CBORPathResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CBORPathResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CBORPathResult_1t_1cbor_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  CBORPathResult *arg1 = (CBORPathResult *) 0 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(CBORPathResult **)&jarg1; 
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->cbor = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CBORPathResult_1t_1cbor_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  CBORPathResult *arg1 = (CBORPathResult *) 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CBORPathResult **)&jarg1; 
  result = (slice_boxed_uint8_t *)& ((arg1)->cbor);
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1CBORPathResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CBORPathResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CBORPathResult *)new CBORPathResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CBORPathResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1CBORPathResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CBORPathResult *arg1 = (CBORPathResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CBORPathResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1cbor_1get_1cbor_1with_1path_1type(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jstring jarg2, jint jarg3) {
  jlong jresult = 0 ;
  slice_ref_uint8_t arg1 ;
  char *arg2 = (char *) 0 ;
  PathAccessorType_t arg3 ;
  CBORPathResult_t result;
  
  (void)jenv;
  (void)jcls;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = (PathAccessorType_t)jarg3; 
  {
    try {
      result = ditto_cbor_get_cbor_with_path_type(SWIG_STD_MOVE(arg1),(char const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CBORPathResult_t **)&jresult = new CBORPathResult_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1OK_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_OK;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1UNKNOWN_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_UNKNOWN;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1NOT_1IMPLEMENTED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_NOT_IMPLEMENTED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1UNREACHABLE_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_UNREACHABLE;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1FAILED_1TO_1ACQUIRE_1LOCK_1FILE_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_FAILED_TO_ACQUIRE_LOCK_FILE;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1INVALID_1PASSPHRASE_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_INVALID_PASSPHRASE;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1EXTRANEOUS_1PASSPHRASE_1GIVEN_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_EXTRANEOUS_PASSPHRASE_GIVEN;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1PASSPHRASE_1NOT_1GIVEN_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_PASSPHRASE_NOT_GIVEN;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1ALREADY_1ENCRYPTED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_ALREADY_ENCRYPTED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1ENCRYPTION_1FAILED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_ENCRYPTION_FAILED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1CANNOT_1BE_1ENCRYPTED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_CANNOT_BE_ENCRYPTED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1NOT_1INITIALIZED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_NOT_INITIALIZED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1SORT_1FAILED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_SORT_FAILED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1DQL_1FAILED_1TO_1COMPILE_1QUERY_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_DQL_FAILED_TO_COMPILE_QUERY;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1DQL_1UNSUPPORTED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_DQL_UNSUPPORTED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1DQL_1EXECUTION_1FAILED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_DQL_EXECUTION_FAILED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1ERROR_1CODE_1PARAMETER_1QUERY_1FAILED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoErrorCode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoErrorCode)DITTO_ERROR_CODE_PARAMETER_QUERY_FAILED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1change_1passphrase(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jlong jarg6) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  void *arg4 = (void *) 0 ;
  void (*arg5)(void *) = (void (*)(void *)) 0 ;
  DittoErrorCode_t *arg6 = (DittoErrorCode_t *) 0 ;
  DittoCancellable_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  arg4 = *(void **)&jarg4; 
  arg5 = *(void (**)(void *))&jarg5; 
  arg6 = *(DittoErrorCode_t **)&jarg6; 
  {
    try {
      result = (DittoCancellable_t *)ditto_change_passphrase((char const *)arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DittoCancellable_t **)&jresult = result; 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1clear_1presence_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      ditto_clear_presence_callback((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1clear_1presence_1v1_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      ditto_clear_presence_v1_callback((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1clear_1presence_1v2_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      ditto_clear_presence_v2_callback((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1clear_1presence_1v3_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      ditto_clear_presence_v3_callback((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = (int32_t)ditto_collection((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoolResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  BoolResult *arg1 = (BoolResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoolResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoolResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  BoolResult *arg1 = (BoolResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoolResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoolResult_1t_1bool_1value_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
  BoolResult *arg1 = (BoolResult *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoolResult **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  if (arg1) (arg1)->bool_value = arg2;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoolResult_1t_1bool_1value_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  BoolResult *arg1 = (BoolResult *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoolResult **)&jarg1; 
  result = (bool) ((arg1)->bool_value);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoolResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoolResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoolResult *)new BoolResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoolResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoolResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoolResult *arg1 = (BoolResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoolResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1evict(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jbyteArray jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_uint8_t arg4 ;
  BoolResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = ditto_collection_evict((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoolResult_t **)&jresult = new BoolResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1slice_1boxed_1uint8_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  slice_ref_slice_boxed_uint8 *arg1 = (slice_ref_slice_boxed_uint8 *) 0 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(slice_ref_slice_boxed_uint8 **)&jarg1; 
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->ptr = (slice_boxed_uint8_t const *)arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1slice_1boxed_1uint8_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_slice_boxed_uint8 *arg1 = (slice_ref_slice_boxed_uint8 *) 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_slice_boxed_uint8 **)&jarg1; 
  result = (slice_boxed_uint8_t *) ((arg1)->ptr);
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1slice_1boxed_1uint8_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_slice_boxed_uint8 *arg1 = (slice_ref_slice_boxed_uint8 *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_slice_boxed_uint8 **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1slice_1boxed_1uint8_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_slice_boxed_uint8 *arg1 = (slice_ref_slice_boxed_uint8 *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_slice_boxed_uint8 **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1ref_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_ref_slice_boxed_uint8 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_ref_slice_boxed_uint8 *)new slice_ref_slice_boxed_uint8();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_ref_slice_boxed_uint8 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1ref_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_ref_slice_boxed_uint8 *arg1 = (slice_ref_slice_boxed_uint8 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_ref_slice_boxed_uint8 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1slice_1boxed_1uint8_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  Vec_slice_boxed_uint8 *arg1 = (Vec_slice_boxed_uint8 *) 0 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(Vec_slice_boxed_uint8 **)&jarg1; 
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1slice_1boxed_1uint8_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_slice_boxed_uint8 *arg1 = (Vec_slice_boxed_uint8 *) 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_slice_boxed_uint8 **)&jarg1; 
  result = (slice_boxed_uint8_t *) ((arg1)->ptr);
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1slice_1boxed_1uint8_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_slice_boxed_uint8 *arg1 = (Vec_slice_boxed_uint8 *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_slice_boxed_uint8 **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1slice_1boxed_1uint8_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_slice_boxed_uint8 *arg1 = (Vec_slice_boxed_uint8 *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_slice_boxed_uint8 **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1slice_1boxed_1uint8_1t_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_slice_boxed_uint8 *arg1 = (Vec_slice_boxed_uint8 *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_slice_boxed_uint8 **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->cap = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1slice_1boxed_1uint8_1t_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_slice_boxed_uint8 *arg1 = (Vec_slice_boxed_uint8 *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_slice_boxed_uint8 **)&jarg1; 
  result =  ((arg1)->cap);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Vec_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  Vec_slice_boxed_uint8 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (Vec_slice_boxed_uint8 *)new Vec_slice_boxed_uint8();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Vec_slice_boxed_uint8 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Vec_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  Vec_slice_boxed_uint8 *arg1 = (Vec_slice_boxed_uint8 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Vec_slice_boxed_uint8 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdsResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  DocIdsResult *arg1 = (DocIdsResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocIdsResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdsResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  DocIdsResult *arg1 = (DocIdsResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocIdsResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdsResult_1t_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  DocIdsResult *arg1 = (DocIdsResult *) 0 ;
  Vec_slice_boxed_uint8_t *arg2 = (Vec_slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(DocIdsResult **)&jarg1; 
  arg2 = *(Vec_slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->ids = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdsResult_1t_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  DocIdsResult *arg1 = (DocIdsResult *) 0 ;
  Vec_slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocIdsResult **)&jarg1; 
  result = (Vec_slice_boxed_uint8_t *)& ((arg1)->ids);
  *(Vec_slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1DocIdsResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  DocIdsResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DocIdsResult *)new DocIdsResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocIdsResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1DocIdsResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DocIdsResult *arg1 = (DocIdsResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DocIdsResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1evict_1by_1ids(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_slice_boxed_uint8_t arg4 ;
  slice_ref_slice_boxed_uint8_t *argp4 ;
  DocIdsResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  argp4 = *(slice_ref_slice_boxed_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_slice_boxed_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  {
    try {
      result = ditto_collection_evict_by_ids((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocIdsResult_t **)&jresult = new DocIdsResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1evict_1query_1str(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jstring jarg4, jbyteArray jarg5, jobjectArray jarg6, jint jarg7, jlong jarg8) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  char *arg4 = (char *) 0 ;
  slice_ref_uint8_t arg5 ;
  slice_ref_COrderByParam_t arg6 ;
  int32_t arg7 ;
  uint32_t arg8 ;
  DocIdsResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5 == NULL) {
      arg5 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg5, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg5);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg5 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg6 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg6),
    };
    (&arg6)->ptr = (typeof((&arg6)->ptr)) calloc(sizeof(*(&arg6)->ptr), (&arg6)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg6)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg6, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg6)->ptr[i],
        (void *) cptr,
        sizeof((&arg6)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg6)->ptr is to be done within the `freearg` typemap
  }
  arg7 = (int32_t)jarg7; 
  arg8 = (uint32_t)jarg8; 
  {
    try {
      result = ditto_collection_evict_query_str((CDitto const *)arg1,(char const *)arg2,arg3,(char const *)arg4,SWIG_STD_MOVE(arg5),SWIG_STD_MOVE(arg6),arg7,arg8);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocIdsResult_t **)&jresult = new DocIdsResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg5 != NULL) {
      jenv->ReleaseByteArrayElements(jarg5, (jbyte *)(&arg5)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg6)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1CDocument_1ptr_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_CDocument_ptr *arg1 = (Vec_CDocument_ptr *) 0 ;
  CDocument_t **arg2 = (CDocument_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_CDocument_ptr **)&jarg1; 
  arg2 = *(CDocument_t ***)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1CDocument_1ptr_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_CDocument_ptr *arg1 = (Vec_CDocument_ptr *) 0 ;
  CDocument_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_CDocument_ptr **)&jarg1; 
  result = (CDocument_t **) ((arg1)->ptr);
  *(CDocument_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1CDocument_1ptr_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_CDocument_ptr *arg1 = (Vec_CDocument_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_CDocument_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1CDocument_1ptr_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_CDocument_ptr *arg1 = (Vec_CDocument_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_CDocument_ptr **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1CDocument_1ptr_1t_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_CDocument_ptr *arg1 = (Vec_CDocument_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_CDocument_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->cap = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1CDocument_1ptr_1t_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_CDocument_ptr *arg1 = (Vec_CDocument_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_CDocument_ptr **)&jarg1; 
  result =  ((arg1)->cap);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Vec_1CDocument_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  Vec_CDocument_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (Vec_CDocument_ptr *)new Vec_CDocument_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Vec_CDocument_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Vec_1CDocument_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  Vec_CDocument_ptr *arg1 = (Vec_CDocument_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Vec_CDocument_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  DocumentsResult *arg1 = (DocumentsResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentsResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  DocumentsResult *arg1 = (DocumentsResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentsResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsResult_1t_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  DocumentsResult *arg1 = (DocumentsResult *) 0 ;
  Vec_CDocument_ptr_t *arg2 = (Vec_CDocument_ptr_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(DocumentsResult **)&jarg1; 
  arg2 = *(Vec_CDocument_ptr_t **)&jarg2; 
  if (arg1) (arg1)->documents = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsResult_1t_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  DocumentsResult *arg1 = (DocumentsResult *) 0 ;
  Vec_CDocument_ptr_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentsResult **)&jarg1; 
  result = (Vec_CDocument_ptr_t *)& ((arg1)->documents);
  *(Vec_CDocument_ptr_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1DocumentsResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  DocumentsResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DocumentsResult *)new DocumentsResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocumentsResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1DocumentsResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DocumentsResult *arg1 = (DocumentsResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DocumentsResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1exec_1query_1str(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jstring jarg4, jbyteArray jarg5, jobjectArray jarg6, jint jarg7, jlong jarg8) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  char *arg4 = (char *) 0 ;
  slice_ref_uint8_t arg5 ;
  slice_ref_COrderByParam_t arg6 ;
  int32_t arg7 ;
  uint32_t arg8 ;
  DocumentsResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5 == NULL) {
      arg5 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg5, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg5);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg5 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg6 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg6),
    };
    (&arg6)->ptr = (typeof((&arg6)->ptr)) calloc(sizeof(*(&arg6)->ptr), (&arg6)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg6)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg6, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg6)->ptr[i],
        (void *) cptr,
        sizeof((&arg6)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg6)->ptr is to be done within the `freearg` typemap
  }
  arg7 = (int32_t)jarg7; 
  arg8 = (uint32_t)jarg8; 
  {
    try {
      result = ditto_collection_exec_query_str((CDitto const *)arg1,(char const *)arg2,arg3,(char const *)arg4,SWIG_STD_MOVE(arg5),SWIG_STD_MOVE(arg6),arg7,arg8);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocumentsResult_t **)&jresult = new DocumentsResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg5 != NULL) {
      jenv->ReleaseByteArrayElements(jarg5, (jbyte *)(&arg5)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg6)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsIdsResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  DocumentsIdsResult *arg1 = (DocumentsIdsResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentsIdsResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsIdsResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  DocumentsIdsResult *arg1 = (DocumentsIdsResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentsIdsResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsIdsResult_1t_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  DocumentsIdsResult *arg1 = (DocumentsIdsResult *) 0 ;
  Vec_CDocument_ptr_t *arg2 = (Vec_CDocument_ptr_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(DocumentsIdsResult **)&jarg1; 
  arg2 = *(Vec_CDocument_ptr_t **)&jarg2; 
  if (arg1) (arg1)->documents = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsIdsResult_1t_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  DocumentsIdsResult *arg1 = (DocumentsIdsResult *) 0 ;
  Vec_CDocument_ptr_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentsIdsResult **)&jarg1; 
  result = (Vec_CDocument_ptr_t *)& ((arg1)->documents);
  *(Vec_CDocument_ptr_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsIdsResult_1t_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  DocumentsIdsResult *arg1 = (DocumentsIdsResult *) 0 ;
  Vec_slice_boxed_uint8_t *arg2 = (Vec_slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(DocumentsIdsResult **)&jarg1; 
  arg2 = *(Vec_slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->ids = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentsIdsResult_1t_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  DocumentsIdsResult *arg1 = (DocumentsIdsResult *) 0 ;
  Vec_slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentsIdsResult **)&jarg1; 
  result = (Vec_slice_boxed_uint8_t *)& ((arg1)->ids);
  *(Vec_slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1DocumentsIdsResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  DocumentsIdsResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DocumentsIdsResult *)new DocumentsIdsResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocumentsIdsResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1DocumentsIdsResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DocumentsIdsResult *arg1 = (DocumentsIdsResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DocumentsIdsResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1find_1by_1ids(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_slice_boxed_uint8_t arg3 ;
  CReadTransaction_t *arg4 = (CReadTransaction_t *) 0 ;
  slice_ref_slice_boxed_uint8_t *argp3 ;
  DocumentsIdsResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg3_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  argp3 = *(slice_ref_slice_boxed_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_slice_boxed_uint8_t");
    return 0;
  }
  arg3 = *argp3; 
  arg4 = *(CReadTransaction_t **)&jarg4; 
  {
    try {
      result = ditto_collection_find_by_ids((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocumentsIdsResult_t **)&jresult = new DocumentsIdsResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  DocumentResult *arg1 = (DocumentResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  DocumentResult *arg1 = (DocumentResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentResult_1t_1document_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  DocumentResult *arg1 = (DocumentResult *) 0 ;
  CDocument_t *arg2 = (CDocument_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentResult **)&jarg1; 
  arg2 = *(CDocument_t **)&jarg2; 
  if (arg1) (arg1)->document = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocumentResult_1t_1document_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  DocumentResult *arg1 = (DocumentResult *) 0 ;
  CDocument_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocumentResult **)&jarg1; 
  result = (CDocument_t *) ((arg1)->document);
  *(CDocument_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1DocumentResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  DocumentResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DocumentResult *)new DocumentResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocumentResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1DocumentResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DocumentResult *arg1 = (DocumentResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DocumentResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jlong jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  CReadTransaction_t *arg4 = (CReadTransaction_t *) 0 ;
  DocumentResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = *(CReadTransaction_t **)&jarg4; 
  {
    try {
      result = ditto_collection_get((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocumentResult_t **)&jresult = new DocumentResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1get_1with_1write_1transaction(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jlong jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  CWriteTransaction_t *arg4 = (CWriteTransaction_t *) 0 ;
  DocumentResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = *(CWriteTransaction_t **)&jarg4; 
  {
    try {
      result = ditto_collection_get_with_write_transaction((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocumentResult_t **)&jresult = new DocumentResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  DocIdResult *arg1 = (DocIdResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocIdResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  DocIdResult *arg1 = (DocIdResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocIdResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdResult_1t_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  DocIdResult *arg1 = (DocIdResult *) 0 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(DocIdResult **)&jarg1; 
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->id = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DocIdResult_1t_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  DocIdResult *arg1 = (DocIdResult *) 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(DocIdResult **)&jarg1; 
  result = (slice_boxed_uint8_t *)& ((arg1)->id);
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1DocIdResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  DocIdResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DocIdResult *)new DocIdResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocIdResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1DocIdResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DocIdResult *arg1 = (DocIdResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DocIdResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1insert_1value(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jint jarg4, jstring jarg5, jlong jarg6) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  WriteStrategyRs_t arg4 ;
  char *arg5 = (char *) 0 ;
  CWriteTransaction_t *arg6 = (CWriteTransaction_t *) 0 ;
  DocIdResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = (WriteStrategyRs_t)jarg4; 
  arg5 = 0;
  if (jarg5) {
    arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0);
    if (!arg5) return 0;
  }
  arg6 = *(CWriteTransaction_t **)&jarg6; 
  {
    try {
      result = ditto_collection_insert_value((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4,(char const *)arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocIdResult_t **)&jresult = new DocIdResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1remove(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jbyteArray jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_uint8_t arg4 ;
  BoolResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = ditto_collection_remove((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoolResult_t **)&jresult = new BoolResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1remove_1by_1ids(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_slice_boxed_uint8_t arg4 ;
  slice_ref_slice_boxed_uint8_t *argp4 ;
  DocIdsResult_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  argp4 = *(slice_ref_slice_boxed_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_slice_boxed_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  {
    try {
      result = ditto_collection_remove_by_ids((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocIdsResult_t **)&jresult = new DocIdsResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1remove_1query_1str(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jstring jarg4, jbyteArray jarg5, jobjectArray jarg6, jint jarg7, jlong jarg8) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  char *arg4 = (char *) 0 ;
  slice_ref_uint8_t arg5 ;
  slice_ref_COrderByParam_t arg6 ;
  int32_t arg7 ;
  uint32_t arg8 ;
  DocIdsResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5 == NULL) {
      arg5 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg5, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg5);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg5 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg6 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg6),
    };
    (&arg6)->ptr = (typeof((&arg6)->ptr)) calloc(sizeof(*(&arg6)->ptr), (&arg6)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg6)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg6, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg6)->ptr[i],
        (void *) cptr,
        sizeof((&arg6)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg6)->ptr is to be done within the `freearg` typemap
  }
  arg7 = (int32_t)jarg7; 
  arg8 = (uint32_t)jarg8; 
  {
    try {
      result = ditto_collection_remove_query_str((CDitto const *)arg1,(char const *)arg2,arg3,(char const *)arg4,SWIG_STD_MOVE(arg5),SWIG_STD_MOVE(arg6),arg7,arg8);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DocIdsResult_t **)&jresult = new DocIdsResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg5 != NULL) {
      jenv->ReleaseByteArrayElements(jarg5, (jbyte *)(&arg5)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg6)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1update(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  CDocument_t *arg4 = (CDocument_t *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  arg4 = *(CDocument_t **)&jarg4; 
  {
    try {
      result = (int32_t)ditto_collection_update((CDitto const *)arg1,(char const *)arg2,arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1collection_1update_1multiple(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  Vec_CDocument_ptr_t arg4 ;
  Vec_CDocument_ptr_t *argp4 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  argp4 = *(Vec_CDocument_ptr_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Vec_CDocument_ptr_t");
    return 0;
  }
  arg4 = *argp4; 
  {
    try {
      result = (int32_t)ditto_collection_update_multiple((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1disable_1sync_1with_1v3(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (int32_t)ditto_disable_sync_with_v3((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_FS_1COMPONENT_1ROOT_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  FsComponent result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (FsComponent)FS_COMPONENT_ROOT;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1disk_1usage(JNIEnv *jenv, jclass jcls, jlong jarg1, jshort jarg2) {
  jbyteArray jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  FsComponent_t arg2 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = (FsComponent_t)jarg2; 
  {
    try {
      result = ditto_disk_usage((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1cbor(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  {
    try {
      result = ditto_document_cbor((CDocument const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  {
    try {
      ditto_document_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1get_1cbor_1with_1path_1type(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jint jarg3) {
  jlong jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  char *arg2 = (char *) 0 ;
  PathAccessorType_t arg3 ;
  CBORPathResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = (PathAccessorType_t)jarg3; 
  {
    try {
      result = ditto_document_get_cbor_with_path_type((CDocument const *)arg1,(char const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CBORPathResult_t **)&jresult = new CBORPathResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1id(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  {
    try {
      result = ditto_document_id((CDocument const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1id_1query_1compatible(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2) {
  jstring jresult = 0 ;
  slice_ref_uint8_t arg1 ;
  StringPrimitiveFormat_t arg2 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg2 = (StringPrimitiveFormat_t)jarg2; 
  {
    try {
      result = (char *)ditto_document_id_query_compatible(SWIG_STD_MOVE(arg1),arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
  {
    if (result != NULL) {
      ditto_c_string_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1increment_1counter(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jdouble jarg3) {
  jint jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  char *arg2 = (char *) 0 ;
  double arg3 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = (double)jarg3; 
  {
    try {
      result = (int32_t)ditto_document_increment_counter(arg1,(char const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1remove(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jint jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  char *arg2 = (char *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = (int32_t)ditto_document_remove(arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1set_1cbor(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3) {
  jint jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = (int32_t)ditto_document_set_cbor(arg1,(char const *)arg2,SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1set_1cbor_1with_1timestamp(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jlong jarg4) {
  jint jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  uint32_t arg4 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = (uint32_t)jarg4; 
  {
    try {
      result = (int32_t)ditto_document_set_cbor_with_timestamp(arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1document_1update(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2) {
  jint jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = (int32_t)ditto_document_update(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1CDocument_1ptr_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_CDocument_ptr *arg1 = (slice_ref_CDocument_ptr *) 0 ;
  CDocument_t **arg2 = (CDocument_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_CDocument_ptr **)&jarg1; 
  arg2 = *(CDocument_t ***)&jarg2; 
  if (arg1) (arg1)->ptr = (CDocument_t *const *)arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1CDocument_1ptr_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_CDocument_ptr *arg1 = (slice_ref_CDocument_ptr *) 0 ;
  CDocument_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_CDocument_ptr **)&jarg1; 
  result = (CDocument_t **) ((arg1)->ptr);
  *(CDocument_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1CDocument_1ptr_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_CDocument_ptr *arg1 = (slice_ref_CDocument_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_CDocument_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1CDocument_1ptr_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_CDocument_ptr *arg1 = (slice_ref_CDocument_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_CDocument_ptr **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1ref_1CDocument_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_ref_CDocument_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_ref_CDocument_ptr *)new slice_ref_CDocument_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_ref_CDocument_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1ref_1CDocument_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_ref_CDocument_ptr *arg1 = (slice_ref_CDocument_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_ref_CDocument_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_U64Result_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  U64Result *arg1 = (U64Result *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(U64Result **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_U64Result_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  U64Result *arg1 = (U64Result *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(U64Result **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_U64Result_1t_1u64_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) {
  U64Result *arg1 = (U64Result *) 0 ;
  uint64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(U64Result **)&jarg1; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg2) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg2);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg2 = 0;
    if (sz > 0) {
      arg2 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg2 = (arg2 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  if (arg1) (arg1)->u64 = arg2;
}


SWIGEXPORT jobject JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_U64Result_1t_1u64_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jobject jresult = 0 ;
  U64Result *arg1 = (U64Result *) 0 ;
  uint64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(U64Result **)&jarg1; 
  result = (uint64_t) ((arg1)->u64);
  {
    jbyteArray ba = jenv->NewByteArray(9);
    jbyte* bae = jenv->GetByteArrayElements(ba, 0);
    jclass clazz = jenv->FindClass("java/math/BigInteger");
    jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
    jobject bigint;
    int i;
    
    bae[0] = 0;
    for(i=1; i<9; i++ ) {
      bae[i] = (jbyte)(result>>8*(8-i));
    }
    
    jenv->ReleaseByteArrayElements(ba, bae, 0);
    bigint = jenv->NewObject(clazz, mid, ba);
    jenv->DeleteLocalRef(ba);
    jresult = bigint;
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1U64Result_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  U64Result *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (U64Result *)new U64Result();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(U64Result **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1U64Result_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  U64Result *arg1 = (U64Result *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(U64Result **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1documents_1hash(JNIEnv *jenv, jclass jcls, jobjectArray jarg1) {
  jlong jresult = 0 ;
  slice_ref_CDocument_ptr_t arg1 ;
  U64Result_t result;
  
  (void)jenv;
  (void)jcls;
  {
    size_t arr_len = (size_t) jenv->GetArrayLength(jarg1);
    if (arr_len == 0) {
      arg1 = (slice_ref_CDocument_ptr_t) {
        .ptr = (CDocument * const *)0xbad000, .len = 0 
      };
    } else {
      arg1 = (slice_ref_CDocument_ptr_t) {
        .len = arr_len,
      };
      (&arg1)->ptr = (typeof((&arg1)->ptr)) calloc(sizeof(*(&arg1)->ptr), (&arg1)->len);
      // Prepare to call `SWIGTYPE_p_CDocument.getCPtr()` as done above
      jclass jcls_SWIGTYPE_p_CDocument = jenv->FindClass("live/ditto/internal/swig/ffi/SWIGTYPE_p_CDocument")
      
      ;
      do {
        if (!(jcls_SWIGTYPE_p_CDocument != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "jcls_SWIGTYPE_p_CDocument is NULL");              return NULL;          
        }      
      } while (0);
      jmethodID getCPtr = jenv->GetStaticMethodID(jcls_SWIGTYPE_p_CDocument, "getCPtr", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDocument;)J")
      
      
      
      ;
      do {
        if (!(getCPtr != 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get method ID for getCPtr");              return NULL;          
        }      
      } while (0);
      for (size_t i = 0; i < (&arg1)->len; ++i) {
        jobject jobj = jenv->GetObjectArrayElement(jarg1, i);
        ((CDocument_t const * *) (&arg1)->ptr)[i] = (CDocument *)jenv->CallStaticLongMethod(jcls_SWIGTYPE_p_CDocument, getCPtr, jobj)
        
        
        
        ;
        jenv->DeleteLocalRef(jobj);
      }
      // Freeing (&arg1)->ptr is to be done within the `freearg` typemap
    }
  }
  {
    try {
      result = ditto_documents_hash(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(U64Result_t **)&jresult = new U64Result_t(result); 
  {
    if ((&arg1)->len > 0) {
      free((void *) (&arg1)->ptr); // frees calloc
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1documents_1hash_1mnemonic(JNIEnv *jenv, jclass jcls, jobjectArray jarg1) {
  jlong jresult = 0 ;
  slice_ref_CDocument_ptr_t arg1 ;
  BoxedCharPtrResult_t result;
  
  (void)jenv;
  (void)jcls;
  {
    size_t arr_len = (size_t) jenv->GetArrayLength(jarg1);
    if (arr_len == 0) {
      arg1 = (slice_ref_CDocument_ptr_t) {
        .ptr = (CDocument * const *)0xbad000, .len = 0 
      };
    } else {
      arg1 = (slice_ref_CDocument_ptr_t) {
        .len = arr_len,
      };
      (&arg1)->ptr = (typeof((&arg1)->ptr)) calloc(sizeof(*(&arg1)->ptr), (&arg1)->len);
      // Prepare to call `SWIGTYPE_p_CDocument.getCPtr()` as done above
      jclass jcls_SWIGTYPE_p_CDocument = jenv->FindClass("live/ditto/internal/swig/ffi/SWIGTYPE_p_CDocument")
      
      ;
      do {
        if (!(jcls_SWIGTYPE_p_CDocument != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "jcls_SWIGTYPE_p_CDocument is NULL");              return NULL;          
        }      
      } while (0);
      jmethodID getCPtr = jenv->GetStaticMethodID(jcls_SWIGTYPE_p_CDocument, "getCPtr", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_CDocument;)J")
      
      
      
      ;
      do {
        if (!(getCPtr != 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get method ID for getCPtr");              return NULL;          
        }      
      } while (0);
      for (size_t i = 0; i < (&arg1)->len; ++i) {
        jobject jobj = jenv->GetObjectArrayElement(jarg1, i);
        ((CDocument_t const * *) (&arg1)->ptr)[i] = (CDocument *)jenv->CallStaticLongMethod(jcls_SWIGTYPE_p_CDocument, getCPtr, jobj)
        
        
        
        ;
        jenv->DeleteLocalRef(jobj);
      }
      // Freeing (&arg1)->ptr is to be done within the `freearg` typemap
    }
  }
  {
    try {
      result = ditto_documents_hash_mnemonic(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxedCharPtrResult_t **)&jresult = new BoxedCharPtrResult_t(result); 
  {
    if ((&arg1)->len > 0) {
      free((void *) (&arg1)->ptr); // frees calloc
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1error_1message(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)ditto_error_message();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  {
    if (result != NULL) {
      ditto_c_string_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1error_1message_1peek(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)ditto_error_message_peek();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1experimental_1make_1with_1passphrase(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jint jarg3, jstring jarg4, jlong jarg5) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  CIdentityConfig_t *arg2 = (CIdentityConfig_t *) 0 ;
  HistoryTracking_t arg3 ;
  char *arg4 = (char *) 0 ;
  DittoErrorCode_t *arg5 = (DittoErrorCode_t *) 0 ;
  CDitto_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = *(CIdentityConfig_t **)&jarg2; 
  arg3 = (HistoryTracking_t)jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  arg5 = *(DittoErrorCode_t **)&jarg5; 
  {
    try {
      result = (CDitto_t *)ditto_experimental_make_with_passphrase((char const *)arg1,arg2,arg3,(char const *)arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CDitto_t **)&jresult = result; 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      ditto_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1free_1attachment_1handle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  AttachmentHandle_t *arg1 = (AttachmentHandle_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(AttachmentHandle_t **)&jarg1; 
  {
    try {
      ditto_free_attachment_handle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1size_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_boxed_size *arg1 = (slice_boxed_size *) 0 ;
  size_t *arg2 = (size_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_size **)&jarg1; 
  arg2 = *(size_t **)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1size_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_boxed_size *arg1 = (slice_boxed_size *) 0 ;
  size_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_size **)&jarg1; 
  result = (size_t *) ((arg1)->ptr);
  *(size_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1size_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_boxed_size *arg1 = (slice_boxed_size *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_size **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1boxed_1size_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_boxed_size *arg1 = (slice_boxed_size *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_boxed_size **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1boxed_1size_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_boxed_size *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_boxed_size *)new slice_boxed_size();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_boxed_size **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1boxed_1size_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_boxed_size *arg1 = (slice_boxed_size *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_boxed_size **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1free_1indices(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  slice_boxed_size_t arg1 ;
  slice_boxed_size_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  argp1 = *(slice_boxed_size_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_boxed_size_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      ditto_free_indices(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentHandleResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  AttachmentHandleResult *arg1 = (AttachmentHandleResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentHandleResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentHandleResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  AttachmentHandleResult *arg1 = (AttachmentHandleResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentHandleResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentHandleResult_1t_1handle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  AttachmentHandleResult *arg1 = (AttachmentHandleResult *) 0 ;
  AttachmentHandle_t *arg2 = (AttachmentHandle_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentHandleResult **)&jarg1; 
  arg2 = *(AttachmentHandle_t **)&jarg2; 
  if (arg1) (arg1)->handle = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentHandleResult_1t_1handle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AttachmentHandleResult *arg1 = (AttachmentHandleResult *) 0 ;
  AttachmentHandle_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentHandleResult **)&jarg1; 
  result = (AttachmentHandle_t *) ((arg1)->handle);
  *(AttachmentHandle_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1AttachmentHandleResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  AttachmentHandleResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (AttachmentHandleResult *)new AttachmentHandleResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AttachmentHandleResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1AttachmentHandleResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  AttachmentHandleResult *arg1 = (AttachmentHandleResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(AttachmentHandleResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1get_1attachment_1status(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  AttachmentHandleResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = ditto_get_attachment_status(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AttachmentHandleResult_t **)&jresult = new AttachmentHandleResult_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1char_1ptr_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_char_ptr *arg1 = (Vec_char_ptr *) 0 ;
  char **arg2 = (char **) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_char_ptr **)&jarg1; 
  arg2 = *(char ***)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1char_1ptr_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_char_ptr *arg1 = (Vec_char_ptr *) 0 ;
  char **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_char_ptr **)&jarg1; 
  result = (char **) ((arg1)->ptr);
  *(char ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1char_1ptr_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_char_ptr *arg1 = (Vec_char_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_char_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1char_1ptr_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_char_ptr *arg1 = (Vec_char_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_char_ptr **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1char_1ptr_1t_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_char_ptr *arg1 = (Vec_char_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_char_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->cap = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1char_1ptr_1t_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_char_ptr *arg1 = (Vec_char_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_char_ptr **)&jarg1; 
  result =  ((arg1)->cap);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Vec_1char_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  Vec_char_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (Vec_char_ptr *)new Vec_char_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Vec_char_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Vec_1char_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  Vec_char_ptr *arg1 = (Vec_char_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Vec_char_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CollectionNamesResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  CollectionNamesResult *arg1 = (CollectionNamesResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CollectionNamesResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CollectionNamesResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  CollectionNamesResult *arg1 = (CollectionNamesResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CollectionNamesResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CollectionNamesResult_1t_1names_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  CollectionNamesResult *arg1 = (CollectionNamesResult *) 0 ;
  Vec_char_ptr_t *arg2 = (Vec_char_ptr_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(CollectionNamesResult **)&jarg1; 
  arg2 = *(Vec_char_ptr_t **)&jarg2; 
  if (arg1) (arg1)->names = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CollectionNamesResult_1t_1names_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  CollectionNamesResult *arg1 = (CollectionNamesResult *) 0 ;
  Vec_char_ptr_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CollectionNamesResult **)&jarg1; 
  result = (Vec_char_ptr_t *)& ((arg1)->names);
  *(Vec_char_ptr_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1CollectionNamesResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CollectionNamesResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CollectionNamesResult *)new CollectionNamesResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CollectionNamesResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1CollectionNamesResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CollectionNamesResult *arg1 = (CollectionNamesResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CollectionNamesResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1get_1collection_1names(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  CollectionNamesResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = ditto_get_collection_names((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CollectionNamesResult_t **)&jresult = new CollectionNamesResult_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentDataResult_1t_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyte jarg2) {
  AttachmentDataResult *arg1 = (AttachmentDataResult *) 0 ;
  int8_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentDataResult **)&jarg1; 
  arg2 = (int8_t)jarg2; 
  if (arg1) (arg1)->status = arg2;
}


SWIGEXPORT jbyte JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentDataResult_1t_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jbyte jresult = 0 ;
  AttachmentDataResult *arg1 = (AttachmentDataResult *) 0 ;
  int8_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentDataResult **)&jarg1; 
  result = (int8_t) ((arg1)->status);
  jresult = (jbyte)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentDataResult_1t_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  AttachmentDataResult *arg1 = (AttachmentDataResult *) 0 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(AttachmentDataResult **)&jarg1; 
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->data = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentDataResult_1t_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  AttachmentDataResult *arg1 = (AttachmentDataResult *) 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(AttachmentDataResult **)&jarg1; 
  result = (slice_boxed_uint8_t *)& ((arg1)->data);
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1AttachmentDataResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  AttachmentDataResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (AttachmentDataResult *)new AttachmentDataResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AttachmentDataResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1AttachmentDataResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  AttachmentDataResult *arg1 = (AttachmentDataResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(AttachmentDataResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1get_1complete_1attachment_1data(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  AttachmentHandle_t *arg2 = (AttachmentHandle_t *) 0 ;
  AttachmentDataResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(AttachmentHandle_t **)&jarg2; 
  {
    try {
      result = ditto_get_complete_attachment_data((CDitto const *)arg1,(AttachmentHandle const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(AttachmentDataResult_t **)&jresult = new AttachmentDataResult_t(result); 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1get_1complete_1attachment_1path(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  AttachmentHandle_t *arg2 = (AttachmentHandle_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(AttachmentHandle_t **)&jarg2; 
  {
    try {
      result = (char *)ditto_get_complete_attachment_path((CDitto const *)arg1,(AttachmentHandle const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  {
    if (result != NULL) {
      ditto_c_string_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1get_1sdk_1version(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)ditto_get_sdk_version();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  {
    if (result != NULL) {
      ditto_c_string_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_IdentityConfigResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  IdentityConfigResult *arg1 = (IdentityConfigResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(IdentityConfigResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_IdentityConfigResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  IdentityConfigResult *arg1 = (IdentityConfigResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(IdentityConfigResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_IdentityConfigResult_1t_1identity_1config_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  IdentityConfigResult *arg1 = (IdentityConfigResult *) 0 ;
  CIdentityConfig_t *arg2 = (CIdentityConfig_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(IdentityConfigResult **)&jarg1; 
  arg2 = *(CIdentityConfig_t **)&jarg2; 
  if (arg1) (arg1)->identity_config = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_IdentityConfigResult_1t_1identity_1config_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  IdentityConfigResult *arg1 = (IdentityConfigResult *) 0 ;
  CIdentityConfig_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(IdentityConfigResult **)&jarg1; 
  result = (CIdentityConfig_t *) ((arg1)->identity_config);
  *(CIdentityConfig_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1IdentityConfigResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  IdentityConfigResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (IdentityConfigResult *)new IdentityConfigResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(IdentityConfigResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1IdentityConfigResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  IdentityConfigResult *arg1 = (IdentityConfigResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(IdentityConfigResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1identity_1config_1make_1manual(JNIEnv *jenv, jclass jcls, jstring jarg1) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  IdentityConfigResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  {
    try {
      result = ditto_identity_config_make_manual((char const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(IdentityConfigResult_t **)&jresult = new IdentityConfigResult_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1identity_1config_1make_1manual_1v0(JNIEnv *jenv, jclass jcls, jstring jarg1) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  IdentityConfigResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  {
    try {
      result = ditto_identity_config_make_manual_v0((char const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(IdentityConfigResult_t **)&jresult = new IdentityConfigResult_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1identity_1config_1make_1offline_1playground(JNIEnv *jenv, jclass jcls, jstring jarg1, jobject jarg2) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  uint64_t arg2 ;
  IdentityConfigResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg2) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return 0;
    }
    clazz = jenv->GetObjectClass(jarg2);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg2 = 0;
    if (sz > 0) {
      arg2 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg2 = (arg2 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    try {
      result = ditto_identity_config_make_offline_playground((char const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(IdentityConfigResult_t **)&jresult = new IdentityConfigResult_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1identity_1config_1make_1online_1playground(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  IdentityConfigResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    try {
      result = ditto_identity_config_make_online_playground((char const *)arg1,(char const *)arg2,(char const *)arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(IdentityConfigResult_t **)&jresult = new IdentityConfigResult_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1identity_1config_1make_1online_1with_1authentication(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  IdentityConfigResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = ditto_identity_config_make_online_with_authentication((char const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(IdentityConfigResult_t **)&jresult = new IdentityConfigResult_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1identity_1config_1make_1shared_1key(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jobject jarg3) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  char *arg2 = (char *) 0 ;
  uint64_t arg3 ;
  IdentityConfigResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg3) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return 0;
    }
    clazz = jenv->GetObjectClass(jarg3);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg3 = 0;
    if (sz > 0) {
      arg3 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg3 = (arg3 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  {
    try {
      result = ditto_identity_config_make_shared_key((char const *)arg1,(char const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(IdentityConfigResult_t **)&jresult = new IdentityConfigResult_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1init_1sdk_1version(JNIEnv *jenv, jclass jcls, jint jarg1, jint jarg2, jstring jarg3) {
  Platform_t arg1 ;
  Language_t arg2 ;
  char *arg3 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (Platform_t)jarg1; 
  arg2 = (Language_t)jarg2; 
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  {
    try {
      ditto_init_sdk_version(arg1,arg2,(char const *)arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_uint8_18_1array_1t_1idx_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  uint8_8_array_t *arg1 = (uint8_8_array_t *) 0 ;
  uint8_t *arg2 = (uint8_t *) (uint8_t *)0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(uint8_8_array_t **)&jarg1; 
  arg2 = *(uint8_t **)&jarg2; 
  {
    size_t ii;
    uint8_t *b = (uint8_t *) arg1->idx;
    for (ii = 0; ii < (size_t)8; ii++) b[ii] = *((uint8_t *) arg2 + ii);
  }
  
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_uint8_18_1array_1t_1idx_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  uint8_8_array_t *arg1 = (uint8_8_array_t *) 0 ;
  uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(uint8_8_array_t **)&jarg1; 
  result = (uint8_t *)(uint8_t *) ((arg1)->idx);
  *(uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1uint8_18_1array_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  uint8_8_array_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (uint8_8_array_t *)new uint8_8_array_t();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(uint8_8_array_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1uint8_18_1array_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  uint8_8_array_t *arg1 = (uint8_8_array_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(uint8_8_array_t **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1insert_1timeseries_1event(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jstring jarg4, jbyteArray jarg5, jlong jarg6) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  uint8_8_array_t arg2 ;
  uint32_t arg3 ;
  char *arg4 = (char *) 0 ;
  slice_ref_uint8_t arg5 ;
  CWriteTransaction_t *arg6 = (CWriteTransaction_t *) 0 ;
  uint8_8_array_t *argp2 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(CDitto_t **)&jarg1; 
  argp2 = *(uint8_8_array_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null uint8_8_array_t");
    return 0;
  }
  arg2 = *argp2; 
  arg3 = (uint32_t)jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5 == NULL) {
      arg5 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg5, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg5);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg5 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg6 = *(CWriteTransaction_t **)&jarg6; 
  {
    try {
      result = (int32_t)ditto_insert_timeseries_event((CDitto const *)arg1,SWIG_STD_MOVE(arg2),arg3,(char const *)arg4,SWIG_STD_MOVE(arg5),arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg5 != NULL) {
      jenv->ReleaseByteArrayElements(jarg5, (jbyte *)(&arg5)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1invalidate_1tcp_1listeners(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      ditto_invalidate_tcp_listeners((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1is_1encrypted(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (bool)ditto_is_encrypted((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  Vec_CDocument_ptr_t *arg2 = (Vec_CDocument_ptr_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(c_cb_params **)&jarg1; 
  arg2 = *(Vec_CDocument_ptr_t **)&jarg2; 
  if (arg1) (arg1)->documents = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  Vec_CDocument_ptr_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  result = (Vec_CDocument_ptr_t *)& ((arg1)->documents);
  *(Vec_CDocument_ptr_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1is_1initial_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  if (arg1) (arg1)->is_initial = arg2;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1is_1initial_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  result = (bool) ((arg1)->is_initial);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1old_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  Vec_CDocument_ptr_t *arg2 = (Vec_CDocument_ptr_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(c_cb_params **)&jarg1; 
  arg2 = *(Vec_CDocument_ptr_t **)&jarg2; 
  if (arg1) (arg1)->old_documents = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1old_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  Vec_CDocument_ptr_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  result = (Vec_CDocument_ptr_t *)& ((arg1)->old_documents);
  *(Vec_CDocument_ptr_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1insertions_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *arg2 = (slice_boxed_size_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(c_cb_params **)&jarg1; 
  arg2 = *(slice_boxed_size_t **)&jarg2; 
  if (arg1) (arg1)->insertions = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1insertions_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  result = (slice_boxed_size_t *)& ((arg1)->insertions);
  *(slice_boxed_size_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1deletions_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *arg2 = (slice_boxed_size_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(c_cb_params **)&jarg1; 
  arg2 = *(slice_boxed_size_t **)&jarg2; 
  if (arg1) (arg1)->deletions = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1deletions_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  result = (slice_boxed_size_t *)& ((arg1)->deletions);
  *(slice_boxed_size_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1updates_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *arg2 = (slice_boxed_size_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(c_cb_params **)&jarg1; 
  arg2 = *(slice_boxed_size_t **)&jarg2; 
  if (arg1) (arg1)->updates = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1updates_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  result = (slice_boxed_size_t *)& ((arg1)->updates);
  *(slice_boxed_size_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1moves_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *arg2 = (slice_boxed_size_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(c_cb_params **)&jarg1; 
  arg2 = *(slice_boxed_size_t **)&jarg2; 
  if (arg1) (arg1)->moves = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_c_1cb_1params_1t_1moves_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  slice_boxed_size_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(c_cb_params **)&jarg1; 
  result = (slice_boxed_size_t *)& ((arg1)->moves);
  *(slice_boxed_size_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1c_1cb_1params_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  c_cb_params *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (c_cb_params *)new c_cb_params();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(c_cb_params **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1c_1cb_1params_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  c_cb_params *arg1 = (c_cb_params *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(c_cb_params **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_I64Result_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  I64Result *arg1 = (I64Result *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(I64Result **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_I64Result_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  I64Result *arg1 = (I64Result *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(I64Result **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_I64Result_1t_1i64_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  I64Result *arg1 = (I64Result *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(I64Result **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  if (arg1) (arg1)->i64 = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_I64Result_1t_1i64_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  I64Result *arg1 = (I64Result *) 0 ;
  int64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(I64Result **)&jarg1; 
  result = (int64_t) ((arg1)->i64);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1I64Result_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  I64Result *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (I64Result *)new I64Result();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(I64Result **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1I64Result_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  I64Result *arg1 = (I64Result *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(I64Result **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1live_1query_1register_1str(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jbyteArray jarg4, jobjectArray jarg5, jint jarg6, jlong jarg7, jint jarg8, jlong jarg9, jlong jarg10, jlong jarg11, jlong jarg12) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_COrderByParam_t arg5 ;
  int32_t arg6 ;
  uint32_t arg7 ;
  LiveQueryAvailability_t arg8 ;
  void *arg9 = (void *) 0 ;
  void (*arg10)(void *) = (void (*)(void *)) 0 ;
  void (*arg11)(void *) = (void (*)(void *)) 0 ;
  void (*arg12)(void *,c_cb_params_t) = (void (*)(void *,c_cb_params_t)) 0 ;
  I64Result_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg5 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg5),
    };
    (&arg5)->ptr = (typeof((&arg5)->ptr)) calloc(sizeof(*(&arg5)->ptr), (&arg5)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg5)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg5, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg5)->ptr[i],
        (void *) cptr,
        sizeof((&arg5)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg5)->ptr is to be done within the `freearg` typemap
  }
  arg6 = (int32_t)jarg6; 
  arg7 = (uint32_t)jarg7; 
  arg8 = (LiveQueryAvailability_t)jarg8; 
  arg9 = *(void **)&jarg9; 
  arg10 = *(void (**)(void *))&jarg10; 
  arg11 = *(void (**)(void *))&jarg11; 
  arg12 = *(void (**)(void *,c_cb_params_t))&jarg12; 
  {
    try {
      result = ditto_live_query_register_str((CDitto const *)arg1,(char const *)arg2,(char const *)arg3,SWIG_STD_MOVE(arg4),SWIG_STD_MOVE(arg5),arg6,arg7,arg8,arg9,arg10,arg11,arg12);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(I64Result_t **)&jresult = new I64Result_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg5)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1live_1query_1signal_1available_1next(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      ditto_live_query_signal_available_next((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1live_1query_1start(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  int64_t arg2 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      result = (int32_t)ditto_live_query_start((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1live_1query_1stop(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      ditto_live_query_stop((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_C_1LOG_1LEVEL_1ERROR_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  CLogLevel result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CLogLevel)C_LOG_LEVEL_ERROR;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1log(JNIEnv *jenv, jclass jcls, jint jarg1, jstring jarg2) {
  CLogLevel_t arg1 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (CLogLevel_t)jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      ditto_log(arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1emoji_1headings_1enabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
  bool arg1 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = jarg1 ? true : false; 
  {
    try {
      ditto_logger_emoji_headings_enabled(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1emoji_1headings_1enabled_1get(JNIEnv *jenv, jclass jcls) {
  jboolean jresult = 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (bool)ditto_logger_emoji_headings_enabled_get();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1enabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
  bool arg1 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = jarg1 ? true : false; 
  {
    try {
      ditto_logger_enabled(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1enabled_1get(JNIEnv *jenv, jclass jcls) {
  jboolean jresult = 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (bool)ditto_logger_enabled_get();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1init(JNIEnv *jenv, jclass jcls) {
  (void)jenv;
  (void)jcls;
  {
    try {
      ditto_logger_init();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1minimum_1log_1level(JNIEnv *jenv, jclass jcls, jint jarg1) {
  CLogLevel_t arg1 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (CLogLevel_t)jarg1; 
  {
    try {
      ditto_logger_minimum_log_level(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1minimum_1log_1level_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  CLogLevel_t result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CLogLevel_t)ditto_logger_minimum_log_level_get();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1set_1custom_1log_1cb(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  void (*arg1)(CLogLevel_t,char *) = (void (*)(CLogLevel_t,char *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void (**)(CLogLevel_t,char *))&jarg1; 
  {
    try {
      ditto_logger_set_custom_log_cb(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jbyte JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1logger_1set_1log_1file(JNIEnv *jenv, jclass jcls, jstring jarg1) {
  jbyte jresult = 0 ;
  char *arg1 = (char *) 0 ;
  int8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  {
    try {
      result = (int8_t)ditto_logger_set_log_file((char const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jbyte)result; 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1make(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jint jarg3) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  CIdentityConfig_t *arg2 = (CIdentityConfig_t *) 0 ;
  HistoryTracking_t arg3 ;
  CDitto_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = *(CIdentityConfig_t **)&jarg2; 
  arg3 = (HistoryTracking_t)jarg3; 
  {
    try {
      result = (CDitto_t *)ditto_make((char const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CDitto_t **)&jresult = result; 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1mdns_1transport_1free_1handle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_mdns_transport_free_handle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CAttachment_1t_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  CAttachment *arg1 = (CAttachment *) 0 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(CAttachment **)&jarg1; 
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->id = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CAttachment_1t_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  CAttachment *arg1 = (CAttachment *) 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CAttachment **)&jarg1; 
  result = (slice_boxed_uint8_t *)& ((arg1)->id);
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CAttachment_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) {
  CAttachment *arg1 = (CAttachment *) 0 ;
  uint64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CAttachment **)&jarg1; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg2) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg2);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg2 = 0;
    if (sz > 0) {
      arg2 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg2 = (arg2 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jobject JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CAttachment_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jobject jresult = 0 ;
  CAttachment *arg1 = (CAttachment *) 0 ;
  uint64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CAttachment **)&jarg1; 
  result = (uint64_t) ((arg1)->len);
  {
    jbyteArray ba = jenv->NewByteArray(9);
    jbyte* bae = jenv->GetByteArrayElements(ba, 0);
    jclass clazz = jenv->FindClass("java/math/BigInteger");
    jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
    jobject bigint;
    int i;
    
    bae[0] = 0;
    for(i=1; i<9; i++ ) {
      bae[i] = (jbyte)(result>>8*(8-i));
    }
    
    jenv->ReleaseByteArrayElements(ba, bae, 0);
    bigint = jenv->NewObject(clazz, mid, ba);
    jenv->DeleteLocalRef(ba);
    jresult = bigint;
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CAttachment_1t_1handle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  CAttachment *arg1 = (CAttachment *) 0 ;
  AttachmentHandle_t *arg2 = (AttachmentHandle_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CAttachment **)&jarg1; 
  arg2 = *(AttachmentHandle_t **)&jarg2; 
  if (arg1) (arg1)->handle = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CAttachment_1t_1handle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  CAttachment *arg1 = (CAttachment *) 0 ;
  AttachmentHandle_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CAttachment **)&jarg1; 
  result = (AttachmentHandle_t *) ((arg1)->handle);
  *(AttachmentHandle_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1CAttachment_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CAttachment *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CAttachment *)new CAttachment();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CAttachment **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1CAttachment_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CAttachment *arg1 = (CAttachment *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CAttachment **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1new_1attachment_1from_1bytes(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2, jlong jarg3, jobject jarg3_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  CAttachment_t *arg3 = (CAttachment_t *) 0 ;
  uint32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg3_;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg3 = *(CAttachment_t **)&jarg3; 
  {
    try {
      result = (uint32_t)ditto_new_attachment_from_bytes((CDitto const *)arg1,SWIG_STD_MOVE(arg2),arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ATTACHMENT_1FILE_1OPERATION_1COPY_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  AttachmentFileOperation result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (AttachmentFileOperation)ATTACHMENT_FILE_OPERATION_COPY;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1new_1attachment_1from_1file(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  AttachmentFileOperation_t arg3 ;
  CAttachment_t *arg4 = (CAttachment_t *) 0 ;
  uint32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = (AttachmentFileOperation_t)jarg3; 
  arg4 = *(CAttachment_t **)&jarg4; 
  {
    try {
      result = (uint32_t)ditto_new_attachment_from_file((CDitto const *)arg1,(char const *)arg2,arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1presence_1v1(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (char *)ditto_presence_v1((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1presence_1v2(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (char *)ditto_presence_v2((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1presence_1v3(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (char *)ditto_presence_v3((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1char_1const_1ptr_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_char_const_ptr *arg1 = (slice_ref_char_const_ptr *) 0 ;
  char **arg2 = (char **) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_char_const_ptr **)&jarg1; 
  arg2 = *(char ***)&jarg2; 
  if (arg1) (arg1)->ptr = (char const *const *)arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1char_1const_1ptr_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_char_const_ptr *arg1 = (slice_ref_char_const_ptr *) 0 ;
  char **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_char_const_ptr **)&jarg1; 
  result = (char **) ((arg1)->ptr);
  *(char ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1char_1const_1ptr_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_char_const_ptr *arg1 = (slice_ref_char_const_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_char_const_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1char_1const_1ptr_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_char_const_ptr *arg1 = (slice_ref_char_const_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_char_const_ptr **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1ref_1char_1const_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_ref_char_const_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_ref_char_const_ptr *)new slice_ref_char_const_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_ref_char_const_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1ref_1char_1const_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_ref_char_const_ptr *arg1 = (slice_ref_char_const_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_ref_char_const_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1queries_1hash(JNIEnv *jenv, jclass jcls, jlong jarg1, jobjectArray jarg2, jobjectArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_char_const_ptr_t arg2 ;
  slice_ref_char_const_ptr_t arg3 ;
  U64Result_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    arg2 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg2),
    };
    (&arg2)->ptr = (typeof((&arg2)->ptr)) calloc(sizeof(*(&arg2)->ptr), (&arg2)->len);
    for (size_t i = 0; i < (&arg2)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg2, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg2)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg2)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    arg3 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg3),
    };
    (&arg3)->ptr = (typeof((&arg3)->ptr)) calloc(sizeof(*(&arg3)->ptr), (&arg3)->len);
    for (size_t i = 0; i < (&arg3)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg3, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg3)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg3)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    try {
      result = ditto_queries_hash((CDitto const *)arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(U64Result_t **)&jresult = new U64Result_t(result); 
  {
    while ((&arg2)->len > 0) {
      --(&arg2)->len;
      free((void *) (&arg2)->ptr[(&arg2)->len]); // frees strdup
    }
    free((void *) (&arg2)->ptr); // frees calloc
  }
  {
    while ((&arg3)->len > 0) {
      --(&arg3)->len;
      free((void *) (&arg3)->ptr[(&arg3)->len]); // frees strdup
    }
    free((void *) (&arg3)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1queries_1hash_1mnemonic(JNIEnv *jenv, jclass jcls, jlong jarg1, jobjectArray jarg2, jobjectArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_char_const_ptr_t arg2 ;
  slice_ref_char_const_ptr_t arg3 ;
  BoxedCharPtrResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    arg2 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg2),
    };
    (&arg2)->ptr = (typeof((&arg2)->ptr)) calloc(sizeof(*(&arg2)->ptr), (&arg2)->len);
    for (size_t i = 0; i < (&arg2)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg2, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg2)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg2)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    arg3 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg3),
    };
    (&arg3)->ptr = (typeof((&arg3)->ptr)) calloc(sizeof(*(&arg3)->ptr), (&arg3)->len);
    for (size_t i = 0; i < (&arg3)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg3, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg3)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg3)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    try {
      result = ditto_queries_hash_mnemonic((CDitto const *)arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxedCharPtrResult_t **)&jresult = new BoxedCharPtrResult_t(result); 
  {
    while ((&arg2)->len > 0) {
      --(&arg2)->len;
      free((void *) (&arg2)->ptr[(&arg2)->len]); // frees strdup
    }
    free((void *) (&arg2)->ptr); // frees calloc
  }
  {
    while ((&arg3)->len > 0) {
      --(&arg3)->len;
      free((void *) (&arg3)->ptr[(&arg3)->len]); // frees strdup
    }
    free((void *) (&arg3)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CReadTransactionResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  CReadTransactionResult *arg1 = (CReadTransactionResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CReadTransactionResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CReadTransactionResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  CReadTransactionResult *arg1 = (CReadTransactionResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CReadTransactionResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CReadTransactionResult_1t_1txn_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  CReadTransactionResult *arg1 = (CReadTransactionResult *) 0 ;
  CReadTransaction_t *arg2 = (CReadTransaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CReadTransactionResult **)&jarg1; 
  arg2 = *(CReadTransaction_t **)&jarg2; 
  if (arg1) (arg1)->txn = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CReadTransactionResult_1t_1txn_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  CReadTransactionResult *arg1 = (CReadTransactionResult *) 0 ;
  CReadTransaction_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CReadTransactionResult **)&jarg1; 
  result = (CReadTransaction_t *) ((arg1)->txn);
  *(CReadTransaction_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1CReadTransactionResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CReadTransactionResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CReadTransactionResult *)new CReadTransactionResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CReadTransactionResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1CReadTransactionResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CReadTransactionResult *arg1 = (CReadTransactionResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CReadTransactionResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1read_1transaction(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  CReadTransactionResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = ditto_read_transaction((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CReadTransactionResult_t **)&jresult = new CReadTransactionResult_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1read_1transaction_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CReadTransaction_t *arg1 = (CReadTransaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CReadTransaction_t **)&jarg1; 
  {
    try {
      ditto_read_transaction_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1register_1disk_1usage_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jshort jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jlong jarg6) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  FsComponent_t arg2 ;
  void *arg3 = (void *) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *) = (void (*)(void *)) 0 ;
  void (*arg6)(void *,slice_ref_uint8_t) = (void (*)(void *,slice_ref_uint8_t)) 0 ;
  DiskUsageObserver_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = (FsComponent_t)jarg2; 
  arg3 = *(void **)&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *))&jarg5; 
  arg6 = *(void (**)(void *,slice_ref_uint8_t))&jarg6; 
  {
    try {
      result = (DiskUsageObserver_t *)ditto_register_disk_usage_callback((CDitto const *)arg1,arg2,arg3,arg4,arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DiskUsageObserver_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1register_1presence_1callback_1v3(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  void *arg2 = (void *) 0 ;
  void (*arg3)(void *) = (void (*)(void *)) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  arg3 = *(void (**)(void *))&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *,char const *))&jarg5; 
  {
    try {
      ditto_register_presence_callback_v3((CDitto const *)arg1,arg2,arg3,arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1register_1presence_1callback_1v3_1owned(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  void *arg2 = (void *) 0 ;
  void (*arg3)(void *) = (void (*)(void *)) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *,char *) = (void (*)(void *,char *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  arg3 = *(void (**)(void *))&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *,char *))&jarg5; 
  {
    try {
      ditto_register_presence_callback_v3_owned((CDitto const *)arg1,arg2,arg3,arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1register_1presence_1v1_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  void *arg2 = (void *) 0 ;
  void (*arg3)(void *) = (void (*)(void *)) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  arg3 = *(void (**)(void *))&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *,char const *))&jarg5; 
  {
    try {
      ditto_register_presence_v1_callback((CDitto const *)arg1,arg2,arg3,arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1register_1presence_1v2_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  void *arg2 = (void *) 0 ;
  void (*arg3)(void *) = (void (*)(void *)) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *,char const *) = (void (*)(void *,char const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  arg3 = *(void (**)(void *))&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *,char const *))&jarg5; 
  {
    try {
      ditto_register_presence_v2_callback((CDitto const *)arg1,arg2,arg3,arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1register_1transport_1condition_1changed_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  void *arg2 = (void *) 0 ;
  void (*arg3)(void *) = (void (*)(void *)) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *,ConditionSource_t,TransportCondition_t) = (void (*)(void *,ConditionSource_t,TransportCondition_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  arg3 = *(void (**)(void *))&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *,ConditionSource_t,TransportCondition_t))&jarg5; 
  {
    try {
      ditto_register_transport_condition_changed_callback((CDitto const *)arg1,arg2,arg3,arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1release_1disk_1usage_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DiskUsageObserver_t *arg1 = (DiskUsageObserver_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DiskUsageObserver_t **)&jarg1; 
  {
    try {
      ditto_release_disk_usage_callback(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1remove_1subscription(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jbyteArray jarg4, jobjectArray jarg5, jint jarg6, jlong jarg7) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_COrderByParam_t arg5 ;
  int32_t arg6 ;
  uint32_t arg7 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg5 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg5),
    };
    (&arg5)->ptr = (typeof((&arg5)->ptr)) calloc(sizeof(*(&arg5)->ptr), (&arg5)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg5)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg5, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg5)->ptr[i],
        (void *) cptr,
        sizeof((&arg5)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg5)->ptr is to be done within the `freearg` typemap
  }
  arg6 = (int32_t)jarg6; 
  arg7 = (uint32_t)jarg7; 
  {
    try {
      result = (int32_t)ditto_remove_subscription((CDitto const *)arg1,(char const *)arg2,(char const *)arg3,SWIG_STD_MOVE(arg4),SWIG_STD_MOVE(arg5),arg6,arg7);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg5)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CancelTokenResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  CancelTokenResult *arg1 = (CancelTokenResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CancelTokenResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CancelTokenResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  CancelTokenResult *arg1 = (CancelTokenResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CancelTokenResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CancelTokenResult_1t_1cancel_1token_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  CancelTokenResult *arg1 = (CancelTokenResult *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CancelTokenResult **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  if (arg1) (arg1)->cancel_token = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CancelTokenResult_1t_1cancel_1token_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  CancelTokenResult *arg1 = (CancelTokenResult *) 0 ;
  int64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CancelTokenResult **)&jarg1; 
  result = (int64_t) ((arg1)->cancel_token);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1CancelTokenResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CancelTokenResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CancelTokenResult *)new CancelTokenResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CancelTokenResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1CancelTokenResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CancelTokenResult *arg1 = (CancelTokenResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CancelTokenResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1resolve_1attachment(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jlong jarg6, jlong jarg7, jlong jarg8) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  void *arg3 = (void *) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *) = (void (*)(void *)) 0 ;
  void (*arg6)(void *,AttachmentHandle_t *) = (void (*)(void *,AttachmentHandle_t *)) 0 ;
  void (*arg7)(void *,uint64_t,uint64_t) = (void (*)(void *,uint64_t,uint64_t)) 0 ;
  void (*arg8)(void *) = (void (*)(void *)) 0 ;
  CancelTokenResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg3 = *(void **)&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *))&jarg5; 
  arg6 = *(void (**)(void *,AttachmentHandle_t *))&jarg6; 
  arg7 = *(void (**)(void *,uint64_t,uint64_t))&jarg7; 
  arg8 = *(void (**)(void *))&jarg8; 
  {
    try {
      result = ditto_resolve_attachment((CDitto const *)arg1,SWIG_STD_MOVE(arg2),arg3,arg4,arg5,arg6,arg7,arg8);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CancelTokenResult_t **)&jresult = new CancelTokenResult_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1run_1garbage_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  uint32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (uint32_t)ditto_run_garbage_collection((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1android_1is_1inited(JNIEnv *jenv, jclass jcls) {
  jboolean jresult = 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (bool)ditto_sdk_transports_android_is_inited();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1android_1missing_1permissions(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)ditto_sdk_transports_android_missing_permissions();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1android_1missing_1permissions_1jni_1array(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (void *)ditto_sdk_transports_android_missing_permissions_jni_array();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1android_1shutdown(JNIEnv *jenv, jclass jcls) {
  (void)jenv;
  (void)jcls;
  {
    try {
      ditto_sdk_transports_android_shutdown();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1SDK_1TRANSPORTS_1ERROR_1NONE_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoSdkTransportsError result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError)DITTO_SDK_TRANSPORTS_ERROR_NONE;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1SDK_1TRANSPORTS_1ERROR_1GENERIC_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoSdkTransportsError result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError)DITTO_SDK_TRANSPORTS_ERROR_GENERIC;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1SDK_1TRANSPORTS_1ERROR_1UNAVAILABLE_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoSdkTransportsError result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError)DITTO_SDK_TRANSPORTS_ERROR_UNAVAILABLE;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1SDK_1TRANSPORTS_1ERROR_1MISSING_1BLUETOOTH_1INFO_1PLIST_1ENTRY_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoSdkTransportsError result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError)DITTO_SDK_TRANSPORTS_ERROR_MISSING_BLUETOOTH_INFO_PLIST_ENTRY;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1SDK_1TRANSPORTS_1ERROR_1MISSING_1BLUETOOTH_1U_1I_1BACKGROUND_1MODES_1INFO_1PLIST_1ENTRY_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoSdkTransportsError result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError)DITTO_SDK_TRANSPORTS_ERROR_MISSING_BLUETOOTH_U_I_BACKGROUND_MODES_INFO_PLIST_ENTRY;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1SDK_1TRANSPORTS_1ERROR_1MISSING_1LOCAL_1NETWORK_1INFO_1PLIST_1ENTRY_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoSdkTransportsError result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError)DITTO_SDK_TRANSPORTS_ERROR_MISSING_LOCAL_NETWORK_INFO_PLIST_ENTRY;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DITTO_1SDK_1TRANSPORTS_1ERROR_1MISSING_1BONJOUR_1SERVICES_1INFO_1PLIST_1ENTRY_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  DittoSdkTransportsError result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError)DITTO_SDK_TRANSPORTS_ERROR_MISSING_BONJOUR_SERVICES_INFO_PLIST_ENTRY;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1error_1description(JNIEnv *jenv, jclass jcls, jint jarg1) {
  jstring jresult = 0 ;
  DittoSdkTransportsError_t arg1 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (DittoSdkTransportsError_t)jarg1; 
  {
    try {
      result = (char *)ditto_sdk_transports_error_description(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1error_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  DittoSdkTransportsError_t *arg1 = (DittoSdkTransportsError_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DittoSdkTransportsError_t **)&jarg1; 
  {
    try {
      ditto_sdk_transports_error_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1error_1new(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  DittoSdkTransportsError_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (DittoSdkTransportsError_t *)ditto_sdk_transports_error_new();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(DittoSdkTransportsError_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1error_1value(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  DittoSdkTransportsError_t *arg1 = (DittoSdkTransportsError_t *) 0 ;
  DittoSdkTransportsError_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DittoSdkTransportsError_t **)&jarg1; 
  {
    try {
      result = (DittoSdkTransportsError_t)ditto_sdk_transports_error_value((enum DittoSdkTransportsError const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1init(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  DittoSdkTransportsError_t *arg1 = (DittoSdkTransportsError_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(DittoSdkTransportsError_t **)&jarg1; 
  {
    try {
      result = (bool)ditto_sdk_transports_init(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sdk_1transports_1set_1android_1context(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jboolean jresult = 0 ;
  void *arg1 = (void *) 0 ;
  void *arg2 = (void *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(void **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  {
    try {
      result = (bool)ditto_sdk_transports_set_android_context(arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1set_1device_1name(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = (char *)ditto_set_device_name((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    if (result != NULL) {
      ditto_c_string_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1shutdown(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      ditto_shutdown((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1small_1peer_1info_1get_1is_1enabled(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (bool)ditto_small_peer_info_get_is_enabled((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1small_1peer_1info_1get_1metadata(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (char *)ditto_small_peer_info_get_metadata((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1small_1peer_1info_1get_1sync_1scope(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  DittoSmallPeerInfoSyncScope_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (DittoSmallPeerInfoSyncScope_t)ditto_small_peer_info_get_sync_scope((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1small_1peer_1info_1set_1enabled(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  {
    try {
      ditto_small_peer_info_set_enabled((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1small_1peer_1info_1set_1metadata(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = (int32_t)ditto_small_peer_info_set_metadata((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1small_1peer_1info_1set_1sync_1scope(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  DittoSmallPeerInfoSyncScope_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = (DittoSmallPeerInfoSyncScope_t)jarg2; 
  {
    try {
      ditto_small_peer_info_set_sync_scope((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1sparse_1vec_1documents_1free(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  Vec_CDocument_ptr_t arg1 ;
  Vec_CDocument_ptr_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  argp1 = *(Vec_CDocument_ptr_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Vec_CDocument_ptr_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      ditto_sparse_vec_documents_free(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1transports_1ble_1advertisement_1heard(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jbyteArray jarg3, jboolean jarg4, jbyteArray jarg5, jfloat jarg6) {
  TransportHandle_BlePlatformEvent_t *arg1 = (TransportHandle_BlePlatformEvent_t *) 0 ;
  uint8_16_array_t *arg2 = (uint8_16_array_t *) 0 ;
  slice_ref_uint8_t arg3 ;
  bool arg4 ;
  slice_ref_uint8_t arg5 ;
  float arg6 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(TransportHandle_BlePlatformEvent_t **)&jarg1; 
  arg2 = *(uint8_16_array_t **)&jarg2; 
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = jarg4 ? true : false; 
  {
    if (jarg5 == NULL) {
      arg5 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg5, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg5);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg5 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg6 = (float)jarg6; 
  {
    try {
      ditto_transports_ble_advertisement_heard((TransportHandle_BlePlatformEvent const *)arg1,(uint8_16_array_t const *)arg2,SWIG_STD_MOVE(arg3),arg4,SWIG_STD_MOVE(arg5),arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg5 != NULL) {
      jenv->ReleaseByteArrayElements(jarg5, (jbyte *)(&arg5)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1transports_1diagnostics(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (char *)ditto_transports_diagnostics((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1unregister_1and_1free_1legacy_1subscription(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  LegacySubscriptionHandle_t *arg2 = (LegacySubscriptionHandle_t *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(LegacySubscriptionHandle_t **)&jarg2; 
  {
    try {
      result = (int32_t)ditto_unregister_and_free_legacy_subscription((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1validate_1document_1id(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jobject jarg2_) {
  jlong jresult = 0 ;
  slice_ref_uint8_t arg1 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  uint32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  {
    try {
      result = (uint32_t)ditto_validate_document_id(SWIG_STD_MOVE(arg1),arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1vec_1char_1ptr_1free(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  Vec_char_ptr_t arg1 ;
  Vec_char_ptr_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  argp1 = *(Vec_char_ptr_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Vec_char_ptr_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      ditto_vec_char_ptr_free(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1vec_1slice_1boxed_1uint8_1t_1free(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  Vec_slice_boxed_uint8_t arg1 ;
  Vec_slice_boxed_uint8_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  argp1 = *(Vec_slice_boxed_uint8_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Vec_slice_boxed_uint8_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      ditto_vec_slice_boxed_uint8_t_free(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LICENSE_1VERIFICATION_1RESULT_1LICENSE_1OK_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  LicenseVerificationResult result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LicenseVerificationResult)LICENSE_VERIFICATION_RESULT_LICENSE_OK;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LICENSE_1VERIFICATION_1RESULT_1VERIFICATION_1FAILED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  LicenseVerificationResult result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LicenseVerificationResult)LICENSE_VERIFICATION_RESULT_VERIFICATION_FAILED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LICENSE_1VERIFICATION_1RESULT_1LICENSE_1EXPIRED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  LicenseVerificationResult result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LicenseVerificationResult)LICENSE_VERIFICATION_RESULT_LICENSE_EXPIRED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LICENSE_1VERIFICATION_1RESULT_1UNSUPPORTED_1FUTURE_1VERSION_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  LicenseVerificationResult result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (LicenseVerificationResult)LICENSE_VERIFICATION_RESULT_UNSUPPORTED_FUTURE_VERSION;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1verify_1license(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char **arg3 = (char **) 0 ;
  LicenseVerificationResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(char ***)&jarg3; 
  {
    try {
      result = (LicenseVerificationResult_t)ditto_verify_license((CDitto const *)arg1,(char const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1client_1go_1offline_1request(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_wifi_aware_client_go_offline_request((TransportHandle_WifiAwarePlatformEvent const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1client_1go_1online_1request(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_wifi_aware_client_go_online_request((TransportHandle_WifiAwarePlatformEvent const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1client_1network_1did_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jint jarg4) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  uint16_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  arg4 = (uint16_t)jarg4; 
  {
    try {
      ditto_wifi_aware_client_network_did_create((TransportHandle_WifiAwarePlatformEvent const *)arg1,(char const *)arg2,(char const *)arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1client_1peer_1appeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      ditto_wifi_aware_client_peer_appeared((TransportHandle_WifiAwarePlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1client_1peer_1did_1not_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      ditto_wifi_aware_client_peer_did_not_connect((TransportHandle_WifiAwarePlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1client_1peer_1disappeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      ditto_wifi_aware_client_peer_disappeared((TransportHandle_WifiAwarePlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1client_1scanning_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      ditto_wifi_aware_client_scanning_state_changed((TransportHandle_WifiAwarePlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1server_1advertising_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      ditto_wifi_aware_server_advertising_state_changed((TransportHandle_WifiAwarePlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1server_1go_1offline_1request(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_wifi_aware_server_go_offline_request((TransportHandle_WifiAwarePlatformEvent const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1server_1go_1online_1request(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_wifi_aware_server_go_online_request((TransportHandle_WifiAwarePlatformEvent const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1server_1network_1scope_1id_1added(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  {
    try {
      ditto_wifi_aware_server_network_scope_id_added((TransportHandle_WifiAwarePlatformEvent const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1server_1network_1scope_1id_1removed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  uint32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  arg2 = (uint32_t)jarg2; 
  {
    try {
      ditto_wifi_aware_server_network_scope_id_removed((TransportHandle_WifiAwarePlatformEvent const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1wifi_1aware_1transport_1free_1handle(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_WifiAwarePlatformEvent_t *arg1 = (TransportHandle_WifiAwarePlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_WifiAwarePlatformEvent_t **)&jarg1; 
  {
    try {
      ditto_wifi_aware_transport_free_handle(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CWriteTransactionResult_1t_1status_1code_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  CWriteTransactionResult *arg1 = (CWriteTransactionResult *) 0 ;
  int32_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CWriteTransactionResult **)&jarg1; 
  arg2 = (int32_t)jarg2; 
  if (arg1) (arg1)->status_code = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CWriteTransactionResult_1t_1status_1code_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  CWriteTransactionResult *arg1 = (CWriteTransactionResult *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CWriteTransactionResult **)&jarg1; 
  result = (int32_t) ((arg1)->status_code);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CWriteTransactionResult_1t_1txn_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  CWriteTransactionResult *arg1 = (CWriteTransactionResult *) 0 ;
  CWriteTransaction_t *arg2 = (CWriteTransaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CWriteTransactionResult **)&jarg1; 
  arg2 = *(CWriteTransaction_t **)&jarg2; 
  if (arg1) (arg1)->txn = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CWriteTransactionResult_1t_1txn_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  CWriteTransactionResult *arg1 = (CWriteTransactionResult *) 0 ;
  CWriteTransaction_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(CWriteTransactionResult **)&jarg1; 
  result = (CWriteTransaction_t *) ((arg1)->txn);
  *(CWriteTransaction_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1CWriteTransactionResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  CWriteTransactionResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (CWriteTransactionResult *)new CWriteTransactionResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CWriteTransactionResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1CWriteTransactionResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CWriteTransactionResult *arg1 = (CWriteTransactionResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CWriteTransactionResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1write_1transaction(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransactionResult_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = ditto_write_transaction((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CWriteTransactionResult_t **)&jresult = new CWriteTransactionResult_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1write_1transaction_1add_1metadata(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2) {
  jint jresult = 0 ;
  CWriteTransaction_t *arg1 = (CWriteTransaction_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CWriteTransaction_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = (int32_t)ditto_write_transaction_add_metadata(arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1write_1transaction_1commit(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  CWriteTransaction_t *arg2 = (CWriteTransaction_t *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(CWriteTransaction_t **)&jarg2; 
  {
    try {
      result = (int32_t)ditto_write_transaction_commit((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1write_1transaction_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CWriteTransaction_t *arg1 = (CWriteTransaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CWriteTransaction_t **)&jarg1; 
  {
    try {
      ditto_write_transaction_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ditto_1write_1transaction_1rollback(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jint jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  CWriteTransaction_t *arg2 = (CWriteTransaction_t *) 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(CWriteTransaction_t **)&jarg2; 
  {
    try {
      result = (int32_t)ditto_write_transaction_rollback((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1DITTO_1DEVELOPMENT_1PROVIDER(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)dittoffi_DITTO_DEVELOPMENT_PROVIDER();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1authentication_1register_1local_1server_1backend(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jlong jarg6) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  void *arg2 = (void *) 0 ;
  void (*arg3)(void *) = (void (*)(void *)) 0 ;
  void (*arg4)(void *) = (void (*)(void *)) 0 ;
  void (*arg5)(void *,CAuthServerAuthRequest_t *,slice_ref_uint8_t) = (void (*)(void *,CAuthServerAuthRequest_t *,slice_ref_uint8_t)) 0 ;
  void (*arg6)(void *,CAuthServerRefreshRequest_t *,slice_ref_uint8_t) = (void (*)(void *,CAuthServerRefreshRequest_t *,slice_ref_uint8_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  arg3 = *(void (**)(void *))&jarg3; 
  arg4 = *(void (**)(void *))&jarg4; 
  arg5 = *(void (**)(void *,CAuthServerAuthRequest_t *,slice_ref_uint8_t))&jarg5; 
  arg6 = *(void (**)(void *,CAuthServerRefreshRequest_t *,slice_ref_uint8_t))&jarg6; 
  {
    try {
      dittoffi_authentication_register_local_server_backend((CDitto const *)arg1,arg2,arg3,arg4,arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1authentication_1status_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_authentication_status_t *arg1 = (dittoffi_authentication_status_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_authentication_status_t **)&jarg1; 
  {
    try {
      dittoffi_authentication_status_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1authentication_1status_1is_1authenticated(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  dittoffi_authentication_status_t *arg1 = (dittoffi_authentication_status_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_authentication_status_t **)&jarg1; 
  {
    try {
      result = (bool)dittoffi_authentication_status_is_authenticated((dittoffi_authentication_status const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1authentication_1status_1user_1id(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_authentication_status_t *arg1 = (dittoffi_authentication_status_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_authentication_status_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_authentication_status_user_id((dittoffi_authentication_status const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  {
    if (result != NULL) {
      ditto_c_string_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BASE64_1PADDING_1MODE_1PADDED_1get(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  Base64PaddingMode result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (Base64PaddingMode)BASE64_PADDING_MODE_PADDED;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1base64_1encode(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2) {
  jstring jresult = 0 ;
  slice_ref_uint8_t arg1 ;
  Base64PaddingMode_t arg2 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg2 = (Base64PaddingMode_t)jarg2; 
  {
    try {
      result = (char *)dittoffi_base64_encode(SWIG_STD_MOVE(arg1),arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1check_1doc_1cbor_1against_1provided_1cbor(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jbyteArray jarg2) {
  jlong jresult = 0 ;
  slice_ref_uint8_t arg1 ;
  slice_ref_uint8_t arg2 ;
  BoolResult_t result;
  
  (void)jenv;
  (void)jcls;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_check_doc_cbor_against_provided_cbor(SWIG_STD_MOVE(arg1),SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoolResult_t **)&jresult = new BoolResult_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1connection_1request_1authorize(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) {
  dittoffi_connection_request_t *arg1 = (dittoffi_connection_request_t *) 0 ;
  dittoffi_connection_request_authorization_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_connection_request_t **)&jarg1; 
  arg2 = (dittoffi_connection_request_authorization_t)jarg2; 
  {
    try {
      dittoffi_connection_request_authorize((dittoffi_connection_request const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1connection_1request_1connection_1type(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  dittoffi_connection_request_t *arg1 = (dittoffi_connection_request_t *) 0 ;
  dittoffi_connection_type_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_connection_request_t **)&jarg1; 
  {
    try {
      result = (dittoffi_connection_type_t)dittoffi_connection_request_connection_type((dittoffi_connection_request const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1connection_1request_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_connection_request_t *arg1 = (dittoffi_connection_request_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_connection_request_t **)&jarg1; 
  {
    try {
      dittoffi_connection_request_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1connection_1request_1identity_1service_1metadata_1json(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_connection_request_t *arg1 = (dittoffi_connection_request_t *) 0 ;
  slice_ref_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_connection_request_t **)&jarg1; 
  {
    try {
      result = dittoffi_connection_request_identity_service_metadata_json((dittoffi_connection_request const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1connection_1request_1peer_1key_1string(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_connection_request_t *arg1 = (dittoffi_connection_request_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_connection_request_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_connection_request_peer_key_string((dittoffi_connection_request const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1connection_1request_1peer_1metadata_1json(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_connection_request_t *arg1 = (dittoffi_connection_request_t *) 0 ;
  slice_ref_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_connection_request_t **)&jarg1; 
  {
    try {
      result = dittoffi_connection_request_peer_metadata_json((dittoffi_connection_request const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1crypto_1generate_1secure_1random_1token(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)dittoffi_crypto_generate_secure_random_token();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1dittoffi_1query_1result_1item_1ptr_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_dittoffi_query_result_item_ptr *arg1 = (slice_ref_dittoffi_query_result_item_ptr *) 0 ;
  dittoffi_query_result_item_t **arg2 = (dittoffi_query_result_item_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_dittoffi_query_result_item_ptr **)&jarg1; 
  arg2 = *(dittoffi_query_result_item_t ***)&jarg2; 
  if (arg1) (arg1)->ptr = (dittoffi_query_result_item_t *const *)arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1dittoffi_1query_1result_1item_1ptr_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_dittoffi_query_result_item_ptr *arg1 = (slice_ref_dittoffi_query_result_item_ptr *) 0 ;
  dittoffi_query_result_item_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_dittoffi_query_result_item_ptr **)&jarg1; 
  result = (dittoffi_query_result_item_t **) ((arg1)->ptr);
  *(dittoffi_query_result_item_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1dittoffi_1query_1result_1item_1ptr_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  slice_ref_dittoffi_query_result_item_ptr *arg1 = (slice_ref_dittoffi_query_result_item_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_dittoffi_query_result_item_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_slice_1ref_1dittoffi_1query_1result_1item_1ptr_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  slice_ref_dittoffi_query_result_item_ptr *arg1 = (slice_ref_dittoffi_query_result_item_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(slice_ref_dittoffi_query_result_item_ptr **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1slice_1ref_1dittoffi_1query_1result_1item_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  slice_ref_dittoffi_query_result_item_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (slice_ref_dittoffi_query_result_item_ptr *)new slice_ref_dittoffi_query_result_item_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(slice_ref_dittoffi_query_result_item_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1slice_1ref_1dittoffi_1query_1result_1item_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  slice_ref_dittoffi_query_result_item_ptr *arg1 = (slice_ref_dittoffi_query_result_item_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(slice_ref_dittoffi_query_result_item_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1differ_1diff(JNIEnv *jenv, jclass jcls, jlong jarg1, jobjectArray jarg2) {
  jbyteArray jresult = 0 ;
  dittoffi_differ_t *arg1 = (dittoffi_differ_t *) 0 ;
  slice_ref_dittoffi_query_result_item_ptr_t arg2 ;
  dittoffi_cbor_data_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_differ_t **)&jarg1; 
  {
    size_t arr_len = (size_t) jenv->GetArrayLength(jarg2);
    if (arr_len == 0) {
      arg2 = (slice_ref_dittoffi_query_result_item_ptr_t) {
        .ptr = (dittoffi_query_result_item * const *)0xbad000, .len = 0 
      };
    } else {
      arg2 = (slice_ref_dittoffi_query_result_item_ptr_t) {
        .len = arr_len,
      };
      (&arg2)->ptr = (typeof((&arg2)->ptr)) calloc(sizeof(*(&arg2)->ptr), (&arg2)->len);
      // Prepare to call `SWIGTYPE_p_dittoffi_query_result_item.getCPtr()` as done above
      jclass jcls_SWIGTYPE_p_dittoffi_query_result_item = jenv->FindClass("live/ditto/internal/swig/ffi/SWIGTYPE_p_dittoffi_query_result_item")
      
      ;
      do {
        if (!(jcls_SWIGTYPE_p_dittoffi_query_result_item != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "jcls_SWIGTYPE_p_dittoffi_query_result_item is NULL");              return NULL;          
        }      
      } while (0);
      jmethodID getCPtr = jenv->GetStaticMethodID(jcls_SWIGTYPE_p_dittoffi_query_result_item, "getCPtr", "(Llive/ditto/internal/swig/ffi/SWIGTYPE_p_dittoffi_query_result_item;)J")
      
      
      
      ;
      do {
        if (!(getCPtr != 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get method ID for getCPtr");              return NULL;          
        }      
      } while (0);
      for (size_t i = 0; i < (&arg2)->len; ++i) {
        jobject jobj = jenv->GetObjectArrayElement(jarg2, i);
        ((dittoffi_query_result_item const * *) (&arg2)->ptr)[i] = (dittoffi_query_result_item *)jenv->CallStaticLongMethod(jcls_SWIGTYPE_p_dittoffi_query_result_item, getCPtr, jobj)
        
        
        
        ;
        jenv->DeleteLocalRef(jobj);
      }
      // Freeing (&arg2)->ptr is to be done within the `freearg` typemap
    }
  }
  {
    try {
      result = dittoffi_differ_diff((dittoffi_differ const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&arg2)->len > 0) {
      free((void *) (&arg2)->ptr); // frees calloc
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1differ_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_differ_t *arg1 = (dittoffi_differ_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_differ_t **)&jarg1; 
  {
    try {
      dittoffi_differ_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1differ_1identity_1key_1path_1at(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jstring jresult = 0 ;
  dittoffi_differ_t *arg1 = (dittoffi_differ_t *) 0 ;
  size_t arg2 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_differ_t **)&jarg1; 
  arg2 = (size_t)jarg2; 
  {
    try {
      result = (char *)dittoffi_differ_identity_key_path_at((dittoffi_differ const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1differ_1identity_1key_1path_1count(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  dittoffi_differ_t *arg1 = (dittoffi_differ_t *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_differ_t **)&jarg1; 
  {
    try {
      result = dittoffi_differ_identity_key_path_count((dittoffi_differ const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1differ_1new(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_differ_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_differ_t *)dittoffi_differ_new();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_differ_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1differ_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_differ_ptr *arg1 = (dittoffi_result_dittoffi_differ_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_differ_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1differ_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_differ_ptr *arg1 = (dittoffi_result_dittoffi_differ_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_differ_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1differ_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_differ_ptr *arg1 = (dittoffi_result_dittoffi_differ_ptr *) 0 ;
  dittoffi_differ_t *arg2 = (dittoffi_differ_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_differ_ptr **)&jarg1; 
  arg2 = *(dittoffi_differ_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1differ_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_differ_ptr *arg1 = (dittoffi_result_dittoffi_differ_ptr *) 0 ;
  dittoffi_differ_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_differ_ptr **)&jarg1; 
  result = (dittoffi_differ_t *) ((arg1)->success);
  *(dittoffi_differ_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1dittoffi_1differ_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_differ_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_dittoffi_differ_ptr *)new dittoffi_result_dittoffi_differ_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_differ_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1dittoffi_1differ_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_dittoffi_differ_ptr *arg1 = (dittoffi_result_dittoffi_differ_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_dittoffi_differ_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1differ_1new_1with_1identity_1key_1paths_1throws(JNIEnv *jenv, jclass jcls, jobjectArray jarg1) {
  jlong jresult = 0 ;
  slice_ref_char_const_ptr_t arg1 ;
  dittoffi_result_dittoffi_differ_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  {
    arg1 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg1),
    };
    (&arg1)->ptr = (typeof((&arg1)->ptr)) calloc(sizeof(*(&arg1)->ptr), (&arg1)->len);
    for (size_t i = 0; i < (&arg1)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg1, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg1)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg1)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    try {
      result = dittoffi_differ_new_with_identity_key_paths_throws(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_differ_ptr_t **)&jresult = new dittoffi_result_dittoffi_differ_ptr_t(result); 
  {
    while ((&arg1)->len > 0) {
      --(&arg1)->len;
      free((void *) (&arg1)->ptr[(&arg1)->len]); // frees strdup
    }
    free((void *) (&arg1)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1capture_1stack_1trace_1string_1internal(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)dittoffi_ditto_capture_stack_trace_string_internal();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1config(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = dittoffi_ditto_config((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1uint64_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_uint64 *arg1 = (dittoffi_result_uint64 *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_uint64 **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1uint64_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_uint64 *arg1 = (dittoffi_result_uint64 *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_uint64 **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1uint64_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) {
  dittoffi_result_uint64 *arg1 = (dittoffi_result_uint64 *) 0 ;
  uint64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_uint64 **)&jarg1; 
  {
    jclass clazz;
    jmethodID mid;
    jbyteArray ba;
    jbyte* bae;
    jsize sz;
    int i;
    
    if (!jarg2) {
      SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
      return ;
    }
    clazz = jenv->GetObjectClass(jarg2);
    mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
    ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid);
    bae = jenv->GetByteArrayElements(ba, 0);
    sz = jenv->GetArrayLength(ba);
    arg2 = 0;
    if (sz > 0) {
      arg2 = (uint64_t)(signed char)bae[0];
      for(i=1; i<sz; i++) {
        arg2 = (arg2 << 8) | (uint64_t)(unsigned char)bae[i];
      }
    }
    jenv->ReleaseByteArrayElements(ba, bae, 0);
  }
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jobject JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1uint64_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jobject jresult = 0 ;
  dittoffi_result_uint64 *arg1 = (dittoffi_result_uint64 *) 0 ;
  uint64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_uint64 **)&jarg1; 
  result = (uint64_t) ((arg1)->success);
  {
    jbyteArray ba = jenv->NewByteArray(9);
    jbyte* bae = jenv->GetByteArrayElements(ba, 0);
    jclass clazz = jenv->FindClass("java/math/BigInteger");
    jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V");
    jobject bigint;
    int i;
    
    bae[0] = 0;
    for(i=1; i<9; i++ ) {
      bae[i] = (jbyte)(result>>8*(8-i));
    }
    
    jenv->ReleaseByteArrayElements(ba, bae, 0);
    bigint = jenv->NewObject(clazz, mid, ba);
    jenv->DeleteLocalRef(ba);
    jresult = bigint;
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1uint64_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_uint64 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_uint64 *)new dittoffi_result_uint64();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_uint64 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1uint64_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_uint64 *arg1 = (dittoffi_result_uint64 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_uint64 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1get_1system_1parameter_1u64(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  dittoffi_result_uint64_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = dittoffi_ditto_get_system_parameter_u64((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_uint64_t **)&jresult = new dittoffi_result_uint64_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1is_1activated(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (bool)dittoffi_ditto_is_activated((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1is_1sync_1active(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = (bool)dittoffi_ditto_is_sync_active((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDitto_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_CDitto_ptr *arg1 = (dittoffi_result_CDitto_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDitto_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDitto_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_CDitto_ptr *arg1 = (dittoffi_result_CDitto_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDitto_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDitto_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_CDitto_ptr *arg1 = (dittoffi_result_CDitto_ptr *) 0 ;
  CDitto_t *arg2 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDitto_ptr **)&jarg1; 
  arg2 = *(CDitto_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDitto_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_CDitto_ptr *arg1 = (dittoffi_result_CDitto_ptr *) 0 ;
  CDitto_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDitto_ptr **)&jarg1; 
  result = (CDitto_t *) ((arg1)->success);
  *(CDitto_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1CDitto_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_CDitto_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_CDitto_ptr *)new dittoffi_result_CDitto_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_CDitto_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1CDitto_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_CDitto_ptr *arg1 = (dittoffi_result_CDitto_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_CDitto_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *) 0 ;
  void (*arg2)(void *,dittoffi_result_CDitto_ptr_t) = (void (*)(void *,dittoffi_result_CDitto_ptr_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_result_CDitto_ptr_t))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *) 0 ;
  void (*result)(void *,dittoffi_result_CDitto_ptr_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jarg1; 
  result = (void (*)(void *,dittoffi_result_CDitto_ptr_t)) ((arg1)->call);
  *(void (**)(void *,dittoffi_result_CDitto_ptr_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *)new BoxDynFnMut1_void_dittoffi_result_CDitto_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut1_1void_1dittoffi_1result_1CDitto_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_CDitto_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_CDitto_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1open_1async_1throws(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jlong jarg3, jobject jarg3_) {
  slice_ref_uint8_t arg1 ;
  TransportConfigMode_t arg2 ;
  continuation_dittoffi_result_CDitto_ptr_t arg3 ;
  continuation_dittoffi_result_CDitto_ptr_t *argp3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg3_;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg2 = (TransportConfigMode_t)jarg2; 
  argp3 = *(continuation_dittoffi_result_CDitto_ptr_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null continuation_dittoffi_result_CDitto_ptr_t");
    return ;
  }
  arg3 = *argp3; 
  {
    try {
      dittoffi_ditto_open_async_throws(SWIG_STD_MOVE(arg1),arg2,SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1open_1throws(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2) {
  jlong jresult = 0 ;
  slice_ref_uint8_t arg1 ;
  TransportConfigMode_t arg2 ;
  dittoffi_result_CDitto_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg2 = (TransportConfigMode_t)jarg2; 
  {
    try {
      result = dittoffi_ditto_open_throws(SWIG_STD_MOVE(arg1),arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_CDitto_ptr_t **)&jresult = new dittoffi_result_CDitto_ptr_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *) 0 ;
  void (*arg2)(void *,dittoffi_authentication_status_t *) = (void (*)(void *,dittoffi_authentication_status_t *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_authentication_status_t *))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *) 0 ;
  void (*result)(void *,dittoffi_authentication_status_t *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jarg1; 
  result = (void (*)(void *,dittoffi_authentication_status_t *)) ((arg1)->call);
  *(void (**)(void *,dittoffi_authentication_status_t *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *)new BoxDynFnMut1_void_dittoffi_authentication_status_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut1_1void_1dittoffi_1authentication_1status_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut1_void_dittoffi_authentication_status_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_authentication_status_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut1_void_dittoffi_authentication_status_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1set_1authentication_1status_1handler(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  dittoffi_authentication_status_handler_t arg2 ;
  dittoffi_authentication_status_handler_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(CDitto_t **)&jarg1; 
  argp2 = *(dittoffi_authentication_status_handler_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_authentication_status_handler_t");
    return ;
  }
  arg2 = *argp2; 
  {
    try {
      dittoffi_ditto_set_authentication_status_handler((CDitto const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1set_1cloud_1sync_1enabled(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  {
    try {
      dittoffi_ditto_set_cloud_sync_enabled((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1void_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_void *arg1 = (dittoffi_result_void *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_void **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1void_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_void *arg1 = (dittoffi_result_void *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_void **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1void_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_void *)new dittoffi_result_void();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1void_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_void *arg1 = (dittoffi_result_void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_void **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1set_1offline_1only_1license_1token_1throws(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = dittoffi_ditto_set_offline_only_license_token_throws((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_panic_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_panic_ptr *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_panic_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_panic_ptr *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_panic_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_panic_ptr *) 0 ;
  void (*arg2)(void *,dittoffi_panic_t *) = (void (*)(void *,dittoffi_panic_t *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_panic_t *))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_panic_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_panic_ptr *) 0 ;
  void (*result)(void *,dittoffi_panic_t *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jarg1; 
  result = (void (*)(void *,dittoffi_panic_t *)) ((arg1)->call);
  *(void (**)(void *,dittoffi_panic_t *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_panic_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_panic_ptr *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_panic_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_panic_ptr *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_panic_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut1_void_dittoffi_panic_ptr *)new BoxDynFnMut1_void_dittoffi_panic_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut1_1void_1dittoffi_1panic_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut1_void_dittoffi_panic_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_panic_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut1_void_dittoffi_panic_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1set_1panic_1handler(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  dittoffi_panic_handler_t arg1 ;
  dittoffi_panic_handler_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  argp1 = *(dittoffi_panic_handler_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_panic_handler_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      dittoffi_ditto_set_panic_handler(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1stop_1sync(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      dittoffi_ditto_stop_sync((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1transport_1config(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = dittoffi_ditto_transport_config((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1trigger_1test_1panic(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  int32_t result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (int32_t)dittoffi_ditto_trigger_test_panic();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1trigger_1test_1panic_1in_1background(JNIEnv *jenv, jclass jcls) {
  (void)jenv;
  (void)jcls;
  {
    try {
      dittoffi_ditto_trigger_test_panic_in_background();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1try_1new_1blocking(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jint jarg3, jstring jarg4, jint jarg5) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  CIdentityConfig_t *arg2 = (CIdentityConfig_t *) 0 ;
  HistoryTracking_t arg3 ;
  char *arg4 = (char *) 0 ;
  TransportConfigMode_t arg5 ;
  dittoffi_result_CDitto_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = *(CIdentityConfig_t **)&jarg2; 
  arg3 = (HistoryTracking_t)jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  arg5 = (TransportConfigMode_t)jarg5; 
  {
    try {
      result = dittoffi_ditto_try_new_blocking((char const *)arg1,arg2,arg3,(char const *)arg4,arg5);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_CDitto_ptr_t **)&jresult = new dittoffi_result_CDitto_ptr_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1try_1set_1transport_1config(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2, jboolean jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  bool arg3 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg3 = jarg3 ? true : false; 
  {
    try {
      result = dittoffi_ditto_try_set_transport_config((CDitto const *)arg1,SWIG_STD_MOVE(arg2),arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1try_1start_1sync(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = dittoffi_ditto_try_start_sync((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1ditto_1use_1helper_1thread_1for_1panic_1handler_1internal(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
  bool arg1 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = jarg1 ? true : false; 
  {
    try {
      dittoffi_ditto_use_helper_thread_for_panic_handler_internal(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1error_1code(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  dittoffi_error_t *arg1 = (dittoffi_error_t *) 0 ;
  dittoffi_error_code_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_error_t **)&jarg1; 
  {
    try {
      result = (dittoffi_error_code_t)dittoffi_error_code((dittoffi_error const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1error_1description(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_error_t *arg1 = (dittoffi_error_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_error_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_error_description((dittoffi_error const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1error_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_error_t *arg1 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_error_t **)&jarg1; 
  {
    try {
      dittoffi_error_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1error_1internal_1get_1legacy_1error_1code(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jint jresult = 0 ;
  dittoffi_error_t *arg1 = (dittoffi_error_t *) 0 ;
  DittoErrorCode_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_error_t **)&jarg1; 
  {
    try {
      result = (DittoErrorCode_t)dittoffi_error_internal_get_legacy_error_code((dittoffi_error const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1get_1sdk_1semver(JNIEnv *jenv, jclass jcls) {
  jstring jresult = 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (char *)dittoffi_get_sdk_semver();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_uint64 *arg1 = (BoxDynFnMut1_void_dittoffi_result_uint64 *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_uint64 *arg1 = (BoxDynFnMut1_void_dittoffi_result_uint64 *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_uint64 *arg1 = (BoxDynFnMut1_void_dittoffi_result_uint64 *) 0 ;
  void (*arg2)(void *,dittoffi_result_uint64_t) = (void (*)(void *,dittoffi_result_uint64_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_result_uint64_t))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_uint64 *arg1 = (BoxDynFnMut1_void_dittoffi_result_uint64 *) 0 ;
  void (*result)(void *,dittoffi_result_uint64_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jarg1; 
  result = (void (*)(void *,dittoffi_result_uint64_t)) ((arg1)->call);
  *(void (**)(void *,dittoffi_result_uint64_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_uint64 *arg1 = (BoxDynFnMut1_void_dittoffi_result_uint64 *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_uint64 *arg1 = (BoxDynFnMut1_void_dittoffi_result_uint64 *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_uint64 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut1_void_dittoffi_result_uint64 *)new BoxDynFnMut1_void_dittoffi_result_uint64();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut1_1void_1dittoffi_1result_1uint64_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut1_void_dittoffi_result_uint64 *arg1 = (BoxDynFnMut1_void_dittoffi_result_uint64 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_uint64 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1logger_1try_1export_1to_1file_1async(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jobject jarg2_) {
  char *arg1 = (char *) 0 ;
  continuation_dittoffi_result_uint64_t arg2 ;
  continuation_dittoffi_result_uint64_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return ;
  }
  argp2 = *(continuation_dittoffi_result_uint64_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null continuation_dittoffi_result_uint64_t");
    return ;
  }
  arg2 = *argp2; 
  {
    try {
      dittoffi_logger_try_export_to_file_async((char const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1make_1with_1transport_1config_1mode(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jint jarg3, jint jarg4) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  CIdentityConfig_t *arg2 = (CIdentityConfig_t *) 0 ;
  HistoryTracking_t arg3 ;
  TransportConfigMode_t arg4 ;
  CDitto_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = *(CIdentityConfig_t **)&jarg2; 
  arg3 = (HistoryTracking_t)jarg3; 
  arg4 = (TransportConfigMode_t)jarg4; 
  {
    try {
      result = (CDitto_t *)dittoffi_make_with_transport_config_mode((char const *)arg1,arg2,arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(CDitto_t **)&jresult = result; 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1panic_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_panic_t *arg1 = (dittoffi_panic_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_panic_t **)&jarg1; 
  {
    try {
      dittoffi_panic_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1panic_1message(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_panic_t *arg1 = (dittoffi_panic_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_panic_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_panic_message((dittoffi_panic const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1panic_1stack_1trace_1string(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_panic_t *arg1 = (dittoffi_panic_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_panic_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_panic_stack_trace_string((dittoffi_panic const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1presence_1peer_1metadata_1json(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = dittoffi_presence_peer_metadata_json((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_FfiConnectionRequestHandlerVTable_1t_1release_1vptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  FfiConnectionRequestHandlerVTable *arg1 = (FfiConnectionRequestHandlerVTable *) 0 ;
  void (*arg2)(Erased_t *) = (void (*)(Erased_t *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(FfiConnectionRequestHandlerVTable **)&jarg1; 
  arg2 = *(void (**)(Erased_t *))&jarg2; 
  if (arg1) (arg1)->release_vptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_FfiConnectionRequestHandlerVTable_1t_1release_1vptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  FfiConnectionRequestHandlerVTable *arg1 = (FfiConnectionRequestHandlerVTable *) 0 ;
  void (*result)(Erased_t *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(FfiConnectionRequestHandlerVTable **)&jarg1; 
  result = (void (*)(Erased_t *)) ((arg1)->release_vptr);
  *(void (**)(Erased_t *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_FfiConnectionRequestHandlerVTable_1t_1retain_1vptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  FfiConnectionRequestHandlerVTable *arg1 = (FfiConnectionRequestHandlerVTable *) 0 ;
  Erased_t *(*arg2)(Erased_t const *) = (Erased_t *(*)(Erased_t const *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(FfiConnectionRequestHandlerVTable **)&jarg1; 
  arg2 = *(Erased_t *(**)(Erased_t const *))&jarg2; 
  if (arg1) (arg1)->retain_vptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_FfiConnectionRequestHandlerVTable_1t_1retain_1vptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  FfiConnectionRequestHandlerVTable *arg1 = (FfiConnectionRequestHandlerVTable *) 0 ;
  Erased_t *(*result)(Erased_t const *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(FfiConnectionRequestHandlerVTable **)&jarg1; 
  result = (Erased_t *(*)(Erased_t const *)) ((arg1)->retain_vptr);
  *(Erased_t *(**)(Erased_t const *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_FfiConnectionRequestHandlerVTable_1t_1on_1connecting_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  FfiConnectionRequestHandlerVTable *arg1 = (FfiConnectionRequestHandlerVTable *) 0 ;
  void (*arg2)(Erased_t const *,dittoffi_connection_request_t *) = (void (*)(Erased_t const *,dittoffi_connection_request_t *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(FfiConnectionRequestHandlerVTable **)&jarg1; 
  arg2 = *(void (**)(Erased_t const *,dittoffi_connection_request_t *))&jarg2; 
  if (arg1) (arg1)->on_connecting = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_FfiConnectionRequestHandlerVTable_1t_1on_1connecting_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  FfiConnectionRequestHandlerVTable *arg1 = (FfiConnectionRequestHandlerVTable *) 0 ;
  void (*result)(Erased_t const *,dittoffi_connection_request_t *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(FfiConnectionRequestHandlerVTable **)&jarg1; 
  result = (void (*)(Erased_t const *,dittoffi_connection_request_t *)) ((arg1)->on_connecting);
  *(void (**)(Erased_t const *,dittoffi_connection_request_t *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1FfiConnectionRequestHandlerVTable_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  FfiConnectionRequestHandlerVTable *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (FfiConnectionRequestHandlerVTable *)new FfiConnectionRequestHandlerVTable();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(FfiConnectionRequestHandlerVTable **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1FfiConnectionRequestHandlerVTable_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  FfiConnectionRequestHandlerVTable *arg1 = (FfiConnectionRequestHandlerVTable *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(FfiConnectionRequestHandlerVTable **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_VirtualPtr_1_1Erased_1ptr_1FfiConnectionRequestHandlerVTable_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *arg1 = (VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *) 0 ;
  Erased_t *arg2 = (Erased_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable **)&jarg1; 
  arg2 = *(Erased_t **)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_VirtualPtr_1_1Erased_1ptr_1FfiConnectionRequestHandlerVTable_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *arg1 = (VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *) 0 ;
  Erased_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable **)&jarg1; 
  result = (Erased_t *) ((arg1)->ptr);
  *(Erased_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_VirtualPtr_1_1Erased_1ptr_1FfiConnectionRequestHandlerVTable_1t_1vtable_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *arg1 = (VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *) 0 ;
  FfiConnectionRequestHandlerVTable_t *arg2 = (FfiConnectionRequestHandlerVTable_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable **)&jarg1; 
  arg2 = *(FfiConnectionRequestHandlerVTable_t **)&jarg2; 
  if (arg1) (arg1)->vtable = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_VirtualPtr_1_1Erased_1ptr_1FfiConnectionRequestHandlerVTable_1t_1vtable_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *arg1 = (VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *) 0 ;
  FfiConnectionRequestHandlerVTable_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable **)&jarg1; 
  result = (FfiConnectionRequestHandlerVTable_t *)& ((arg1)->vtable);
  *(FfiConnectionRequestHandlerVTable_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1VirtualPtr_1_1Erased_1ptr_1FfiConnectionRequestHandlerVTable_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *)new VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1VirtualPtr_1_1Erased_1ptr_1FfiConnectionRequestHandlerVTable_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *arg1 = (VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1presence_1set_1connection_1request_1handler(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable_t arg2 ;
  VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable_t *argp2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  arg1 = *(CDitto_t **)&jarg1; 
  argp2 = *(VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable_t");
    return ;
  }
  arg2 = *argp2; 
  {
    try {
      dittoffi_presence_set_connection_request_handler((CDitto const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1presence_1try_1set_1peer_1metadata_1json(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_uint8_t arg2 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    if (jarg2 == NULL) {
      arg2 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg2, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg2);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg2 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_presence_try_set_peer_metadata_json((CDitto const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg2 != NULL) {
      jenv->ReleaseByteArrayElements(jarg2, (jbyte *)(&arg2)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_query_result_t *arg1 = (dittoffi_query_result_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_t **)&jarg1; 
  {
    try {
      dittoffi_query_result_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1item_1at(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jlong jresult = 0 ;
  dittoffi_query_result_t *arg1 = (dittoffi_query_result_t *) 0 ;
  size_t arg2 ;
  dittoffi_query_result_item_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_t **)&jarg1; 
  arg2 = (size_t)jarg2; 
  {
    try {
      result = (dittoffi_query_result_item_t *)dittoffi_query_result_item_at((dittoffi_query_result const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_query_result_item_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1item_1cbor(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_query_result_item_t *arg1 = (dittoffi_query_result_item_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_item_t **)&jarg1; 
  {
    try {
      result = dittoffi_query_result_item_cbor((dittoffi_query_result_item const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1item_1count(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  dittoffi_query_result_t *arg1 = (dittoffi_query_result_t *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_t **)&jarg1; 
  {
    try {
      result = dittoffi_query_result_item_count((dittoffi_query_result const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1item_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_query_result_item_t *arg1 = (dittoffi_query_result_item_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_item_t **)&jarg1; 
  {
    try {
      dittoffi_query_result_item_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1item_1json(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_query_result_item_t *arg1 = (dittoffi_query_result_item_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_item_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_query_result_item_json((dittoffi_query_result_item const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1item_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_query_result_item_ptr *arg1 = (dittoffi_result_dittoffi_query_result_item_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_item_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1item_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_query_result_item_ptr *arg1 = (dittoffi_result_dittoffi_query_result_item_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_item_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1item_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_query_result_item_ptr *arg1 = (dittoffi_result_dittoffi_query_result_item_ptr *) 0 ;
  dittoffi_query_result_item_t *arg2 = (dittoffi_query_result_item_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_item_ptr **)&jarg1; 
  arg2 = *(dittoffi_query_result_item_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1item_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_query_result_item_ptr *arg1 = (dittoffi_result_dittoffi_query_result_item_ptr *) 0 ;
  dittoffi_query_result_item_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_item_ptr **)&jarg1; 
  result = (dittoffi_query_result_item_t *) ((arg1)->success);
  *(dittoffi_query_result_item_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1dittoffi_1query_1result_1item_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_query_result_item_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_dittoffi_query_result_item_ptr *)new dittoffi_result_dittoffi_query_result_item_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_query_result_item_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1dittoffi_1query_1result_1item_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_dittoffi_query_result_item_ptr *arg1 = (dittoffi_result_dittoffi_query_result_item_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_dittoffi_query_result_item_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1item_1new(JNIEnv *jenv, jclass jcls, jbyteArray jarg1) {
  jlong jresult = 0 ;
  slice_ref_uint8_t arg1 ;
  dittoffi_result_dittoffi_query_result_item_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  {
    if (jarg1 == NULL) {
      arg1 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg1, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg1);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg1 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_query_result_item_new(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_query_result_item_ptr_t **)&jresult = new dittoffi_result_dittoffi_query_result_item_ptr_t(result); 
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg1 != NULL) {
      jenv->ReleaseByteArrayElements(jarg1, (jbyte *)(&arg1)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1mutated_1document_1id_1at(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jbyteArray jresult = 0 ;
  dittoffi_query_result_t *arg1 = (dittoffi_query_result_t *) 0 ;
  size_t arg2 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_t **)&jarg1; 
  arg2 = (size_t)jarg2; 
  {
    try {
      result = dittoffi_query_result_mutated_document_id_at((dittoffi_query_result const *)arg1,SWIG_STD_MOVE(arg2));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1query_1result_1mutated_1document_1id_1count(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  dittoffi_query_result_t *arg1 = (dittoffi_query_result_t *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_query_result_t **)&jarg1; 
  {
    try {
      result = dittoffi_query_result_mutated_document_id_count((dittoffi_query_result const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1begin_1transaction_1options_1t_1is_1read_1only_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
  dittoffi_store_begin_transaction_options *arg1 = (dittoffi_store_begin_transaction_options *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_store_begin_transaction_options **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  if (arg1) (arg1)->is_read_only = arg2;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1begin_1transaction_1options_1t_1is_1read_1only_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  dittoffi_store_begin_transaction_options *arg1 = (dittoffi_store_begin_transaction_options *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_store_begin_transaction_options **)&jarg1; 
  result = (bool) ((arg1)->is_read_only);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1begin_1transaction_1options_1t_1hint_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  dittoffi_store_begin_transaction_options *arg1 = (dittoffi_store_begin_transaction_options *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_store_begin_transaction_options **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    if (arg2) {
      arg1->hint = (char const *) (new char[strlen((const char *)arg2)+1]);
      strcpy((char *)arg1->hint, (const char *)arg2);
    } else {
      arg1->hint = 0;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1begin_1transaction_1options_1t_1hint_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jstring jresult = 0 ;
  dittoffi_store_begin_transaction_options *arg1 = (dittoffi_store_begin_transaction_options *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_store_begin_transaction_options **)&jarg1; 
  result = (char *) ((arg1)->hint);
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1store_1begin_1transaction_1options_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_store_begin_transaction_options *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_store_begin_transaction_options *)new dittoffi_store_begin_transaction_options();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_store_begin_transaction_options **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1store_1begin_1transaction_1options_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_store_begin_transaction_options *arg1 = (dittoffi_store_begin_transaction_options *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_begin_transaction_options **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_transaction_ptr *arg1 = (dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_transaction_ptr *arg1 = (dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_transaction_ptr *arg1 = (dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  dittoffi_transaction_t *arg2 = (dittoffi_transaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  arg2 = *(dittoffi_transaction_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_transaction_ptr *arg1 = (dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  dittoffi_transaction_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  result = (dittoffi_transaction_t *) ((arg1)->success);
  *(dittoffi_transaction_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_transaction_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_dittoffi_transaction_ptr *)new dittoffi_result_dittoffi_transaction_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_transaction_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_dittoffi_transaction_ptr *arg1 = (dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  void (*arg2)(void *,dittoffi_result_dittoffi_transaction_ptr_t) = (void (*)(void *,dittoffi_result_dittoffi_transaction_ptr_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_result_dittoffi_transaction_ptr_t))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  void (*result)(void *,dittoffi_result_dittoffi_transaction_ptr_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  result = (void (*)(void *,dittoffi_result_dittoffi_transaction_ptr_t)) ((arg1)->call);
  *(void (**)(void *,dittoffi_result_dittoffi_transaction_ptr_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *)new BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1begin_1transaction_1async_1throws(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) {
  dittoffi_store_t *arg1 = (dittoffi_store_t *) 0 ;
  dittoffi_store_begin_transaction_options_t arg2 ;
  continuation_dittoffi_result_dittoffi_transaction_ptr_t arg3 ;
  dittoffi_store_begin_transaction_options_t *argp2 ;
  continuation_dittoffi_result_dittoffi_transaction_ptr_t *argp3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg2_;
  (void)jarg3_;
  arg1 = *(dittoffi_store_t **)&jarg1; 
  argp2 = *(dittoffi_store_begin_transaction_options_t **)&jarg2; 
  if (!argp2) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null dittoffi_store_begin_transaction_options_t");
    return ;
  }
  arg2 = *argp2; 
  argp3 = *(continuation_dittoffi_result_dittoffi_transaction_ptr_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null continuation_dittoffi_result_dittoffi_transaction_ptr_t");
    return ;
  }
  arg3 = *argp3; 
  {
    try {
      dittoffi_store_begin_transaction_async_throws((CDitto const *)arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1begin_1transaction_1options_1make(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_store_begin_transaction_options_t result;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = dittoffi_store_begin_transaction_options_make();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_store_begin_transaction_options_t **)&jresult = new dittoffi_store_begin_transaction_options_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observer_1cancel(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_store_observer_t *arg1 = (dittoffi_store_observer_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_observer_t **)&jarg1; 
  {
    try {
      dittoffi_store_observer_cancel((dittoffi_store_observer const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observer_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_store_observer_t *arg1 = (dittoffi_store_observer_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_observer_t **)&jarg1; 
  {
    try {
      dittoffi_store_observer_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1store_1observer_1ptr_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_dittoffi_store_observer_ptr *arg1 = (Vec_dittoffi_store_observer_ptr *) 0 ;
  dittoffi_store_observer_t **arg2 = (dittoffi_store_observer_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_store_observer_ptr **)&jarg1; 
  arg2 = *(dittoffi_store_observer_t ***)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1store_1observer_1ptr_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_dittoffi_store_observer_ptr *arg1 = (Vec_dittoffi_store_observer_ptr *) 0 ;
  dittoffi_store_observer_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_store_observer_ptr **)&jarg1; 
  result = (dittoffi_store_observer_t **) ((arg1)->ptr);
  *(dittoffi_store_observer_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1store_1observer_1ptr_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_dittoffi_store_observer_ptr *arg1 = (Vec_dittoffi_store_observer_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_store_observer_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1store_1observer_1ptr_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_dittoffi_store_observer_ptr *arg1 = (Vec_dittoffi_store_observer_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_store_observer_ptr **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1store_1observer_1ptr_1t_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_dittoffi_store_observer_ptr *arg1 = (Vec_dittoffi_store_observer_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_store_observer_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->cap = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1store_1observer_1ptr_1t_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_dittoffi_store_observer_ptr *arg1 = (Vec_dittoffi_store_observer_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_store_observer_ptr **)&jarg1; 
  result =  ((arg1)->cap);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Vec_1dittoffi_1store_1observer_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  Vec_dittoffi_store_observer_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (Vec_dittoffi_store_observer_ptr *)new Vec_dittoffi_store_observer_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Vec_dittoffi_store_observer_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Vec_1dittoffi_1store_1observer_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  Vec_dittoffi_store_observer_ptr *arg1 = (Vec_dittoffi_store_observer_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Vec_dittoffi_store_observer_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observer_1free_1sparse(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  Vec_dittoffi_store_observer_ptr_t arg1 ;
  Vec_dittoffi_store_observer_ptr_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  argp1 = *(Vec_dittoffi_store_observer_ptr_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Vec_dittoffi_store_observer_ptr_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      dittoffi_store_observer_free_sparse(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observer_1id(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_store_observer_t *arg1 = (dittoffi_store_observer_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_observer_t **)&jarg1; 
  {
    try {
      result = dittoffi_store_observer_id((dittoffi_store_observer const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observer_1is_1cancelled(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  dittoffi_store_observer_t *arg1 = (dittoffi_store_observer_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_observer_t **)&jarg1; 
  {
    try {
      result = (bool)dittoffi_store_observer_is_cancelled((dittoffi_store_observer const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observer_1query_1arguments(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_store_observer_t *arg1 = (dittoffi_store_observer_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_observer_t **)&jarg1; 
  {
    try {
      result = dittoffi_store_observer_query_arguments((dittoffi_store_observer const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observer_1query_1string(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_store_observer_t *arg1 = (dittoffi_store_observer_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_observer_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_store_observer_query_string((dittoffi_store_observer const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1observers(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  Vec_dittoffi_store_observer_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = dittoffi_store_observers((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Vec_dittoffi_store_observer_ptr_t **)&jresult = new Vec_dittoffi_store_observer_ptr_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->call);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1release_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->release = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1release_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->release);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1retain_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->retain = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ArcDynFn0_1void_1t_1retain_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->retain);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1ArcDynFn0_1void_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  ArcDynFn0_void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (ArcDynFn0_void *)new ArcDynFn0_void();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(ArcDynFn0_void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1ArcDynFn0_1void_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  ArcDynFn0_void *arg1 = (ArcDynFn0_void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(ArcDynFn0_void **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *arg1 = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *arg1 = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *arg1 = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *) 0 ;
  void (*arg2)(void *,dittoffi_query_result_t *,ArcDynFn0_void_t) = (void (*)(void *,dittoffi_query_result_t *,ArcDynFn0_void_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_query_result_t *,ArcDynFn0_void_t))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *arg1 = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *) 0 ;
  void (*result)(void *,dittoffi_query_result_t *,ArcDynFn0_void_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jarg1; 
  result = (void (*)(void *,dittoffi_query_result_t *,ArcDynFn0_void_t)) ((arg1)->call);
  *(void (**)(void *,dittoffi_query_result_t *,ArcDynFn0_void_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *arg1 = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *arg1 = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *)new BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut2_1void_1dittoffi_1query_1result_1ptr_1ArcDynFn0_1void_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *arg1 = (BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1store_1observer_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_store_observer_ptr *arg1 = (dittoffi_result_dittoffi_store_observer_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_store_observer_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1store_1observer_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_store_observer_ptr *arg1 = (dittoffi_result_dittoffi_store_observer_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_store_observer_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1store_1observer_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_store_observer_ptr *arg1 = (dittoffi_result_dittoffi_store_observer_ptr *) 0 ;
  dittoffi_store_observer_t *arg2 = (dittoffi_store_observer_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_store_observer_ptr **)&jarg1; 
  arg2 = *(dittoffi_store_observer_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1store_1observer_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_store_observer_ptr *arg1 = (dittoffi_result_dittoffi_store_observer_ptr *) 0 ;
  dittoffi_store_observer_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_store_observer_ptr **)&jarg1; 
  result = (dittoffi_store_observer_t *) ((arg1)->success);
  *(dittoffi_store_observer_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1dittoffi_1store_1observer_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_store_observer_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_dittoffi_store_observer_ptr *)new dittoffi_result_dittoffi_store_observer_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_store_observer_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1dittoffi_1store_1observer_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_dittoffi_store_observer_ptr *arg1 = (dittoffi_result_dittoffi_store_observer_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_dittoffi_store_observer_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1register_1observer_1throws(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void_t arg4 ;
  BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void_t *argp4 ;
  dittoffi_result_dittoffi_store_observer_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  argp4 = *(BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null BoxDynFnMut2_void_dittoffi_query_result_ptr_ArcDynFn0_void_t");
    return 0;
  }
  arg4 = *argp4; 
  {
    try {
      result = dittoffi_store_register_observer_throws((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_store_observer_ptr_t **)&jresult = new dittoffi_result_dittoffi_store_observer_ptr_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1store_1transactions(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_store_t *arg1 = (dittoffi_store_t *) 0 ;
  dittoffi_cbor_data_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_store_t **)&jarg1; 
  {
    try {
      result = dittoffi_store_transactions((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1sync_1subscription_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_sync_subscription_ptr *arg1 = (dittoffi_result_dittoffi_sync_subscription_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_sync_subscription_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1sync_1subscription_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_sync_subscription_ptr *arg1 = (dittoffi_result_dittoffi_sync_subscription_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_sync_subscription_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1sync_1subscription_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_sync_subscription_ptr *arg1 = (dittoffi_result_dittoffi_sync_subscription_ptr *) 0 ;
  dittoffi_sync_subscription_t *arg2 = (dittoffi_sync_subscription_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_sync_subscription_ptr **)&jarg1; 
  arg2 = *(dittoffi_sync_subscription_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1sync_1subscription_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_sync_subscription_ptr *arg1 = (dittoffi_result_dittoffi_sync_subscription_ptr *) 0 ;
  dittoffi_sync_subscription_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_sync_subscription_ptr **)&jarg1; 
  result = (dittoffi_sync_subscription_t *) ((arg1)->success);
  *(dittoffi_sync_subscription_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1dittoffi_1sync_1subscription_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_sync_subscription_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_dittoffi_sync_subscription_ptr *)new dittoffi_result_dittoffi_sync_subscription_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_sync_subscription_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1dittoffi_1sync_1subscription_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_dittoffi_sync_subscription_ptr *arg1 = (dittoffi_result_dittoffi_sync_subscription_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_dittoffi_sync_subscription_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1register_1subscription_1throws(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  dittoffi_result_dittoffi_sync_subscription_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_sync_register_subscription_throws((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_sync_subscription_ptr_t **)&jresult = new dittoffi_result_dittoffi_sync_subscription_ptr_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscription_1cancel(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_sync_subscription_t *arg1 = (dittoffi_sync_subscription_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_sync_subscription_t **)&jarg1; 
  {
    try {
      dittoffi_sync_subscription_cancel((dittoffi_sync_subscription const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscription_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_sync_subscription_t *arg1 = (dittoffi_sync_subscription_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_sync_subscription_t **)&jarg1; 
  {
    try {
      dittoffi_sync_subscription_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscription_1id(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_sync_subscription_t *arg1 = (dittoffi_sync_subscription_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_sync_subscription_t **)&jarg1; 
  {
    try {
      result = dittoffi_sync_subscription_id((dittoffi_sync_subscription const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscription_1is_1cancelled(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jboolean jresult = 0 ;
  dittoffi_sync_subscription_t *arg1 = (dittoffi_sync_subscription_t *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_sync_subscription_t **)&jarg1; 
  {
    try {
      result = (bool)dittoffi_sync_subscription_is_cancelled((dittoffi_sync_subscription const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscription_1query_1arguments(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_sync_subscription_t *arg1 = (dittoffi_sync_subscription_t *) 0 ;
  slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_sync_subscription_t **)&jarg1; 
  {
    try {
      result = dittoffi_sync_subscription_query_arguments((dittoffi_sync_subscription const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscription_1query_1string(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jstring jresult = 0 ;
  dittoffi_sync_subscription_t *arg1 = (dittoffi_sync_subscription_t *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_sync_subscription_t **)&jarg1; 
  {
    try {
      result = (char *)dittoffi_sync_subscription_query_string((dittoffi_sync_subscription const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1sync_1subscription_1ptr_1t_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_dittoffi_sync_subscription_ptr *arg1 = (Vec_dittoffi_sync_subscription_ptr *) 0 ;
  dittoffi_sync_subscription_t **arg2 = (dittoffi_sync_subscription_t **) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_sync_subscription_ptr **)&jarg1; 
  arg2 = *(dittoffi_sync_subscription_t ***)&jarg2; 
  if (arg1) (arg1)->ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1sync_1subscription_1ptr_1t_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_dittoffi_sync_subscription_ptr *arg1 = (Vec_dittoffi_sync_subscription_ptr *) 0 ;
  dittoffi_sync_subscription_t **result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_sync_subscription_ptr **)&jarg1; 
  result = (dittoffi_sync_subscription_t **) ((arg1)->ptr);
  *(dittoffi_sync_subscription_t ***)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1sync_1subscription_1ptr_1t_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_dittoffi_sync_subscription_ptr *arg1 = (Vec_dittoffi_sync_subscription_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_sync_subscription_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->len = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1sync_1subscription_1ptr_1t_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_dittoffi_sync_subscription_ptr *arg1 = (Vec_dittoffi_sync_subscription_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_sync_subscription_ptr **)&jarg1; 
  result =  ((arg1)->len);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1sync_1subscription_1ptr_1t_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  Vec_dittoffi_sync_subscription_ptr *arg1 = (Vec_dittoffi_sync_subscription_ptr *) 0 ;
  size_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_sync_subscription_ptr **)&jarg1; 
  arg2 = (size_t)jarg2; 
  if (arg1) (arg1)->cap = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_Vec_1dittoffi_1sync_1subscription_1ptr_1t_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  Vec_dittoffi_sync_subscription_ptr *arg1 = (Vec_dittoffi_sync_subscription_ptr *) 0 ;
  size_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Vec_dittoffi_sync_subscription_ptr **)&jarg1; 
  result =  ((arg1)->cap);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1Vec_1dittoffi_1sync_1subscription_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  Vec_dittoffi_sync_subscription_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (Vec_dittoffi_sync_subscription_ptr *)new Vec_dittoffi_sync_subscription_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Vec_dittoffi_sync_subscription_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1Vec_1dittoffi_1sync_1subscription_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  Vec_dittoffi_sync_subscription_ptr *arg1 = (Vec_dittoffi_sync_subscription_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(Vec_dittoffi_sync_subscription_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscriptions(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  Vec_dittoffi_sync_subscription_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = dittoffi_sync_subscriptions((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(Vec_dittoffi_sync_subscription_ptr_t **)&jresult = new Vec_dittoffi_sync_subscription_ptr_t(result); 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1sync_1subscriptions_1free_1sparse(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  Vec_dittoffi_sync_subscription_ptr_t arg1 ;
  Vec_dittoffi_sync_subscription_ptr_t *argp1 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  argp1 = *(Vec_dittoffi_sync_subscription_ptr_t **)&jarg1; 
  if (!argp1) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Vec_dittoffi_sync_subscription_ptr_t");
    return ;
  }
  arg1 = *argp1; 
  {
    try {
      dittoffi_sync_subscriptions_free_sparse(SWIG_STD_MOVE(arg1));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_transaction_completion_action *arg1 = (dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_transaction_completion_action *arg1 = (dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
  dittoffi_result_dittoffi_transaction_completion_action *arg1 = (dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  dittoffi_transaction_completion_action_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  arg2 = (dittoffi_transaction_completion_action_t)jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jint JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jint jresult = 0 ;
  dittoffi_result_dittoffi_transaction_completion_action *arg1 = (dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  dittoffi_transaction_completion_action_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  result = (dittoffi_transaction_completion_action_t) ((arg1)->success);
  jresult = (jint)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_transaction_completion_action *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_dittoffi_transaction_completion_action *)new dittoffi_result_dittoffi_transaction_completion_action();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_transaction_completion_action **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_dittoffi_transaction_completion_action *arg1 = (dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  void (*arg2)(void *,dittoffi_result_dittoffi_transaction_completion_action_t) = (void (*)(void *,dittoffi_result_dittoffi_transaction_completion_action_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_result_dittoffi_transaction_completion_action_t))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  void (*result)(void *,dittoffi_result_dittoffi_transaction_completion_action_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  result = (void (*)(void *,dittoffi_result_dittoffi_transaction_completion_action_t)) ((arg1)->call);
  *(void (**)(void *,dittoffi_result_dittoffi_transaction_completion_action_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *)new BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1transaction_1completion_1action_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_transaction_completion_action **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1transaction_1complete_1async_1throws(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jlong jarg3, jobject jarg3_) {
  dittoffi_transaction_t *arg1 = (dittoffi_transaction_t *) 0 ;
  dittoffi_transaction_completion_action_t arg2 ;
  continuation_dittoffi_result_dittoffi_transaction_completion_action_t arg3 ;
  continuation_dittoffi_result_dittoffi_transaction_completion_action_t *argp3 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg3_;
  arg1 = *(dittoffi_transaction_t **)&jarg1; 
  arg2 = (dittoffi_transaction_completion_action_t)jarg2; 
  argp3 = *(continuation_dittoffi_result_dittoffi_transaction_completion_action_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null continuation_dittoffi_result_dittoffi_transaction_completion_action_t");
    return ;
  }
  arg3 = *argp3; 
  {
    try {
      dittoffi_transaction_complete_async_throws((dittoffi_transaction const *)arg1,arg2,SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_query_result_ptr *arg1 = (dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_query_result_ptr *arg1 = (dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_dittoffi_query_result_ptr *arg1 = (dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  dittoffi_query_result_t *arg2 = (dittoffi_query_result_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  arg2 = *(dittoffi_query_result_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_query_result_ptr *arg1 = (dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  dittoffi_query_result_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  result = (dittoffi_query_result_t *) ((arg1)->success);
  *(dittoffi_query_result_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_dittoffi_query_result_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_dittoffi_query_result_ptr *)new dittoffi_result_dittoffi_query_result_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_query_result_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_dittoffi_query_result_ptr *arg1 = (dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1env_1ptr_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  void *arg2 = (void *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  arg2 = *(void **)&jarg2; 
  if (arg1) (arg1)->env_ptr = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1env_1ptr_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  void *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  result = (void *) ((arg1)->env_ptr);
  *(void **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1call_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  void (*arg2)(void *,dittoffi_result_dittoffi_query_result_ptr_t) = (void (*)(void *,dittoffi_result_dittoffi_query_result_ptr_t)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  arg2 = *(void (**)(void *,dittoffi_result_dittoffi_query_result_ptr_t))&jarg2; 
  if (arg1) (arg1)->call = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1call_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  void (*result)(void *,dittoffi_result_dittoffi_query_result_ptr_t) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  result = (void (*)(void *,dittoffi_result_dittoffi_query_result_ptr_t)) ((arg1)->call);
  *(void (**)(void *,dittoffi_result_dittoffi_query_result_ptr_t))&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1free_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  void (*arg2)(void *) = (void (*)(void *)) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  arg2 = *(void (**)(void *))&jarg2; 
  if (arg1) (arg1)->free = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t_1free_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  void (*result)(void *) = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  result = (void (*)(void *)) ((arg1)->free);
  *(void (**)(void *))&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *)new BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1BoxDynFnMut1_1void_1dittoffi_1result_1dittoffi_1query_1result_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *arg1 = (BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(BoxDynFnMut1_void_dittoffi_result_dittoffi_query_result_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1transaction_1execute_1async_1throws(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jlong jarg4, jobject jarg4_) {
  dittoffi_transaction_t *arg1 = (dittoffi_transaction_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  continuation_dittoffi_result_dittoffi_query_result_ptr_t arg4 ;
  continuation_dittoffi_result_dittoffi_query_result_ptr_t *argp4 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(dittoffi_transaction_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  argp4 = *(continuation_dittoffi_result_dittoffi_query_result_ptr_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null continuation_dittoffi_result_dittoffi_query_result_ptr_t");
    return ;
  }
  arg4 = *argp4; 
  {
    try {
      dittoffi_transaction_execute_async_throws((dittoffi_transaction const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1transaction_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_transaction_t *arg1 = (dittoffi_transaction_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_transaction_t **)&jarg1; 
  {
    try {
      dittoffi_transaction_free(arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jbyteArray JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1transaction_1info(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jbyteArray jresult = 0 ;
  dittoffi_transaction_t *arg1 = (dittoffi_transaction_t *) 0 ;
  dittoffi_cbor_data_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_transaction_t **)&jarg1; 
  {
    try {
      result = dittoffi_transaction_info((dittoffi_transaction const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  {
    if ((&result)->ptr != NULL) {
      jresult = jenv->NewByteArray((&result)->len);
      jenv->SetByteArrayRegion(jresult, 0, (&result)->len, (jbyte *)(&result)->ptr);
      // We do not call `ditto_c_bytes_free(result);` here since the `ret` typemap
      // takes care of that.
    } else {
      jresult = jenv->NewByteArray(0);
    }
  }
  {
    if ((&result)->ptr != NULL) {
      ditto_c_bytes_free(result);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1transports_1refresh_1permissions(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      dittoffi_transports_refresh_permissions((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1transports_1update_1app_1in_1foreground(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) {
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  {
    try {
      dittoffi_transports_update_app_in_foreground((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1add_1subscription(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jbyteArray jarg4, jobjectArray jarg5, jint jarg6, jlong jarg7) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_COrderByParam_t arg5 ;
  int32_t arg6 ;
  uint32_t arg7 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg5 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg5),
    };
    (&arg5)->ptr = (typeof((&arg5)->ptr)) calloc(sizeof(*(&arg5)->ptr), (&arg5)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg5)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg5, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg5)->ptr[i],
        (void *) cptr,
        sizeof((&arg5)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg5)->ptr is to be done within the `freearg` typemap
  }
  arg6 = (int32_t)jarg6; 
  arg7 = (uint32_t)jarg7; 
  {
    try {
      result = dittoffi_try_add_subscription((CDitto const *)arg1,(char const *)arg2,(char const *)arg3,SWIG_STD_MOVE(arg4),SWIG_STD_MOVE(arg5),arg6,arg7);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg5)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1add_1sync_1subscription(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_try_add_sync_subscription((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1slice_1boxed_1uint8_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_slice_boxed_uint8 *arg1 = (dittoffi_result_slice_boxed_uint8 *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_slice_boxed_uint8 **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1slice_1boxed_1uint8_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_slice_boxed_uint8 *arg1 = (dittoffi_result_slice_boxed_uint8 *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_slice_boxed_uint8 **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1slice_1boxed_1uint8_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  dittoffi_result_slice_boxed_uint8 *arg1 = (dittoffi_result_slice_boxed_uint8 *) 0 ;
  slice_boxed_uint8_t *arg2 = (slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(dittoffi_result_slice_boxed_uint8 **)&jarg1; 
  arg2 = *(slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->success = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1slice_1boxed_1uint8_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_slice_boxed_uint8 *arg1 = (dittoffi_result_slice_boxed_uint8 *) 0 ;
  slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_slice_boxed_uint8 **)&jarg1; 
  result = (slice_boxed_uint8_t *)& ((arg1)->success);
  *(slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_slice_boxed_uint8 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_slice_boxed_uint8 *)new dittoffi_result_slice_boxed_uint8();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_slice_boxed_uint8 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_slice_boxed_uint8 *arg1 = (dittoffi_result_slice_boxed_uint8 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_slice_boxed_uint8 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1base64_1decode(JNIEnv *jenv, jclass jcls, jstring jarg1, jint jarg2) {
  jlong jresult = 0 ;
  char *arg1 = (char *) 0 ;
  Base64PaddingMode_t arg2 ;
  dittoffi_result_slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = 0;
  if (jarg1) {
    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
    if (!arg1) return 0;
  }
  arg2 = (Base64PaddingMode_t)jarg2; 
  {
    try {
      result = dittoffi_try_base64_decode((char const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_slice_boxed_uint8_t **)&jresult = new dittoffi_result_slice_boxed_uint8_t(result); 
  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = dittoffi_try_collection((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1bool_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_bool *arg1 = (dittoffi_result_bool *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_bool **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1bool_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_bool *arg1 = (dittoffi_result_bool *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_bool **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1bool_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
  dittoffi_result_bool *arg1 = (dittoffi_result_bool *) 0 ;
  bool arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_bool **)&jarg1; 
  arg2 = jarg2 ? true : false; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jboolean JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1bool_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jboolean jresult = 0 ;
  dittoffi_result_bool *arg1 = (dittoffi_result_bool *) 0 ;
  bool result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_bool **)&jarg1; 
  result = (bool) ((arg1)->success);
  jresult = (jboolean)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1bool_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_bool *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_bool *)new dittoffi_result_bool();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_bool **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1bool_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_bool *arg1 = (dittoffi_result_bool *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_bool **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1evict(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jbyteArray jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_uint8_t arg4 ;
  dittoffi_result_bool_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_try_collection_evict((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_bool_t **)&jresult = new dittoffi_result_bool_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1slice_1boxed_1uint8_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_Vec_slice_boxed_uint8 *arg1 = (dittoffi_result_Vec_slice_boxed_uint8 *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_Vec_slice_boxed_uint8 **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1slice_1boxed_1uint8_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_Vec_slice_boxed_uint8 *arg1 = (dittoffi_result_Vec_slice_boxed_uint8 *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_Vec_slice_boxed_uint8 **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1slice_1boxed_1uint8_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  dittoffi_result_Vec_slice_boxed_uint8 *arg1 = (dittoffi_result_Vec_slice_boxed_uint8 *) 0 ;
  Vec_slice_boxed_uint8_t *arg2 = (Vec_slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(dittoffi_result_Vec_slice_boxed_uint8 **)&jarg1; 
  arg2 = *(Vec_slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->success = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1slice_1boxed_1uint8_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_Vec_slice_boxed_uint8 *arg1 = (dittoffi_result_Vec_slice_boxed_uint8 *) 0 ;
  Vec_slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_Vec_slice_boxed_uint8 **)&jarg1; 
  result = (Vec_slice_boxed_uint8_t *)& ((arg1)->success);
  *(Vec_slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1Vec_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_Vec_slice_boxed_uint8 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_Vec_slice_boxed_uint8 *)new dittoffi_result_Vec_slice_boxed_uint8();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_Vec_slice_boxed_uint8 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1Vec_1slice_1boxed_1uint8_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_Vec_slice_boxed_uint8 *arg1 = (dittoffi_result_Vec_slice_boxed_uint8 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_Vec_slice_boxed_uint8 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1evict_1by_1ids(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_slice_boxed_uint8_t arg4 ;
  slice_ref_slice_boxed_uint8_t *argp4 ;
  dittoffi_result_Vec_slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  argp4 = *(slice_ref_slice_boxed_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_slice_boxed_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  {
    try {
      result = dittoffi_try_collection_evict_by_ids((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_Vec_slice_boxed_uint8_t **)&jresult = new dittoffi_result_Vec_slice_boxed_uint8_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1evict_1query_1str(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jstring jarg4, jbyteArray jarg5, jobjectArray jarg6, jint jarg7, jlong jarg8) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  char *arg4 = (char *) 0 ;
  slice_ref_uint8_t arg5 ;
  slice_ref_COrderByParam_t arg6 ;
  int32_t arg7 ;
  uint32_t arg8 ;
  dittoffi_result_Vec_slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5 == NULL) {
      arg5 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg5, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg5);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg5 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg6 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg6),
    };
    (&arg6)->ptr = (typeof((&arg6)->ptr)) calloc(sizeof(*(&arg6)->ptr), (&arg6)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg6)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg6, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg6)->ptr[i],
        (void *) cptr,
        sizeof((&arg6)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg6)->ptr is to be done within the `freearg` typemap
  }
  arg7 = (int32_t)jarg7; 
  arg8 = (uint32_t)jarg8; 
  {
    try {
      result = dittoffi_try_collection_evict_query_str((CDitto const *)arg1,(char const *)arg2,arg3,(char const *)arg4,SWIG_STD_MOVE(arg5),SWIG_STD_MOVE(arg6),arg7,arg8);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_Vec_slice_boxed_uint8_t **)&jresult = new dittoffi_result_Vec_slice_boxed_uint8_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg5 != NULL) {
      jenv->ReleaseByteArrayElements(jarg5, (jbyte *)(&arg5)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg6)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_docs_1and_1ids_1t_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  docs_and_ids *arg1 = (docs_and_ids *) 0 ;
  Vec_CDocument_ptr_t *arg2 = (Vec_CDocument_ptr_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(docs_and_ids **)&jarg1; 
  arg2 = *(Vec_CDocument_ptr_t **)&jarg2; 
  if (arg1) (arg1)->documents = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_docs_1and_1ids_1t_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  docs_and_ids *arg1 = (docs_and_ids *) 0 ;
  Vec_CDocument_ptr_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(docs_and_ids **)&jarg1; 
  result = (Vec_CDocument_ptr_t *)& ((arg1)->documents);
  *(Vec_CDocument_ptr_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_docs_1and_1ids_1t_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  docs_and_ids *arg1 = (docs_and_ids *) 0 ;
  Vec_slice_boxed_uint8_t *arg2 = (Vec_slice_boxed_uint8_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(docs_and_ids **)&jarg1; 
  arg2 = *(Vec_slice_boxed_uint8_t **)&jarg2; 
  if (arg1) (arg1)->ids = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_docs_1and_1ids_1t_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  docs_and_ids *arg1 = (docs_and_ids *) 0 ;
  Vec_slice_boxed_uint8_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(docs_and_ids **)&jarg1; 
  result = (Vec_slice_boxed_uint8_t *)& ((arg1)->ids);
  *(Vec_slice_boxed_uint8_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1docs_1and_1ids_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  docs_and_ids *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (docs_and_ids *)new docs_and_ids();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(docs_and_ids **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1docs_1and_1ids_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  docs_and_ids *arg1 = (docs_and_ids *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(docs_and_ids **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1docs_1and_1ids_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_docs_and_ids *arg1 = (dittoffi_result_docs_and_ids *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_docs_and_ids **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1docs_1and_1ids_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_docs_and_ids *arg1 = (dittoffi_result_docs_and_ids *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_docs_and_ids **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1docs_1and_1ids_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  dittoffi_result_docs_and_ids *arg1 = (dittoffi_result_docs_and_ids *) 0 ;
  docs_and_ids_t *arg2 = (docs_and_ids_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(dittoffi_result_docs_and_ids **)&jarg1; 
  arg2 = *(docs_and_ids_t **)&jarg2; 
  if (arg1) (arg1)->success = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1docs_1and_1ids_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_docs_and_ids *arg1 = (dittoffi_result_docs_and_ids *) 0 ;
  docs_and_ids_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_docs_and_ids **)&jarg1; 
  result = (docs_and_ids_t *)& ((arg1)->success);
  *(docs_and_ids_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1docs_1and_1ids_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_docs_and_ids *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_docs_and_ids *)new dittoffi_result_docs_and_ids();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_docs_and_ids **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1docs_1and_1ids_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_docs_and_ids *arg1 = (dittoffi_result_docs_and_ids *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_docs_and_ids **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1find_1by_1ids(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_slice_boxed_uint8_t arg3 ;
  CReadTransaction_t *arg4 = (CReadTransaction_t *) 0 ;
  slice_ref_slice_boxed_uint8_t *argp3 ;
  dittoffi_result_docs_and_ids_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg3_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  argp3 = *(slice_ref_slice_boxed_uint8_t **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_slice_boxed_uint8_t");
    return 0;
  }
  arg3 = *argp3; 
  arg4 = *(CReadTransaction_t **)&jarg4; 
  {
    try {
      result = dittoffi_try_collection_find_by_ids((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_docs_and_ids_t **)&jresult = new dittoffi_result_docs_and_ids_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDocument_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_CDocument_ptr *arg1 = (dittoffi_result_CDocument_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDocument_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDocument_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_CDocument_ptr *arg1 = (dittoffi_result_CDocument_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDocument_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDocument_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_CDocument_ptr *arg1 = (dittoffi_result_CDocument_ptr *) 0 ;
  CDocument_t *arg2 = (CDocument_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDocument_ptr **)&jarg1; 
  arg2 = *(CDocument_t **)&jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1CDocument_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_CDocument_ptr *arg1 = (dittoffi_result_CDocument_ptr *) 0 ;
  CDocument_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_CDocument_ptr **)&jarg1; 
  result = (CDocument_t *) ((arg1)->success);
  *(CDocument_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1CDocument_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_CDocument_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_CDocument_ptr *)new dittoffi_result_CDocument_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_CDocument_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1CDocument_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_CDocument_ptr *arg1 = (dittoffi_result_CDocument_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_CDocument_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jlong jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  CReadTransaction_t *arg4 = (CReadTransaction_t *) 0 ;
  dittoffi_result_CDocument_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = *(CReadTransaction_t **)&jarg4; 
  {
    try {
      result = dittoffi_try_collection_get((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_CDocument_ptr_t **)&jresult = new dittoffi_result_CDocument_ptr_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1insert_1value(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jint jarg4, jstring jarg5, jlong jarg6) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  WriteStrategyRs_t arg4 ;
  char *arg5 = (char *) 0 ;
  CWriteTransaction_t *arg6 = (CWriteTransaction_t *) 0 ;
  dittoffi_result_slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = (WriteStrategyRs_t)jarg4; 
  arg5 = 0;
  if (jarg5) {
    arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0);
    if (!arg5) return 0;
  }
  arg6 = *(CWriteTransaction_t **)&jarg6; 
  {
    try {
      result = dittoffi_try_collection_insert_value((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4,(char const *)arg5,arg6);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_slice_boxed_uint8_t **)&jresult = new dittoffi_result_slice_boxed_uint8_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1remove(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jbyteArray jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_uint8_t arg4 ;
  dittoffi_result_bool_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_try_collection_remove((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_bool_t **)&jresult = new dittoffi_result_bool_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1remove_1by_1ids(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  slice_ref_slice_boxed_uint8_t arg4 ;
  slice_ref_slice_boxed_uint8_t *argp4 ;
  dittoffi_result_Vec_slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  argp4 = *(slice_ref_slice_boxed_uint8_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null slice_ref_slice_boxed_uint8_t");
    return 0;
  }
  arg4 = *argp4; 
  {
    try {
      result = dittoffi_try_collection_remove_by_ids((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_Vec_slice_boxed_uint8_t **)&jresult = new dittoffi_result_Vec_slice_boxed_uint8_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1remove_1query_1str(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jstring jarg4, jbyteArray jarg5, jobjectArray jarg6, jint jarg7, jlong jarg8) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  char *arg4 = (char *) 0 ;
  slice_ref_uint8_t arg5 ;
  slice_ref_COrderByParam_t arg6 ;
  int32_t arg7 ;
  uint32_t arg8 ;
  dittoffi_result_Vec_slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  arg4 = 0;
  if (jarg4) {
    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
    if (!arg4) return 0;
  }
  {
    if (jarg5 == NULL) {
      arg5 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg5, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg5);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg5 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg6 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg6),
    };
    (&arg6)->ptr = (typeof((&arg6)->ptr)) calloc(sizeof(*(&arg6)->ptr), (&arg6)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg6)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg6, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg6)->ptr[i],
        (void *) cptr,
        sizeof((&arg6)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg6)->ptr is to be done within the `freearg` typemap
  }
  arg7 = (int32_t)jarg7; 
  arg8 = (uint32_t)jarg8; 
  {
    try {
      result = dittoffi_try_collection_remove_query_str((CDitto const *)arg1,(char const *)arg2,arg3,(char const *)arg4,SWIG_STD_MOVE(arg5),SWIG_STD_MOVE(arg6),arg7,arg8);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_Vec_slice_boxed_uint8_t **)&jresult = new dittoffi_result_Vec_slice_boxed_uint8_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg5 != NULL) {
      jenv->ReleaseByteArrayElements(jarg5, (jbyte *)(&arg5)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg6)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1update(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  CDocument_t *arg4 = (CDocument_t *) 0 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  arg4 = *(CDocument_t **)&jarg4; 
  {
    try {
      result = dittoffi_try_collection_update((CDitto const *)arg1,(char const *)arg2,arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1collection_1update_1multiple(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  CWriteTransaction_t *arg3 = (CWriteTransaction_t *) 0 ;
  Vec_CDocument_ptr_t arg4 ;
  Vec_CDocument_ptr_t *argp4 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg4_;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(CWriteTransaction_t **)&jarg3; 
  argp4 = *(Vec_CDocument_ptr_t **)&jarg4; 
  if (!argp4) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Vec_CDocument_ptr_t");
    return 0;
  }
  arg4 = *argp4; 
  {
    try {
      result = dittoffi_try_collection_update_multiple((CDitto const *)arg1,(char const *)arg2,arg3,SWIG_STD_MOVE(arg4));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1document_1get_1cbor_1with_1path_1type(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jint jarg3) {
  jlong jresult = 0 ;
  CDocument_t *arg1 = (CDocument_t *) 0 ;
  char *arg2 = (char *) 0 ;
  PathAccessorType_t arg3 ;
  dittoffi_result_slice_boxed_uint8_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDocument_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = (PathAccessorType_t)jarg3; 
  {
    try {
      result = dittoffi_try_document_get_cbor_with_path_type((CDocument const *)arg1,(char const *)arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_slice_boxed_uint8_t **)&jresult = new dittoffi_result_slice_boxed_uint8_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1exec_1statement(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  dittoffi_result_dittoffi_query_result_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_try_exec_statement((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_dittoffi_query_result_ptr_t **)&jresult = new dittoffi_result_dittoffi_query_result_ptr_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ChangeHandlerWithQueryResult_1t_1query_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  ChangeHandlerWithQueryResult *arg1 = (ChangeHandlerWithQueryResult *) 0 ;
  dittoffi_query_result_t *arg2 = (dittoffi_query_result_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ChangeHandlerWithQueryResult **)&jarg1; 
  arg2 = *(dittoffi_query_result_t **)&jarg2; 
  if (arg1) (arg1)->query_result = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ChangeHandlerWithQueryResult_1t_1query_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  ChangeHandlerWithQueryResult *arg1 = (ChangeHandlerWithQueryResult *) 0 ;
  dittoffi_query_result_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(ChangeHandlerWithQueryResult **)&jarg1; 
  result = (dittoffi_query_result_t *) ((arg1)->query_result);
  *(dittoffi_query_result_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1ChangeHandlerWithQueryResult_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  ChangeHandlerWithQueryResult *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (ChangeHandlerWithQueryResult *)new ChangeHandlerWithQueryResult();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(ChangeHandlerWithQueryResult **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1ChangeHandlerWithQueryResult_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  ChangeHandlerWithQueryResult *arg1 = (ChangeHandlerWithQueryResult *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(ChangeHandlerWithQueryResult **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1int64_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_int64 *arg1 = (dittoffi_result_int64 *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_int64 **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1int64_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_int64 *arg1 = (dittoffi_result_int64 *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_int64 **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1int64_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_int64 *arg1 = (dittoffi_result_int64 *) 0 ;
  int64_t arg2 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_int64 **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  if (arg1) (arg1)->success = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1int64_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_int64 *arg1 = (dittoffi_result_int64 *) 0 ;
  int64_t result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_int64 **)&jarg1; 
  result = (int64_t) ((arg1)->success);
  jresult = (jlong)result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1int64_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_int64 *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_int64 *)new dittoffi_result_int64();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_int64 **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1int64_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_int64 *arg1 = (dittoffi_result_int64 *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_int64 **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1experimental_1register_1change_1observer_1str(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3, jint jarg4, jlong jarg5, jlong jarg6, jlong jarg7, jlong jarg8) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  LiveQueryAvailability_t arg4 ;
  void *arg5 = (void *) 0 ;
  void (*arg6)(void *) = (void (*)(void *)) 0 ;
  void (*arg7)(void *) = (void (*)(void *)) 0 ;
  void (*arg8)(void *,ChangeHandlerWithQueryResult_t) = (void (*)(void *,ChangeHandlerWithQueryResult_t)) 0 ;
  dittoffi_result_int64_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  arg4 = (LiveQueryAvailability_t)jarg4; 
  arg5 = *(void **)&jarg5; 
  arg6 = *(void (**)(void *))&jarg6; 
  arg7 = *(void (**)(void *))&jarg7; 
  arg8 = *(void (**)(void *,ChangeHandlerWithQueryResult_t))&jarg8; 
  {
    try {
      result = dittoffi_try_experimental_register_change_observer_str((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3),arg4,arg5,arg6,arg7,arg8);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_int64_t **)&jresult = new dittoffi_result_int64_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1char_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_Vec_char_ptr *arg1 = (dittoffi_result_Vec_char_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_Vec_char_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1char_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_Vec_char_ptr *arg1 = (dittoffi_result_Vec_char_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_Vec_char_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1char_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
  dittoffi_result_Vec_char_ptr *arg1 = (dittoffi_result_Vec_char_ptr *) 0 ;
  Vec_char_ptr_t *arg2 = (Vec_char_ptr_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  (void)jarg2_;
  arg1 = *(dittoffi_result_Vec_char_ptr **)&jarg1; 
  arg2 = *(Vec_char_ptr_t **)&jarg2; 
  if (arg1) (arg1)->success = *arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1Vec_1char_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_Vec_char_ptr *arg1 = (dittoffi_result_Vec_char_ptr *) 0 ;
  Vec_char_ptr_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_Vec_char_ptr **)&jarg1; 
  result = (Vec_char_ptr_t *)& ((arg1)->success);
  *(Vec_char_ptr_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1Vec_1char_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_Vec_char_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_Vec_char_ptr *)new dittoffi_result_Vec_char_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_Vec_char_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1Vec_1char_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_Vec_char_ptr *arg1 = (dittoffi_result_Vec_char_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_Vec_char_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1get_1collection_1names(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  dittoffi_result_Vec_char_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    try {
      result = dittoffi_try_get_collection_names((CDitto const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_Vec_char_ptr_t **)&jresult = new dittoffi_result_Vec_char_ptr_t(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1live_1query_1start(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  int64_t arg2 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = (int64_t)jarg2; 
  {
    try {
      result = dittoffi_try_live_query_start((CDitto const *)arg1,arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1queries_1hash(JNIEnv *jenv, jclass jcls, jlong jarg1, jobjectArray jarg2, jobjectArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_char_const_ptr_t arg2 ;
  slice_ref_char_const_ptr_t arg3 ;
  dittoffi_result_uint64_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    arg2 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg2),
    };
    (&arg2)->ptr = (typeof((&arg2)->ptr)) calloc(sizeof(*(&arg2)->ptr), (&arg2)->len);
    for (size_t i = 0; i < (&arg2)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg2, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg2)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg2)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    arg3 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg3),
    };
    (&arg3)->ptr = (typeof((&arg3)->ptr)) calloc(sizeof(*(&arg3)->ptr), (&arg3)->len);
    for (size_t i = 0; i < (&arg3)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg3, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg3)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg3)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    try {
      result = dittoffi_try_queries_hash((CDitto const *)arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_uint64_t **)&jresult = new dittoffi_result_uint64_t(result); 
  {
    while ((&arg2)->len > 0) {
      --(&arg2)->len;
      free((void *) (&arg2)->ptr[(&arg2)->len]); // frees strdup
    }
    free((void *) (&arg2)->ptr); // frees calloc
  }
  {
    while ((&arg3)->len > 0) {
      --(&arg3)->len;
      free((void *) (&arg3)->ptr[(&arg3)->len]); // frees strdup
    }
    free((void *) (&arg3)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1char_1ptr_1t_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
  dittoffi_result_char_ptr *arg1 = (dittoffi_result_char_ptr *) 0 ;
  dittoffi_error_t *arg2 = (dittoffi_error_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_char_ptr **)&jarg1; 
  arg2 = *(dittoffi_error_t **)&jarg2; 
  if (arg1) (arg1)->error = arg2;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1char_1ptr_1t_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jlong jresult = 0 ;
  dittoffi_result_char_ptr *arg1 = (dittoffi_result_char_ptr *) 0 ;
  dittoffi_error_t *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_char_ptr **)&jarg1; 
  result = (dittoffi_error_t *) ((arg1)->error);
  *(dittoffi_error_t **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1char_1ptr_1t_1success_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  dittoffi_result_char_ptr *arg1 = (dittoffi_result_char_ptr *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_char_ptr **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    delete [] arg1->success;
    if (arg2) {
      arg1->success = (char *) (new char[strlen((const char *)arg2)+1]);
      strcpy((char *)arg1->success, (const char *)arg2);
    } else {
      arg1->success = 0;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT jstring JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1result_1char_1ptr_1t_1success_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
  jstring jresult = 0 ;
  dittoffi_result_char_ptr *arg1 = (dittoffi_result_char_ptr *) 0 ;
  char *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(dittoffi_result_char_ptr **)&jarg1; 
  result = (char *) ((arg1)->success);
  if (result) jresult = jenv->NewStringUTF((const char *)result);
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_new_1dittoffi_1result_1char_1ptr_1t(JNIEnv *jenv, jclass jcls) {
  jlong jresult = 0 ;
  dittoffi_result_char_ptr *result = 0 ;
  
  (void)jenv;
  (void)jcls;
  {
    try {
      result = (dittoffi_result_char_ptr *)new dittoffi_result_char_ptr();
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_char_ptr **)&jresult = result; 
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_delete_1dittoffi_1result_1char_1ptr_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  dittoffi_result_char_ptr *arg1 = (dittoffi_result_char_ptr *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(dittoffi_result_char_ptr **)&jarg1; 
  {
    try {
      delete arg1;
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1queries_1hash_1mnemonic(JNIEnv *jenv, jclass jcls, jlong jarg1, jobjectArray jarg2, jobjectArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  slice_ref_char_const_ptr_t arg2 ;
  slice_ref_char_const_ptr_t arg3 ;
  dittoffi_result_char_ptr_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  {
    arg2 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg2),
    };
    (&arg2)->ptr = (typeof((&arg2)->ptr)) calloc(sizeof(*(&arg2)->ptr), (&arg2)->len);
    for (size_t i = 0; i < (&arg2)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg2, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg2)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg2)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    arg3 = (slice_ref_char_const_ptr_t) {
      .len = (size_t) jenv->GetArrayLength(jarg3),
    };
    (&arg3)->ptr = (typeof((&arg3)->ptr)) calloc(sizeof(*(&arg3)->ptr), (&arg3)->len);
    for (size_t i = 0; i < (&arg3)->len; ++i) {
      jstring j_string = (jstring)jenv->GetObjectArrayElement(jarg3, i);
      char const * c_string = jenv->GetStringUTFChars(j_string, 0);
      ((char const * *) (&arg3)->ptr)[i] = strdup(c_string);
      // Free c_string
      jenv->ReleaseStringUTFChars(j_string, c_string);
      // Free j_string
      jenv->DeleteLocalRef(j_string);
    }
    // Freeing (&arg3)->ptr[i] is to be done within the `freearg` typemap
  }
  {
    try {
      result = dittoffi_try_queries_hash_mnemonic((CDitto const *)arg1,SWIG_STD_MOVE(arg2),SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_char_ptr_t **)&jresult = new dittoffi_result_char_ptr_t(result); 
  {
    while ((&arg2)->len > 0) {
      --(&arg2)->len;
      free((void *) (&arg2)->ptr[(&arg2)->len]); // frees strdup
    }
    free((void *) (&arg2)->ptr); // frees calloc
  }
  {
    while ((&arg3)->len > 0) {
      --(&arg3)->len;
      free((void *) (&arg3)->ptr[(&arg3)->len]); // frees strdup
    }
    free((void *) (&arg3)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1register_1store_1observer(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jbyteArray jarg4, jobjectArray jarg5, jint jarg6, jlong jarg7, jint jarg8, jlong jarg9, jlong jarg10, jlong jarg11, jlong jarg12) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_COrderByParam_t arg5 ;
  int32_t arg6 ;
  uint32_t arg7 ;
  LiveQueryAvailability_t arg8 ;
  void *arg9 = (void *) 0 ;
  void (*arg10)(void *) = (void (*)(void *)) 0 ;
  void (*arg11)(void *) = (void (*)(void *)) 0 ;
  void (*arg12)(void *,c_cb_params_t) = (void (*)(void *,c_cb_params_t)) 0 ;
  dittoffi_result_int64_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg5 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg5),
    };
    (&arg5)->ptr = (typeof((&arg5)->ptr)) calloc(sizeof(*(&arg5)->ptr), (&arg5)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg5)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg5, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg5)->ptr[i],
        (void *) cptr,
        sizeof((&arg5)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg5)->ptr is to be done within the `freearg` typemap
  }
  arg6 = (int32_t)jarg6; 
  arg7 = (uint32_t)jarg7; 
  arg8 = (LiveQueryAvailability_t)jarg8; 
  arg9 = *(void **)&jarg9; 
  arg10 = *(void (**)(void *))&jarg10; 
  arg11 = *(void (**)(void *))&jarg11; 
  arg12 = *(void (**)(void *,c_cb_params_t))&jarg12; 
  {
    try {
      result = dittoffi_try_register_store_observer((CDitto const *)arg1,(char const *)arg2,(char const *)arg3,SWIG_STD_MOVE(arg4),SWIG_STD_MOVE(arg5),arg6,arg7,arg8,arg9,arg10,arg11,arg12);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_int64_t **)&jresult = new dittoffi_result_int64_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg5)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1remove_1subscription(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jbyteArray jarg4, jobjectArray jarg5, jint jarg6, jlong jarg7) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  slice_ref_uint8_t arg4 ;
  slice_ref_COrderByParam_t arg5 ;
  int32_t arg6 ;
  uint32_t arg7 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return 0;
  }
  {
    if (jarg4 == NULL) {
      arg4 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg4, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg4);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg4 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    arg5 = (slice_ref_COrderByParam_t) {
      .len = (size_t) jenv->GetArrayLength(jarg5),
    };
    (&arg5)->ptr = (typeof((&arg5)->ptr)) calloc(sizeof(*(&arg5)->ptr), (&arg5)->len);
    // Prepare to call `COrderByParam_t.getCPtr()` as done above
    jclass jcls_COrderByParam_t = jenv->FindClass("live/ditto/internal/swig/ffi/COrderByParam_t")
    
    ;
    do {
      if (!(jcls_COrderByParam_t != NULL)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to find COrderByParam_t class.");              return NULL;          
      }      
    } while (0);
    jmethodID getCPtr = jenv->GetStaticMethodID(jcls_COrderByParam_t, "getCPtr", "(Llive/ditto/internal/swig/ffi/COrderByParam_t;)J")
    
    
    
    ;
    do {
      if (!(getCPtr != 0)) {
        SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get getCPtr method.");              return NULL;          
      }      
    } while (0);
    for (size_t i = 0; i < (&arg5)->len; ++i) {
      jobject jobj = jenv->GetObjectArrayElement(jarg5, i);
      do {
        if (!(jobj != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Null element in COrderByParam_t array");              return NULL;          
        }      
      } while (0);
      auto cptr = jenv->CallStaticLongMethod(jcls_COrderByParam_t, getCPtr, jobj)
      
      
      
      ;
      do {
        if (!(cptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get C pointer from COrderByParam_t object");              return NULL;          
        }      
      } while (0);
      
      memcpy(
        (void *) &(&arg5)->ptr[i],
        (void *) cptr,
        sizeof((&arg5)->ptr[i])
        );
      jenv->DeleteLocalRef(jobj);
    }
    // Freeing (&arg5)->ptr is to be done within the `freearg` typemap
  }
  arg6 = (int32_t)jarg6; 
  arg7 = (uint32_t)jarg7; 
  {
    try {
      result = dittoffi_try_remove_subscription((CDitto const *)arg1,(char const *)arg2,(char const *)arg3,SWIG_STD_MOVE(arg4),SWIG_STD_MOVE(arg5),arg6,arg7);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg4 != NULL) {
      jenv->ReleaseByteArrayElements(jarg4, (jbyte *)(&arg4)->ptr, JNI_ABORT);
    }
  }
  {
    free((void *) (&arg5)->ptr); // frees calloc
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1remove_1sync_1subscription(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jbyteArray jarg3) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  slice_ref_uint8_t arg3 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    if (jarg3 == NULL) {
      arg3 = slice_ref_uint8_t {
        .ptr = (uint8_t const *) NULL,
        .len = (size_t) 0,
      };
    } else {
      uint8_t const *ptr = (uint8_t const *) jenv->GetByteArrayElements(jarg3, NULL);
      do {
        if (!(ptr != NULL)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array elements");          
        }      
      } while (0) ;
      auto length = jenv->GetArrayLength(jarg3);
      do {
        if (!(length >= 0)) {
          SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Failed to get byte array length");          
        }      
      } while (0) ;
      
      arg3 = slice_ref_uint8_t {
        .ptr = ptr,
        .len = (size_t) length,
      };
    }
  }
  {
    try {
      result = dittoffi_try_remove_sync_subscription((CDitto const *)arg1,(char const *)arg2,SWIG_STD_MOVE(arg3));
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  {
    // Free the allocation from `GetByteArrayElements`
    if (jarg3 != NULL) {
      jenv->ReleaseByteArrayElements(jarg3, (jbyte *)(&arg3)->ptr, JNI_ABORT);
    }
  }
  return jresult;
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_dittoffi_1try_1verify_1license(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  jlong jresult = 0 ;
  CDitto_t *arg1 = (CDitto_t *) 0 ;
  char *arg2 = (char *) 0 ;
  dittoffi_result_void_t result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(CDitto_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return 0;
  }
  {
    try {
      result = dittoffi_try_verify_license((CDitto const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return 0;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return 0;
    }
  }
  *(dittoffi_result_void_t **)&jresult = new dittoffi_result_void_t(result); 
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  return jresult;
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_mdns_1advertising_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      mdns_advertising_state_changed((TransportHandle_MdnsPlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_mdns_1platform_1peer_1appeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      mdns_platform_peer_appeared((TransportHandle_MdnsPlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_mdns_1platform_1peer_1disappeared(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      mdns_platform_peer_disappeared((TransportHandle_MdnsPlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_mdns_1scanning_1state_1changed(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  OnlineState_t arg2 ;
  TransportCondition_t arg3 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  arg2 = (OnlineState_t)jarg2; 
  arg3 = (TransportCondition_t)jarg3; 
  {
    try {
      mdns_scanning_state_changed((TransportHandle_MdnsPlatformEvent const *)arg1,arg2,arg3);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_mdns_1server_1invalidate_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  {
    try {
      mdns_server_invalidate_listener((TransportHandle_MdnsPlatformEvent const *)arg1);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_mdns_1service_1did_1not_1resolve(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  {
    try {
      mdns_service_did_not_resolve((TransportHandle_MdnsPlatformEvent const *)arg1,(char const *)arg2);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}


SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_mdns_1service_1did_1resolve(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jstring jarg3, jint jarg4) {
  TransportHandle_MdnsPlatformEvent_t *arg1 = (TransportHandle_MdnsPlatformEvent_t *) 0 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  uint16_t arg4 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(TransportHandle_MdnsPlatformEvent_t **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
    if (!arg2) return ;
  }
  arg3 = 0;
  if (jarg3) {
    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
    if (!arg3) return ;
  }
  arg4 = (uint16_t)jarg4; 
  {
    try {
      mdns_service_did_resolve((TransportHandle_MdnsPlatformEvent const *)arg1,(char const *)arg2,(char const *)arg3,arg4);
    } catch (const std::runtime_error &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (const std::exception &e) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, e.what());
      return ;
    } catch (...) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unknown exception");
      return ;
    }
  }
  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}


SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_RetainableContinuation_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(RetainableContinuation **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionCompletionContinuation_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(TransactionCompletionContinuation **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_TransactionExecuteContinuation_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(TransactionExecuteContinuation **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BeginTransactionContinuation_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(BeginTransactionContinuation **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_WifiAwareRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(WifiAwareRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_BluetoothLeRadioRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(BluetoothLeRadioRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StatusRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(StatusRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LoginProviderRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(LoginProviderRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AuthenticationStatusHandlerRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(AuthenticationStatusHandlerRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_DiskUsageObserverRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(DiskUsageObserverRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_AttachmentObserverRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(AttachmentObserverRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_ConnectionRequestHandlerRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(ConnectionRequestHandlerRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_CrashReporterFfi_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(CrashReporterFfi **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_LiveQueryHandlerRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(LiveQueryHandlerRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_PresenceRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(PresenceRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT jlong JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_StoreObserverHandlerRust_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
    jlong baseptr = 0;
    (void)jenv;
    (void)jcls;
    *(Retainable **)&baseptr = *(StoreObserverHandlerRust **)&jarg1;
    return baseptr;
}

SWIGEXPORT void JNICALL Java_live_ditto_internal_swig_ffi_dittoffiJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls) {
  int i;
  
  static struct {
    const char *method;
    const char *signature;
  } methods[125] = {
    {
      "SwigDirector_Retainable_java_retain", "(Llive/ditto/internal/swig/ffi/Retainable;)V" 
    },
    {
      "SwigDirector_Retainable_java_release", "(Llive/ditto/internal/swig/ffi/Retainable;)V" 
    },
    {
      "SwigDirector_LoggerCb_ffiCustomLog", "(Llive/ditto/internal/swig/ffi/LoggerCb;ILjava/lang/String;)V" 
    },
    {
      "SwigDirector_RetainableContinuation_java_retain", "(Llive/ditto/internal/swig/ffi/RetainableContinuation;)V" 
    },
    {
      "SwigDirector_RetainableContinuation_java_release", "(Llive/ditto/internal/swig/ffi/RetainableContinuation;)V" 
    },
    {
      "SwigDirector_RetainableContinuation_invoke", "(Llive/ditto/internal/swig/ffi/RetainableContinuation;J)V" 
    },
    {
      "SwigDirector_TransactionCompletionContinuation_java_retain", "(Llive/ditto/internal/swig/ffi/TransactionCompletionContinuation;)V" 
    },
    {
      "SwigDirector_TransactionCompletionContinuation_java_release", "(Llive/ditto/internal/swig/ffi/TransactionCompletionContinuation;)V" 
    },
    {
      "SwigDirector_TransactionCompletionContinuation_invoke", "(Llive/ditto/internal/swig/ffi/TransactionCompletionContinuation;J)V" 
    },
    {
      "SwigDirector_TransactionExecuteContinuation_java_retain", "(Llive/ditto/internal/swig/ffi/TransactionExecuteContinuation;)V" 
    },
    {
      "SwigDirector_TransactionExecuteContinuation_java_release", "(Llive/ditto/internal/swig/ffi/TransactionExecuteContinuation;)V" 
    },
    {
      "SwigDirector_TransactionExecuteContinuation_invoke", "(Llive/ditto/internal/swig/ffi/TransactionExecuteContinuation;J)V" 
    },
    {
      "SwigDirector_BeginTransactionContinuation_java_retain", "(Llive/ditto/internal/swig/ffi/BeginTransactionContinuation;)V" 
    },
    {
      "SwigDirector_BeginTransactionContinuation_java_release", "(Llive/ditto/internal/swig/ffi/BeginTransactionContinuation;)V" 
    },
    {
      "SwigDirector_BeginTransactionContinuation_invoke", "(Llive/ditto/internal/swig/ffi/BeginTransactionContinuation;J)V" 
    },
    {
      "SwigDirector_WifiAwareRust_java_retain", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_java_release", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientStartSearching", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientStopSearching", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientCreateNetwork", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientUpdatePeer", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;I)V" 
    },
    {
      "SwigDirector_WifiAwareRust_serverStartAdvertising", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;Ljava/lang/String;I)V" 
    },
    {
      "SwigDirector_WifiAwareRust_serverStopAdvertising", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_serverUpdatePeer", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;I)V" 
    },
    {
      "SwigDirector_WifiAwareRust_updateParameterU64", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;ILjava/math/BigInteger;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_addWifiAwareTransport", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;J)V" 
    },
    {
      "SwigDirector_WifiAwareRust_removeWifiAwareTransport", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientPeerAppeared", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientPeerDisappeared", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientScanningStateChanged", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;II)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientNetworkDidCreate", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;Ljava/lang/String;I)V" 
    },
    {
      "SwigDirector_WifiAwareRust_clientNetworkDidNotCreate", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_serverAdvertisingStateChanged", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;II)V" 
    },
    {
      "SwigDirector_WifiAwareRust_serverNetworkScopeIdAdded", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;J)V" 
    },
    {
      "SwigDirector_WifiAwareRust_serverNetworkScopeIdRemoved", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;J)V" 
    },
    {
      "SwigDirector_WifiAwareRust_goOnlineRequest", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;)V" 
    },
    {
      "SwigDirector_WifiAwareRust_goOfflineRequest", "(Llive/ditto/internal/swig/ffi/WifiAwareRust;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_java_retain", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_java_release", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_connectPeripheral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_disconnectPeripheral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_getAdvertisingState", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)I" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_getScanningState", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)I" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_notifyToCentral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;I[B[B)J" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_startAdvertising", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BLjava/lang/String;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_startScanning", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BLjava/lang/String;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_stopAdvertising", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_stopScanning", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_writeToPeripheral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;I[B[B)J" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_appIsInForeground", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)Z" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_readL2capFromPeripheral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BJ)I" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_sendL2capToPeripheral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B[B)I" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_readL2capFromCentral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BJ)I" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_sendL2capToCentral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B[B)I" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_addBleTransport", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;J)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_dropBleTransport", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_advertisementHeard", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B[BZLjava/lang/String;F)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_connectionStateChanged", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BIZI)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_peripheralMtuUpdated", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BI)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_receivedFromPeripheral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BI[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_scanningStateChanged", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;II)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_peripheralReadyToSend", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_peripheralL2capReadyToSend", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_peripheralL2capDataAvailable", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_advertisingStateChanged", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;II)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_centralMtuUpdated", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BI)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_receivedFromCentral", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[BI[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_centralFinishedConnecting", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B[BZI)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_centralUnsubscribed", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_centralReadyToSend", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_centralL2capReadyToSend", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_BluetoothLeRadioRust_centralL2capDataAvailable", "(Llive/ditto/internal/swig/ffi/BluetoothLeRadioRust;[B)V" 
    },
    {
      "SwigDirector_StatusRust_java_retain", "(Llive/ditto/internal/swig/ffi/StatusRust;)V" 
    },
    {
      "SwigDirector_StatusRust_java_release", "(Llive/ditto/internal/swig/ffi/StatusRust;)V" 
    },
    {
      "SwigDirector_StatusRust_transportConditionDidChange", "(Llive/ditto/internal/swig/ffi/StatusRust;II)V" 
    },
    {
      "SwigDirector_StatusRust_submit", "(Llive/ditto/internal/swig/ffi/StatusRust;J)V" 
    },
    {
      "SwigDirector_StatusRust_shutdown", "(Llive/ditto/internal/swig/ffi/StatusRust;J)V" 
    },
    {
      "SwigDirector_LoginProviderRust_java_retain", "(Llive/ditto/internal/swig/ffi/LoginProviderRust;)V" 
    },
    {
      "SwigDirector_LoginProviderRust_java_release", "(Llive/ditto/internal/swig/ffi/LoginProviderRust;)V" 
    },
    {
      "SwigDirector_LoginProviderRust_authenticationExpiring", "(Llive/ditto/internal/swig/ffi/LoginProviderRust;J)V" 
    },
    {
      "SwigDirector_LoginProviderRust_submit", "(Llive/ditto/internal/swig/ffi/LoginProviderRust;)V" 
    },
    {
      "SwigDirector_AuthenticationStatusHandlerRust_java_retain", "(Llive/ditto/internal/swig/ffi/AuthenticationStatusHandlerRust;)V" 
    },
    {
      "SwigDirector_AuthenticationStatusHandlerRust_java_release", "(Llive/ditto/internal/swig/ffi/AuthenticationStatusHandlerRust;)V" 
    },
    {
      "SwigDirector_AuthenticationStatusHandlerRust_authenticationStatusUpdated", "(Llive/ditto/internal/swig/ffi/AuthenticationStatusHandlerRust;J)V" 
    },
    {
      "SwigDirector_AuthenticationStatusHandlerRust_submit", "(Llive/ditto/internal/swig/ffi/AuthenticationStatusHandlerRust;J)V" 
    },
    {
      "SwigDirector_DiskUsageObserverRust_java_retain", "(Llive/ditto/internal/swig/ffi/DiskUsageObserverRust;)V" 
    },
    {
      "SwigDirector_DiskUsageObserverRust_java_release", "(Llive/ditto/internal/swig/ffi/DiskUsageObserverRust;)V" 
    },
    {
      "SwigDirector_DiskUsageObserverRust_diskUsageUpdated", "(Llive/ditto/internal/swig/ffi/DiskUsageObserverRust;J)V" 
    },
    {
      "SwigDirector_DiskUsageObserverRust_subscribe", "(Llive/ditto/internal/swig/ffi/DiskUsageObserverRust;J)V" 
    },
    {
      "SwigDirector_DiskUsageObserverRust_stop", "(Llive/ditto/internal/swig/ffi/DiskUsageObserverRust;)V" 
    },
    {
      "SwigDirector_AttachmentObserverRust_java_retain", "(Llive/ditto/internal/swig/ffi/AttachmentObserverRust;)V" 
    },
    {
      "SwigDirector_AttachmentObserverRust_java_release", "(Llive/ditto/internal/swig/ffi/AttachmentObserverRust;)V" 
    },
    {
      "SwigDirector_AttachmentObserverRust_completedEventHandler", "(Llive/ditto/internal/swig/ffi/AttachmentObserverRust;J)V" 
    },
    {
      "SwigDirector_AttachmentObserverRust_progressEventHandler", "(Llive/ditto/internal/swig/ffi/AttachmentObserverRust;Ljava/math/BigInteger;Ljava/math/BigInteger;)V" 
    },
    {
      "SwigDirector_AttachmentObserverRust_deletedEventHandler", "(Llive/ditto/internal/swig/ffi/AttachmentObserverRust;)V" 
    },
    {
      "SwigDirector_AttachmentObserverRust_resolve_attachment", "(Llive/ditto/internal/swig/ffi/AttachmentObserverRust;J[B)J" 
    },
    {
      "SwigDirector_ConnectionRequestHandlerRust_java_retain", "(Llive/ditto/internal/swig/ffi/ConnectionRequestHandlerRust;)V" 
    },
    {
      "SwigDirector_ConnectionRequestHandlerRust_java_release", "(Llive/ditto/internal/swig/ffi/ConnectionRequestHandlerRust;)V" 
    },
    {
      "SwigDirector_ConnectionRequestHandlerRust_eventHandler", "(Llive/ditto/internal/swig/ffi/ConnectionRequestHandlerRust;J)V" 
    },
    {
      "SwigDirector_ConnectionRequestHandlerRust_registerConnectionRequestHandler", "(Llive/ditto/internal/swig/ffi/ConnectionRequestHandlerRust;JJ)V" 
    },
    {
      "SwigDirector_CrashReporterFfi_java_retain", "(Llive/ditto/internal/swig/ffi/CrashReporterFfi;)V" 
    },
    {
      "SwigDirector_CrashReporterFfi_java_release", "(Llive/ditto/internal/swig/ffi/CrashReporterFfi;)V" 
    },
    {
      "SwigDirector_CrashReporterFfi_reportCrashKotlinImplementation", "(Llive/ditto/internal/swig/ffi/CrashReporterFfi;J)V" 
    },
    {
      "SwigDirector_CrashReporterFfi_overrideCrashReporter", "(Llive/ditto/internal/swig/ffi/CrashReporterFfi;J)V" 
    },
    {
      "SwigDirector_LiveQueryHandlerRust_java_retain", "(Llive/ditto/internal/swig/ffi/LiveQueryHandlerRust;)V" 
    },
    {
      "SwigDirector_LiveQueryHandlerRust_java_release", "(Llive/ditto/internal/swig/ffi/LiveQueryHandlerRust;)V" 
    },
    {
      "SwigDirector_LiveQueryHandlerRust_eventHandler", "(Llive/ditto/internal/swig/ffi/LiveQueryHandlerRust;J)V" 
    },
    {
      "SwigDirector_LiveQueryHandlerRust_registerLiveQuery", "(Llive/ditto/internal/swig/ffi/LiveQueryHandlerRust;JLjava/lang/String;Ljava/lang/String;[BJJIJI)J" 
    },
    {
      "SwigDirector_LiveQueryHandlerRust_startLiveQuery", "(Llive/ditto/internal/swig/ffi/LiveQueryHandlerRust;JJ)I" 
    },
    {
      "SwigDirector_PresenceRust_java_retain", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_PresenceRust_java_release", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_PresenceRust_v1Callback", "(Llive/ditto/internal/swig/ffi/PresenceRust;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_PresenceRust_v2Callback", "(Llive/ditto/internal/swig/ffi/PresenceRust;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_PresenceRust_v3Callback", "(Llive/ditto/internal/swig/ffi/PresenceRust;Ljava/lang/String;)V" 
    },
    {
      "SwigDirector_PresenceRust_register_v1", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_PresenceRust_register_v2", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_PresenceRust_register_v3", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_PresenceRust_requestV1Update", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_PresenceRust_requestV2Update", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_PresenceRust_requestV3Update", "(Llive/ditto/internal/swig/ffi/PresenceRust;)V" 
    },
    {
      "SwigDirector_StoreObserverHandlerRust_java_retain", "(Llive/ditto/internal/swig/ffi/StoreObserverHandlerRust;)V" 
    },
    {
      "SwigDirector_StoreObserverHandlerRust_java_release", "(Llive/ditto/internal/swig/ffi/StoreObserverHandlerRust;)V" 
    },
    {
      "SwigDirector_StoreObserverHandlerRust_eventHandler", "(Llive/ditto/internal/swig/ffi/StoreObserverHandlerRust;J)V" 
    },
    {
      "SwigDirector_StoreObserverHandlerRust_registerStoreObserver", "(Llive/ditto/internal/swig/ffi/StoreObserverHandlerRust;JLjava/lang/String;[BI)J" 
    },
    {
      "SwigDirector_StoreObserverHandlerRust_startLiveQuery", "(Llive/ditto/internal/swig/ffi/StoreObserverHandlerRust;JJ)I" 
    }
  };
  Swig::jclass_dittoffiJNI = (jclass) jenv->NewGlobalRef(jcls);
  if (!Swig::jclass_dittoffiJNI) return;
  for (i = 0; i < (int) (sizeof(methods)/sizeof(methods[0])); ++i) {
    Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature);
    if (!Swig::director_method_ids[i]) return;
  }
}


#ifdef __cplusplus
}
#endif

