![]() |
|
|
#include <jdwppacket.h>
Inheritance diagram for inspectorj::jdwp::JDWPPacket:
JDWPPacket provides functions for reading and writing data to the jdwp packets.
Definition at line 45 of file jdwppacket.h.
Public Member Functions | |
JDWPPacket () | |
JDWPPacket constructor. | |
virtual | ~JDWPPacket () |
JDWPPacket destructor. | |
virtual jint | getLength () |
Returns the total length of this packet (header + data). | |
virtual jbyte | getPacketType ()=0 |
virtual jint | getId ()=0 |
virtual short | getErrorCode () |
Returns the packets error code. | |
char * | getDataBytes () |
Returns this packet's data. | |
virtual JDWPPacket * | copy ()=0 |
JDWPPacket & | operator<< (jbyte &byte) |
Write a jbyte to the packet's data payload. | |
JDWPPacket & | operator<< (bool &b) |
Write a bool to the packet's data payload. | |
JDWPPacket & | operator<< (jint &i) |
Write sizeof(jint) bytes to the packet's data payload. | |
JDWPPacket & | operator<< (qint64 &i) |
Write the 8 byte value to the packet's data payload. | |
JDWPPacket & | operator<< (QString &s) |
Write a string to the packet's data payload. | |
JDWPPacket & | operator<< (FieldID &fid) |
Write a FieldID to the packet's data payload. | |
JDWPPacket & | operator<< (ObjectID &oid) |
Write an ObjectID to the packet's data payload. | |
JDWPPacket & | operator<< (MethodID &mid) |
Write a MethodID to the packet's data payload. | |
JDWPPacket & | operator<< (ReferenceTypeID &rid) |
Write a ReferenceTypeID to the packet's data payload. | |
JDWPPacket & | operator<< (FrameID &fid) |
Write a FrameID to the packet's data payload. | |
JDWPPacket & | operator>> (jbyte &b) |
Read 1 byte of data from the packet and store in a jbyte reference. | |
JDWPPacket & | operator>> (bool &b) |
Read a bool value from the packet and store in a bool reference. | |
JDWPPacket & | operator>> (qint32 &i) |
Read 4 bytes and store in the reference i. | |
JDWPPacket & | operator>> (qint64 &i) |
Read 8 bytes from the packet and store in the reference i. | |
JDWPPacket & | operator>> (QString &s) |
Read string data from the packet and store in a QString reference. | |
JDWPPacket & | operator>> (FieldID &fid) |
Read a FieldID from the packets data payload. | |
JDWPPacket & | operator>> (ObjectID &oid) |
Read an ObjectID from the packets data payload. | |
JDWPPacket & | operator>> (MethodID &mid) |
Read a MethodID from the packets data payload. | |
JDWPPacket & | operator>> (ReferenceTypeID &rid) |
Read a ReferenceTypeID from the packets data payload. | |
JDWPPacket & | operator>> (FrameID &fid) |
Read a FrameID from the packets data payload. | |
Static Public Member Functions | |
static void | initIDSizes (JDWPPacket &) |
Id sizes can vary across different jvm implementations, therfore we must initialize these sizes after we've attached to the target jvm. | |
Protected Member Functions | |
void | setReadMode () |
Set the data stream's IODevice to ReadOnly. | |
void | setWriteMode () |
Set the data stream's IODevice to WriteOnly. | |
Protected Attributes | |
QDataStream * | data |
The packet's data stream for reading/writing data. | |
QByteArray | bytes |
The actual data payload. | |
Static Protected Attributes | |
static int | FIELD_ID_SIZE |
The vm specific size of field IDs. | |
static int | OBJECT_ID_SIZE |
The vm specific size of object IDs. | |
static int | METHOD_ID_SIZE |
The vm specific size of method IDs. | |
static int | REFERENCE_TYPE_ID_SIZE |
The vm specific size of reference type IDs. | |
static int | FRAME_ID_SIZE |
The vm specific size of frame IDs. |
JDWPPacket::JDWPPacket | ( | ) |
JDWPPacket::~JDWPPacket | ( | ) | [virtual] |
jint JDWPPacket::getLength | ( | ) | [virtual] |
Returns the total length of this packet (header + data).
Definition at line 104 of file jdwppacket.cpp.
References bytes, and inspectorj::jdwp::JDWP_HEADER_LENGTH.
Referenced by inspectorj::client::ClientPacketHandler::sendJDWPCommand(), and inspectorj::agent::AgentSocket::writeReply().
short JDWPPacket::getErrorCode | ( | ) | [virtual] |
Returns the packets error code.
If the packet is a command packet, this function returns ERR_NONE.
Reimplemented in inspectorj::jdwp::JDWPReply.
Definition at line 96 of file jdwppacket.cpp.
References inspectorj::jdwp::ERR_NONE.
Referenced by inspectorj::toolset::ClassToolSet::getBytecodeString(), and inspectorj::client::ClientPacketHandler::handleJDWPError().
char * JDWPPacket::getDataBytes | ( | ) |
Returns this packet's data.
dataBytes | The packet's data is copied to dataBytes. |
Definition at line 113 of file jdwppacket.cpp.
References bytes.
Referenced by inspectorj::client::ClientPacketHandler::sendJDWPCommand(), and inspectorj::agent::AgentSocket::writeReply().
void JDWPPacket::initIDSizes | ( | JDWPPacket & | packet | ) | [static] |
Id sizes can vary across different jvm implementations, therfore we must initialize these sizes after we've attached to the target jvm.
The ClientPacketHandler facilitates this by calling the VM-IDSizes command after a successful handshake and registering this function as a callback.
Definition at line 83 of file jdwppacket.cpp.
References FIELD_ID_SIZE, FRAME_ID_SIZE, METHOD_ID_SIZE, OBJECT_ID_SIZE, and REFERENCE_TYPE_ID_SIZE.
JDWPPacket & JDWPPacket::operator<< | ( | jbyte & | b | ) |
Write a jbyte to the packet's data payload.
b | The jbyte to add to the packet's data |
Definition at line 127 of file jdwppacket.cpp.
References data, and setWriteMode().
JDWPPacket & JDWPPacket::operator<< | ( | bool & | b | ) |
Write a bool to the packet's data payload.
b | The bool to add to the packet's data |
Definition at line 138 of file jdwppacket.cpp.
References data, and setWriteMode().
JDWPPacket & JDWPPacket::operator<< | ( | jint & | i | ) |
Write sizeof(jint) bytes to the packet's data payload.
i | The jint reference to write data to. |
Definition at line 153 of file jdwppacket.cpp.
References data, and setWriteMode().
JDWPPacket & JDWPPacket::operator<< | ( | qint64 & | i | ) |
Write the 8 byte value to the packet's data payload.
i | The qint64 reference to write to the packet's data. |
Definition at line 181 of file jdwppacket.cpp.
References data, and setWriteMode().
JDWPPacket & JDWPPacket::operator<< | ( | QString & | s | ) |
Write a string to the packet's data payload.
The string's length is added to the packet's data followed by the strings raw bytes.
s | The string to write to the packet's data |
Definition at line 193 of file jdwppacket.cpp.
References data, and setWriteMode().
JDWPPacket & JDWPPacket::operator<< | ( | FieldID & | fid | ) |
Write a FieldID to the packet's data payload.
fid | The FieldID |
Definition at line 225 of file jdwppacket.cpp.
References FIELD_ID_SIZE, and inspectorj::jdwp::FieldID::value.
JDWPPacket & JDWPPacket::operator<< | ( | ObjectID & | oid | ) |
Write an ObjectID to the packet's data payload.
oid | The ObjectID |
Definition at line 209 of file jdwppacket.cpp.
References OBJECT_ID_SIZE, and inspectorj::jdwp::ObjectID::value.
JDWPPacket & JDWPPacket::operator<< | ( | MethodID & | mid | ) |
Write a MethodID to the packet's data payload.
mid | The MethodID |
Definition at line 242 of file jdwppacket.cpp.
References METHOD_ID_SIZE, and inspectorj::jdwp::MethodID::value.
JDWPPacket & JDWPPacket::operator<< | ( | ReferenceTypeID & | rid | ) |
Write a ReferenceTypeID to the packet's data payload.
rid | The ReferenceTypeID |
Definition at line 258 of file jdwppacket.cpp.
References REFERENCE_TYPE_ID_SIZE, and inspectorj::jdwp::ReferenceTypeID::value.
JDWPPacket & JDWPPacket::operator<< | ( | FrameID & | fid | ) |
Write a FrameID to the packet's data payload.
fid | The FrameID |
Definition at line 274 of file jdwppacket.cpp.
References FRAME_ID_SIZE, and inspectorj::jdwp::FrameID::value.
JDWPPacket & JDWPPacket::operator>> | ( | jbyte & | b | ) |
Read 1 byte of data from the packet and store in a jbyte reference.
b | The jbyte reference to write data to. |
Definition at line 294 of file jdwppacket.cpp.
References data, and setReadMode().
JDWPPacket & JDWPPacket::operator>> | ( | bool & | b | ) |
Read a bool value from the packet and store in a bool reference.
b | The bool reference to write data to. |
Definition at line 306 of file jdwppacket.cpp.
References data, and setReadMode().
JDWPPacket & JDWPPacket::operator>> | ( | qint32 & | i | ) |
Read 4 bytes and store in the reference i.
i | The qint32 reference to write data to. |
Definition at line 321 of file jdwppacket.cpp.
References data, and setReadMode().
JDWPPacket & JDWPPacket::operator>> | ( | qint64 & | i | ) |
Read 8 bytes from the packet and store in the reference i.
i | The qint64 reference to write data to. |
Definition at line 332 of file jdwppacket.cpp.
References data, and setReadMode().
JDWPPacket & JDWPPacket::operator>> | ( | QString & | s | ) |
Read string data from the packet and store in a QString reference.
The JDWP protocol specifies that string data is preceeded by a 4 byte value containing the string's length.
s | A QString reference to write data to. |
Definition at line 346 of file jdwppacket.cpp.
References data, and setReadMode().
JDWPPacket & JDWPPacket::operator>> | ( | FieldID & | fid | ) |
Read a FieldID from the packets data payload.
fid | The FieldID |
Definition at line 388 of file jdwppacket.cpp.
References FIELD_ID_SIZE, and inspectorj::jdwp::FieldID::value.
JDWPPacket & JDWPPacket::operator>> | ( | ObjectID & | oid | ) |
Read an ObjectID from the packets data payload.
oid | The ObjectID |
Definition at line 371 of file jdwppacket.cpp.
References OBJECT_ID_SIZE, and inspectorj::jdwp::ObjectID::value.
JDWPPacket & JDWPPacket::operator>> | ( | MethodID & | mid | ) |
Read a MethodID from the packets data payload.
mid | The MethodID |
Definition at line 405 of file jdwppacket.cpp.
References METHOD_ID_SIZE, and inspectorj::jdwp::MethodID::value.
JDWPPacket & JDWPPacket::operator>> | ( | ReferenceTypeID & | rid | ) |
Read a ReferenceTypeID from the packets data payload.
rid | The ReferenceTypeID |
Definition at line 423 of file jdwppacket.cpp.
References REFERENCE_TYPE_ID_SIZE, and inspectorj::jdwp::ReferenceTypeID::value.
JDWPPacket & JDWPPacket::operator>> | ( | FrameID & | fid | ) |
Read a FrameID from the packets data payload.
fid | The FrameID |
Definition at line 440 of file jdwppacket.cpp.
References FRAME_ID_SIZE, and inspectorj::jdwp::FrameID::value.
void JDWPPacket::setReadMode | ( | ) | [protected] |
Set the data stream's IODevice to ReadOnly.
Definition at line 60 of file jdwppacket.cpp.
References data.
Referenced by operator>>().
void JDWPPacket::setWriteMode | ( | ) | [protected] |
Set the data stream's IODevice to WriteOnly.
Definition at line 70 of file jdwppacket.cpp.
References data.
Referenced by operator<<().
int JDWPPacket::FIELD_ID_SIZE [static, protected] |
The vm specific size of field IDs.
Definition at line 136 of file jdwppacket.h.
Referenced by initIDSizes(), operator<<(), and operator>>().
int JDWPPacket::OBJECT_ID_SIZE [static, protected] |
The vm specific size of object IDs.
Definition at line 139 of file jdwppacket.h.
Referenced by initIDSizes(), operator<<(), and operator>>().
int JDWPPacket::METHOD_ID_SIZE [static, protected] |
The vm specific size of method IDs.
Definition at line 142 of file jdwppacket.h.
Referenced by initIDSizes(), operator<<(), and operator>>().
int JDWPPacket::REFERENCE_TYPE_ID_SIZE [static, protected] |
The vm specific size of reference type IDs.
Definition at line 145 of file jdwppacket.h.
Referenced by initIDSizes(), operator<<(), and operator>>().
int JDWPPacket::FRAME_ID_SIZE [static, protected] |
The vm specific size of frame IDs.
Definition at line 148 of file jdwppacket.h.
Referenced by initIDSizes(), operator<<(), and operator>>().
QDataStream* inspectorj::jdwp::JDWPPacket::data [protected] |
The packet's data stream for reading/writing data.
Definition at line 151 of file jdwppacket.h.
Referenced by inspectorj::jdwp::JDWPCommand::JDWPCommand(), inspectorj::jdwp::JDWPReply::JDWPReply(), operator<<(), operator>>(), setReadMode(), setWriteMode(), and ~JDWPPacket().
QByteArray inspectorj::jdwp::JDWPPacket::bytes [protected] |
The actual data payload.
Definition at line 154 of file jdwppacket.h.
Referenced by getDataBytes(), getLength(), inspectorj::jdwp::JDWPCommand::JDWPCommand(), and inspectorj::jdwp::JDWPReply::JDWPReply().