Home | History | Annotate | Download | only in back
      1 /*
      2  * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
      3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      4  *
      5  * This code is free software; you can redistribute it and/or modify it
      6  * under the terms of the GNU General Public License version 2 only, as
      7  * published by the Free Software Foundation.  Oracle designates this
      8  * particular file as subject to the "Classpath" exception as provided
      9  * by Oracle in the LICENSE file that accompanied this code.
     10  *
     11  * This code is distributed in the hope that it will be useful, but WITHOUT
     12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14  * version 2 for more details (a copy is included in the LICENSE file that
     15  * accompanied this code).
     16  *
     17  * You should have received a copy of the GNU General Public License version
     18  * 2 along with this work; if not, write to the Free Software Foundation,
     19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     20  *
     21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     22  * or visit www.oracle.com if you need additional information or have any
     23  * questions.
     24  */
     25 
     26 #ifndef JDWP_INSTREAM_H
     27 #define JDWP_INSTREAM_H
     28 
     29 #include "transport.h"
     30 #include "FrameID.h"
     31 
     32 struct bag;
     33 
     34 typedef struct PacketInputStream {
     35     jbyte *current;
     36     jint left;
     37     jdwpError error;
     38     jdwpPacket packet;
     39     struct bag *refs;
     40 } PacketInputStream;
     41 
     42 void inStream_init(PacketInputStream *stream, jdwpPacket packet);
     43 
     44 jint inStream_id(PacketInputStream *stream);
     45 jbyte inStream_command(PacketInputStream *stream);
     46 
     47 jboolean inStream_readBoolean(PacketInputStream *stream);
     48 jbyte inStream_readByte(PacketInputStream *stream);
     49 jbyte* inStream_readBytes(PacketInputStream *stream,
     50                           int length, jbyte *buf);
     51 jchar inStream_readChar(PacketInputStream *stream);
     52 jshort inStream_readShort(PacketInputStream *stream);
     53 jint inStream_readInt(PacketInputStream *stream);
     54 jlong inStream_readLong(PacketInputStream *stream);
     55 jfloat inStream_readFloat(PacketInputStream *stream);
     56 jdouble inStream_readDouble(PacketInputStream *stream);
     57 jlong inStream_readObjectID(PacketInputStream *stream);
     58 FrameID inStream_readFrameID(PacketInputStream *stream);
     59 jmethodID inStream_readMethodID(PacketInputStream *stream);
     60 jfieldID inStream_readFieldID(PacketInputStream *stream);
     61 jlocation inStream_readLocation(PacketInputStream *stream);
     62 
     63 jobject inStream_readObjectRef(JNIEnv *env, PacketInputStream *stream);
     64 jclass inStream_readClassRef(JNIEnv *env, PacketInputStream *stream);
     65 jthread inStream_readThreadRef(JNIEnv *env, PacketInputStream *stream);
     66 jthreadGroup inStream_readThreadGroupRef(JNIEnv *env, PacketInputStream *stream);
     67 jobject inStream_readClassLoaderRef(JNIEnv *env, PacketInputStream *stream);
     68 jstring inStream_readStringRef(JNIEnv *env, PacketInputStream *stream);
     69 jarray inStream_readArrayRef(JNIEnv *env, PacketInputStream *stream);
     70 
     71 char *inStream_readString(PacketInputStream *stream);
     72 jvalue inStream_readValue(struct PacketInputStream *in, jbyte *typeKeyPtr);
     73 
     74 jdwpError inStream_skipBytes(PacketInputStream *stream, jint count);
     75 
     76 jboolean inStream_endOfInput(PacketInputStream *stream);
     77 jdwpError inStream_error(PacketInputStream *stream);
     78 void inStream_clearError(PacketInputStream *stream);
     79 void inStream_destroy(PacketInputStream *stream);
     80 
     81 #endif /* _INSTREAM_H */
     82