|
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._03OutPacket
public abstract class _03OutPacket
03 protocol family output packet base class, this protocol family format is: 1. protocol family packet header, 1 byte, 0x03 2. command, 1 byte 3. packet sequence, 2 byte 4. packet serial number byte, 4 byte Note: it's in sequence increase numeber, maybe is sequence, name is lesser. 5. unknown 4 byte 6. unknown 4 byte 7. unknown 4 byte 8. unknown 4 byte 9. unknown 4 byte 10. unknown 4 byte 11. unknown 4 byte 12. unknown 4 byte 13. fragment amount, 1 byte Note: for a sent packet, it commonly is 0x01 14. current fragment, 1 byte, from 0 begin 15. unnkown 1 byte 16. sender version number, 2 byte 17. unkown 1 byte 18. packet body Note: this protocol family haven't encrypt,haven't packet tail 03协议族输出包基类,这个协议族的格式为 1. 协议族包头,1字节,0x03 2. 命令,1字节 3. 包序号,2字节 4. 包流水号,4字节 Note: 4部分是一个依次递增的号码,也许是序号,名字是次要的。 5. 未知的4字节 6. 未知的4字节 7. 未知的4字节 8. 未知的4字节 9. 未知的4字节 10. 未知的4字节 11. 未知的4字节 12. 未知的4字节 13. 分片数,1字节 Note: 对于一个发出的包来说,13部分一般都是0x01 14. 当前分片,1字节,从0开始 15. 未知1字节 16. 发送者版本号,2字节 17. 未知1字节 18. 包体 Note: 此协议族无加密,无包尾
| Field Summary | |
|---|---|
protected byte |
currentFragment
|
protected int |
serialNumber
|
protected byte |
totalFragment
|
| 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 | |
|---|---|
_03OutPacket(ByteBuffer buf,
int length,
QQUser user)
|
|
_03OutPacket(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 加密包体 |
boolean |
equals(Object obj)
|
protected byte[] |
getBodyBytes(ByteBuffer buf,
int length)
get byte array of packet body 得到包体的字节数组 |
protected int |
getCryptographStart()
|
byte |
getCurrentFragment()
|
int |
getFamily()
|
protected int |
getHeadLength()
|
protected int |
getLength(int bodyLength)
get total length of UDP form packet, rule out TCP form 得到UDP形式包的总长度,不考虑TCP形式 |
int |
getSerialNumber()
|
protected int |
getTailLength()
|
byte |
getTotalFragment()
|
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. |
void |
setCurrentFragment(byte currentFragment)
|
void |
setSerialNumber(int serialNumber)
|
void |
setTotalFragment(byte totalFragment)
|
String |
toString()
|
protected boolean |
validateHeader()
checkout header 校验头部 |
| Methods inherited from class net.sf.jqql.packets.OutPacket |
|---|
dump, fill, getKey, getNextSeq, getPacketName, getSendCount, getTimeout, needAck, needResend, parseBody, setKey, setSendCount, setTimeout |
| Methods inherited from class net.sf.jqql.packets.Packet |
|---|
getCommand, 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 |
| Field Detail |
|---|
protected byte totalFragment
protected byte currentFragment
protected int serialNumber
| Constructor Detail |
|---|
public _03OutPacket(char command,
boolean ack,
QQUser user)
public _03OutPacket(ByteBuffer buf,
int length,
QQUser user)
throws PacketParseException
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 Packet
protected void postFill(ByteBuffer buf,
int startPos)
OutPacket
postFill in class OutPacketbuf - ByteBufferstartPos - packet initial position
包起始位置protected void putHead(ByteBuffer buf)
Packet
putHead in class Packetbuf - ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.
protected byte[] getBodyBytes(ByteBuffer buf,
int length)
Packet
getBodyBytes in class Packetbuf - ByteBufferlength - packet total length
包总长度
protected void putTail(ByteBuffer buf)
Packet
putTail in class Packetbuf - ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.
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[] 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 int getCryptographStart()
getCryptographStart in class Packet
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
如果解析出错public byte getCurrentFragment()
public void setCurrentFragment(byte currentFragment)
currentFragment - the currentFragment to setpublic byte getTotalFragment()
public void setTotalFragment(byte totalFragment)
totalFragment - the totalFragment to setpublic boolean equals(Object obj)
equals in class Packetpublic String toString()
toString in class Objectpublic int getSerialNumber()
public void setSerialNumber(int serialNumber)
public int getFamily()
getFamily in class Packet
|
JML | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||