|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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.BasicOutPacket
public abstract class BasicOutPacket
output packet base class of basic protocol family packet of basic protocol family have format like: 1. packet header sign, 1 byte, 0x02 2. client version code, 2 byte 3. command, 2 byte 4. packet sequence number, 2 byte 5. user QQ number, 4 byte 6. packet body 7. packet tail sign, 1 byte, 0x03 Note: 6 part will use session key encrypt.log in packet exception, 6 part will use Cipher Key encrypt. request log in token packet exception, 6 part not need encrypt. 基本åè®®æ—的输出包基类 基本åè®®æ—çš„åŒ…éƒ½å…·æœ‰ä»¥ä¸‹çš„æ ¼å¼: 1. åŒ…å¤´æ ‡å¿—ï¼Œ1å—节,0x02 2. 客户端版本代ç ,2å—节 3. 命令,2å—节 4. 包åºå·, 2å—节 5. 用户QQå·ï¼Œ4å—节 6. 包体 7. åŒ…å°¾æ ‡å¿—ï¼Œ1å—节,0x03 Note: 6部分将用会è¯å¯†é’¥åР坆, 登录包例外,6部分è¦ç”¨å¯†ç å¯†é’¥åŠ å¯†ã€‚è¯·æ±‚ç™»å½•ä»¤ç‰ŒåŒ…ä¾‹å¤–ï¼Œ6部分ä¸éœ€åР坆
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 | |
---|---|
protected |
BasicOutPacket(ByteBuffer buf,
int length,
QQUser user)
|
protected |
BasicOutPacket(ByteBuffer buf,
QQUser user)
|
protected |
BasicOutPacket(char command,
boolean ack,
QQUser user)
create a Specify Parameters packet. |
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 得到包体的å—节数组 |
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 |
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, 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 |
---|
protected BasicOutPacket(char command, boolean ack, QQUser user)
command
- command
命令.ack
- whether need answer
是å¦éœ€è¦å›žåº”.protected BasicOutPacket(ByteBuffer buf, QQUser user) throws PacketParseException
PacketParseException
protected BasicOutPacket(ByteBuffer buf, int length, QQUser user) throws PacketParseException
PacketParseException
Method Detail |
---|
protected boolean validateHeader()
Packet
validateHeader
in class Packet
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 void parseTail(ByteBuffer buf) throws PacketParseException
Packet
parseTail
in class Packet
buf
- ByteBuffer
PacketParseException
- if parse error
如果解æžå‡ºé”™public String getPacketName()
getPacketName
in class OutPacket
protected byte[] decryptBody(byte[] body, int offset, int length)
Packet
decryptBody
in class Packet
body
- 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 Packet
b
- unencrypt byte array
æœªåŠ å¯†çš„å—节数组offset
- offset of packet body begin
包体开始的åç§»length
- packet body length
包体长度
protected void putHead(ByteBuffer buf)
Packet
putHead
in class Packet
buf
- ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.protected void postFill(ByteBuffer buf, int startPos)
OutPacket
postFill
in class OutPacket
buf
- ByteBufferstartPos
- packet initial position
包起始ä½ç½®protected void putTail(ByteBuffer buf)
Packet
putTail
in class Packet
buf
- ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.protected void parseHeader(ByteBuffer buf) throws PacketParseException
Packet
parseHeader
in class Packet
buf
- ByteBuffer
PacketParseException
- if parse error
如果解æžå‡ºé”™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 All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |