remove symbolink links
[openjpeg.git] / applications / JavaOpenJPEG / java-jni / include / jdwpTransport.h
1 /*\r
2  * @(#)jdwpTransport.h  1.7 03/12/19\r
3  *\r
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.\r
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.\r
6  */\r
7 \r
8 /*\r
9  * Java Debug Wire Protocol Transport Service Provider Interface.\r
10  */\r
11 \r
12 #ifndef JDWPTRANSPORT_H\r
13 #define JDWPTRANSPORT_H\r
14 \r
15 #include "jni.h"\r
16 \r
17 enum {\r
18     JDWPTRANSPORT_VERSION_1_0 = 0x00010000\r
19 };\r
20 \r
21 #ifdef __cplusplus\r
22 extern "C" {\r
23 #endif\r
24 \r
25 struct jdwpTransportNativeInterface_;\r
26 \r
27 struct _jdwpTransportEnv;\r
28 \r
29 #ifdef __cplusplus\r
30 typedef _jdwpTransportEnv jdwpTransportEnv;\r
31 #else\r
32 typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;\r
33 #endif /* __cplusplus */\r
34 \r
35 /*\r
36  * Errors. Universal errors with JVMTI/JVMDI equivalents keep the\r
37  * values the same.\r
38  */\r
39 typedef enum {\r
40     JDWPTRANSPORT_ERROR_NONE = 0,\r
41     JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,\r
42     JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,\r
43     JDWPTRANSPORT_ERROR_INTERNAL = 113,\r
44     JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,\r
45     JDWPTRANSPORT_ERROR_IO_ERROR = 202,\r
46     JDWPTRANSPORT_ERROR_TIMEOUT = 203,\r
47     JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204\r
48 } jdwpTransportError;\r
49     \r
50 \r
51 /*\r
52  * Structure to define capabilities\r
53  */\r
54 typedef struct {\r
55     unsigned int can_timeout_attach     :1;\r
56     unsigned int can_timeout_accept     :1;\r
57     unsigned int can_timeout_handshake  :1;\r
58     unsigned int reserved3              :1;\r
59     unsigned int reserved4              :1;\r
60     unsigned int reserved5              :1;\r
61     unsigned int reserved6              :1;\r
62     unsigned int reserved7              :1;\r
63     unsigned int reserved8              :1;\r
64     unsigned int reserved9              :1;\r
65     unsigned int reserved10             :1;\r
66     unsigned int reserved11             :1;\r
67     unsigned int reserved12             :1;\r
68     unsigned int reserved13             :1;\r
69     unsigned int reserved14             :1;\r
70     unsigned int reserved15             :1;\r
71 } JDWPTransportCapabilities;\r
72 \r
73 \r
74 /*\r
75  * Structures to define packet layout.\r
76  * \r
77  * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html\r
78  */\r
79 \r
80 enum {\r
81     JDWPTRANSPORT_FLAGS_NONE     = 0x0,\r
82     JDWPTRANSPORT_FLAGS_REPLY    = 0x80\r
83 };\r
84 \r
85 typedef struct {\r
86     jint len; \r
87     jint id;\r
88     jbyte flags;\r
89     jbyte cmdSet;\r
90     jbyte cmd;\r
91     jbyte *data;\r
92 } jdwpCmdPacket;\r
93 \r
94 typedef struct {\r
95     jint len;\r
96     jint id;\r
97     jbyte flags;\r
98     jshort errorCode;\r
99     jbyte *data;\r
100 } jdwpReplyPacket;\r
101 \r
102 typedef struct {\r
103     union {\r
104         jdwpCmdPacket cmd;\r
105         jdwpReplyPacket reply;\r
106     } type;\r
107 } jdwpPacket;\r
108 \r
109 /*\r
110  * JDWP functions called by the transport.\r
111  */\r
112 typedef struct jdwpTransportCallback {\r
113     void *(*alloc)(jint numBytes);   /* Call this for all allocations */\r
114     void (*free)(void *buffer);      /* Call this for all deallocations */\r
115 } jdwpTransportCallback;\r
116 \r
117 typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,\r
118                                                jdwpTransportCallback *callback,\r
119                                                jint version,\r
120                                                jdwpTransportEnv** env);\r
121 \r
122 \r
123 \r
124 /* Function Interface */\r
125 \r
126 struct jdwpTransportNativeInterface_ {\r
127     /*  1 :  RESERVED */\r
128     void *reserved1;\r
129 \r
130     /*  2 : Get Capabilities */\r
131     jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,\r
132          JDWPTransportCapabilities *capabilities_ptr);\r
133 \r
134     /*  3 : Attach */\r
135     jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,\r
136         const char* address,\r
137         jlong attach_timeout,\r
138         jlong handshake_timeout);\r
139 \r
140     /*  4: StartListening */\r
141     jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,\r
142         const char* address, \r
143         char** actual_address);\r
144 \r
145     /*  5: StopListening */\r
146     jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);\r
147 \r
148     /*  6: Accept */\r
149     jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,\r
150         jlong accept_timeout, \r
151         jlong handshake_timeout);\r
152 \r
153     /*  7: IsOpen */\r
154     jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);\r
155 \r
156     /*  8: Close */\r
157     jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);\r
158 \r
159     /*  9: ReadPacket */\r
160     jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,\r
161         jdwpPacket *pkt);\r
162 \r
163     /*  10: Write Packet */\r
164     jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,\r
165         const jdwpPacket* pkt);\r
166 \r
167     /*  11:  GetLastError */\r
168     jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,\r
169         char** error);\r
170 \r
171 };\r
172 \r
173 \r
174 /*\r
175  * Use inlined functions so that C++ code can use syntax such as\r
176  *      env->Attach("mymachine:5000", 10*1000, 0);\r
177  *\r
178  * rather than using C's :-\r
179  *\r
180  *      (*env)->Attach(env, "mymachine:5000", 10*1000, 0);\r
181  */\r
182 struct _jdwpTransportEnv {\r
183     const struct jdwpTransportNativeInterface_ *functions;\r
184 #ifdef __cplusplus\r
185 \r
186     jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {\r
187         return functions->GetCapabilities(this, capabilities_ptr);\r
188     }\r
189 \r
190     jdwpTransportError Attach(const char* address, jlong attach_timeout,\r
191                 jlong handshake_timeout) {\r
192         return functions->Attach(this, address, attach_timeout, handshake_timeout);\r
193     }\r
194 \r
195     jdwpTransportError StartListening(const char* address,\r
196                 char** actual_address) {\r
197         return functions->StartListening(this, address, actual_address);\r
198     }\r
199 \r
200     jdwpTransportError StopListening(void) {\r
201         return functions->StopListening(this);\r
202     }\r
203 \r
204     jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {\r
205         return functions->Accept(this, accept_timeout, handshake_timeout);\r
206     }\r
207 \r
208     jboolean IsOpen(void) {\r
209         return functions->IsOpen(this);\r
210     }\r
211 \r
212     jdwpTransportError Close(void) {\r
213         return functions->Close(this);\r
214     }\r
215 \r
216     jdwpTransportError ReadPacket(jdwpPacket *pkt) {\r
217         return functions->ReadPacket(this, pkt);\r
218     }\r
219 \r
220     jdwpTransportError WritePacket(const jdwpPacket* pkt) {\r
221         return functions->WritePacket(this, pkt);\r
222     }\r
223 \r
224     jdwpTransportError GetLastError(char** error) {\r
225         return functions->GetLastError(this, error);\r
226     }\r
227 \r
228 \r
229 #endif /* __cplusplus */\r
230 };\r
231 \r
232 #ifdef __cplusplus\r
233 } /* extern "C" */\r
234 #endif /* __cplusplus */\r
235 \r
236 #endif /* JDWPTRANSPORT_H */\r
237 \r