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
32struct bag;
33
34typedef struct PacketInputStream {
35    jbyte *current;
36    jint left;
37    jdwpError error;
38    jdwpPacket packet;
39    struct bag *refs;
40} PacketInputStream;
41
42void inStream_init(PacketInputStream *stream, jdwpPacket packet);
43
44jint inStream_id(PacketInputStream *stream);
45jbyte inStream_command(PacketInputStream *stream);
46
47jboolean inStream_readBoolean(PacketInputStream *stream);
48jbyte inStream_readByte(PacketInputStream *stream);
49jbyte* inStream_readBytes(PacketInputStream *stream,
50                          int length, jbyte *buf);
51jchar inStream_readChar(PacketInputStream *stream);
52jshort inStream_readShort(PacketInputStream *stream);
53jint inStream_readInt(PacketInputStream *stream);
54jlong inStream_readLong(PacketInputStream *stream);
55jfloat inStream_readFloat(PacketInputStream *stream);
56jdouble inStream_readDouble(PacketInputStream *stream);
57jlong inStream_readObjectID(PacketInputStream *stream);
58FrameID inStream_readFrameID(PacketInputStream *stream);
59jmethodID inStream_readMethodID(PacketInputStream *stream);
60jfieldID inStream_readFieldID(PacketInputStream *stream);
61jlocation inStream_readLocation(PacketInputStream *stream);
62
63jobject inStream_readObjectRef(JNIEnv *env, PacketInputStream *stream);
64jclass inStream_readClassRef(JNIEnv *env, PacketInputStream *stream);
65jthread inStream_readThreadRef(JNIEnv *env, PacketInputStream *stream);
66jthreadGroup inStream_readThreadGroupRef(JNIEnv *env, PacketInputStream *stream);
67jobject inStream_readClassLoaderRef(JNIEnv *env, PacketInputStream *stream);
68jstring inStream_readStringRef(JNIEnv *env, PacketInputStream *stream);
69jarray inStream_readArrayRef(JNIEnv *env, PacketInputStream *stream);
70
71char *inStream_readString(PacketInputStream *stream);
72jvalue inStream_readValue(struct PacketInputStream *in, jbyte *typeKeyPtr);
73
74jdwpError inStream_skipBytes(PacketInputStream *stream, jint count);
75
76jboolean inStream_endOfInput(PacketInputStream *stream);
77jdwpError inStream_error(PacketInputStream *stream);
78void inStream_clearError(PacketInputStream *stream);
79void inStream_destroy(PacketInputStream *stream);
80
81#endif /* _INSTREAM_H */
82