jdk/src/share/back/outStream.h
changeset 2 90ce3da70b43
child 1090 c5805b1672a6
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 /*
       
     2  * Copyright 1998-2005 Sun Microsystems, Inc.  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.  Sun designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    23  * have any questions.
       
    24  */
       
    25 
       
    26 #ifndef JDWP_OUTSTREAM_H
       
    27 #define JDWP_OUTSTREAM_H
       
    28 
       
    29 #include "typedefs.h"
       
    30 
       
    31 #include "transport.h"
       
    32 #include "FrameID.h"
       
    33 
       
    34 struct bag;
       
    35 
       
    36 #define INITIAL_SEGMENT_SIZE   300
       
    37 #define MAX_SEGMENT_SIZE     10000
       
    38 
       
    39 typedef struct PacketData {
       
    40     int length;
       
    41     jbyte *data;
       
    42     struct PacketData *next;
       
    43 } PacketData;
       
    44 
       
    45 typedef struct PacketOutputStream {
       
    46     jbyte *current;
       
    47     jint left;
       
    48     struct PacketData *segment;
       
    49     struct PacketData firstSegment;
       
    50     jvmtiError error;
       
    51     jboolean sent;
       
    52     jdwpPacket packet;
       
    53     jbyte initialSegment[INITIAL_SEGMENT_SIZE];
       
    54     struct bag *ids;
       
    55 } PacketOutputStream;
       
    56 
       
    57 void outStream_initCommand(PacketOutputStream *stream, jint id,
       
    58                            jbyte flags, jbyte commandSet, jbyte command);
       
    59 void outStream_initReply(PacketOutputStream *stream, jint id);
       
    60 
       
    61 jint outStream_id(PacketOutputStream *stream);
       
    62 jbyte outStream_command(PacketOutputStream *stream);
       
    63 
       
    64 jdwpError outStream_writeBoolean(PacketOutputStream *stream, jboolean val);
       
    65 jdwpError outStream_writeByte(PacketOutputStream *stream, jbyte val);
       
    66 jdwpError outStream_writeChar(PacketOutputStream *stream, jchar val);
       
    67 jdwpError outStream_writeShort(PacketOutputStream *stream, jshort val);
       
    68 jdwpError outStream_writeInt(PacketOutputStream *stream, jint val);
       
    69 jdwpError outStream_writeLong(PacketOutputStream *stream, jlong val);
       
    70 jdwpError outStream_writeFloat(PacketOutputStream *stream, jfloat val);
       
    71 jdwpError outStream_writeDouble(PacketOutputStream *stream, jdouble val);
       
    72 jdwpError outStream_writeObjectRef(JNIEnv *env, PacketOutputStream *stream, jobject val);
       
    73 jdwpError outStream_writeObjectTag(JNIEnv *env, PacketOutputStream *stream, jobject val);
       
    74 jdwpError outStream_writeFrameID(PacketOutputStream *stream, FrameID val);
       
    75 jdwpError outStream_writeMethodID(PacketOutputStream *stream, jmethodID val);
       
    76 jdwpError outStream_writeFieldID(PacketOutputStream *stream, jfieldID val);
       
    77 jdwpError outStream_writeLocation(PacketOutputStream *stream, jlocation val);
       
    78 jdwpError outStream_writeByteArray(PacketOutputStream*stream, jint length, jbyte *bytes);
       
    79 jdwpError outStream_writeString(PacketOutputStream *stream, char *string);
       
    80 jdwpError outStream_writeValue(JNIEnv *env, struct PacketOutputStream *out,
       
    81                           jbyte typeKey, jvalue value);
       
    82 jdwpError outStream_skipBytes(PacketOutputStream *stream, jint count);
       
    83 
       
    84 jdwpError outStream_error(PacketOutputStream *stream);
       
    85 void outStream_setError(PacketOutputStream *stream, jdwpError error);
       
    86 
       
    87 void outStream_sendReply(PacketOutputStream *stream);
       
    88 void outStream_sendCommand(PacketOutputStream *stream);
       
    89 
       
    90 void outStream_destroy(PacketOutputStream *stream);
       
    91 
       
    92 #endif