|
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.OutPacket
net.sf.jqql.packets._05OutPacket
public abstract class _05OutPacket
output packet with 05 series header, its form is 1. packet header sign, 1 byte 2. source, 2 byte 3. packet length, 2 byte 4. packet command, 2 byte 5. packet sequence number, 2 byte 6. user QQ number, 4 byte 7. packet body 8. packet tail, 1 byte noteworthiness is: packet body of this packet is really not full encryption type, but part encryption. 包头是05系列的输出包,格式为 1. 包头标识,1字节 2. source,2字节 3. 包长度,2字节 4. 包命令,2字节 5. 包序号,2字节 6. 用户QQ号,4字节 7. 包体 8. 包尾,1字节 值得注意的是:这种包的包体并非完全加密型,而是部分加密型
| Field Summary |
|---|
| Fields inherited from class net.sf.jqql.packets.OutPacket |
|---|
ack, key, resendCountDown, sendCount, seq, timeout |
| Fields inherited from class net.sf.jqql.packets.Packet |
|---|
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user |
| Constructor Summary | |
|---|---|
_05OutPacket(ByteBuffer buf,
int length,
QQUser user)
|
|
_05OutPacket(ByteBuffer buf,
QQUser user)
|
|
_05OutPacket(char command,
boolean ack,
QQUser user)
|
|
| Method Summary | |
|---|---|
protected byte[] |
decryptBody(byte[] body,
int offset,
int length)
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 得到包体的字节数组 |
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 |
postFill(ByteBuffer buf,
int startPos)
backfill, some field must fill whole packet to make sure its content, for example length field, then this method will be used after tail filling. |
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()
|
protected boolean |
validateHeader()
checkout header 校验头部 |
| Methods inherited from class net.sf.jqql.packets.OutPacket |
|---|
dump, fill, getKey, getNextSeq, getSendCount, getTimeout, needAck, needResend, parseBody, setKey, setSendCount, setTimeout |
| Methods inherited from class net.sf.jqql.packets.Packet |
|---|
equals, getCommand, getCryptographStart, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, putBody, setDuplicated, setHeader, setSequence |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public _05OutPacket(char command,
boolean ack,
QQUser user)
header - command - ack - user -
public _05OutPacket(ByteBuffer buf,
int length,
QQUser user)
throws PacketParseException
buf - length - user -
PacketParseException
public _05OutPacket(ByteBuffer buf,
QQUser user)
throws PacketParseException
buf - user -
PacketParseException| Method Detail |
|---|
protected int getLength(int bodyLength)
Packet
getLength in class PacketbodyLength - packet body length
包体长度
protected boolean validateHeader()
Packet
validateHeader in class Packetprotected int getHeadLength()
getHeadLength in class Packetprotected int getTailLength()
getTailLength in class Packetpublic String getPacketName()
getPacketName in class OutPacketprotected void putHead(ByteBuffer buf)
Packet
putHead in class Packetbuf - ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.protected void putTail(ByteBuffer buf)
Packet
putTail in class Packetbuf - ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.
protected void postFill(ByteBuffer buf,
int startPos)
OutPacket
postFill in class OutPacketbuf - ByteBufferstartPos - packet initial position
包起始位置
protected void parseHeader(ByteBuffer buf)
throws PacketParseException
Packet
parseHeader in class Packetbuf - ByteBuffer
PacketParseException - if parse error
如果解析出错
protected void parseTail(ByteBuffer buf)
throws PacketParseException
Packet
parseTail in class Packetbuf - ByteBuffer
PacketParseException - if parse error
如果解析出错
protected byte[] decryptBody(byte[] body,
int offset,
int length)
Packet
decryptBody in class Packetbody - byte array of packet body
包体字节数组offset - offset of packet body begin
包体开始偏移length - packet length
包体长度
protected byte[] encryptBody(byte[] b,
int offset,
int length)
Packet
encryptBody in class Packetb - unencrypt byte array
未加密的字节数组offset - offset of packet body begin
包体开始的偏移length - packet body length
包体长度
protected byte[] getBodyBytes(ByteBuffer buf,
int length)
Packet
getBodyBytes in class Packetbuf - ByteBufferlength - packet total length
包总长度
public String toString()
toString in class Objectpublic int getFamily()
getFamily in class Packet
|
JML | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||