Added missing files to JavaOpenJPEG project (files from Patrick Piscaglia)
[openjpeg.git] / JavaOpenJPEG / java-jni / include / jdwpTransport.h
diff --git a/JavaOpenJPEG/java-jni/include/jdwpTransport.h b/JavaOpenJPEG/java-jni/include/jdwpTransport.h
new file mode 100644 (file)
index 0000000..1d78009
--- /dev/null
@@ -0,0 +1,237 @@
+/*\r
+ * @(#)jdwpTransport.h 1.7 03/12/19\r
+ *\r
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.\r
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.\r
+ */\r
+\r
+/*\r
+ * Java Debug Wire Protocol Transport Service Provider Interface.\r
+ */\r
+\r
+#ifndef JDWPTRANSPORT_H\r
+#define JDWPTRANSPORT_H\r
+\r
+#include "jni.h"\r
+\r
+enum {\r
+    JDWPTRANSPORT_VERSION_1_0 = 0x00010000\r
+};\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+struct jdwpTransportNativeInterface_;\r
+\r
+struct _jdwpTransportEnv;\r
+\r
+#ifdef __cplusplus\r
+typedef _jdwpTransportEnv jdwpTransportEnv;\r
+#else\r
+typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;\r
+#endif /* __cplusplus */\r
+\r
+/*\r
+ * Errors. Universal errors with JVMTI/JVMDI equivalents keep the\r
+ * values the same.\r
+ */\r
+typedef enum {\r
+    JDWPTRANSPORT_ERROR_NONE = 0,\r
+    JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,\r
+    JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,\r
+    JDWPTRANSPORT_ERROR_INTERNAL = 113,\r
+    JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,\r
+    JDWPTRANSPORT_ERROR_IO_ERROR = 202,\r
+    JDWPTRANSPORT_ERROR_TIMEOUT = 203,\r
+    JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204\r
+} jdwpTransportError;\r
+    \r
+\r
+/*\r
+ * Structure to define capabilities\r
+ */\r
+typedef struct {\r
+    unsigned int can_timeout_attach     :1;\r
+    unsigned int can_timeout_accept     :1;\r
+    unsigned int can_timeout_handshake  :1;\r
+    unsigned int reserved3              :1;\r
+    unsigned int reserved4              :1;\r
+    unsigned int reserved5              :1;\r
+    unsigned int reserved6              :1;\r
+    unsigned int reserved7              :1;\r
+    unsigned int reserved8              :1;\r
+    unsigned int reserved9              :1;\r
+    unsigned int reserved10             :1;\r
+    unsigned int reserved11             :1;\r
+    unsigned int reserved12             :1;\r
+    unsigned int reserved13             :1;\r
+    unsigned int reserved14            :1;\r
+    unsigned int reserved15            :1;\r
+} JDWPTransportCapabilities;\r
+\r
+\r
+/*\r
+ * Structures to define packet layout.\r
+ * \r
+ * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html\r
+ */\r
+\r
+enum {\r
+    JDWPTRANSPORT_FLAGS_NONE    = 0x0,\r
+    JDWPTRANSPORT_FLAGS_REPLY   = 0x80\r
+};\r
+\r
+typedef struct {\r
+    jint len; \r
+    jint id;\r
+    jbyte flags;\r
+    jbyte cmdSet;\r
+    jbyte cmd;\r
+    jbyte *data;\r
+} jdwpCmdPacket;\r
+\r
+typedef struct {\r
+    jint len;\r
+    jint id;\r
+    jbyte flags;\r
+    jshort errorCode;\r
+    jbyte *data;\r
+} jdwpReplyPacket;\r
+\r
+typedef struct {\r
+    union {\r
+        jdwpCmdPacket cmd;\r
+        jdwpReplyPacket reply;\r
+    } type;\r
+} jdwpPacket;\r
+\r
+/*\r
+ * JDWP functions called by the transport.\r
+ */\r
+typedef struct jdwpTransportCallback {\r
+    void *(*alloc)(jint numBytes);   /* Call this for all allocations */\r
+    void (*free)(void *buffer);      /* Call this for all deallocations */\r
+} jdwpTransportCallback;\r
+\r
+typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,\r
+                                              jdwpTransportCallback *callback,\r
+                                              jint version,\r
+                                              jdwpTransportEnv** env);\r
+\r
+\r
+\r
+/* Function Interface */\r
+\r
+struct jdwpTransportNativeInterface_ {\r
+    /*  1 :  RESERVED */\r
+    void *reserved1;\r
+\r
+    /* 2 : Get Capabilities */\r
+    jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,\r
+        JDWPTransportCapabilities *capabilities_ptr);\r
+\r
+    /*  3 : Attach */\r
+    jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,\r
+       const char* address,\r
+       jlong attach_timeout,\r
+       jlong handshake_timeout);\r
+\r
+    /*  4: StartListening */\r
+    jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,\r
+       const char* address, \r
+       char** actual_address);\r
+\r
+    /*  5: StopListening */\r
+    jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);\r
+\r
+    /*  6: Accept */\r
+    jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,\r
+       jlong accept_timeout, \r
+       jlong handshake_timeout);\r
+\r
+    /*  7: IsOpen */\r
+    jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);\r
+\r
+    /*  8: Close */\r
+    jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);\r
+\r
+    /*  9: ReadPacket */\r
+    jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,\r
+       jdwpPacket *pkt);\r
+\r
+    /*  10: Write Packet */\r
+    jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,\r
+       const jdwpPacket* pkt);\r
+\r
+    /*  11:  GetLastError */\r
+    jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,\r
+       char** error);\r
+\r
+};\r
+\r
+\r
+/*\r
+ * Use inlined functions so that C++ code can use syntax such as\r
+ *     env->Attach("mymachine:5000", 10*1000, 0);\r
+ *\r
+ * rather than using C's :-\r
+ *\r
+ *     (*env)->Attach(env, "mymachine:5000", 10*1000, 0);\r
+ */\r
+struct _jdwpTransportEnv {\r
+    const struct jdwpTransportNativeInterface_ *functions;\r
+#ifdef __cplusplus\r
+\r
+    jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {\r
+       return functions->GetCapabilities(this, capabilities_ptr);\r
+    }\r
+\r
+    jdwpTransportError Attach(const char* address, jlong attach_timeout,\r
+               jlong handshake_timeout) {\r
+       return functions->Attach(this, address, attach_timeout, handshake_timeout);\r
+    }\r
+\r
+    jdwpTransportError StartListening(const char* address,\r
+               char** actual_address) {\r
+       return functions->StartListening(this, address, actual_address);\r
+    }\r
+\r
+    jdwpTransportError StopListening(void) {\r
+       return functions->StopListening(this);\r
+    }\r
+\r
+    jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {\r
+       return functions->Accept(this, accept_timeout, handshake_timeout);\r
+    }\r
+\r
+    jboolean IsOpen(void) {\r
+        return functions->IsOpen(this);\r
+    }\r
+\r
+    jdwpTransportError Close(void) {\r
+        return functions->Close(this);\r
+    }\r
+\r
+    jdwpTransportError ReadPacket(jdwpPacket *pkt) {\r
+       return functions->ReadPacket(this, pkt);\r
+    }\r
+\r
+    jdwpTransportError WritePacket(const jdwpPacket* pkt) {\r
+       return functions->WritePacket(this, pkt);\r
+    }\r
+\r
+    jdwpTransportError GetLastError(char** error) {\r
+       return functions->GetLastError(this, error);\r
+    }\r
+\r
+\r
+#endif /* __cplusplus */\r
+};\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+#endif /* JDWPTRANSPORT_H */\r
+\r