source: trunk/openjdk/jdk/src/share/back/outStream.h

Last change on this file was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

File size: 3.7 KB
Line 
1/*
2 * Copyright (c) 1998, 2008, 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_OUTSTREAM_H
27#define JDWP_OUTSTREAM_H
28
29#include "transport.h"
30#include "FrameID.h"
31
32struct bag;
33
34#define INITIAL_SEGMENT_SIZE 300
35#define MAX_SEGMENT_SIZE 10000
36
37typedef struct PacketData {
38 int length;
39 jbyte *data;
40 struct PacketData *next;
41} PacketData;
42
43typedef struct PacketOutputStream {
44 jbyte *current;
45 jint left;
46 struct PacketData *segment;
47 struct PacketData firstSegment;
48 jvmtiError error;
49 jboolean sent;
50 jdwpPacket packet;
51 jbyte initialSegment[INITIAL_SEGMENT_SIZE];
52 struct bag *ids;
53} PacketOutputStream;
54
55void outStream_initCommand(PacketOutputStream *stream, jint id,
56 jbyte flags, jbyte commandSet, jbyte command);
57void outStream_initReply(PacketOutputStream *stream, jint id);
58
59jint outStream_id(PacketOutputStream *stream);
60jbyte outStream_command(PacketOutputStream *stream);
61
62jdwpError outStream_writeBoolean(PacketOutputStream *stream, jboolean val);
63jdwpError outStream_writeByte(PacketOutputStream *stream, jbyte val);
64jdwpError outStream_writeChar(PacketOutputStream *stream, jchar val);
65jdwpError outStream_writeShort(PacketOutputStream *stream, jshort val);
66jdwpError outStream_writeInt(PacketOutputStream *stream, jint val);
67jdwpError outStream_writeLong(PacketOutputStream *stream, jlong val);
68jdwpError outStream_writeFloat(PacketOutputStream *stream, jfloat val);
69jdwpError outStream_writeDouble(PacketOutputStream *stream, jdouble val);
70jdwpError outStream_writeObjectRef(JNIEnv *env, PacketOutputStream *stream, jobject val);
71jdwpError outStream_writeObjectTag(JNIEnv *env, PacketOutputStream *stream, jobject val);
72jdwpError outStream_writeFrameID(PacketOutputStream *stream, FrameID val);
73jdwpError outStream_writeMethodID(PacketOutputStream *stream, jmethodID val);
74jdwpError outStream_writeFieldID(PacketOutputStream *stream, jfieldID val);
75jdwpError outStream_writeLocation(PacketOutputStream *stream, jlocation val);
76jdwpError outStream_writeByteArray(PacketOutputStream*stream, jint length, jbyte *bytes);
77jdwpError outStream_writeString(PacketOutputStream *stream, char *string);
78jdwpError outStream_writeValue(JNIEnv *env, struct PacketOutputStream *out,
79 jbyte typeKey, jvalue value);
80jdwpError outStream_skipBytes(PacketOutputStream *stream, jint count);
81
82jdwpError outStream_error(PacketOutputStream *stream);
83void outStream_setError(PacketOutputStream *stream, jdwpError error);
84
85void outStream_sendReply(PacketOutputStream *stream);
86void outStream_sendCommand(PacketOutputStream *stream);
87
88void outStream_destroy(PacketOutputStream *stream);
89
90#endif
Note: See TracBrowser for help on using the repository browser.