|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jqql.packets.Packet
net.sf.jqql.packets.InPacket
net.sf.jqql.packets.BasicInPacket
public abstract class BasicInPacket
input packet base class of basic protocol family 1. packet header sign, 1 byte, 0x02 2. server version code, 2 byte 3. command, 2 byte 4. packet sequence number, 2 byte 5. packet body 6. packet tail sign, 1 byte, 0x03 基本协议族的输入包基类: 1. 包头标志,1字节,0x02 2. 服务器端版本代码, 2字节 3. 命令,2字节 4. 包序号,2字节 5. 包体 6. 包尾标志,1字节,0x03
Field Summary |
---|
Fields inherited from class net.sf.jqql.packets.Packet |
---|
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user |
Constructor Summary | |
---|---|
BasicInPacket(ByteBuffer buf,
int length,
QQUser user)
create a InPacket, parse length count byte from current position of buf 构造一个InPacket,从buf的当前位置解析length个字节 |
|
BasicInPacket(ByteBuffer buf,
QQUser user)
create a Specify Parameters packet. |
|
BasicInPacket(char command,
QQUser user)
|
Method Summary | |
---|---|
protected byte[] |
decryptBody(byte[] buf,
int offset,
int len)
decrypt packet body 解密包体 |
protected byte[] |
encryptBody(byte[] b,
int offset,
int length)
encrypt packet body 加密包体 |
protected byte[] |
getBodyBytes(ByteBuffer buf,
int length)
get byte array of packet body 得到包体的字节数组 |
protected int |
getCryptographStart()
|
int |
getFamily()
|
protected int |
getHeadLength()
|
protected int |
getLength(int bodyLength)
get total length of UDP form packet, rule out TCP form 得到UDP形式包的总长度,不考虑TCP形式 |
String |
getPacketName()
|
protected int |
getTailLength()
|
protected void |
parseHeader(ByteBuffer buf)
parse packet header from current position of buf 从buf的当前位置解析包头 |
protected void |
parseTail(ByteBuffer buf)
parse packet tail from current position of buf 从buf的当前未知解析包尾 |
protected void |
putBody(ByteBuffer buf)
initialize packet body 初始化包体 |
protected void |
putHead(ByteBuffer buf)
change packet header to byte stream, and write into appointed ByteBuffer object. |
protected void |
putTail(ByteBuffer buf)
change packet tail to byte stream, and write into appointed ByteBuffer object. |
String |
toString()
|
Methods inherited from class net.sf.jqql.packets.InPacket |
---|
validateHeader |
Methods inherited from class net.sf.jqql.packets.Packet |
---|
dump, equals, getCommand, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, parseBody, setDuplicated, setHeader, setSequence |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BasicInPacket(char command, QQUser user)
command
- user
- public BasicInPacket(ByteBuffer buf, QQUser user) throws PacketParseException
buf
- ByteBuffer对象 //ByteBuffer object
PacketParseException
- content parse error
内容解析出错.public BasicInPacket(ByteBuffer buf, int length, QQUser user) throws PacketParseException
buf
- ByteBuffer对象 //ByteBuffer objectlength
- 字节数 //byte count
PacketParseException
- content parse error
内容解析出错Method Detail |
---|
protected void parseHeader(ByteBuffer buf) throws PacketParseException
Packet
parseHeader
in class Packet
buf
- ByteBuffer
PacketParseException
- if parse error
如果解析出错protected void parseTail(ByteBuffer buf)
Packet
parseTail
in class Packet
buf
- ByteBufferprotected void putHead(ByteBuffer buf)
Packet
putHead
in class Packet
buf
- ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.protected void putBody(ByteBuffer buf)
Packet
putBody
in class Packet
buf
- ByteBufferprotected void putTail(ByteBuffer buf)
Packet
putTail
in class Packet
buf
- ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.public String getPacketName()
getPacketName
in class Packet
protected byte[] decryptBody(byte[] buf, int offset, int len)
Packet
decryptBody
in class Packet
buf
- byte array of packet body
包体字节数组offset
- offset of packet body begin
包体开始偏移len
- packet length
包体长度
protected byte[] encryptBody(byte[] b, int offset, int length)
Packet
encryptBody
in class Packet
b
- unencrypt byte array
未加密的字节数组offset
- offset of packet body begin
包体开始的偏移length
- packet body length
包体长度
protected byte[] getBodyBytes(ByteBuffer buf, int length)
Packet
getBodyBytes
in class Packet
buf
- ByteBufferlength
- packet total length
包总长度
protected int getLength(int bodyLength)
Packet
getLength
in class Packet
bodyLength
- packet body length
包体长度
protected int getHeadLength()
getHeadLength
in class Packet
protected int getTailLength()
getTailLength
in class Packet
public String toString()
toString
in class Object
protected int getCryptographStart()
getCryptographStart
in class Packet
public int getFamily()
getFamily
in class Packet
|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |