|
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
public abstract class Packet
base class of all QQ packet object QQ所有包对象的基类
Field Summary | |
---|---|
protected static ByteBuffer |
bodyBuf
packet buffer, with back array, use to save unencrypted packet body, subcalss should use this buffer in putBody method. |
protected byte[] |
bodyDecrypted
明文包体 |
protected char |
command
packet command, 0x03~0x)4. |
protected static Crypter |
crypter
crypter. |
protected static DebugSwitch |
ds
调试模å¼å¼€å…³ |
protected boolean |
duplicated
true means this packet is a duplicated packet, duplicated packet doesn't need to deal with, but cause LumaQQ often happen ack packet miss problem, so here add a field to show that coming message packet is duplicated. |
protected byte |
header
包头å—节 |
protected static org.apache.commons.logging.Log |
log
logger. |
protected char |
sequence
packet sequence, 0x05~0x06. |
protected char |
source
source sign, 0x01~0x02. |
protected QQUser |
user
QQUser for creating multiple QQClient in a JVM, packet need to keep a QQuser reference to meake sure relevant field of packet user how to fill. |
Constructor Summary | |
---|---|
protected |
Packet()
create a packet object, don't fill any field, only use by subclass æž„é€ ä¸€ä¸ªåŒ…å¯¹è±¡ï¼Œä»€ä¹ˆå—æ®µä¹Ÿä¸å¡«ï¼Œä»…é™äºŽå类使用 |
protected |
Packet(ByteBuffer buf,
int length,
QQUser user)
create a outPacket from buf, use to debug. |
protected |
Packet(ByteBuffer buf,
QQUser user)
从buf䏿ž„é€ ä¸€ä¸ªOutPacket,用于调试。这个buf里é¢å¯èƒ½åŒ…å«äº†æŠ“包软件抓æ¥çš„æ•°æ® |
|
Packet(byte header,
char source,
char command,
char sequence,
QQUser user)
create a specify parameters packet æž„é€ ä¸€ä¸ªæŒ‡å®šå‚æ•°çš„包 |
Method Summary | |
---|---|
protected abstract byte[] |
decryptBody(byte[] body,
int offset,
int length)
decrypt packet body 解密包体 |
byte[] |
dump()
export all content of packet to a byte array, mostly use to debug 导出包的全部内容到一个å—节数组ä¸ï¼Œä¸»è¦ç”¨äºŽè°ƒè¯• |
protected abstract byte[] |
encryptBody(byte[] b,
int offset,
int length)
encrypt packet body åŠ å¯†åŒ…ä½“ |
boolean |
equals(Object obj)
|
protected abstract byte[] |
getBodyBytes(ByteBuffer buf,
int length)
get byte array of packet body 得到包体的å—节数组 |
char |
getCommand()
|
protected abstract int |
getCryptographStart()
|
abstract int |
getFamily()
|
byte |
getHeader()
|
protected abstract int |
getHeadLength()
|
protected abstract int |
getLength(int bodyLength)
get total length of UDP form packet, rule out TCP form 得到UDPå½¢å¼åŒ…的总长度,ä¸è€ƒè™‘TCPå½¢å¼ |
String |
getPacketName()
|
char |
getSequence()
|
char |
getSource()
|
protected abstract int |
getTailLength()
|
static int |
hash(char sequence,
char command)
get hash value 得到hash值 |
int |
hashCode()
make up sequence number and command as hash code. |
boolean |
isDuplicated()
|
protected abstract void |
parseBody(ByteBuffer buf)
parse packet body, from begin position of buf è§£æžåŒ…体,从buf的开头ä½ç½®è§£æžèµ· |
protected abstract void |
parseHeader(ByteBuffer buf)
parse packet header from current position of buf 从buf的当å‰ä½ç½®è§£æžåŒ…头 |
protected abstract void |
parseTail(ByteBuffer buf)
parse packet tail from current position of buf 从bufçš„å½“å‰æœªçŸ¥è§£æžåŒ…å°¾ |
protected abstract void |
putBody(ByteBuffer buf)
initialize packet body åˆå§‹åŒ–包体 |
protected abstract void |
putHead(ByteBuffer buf)
change packet header to byte stream, and write into appointed ByteBuffer object. |
protected abstract void |
putTail(ByteBuffer buf)
change packet tail to byte stream, and write into appointed ByteBuffer object. |
void |
setDuplicated(boolean duplicated)
|
void |
setHeader(byte header)
|
void |
setSequence(char sequence)
|
protected abstract boolean |
validateHeader()
checkout header æ ¡éªŒå¤´éƒ¨ |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
protected static final Crypter crypter
protected static final ByteBuffer bodyBuf
protected static DebugSwitch ds
protected char command
protected char source
protected char sequence
protected byte header
protected QQUser user
protected boolean duplicated
protected byte[] bodyDecrypted
Constructor Detail |
---|
public Packet(byte header, char source, char command, char sequence, QQUser user)
header
- packet header
包头source
- packet source
包æºcommand
- packet command
包命令sequence
- packet sequence number
包åºå·user
- QQ user object
QQ用户对象protected Packet(ByteBuffer buf, QQUser user) throws PacketParseException
buf
- ByteBuffer
PacketParseException
- è§£æžå‡ºé”™protected Packet(ByteBuffer buf, int length, QQUser user) throws PacketParseException
buf
- ByteBufferlength
- parsing content length
è¦è§£æžçš„内容长度
PacketParseException
- if parse error
如果解æžå‡ºé”™protected Packet()
Method Detail |
---|
public byte[] dump()
protected abstract int getLength(int bodyLength)
bodyLength
- packet body length
包体长度
protected abstract boolean validateHeader()
protected abstract int getHeadLength()
protected abstract int getTailLength()
protected abstract void putHead(ByteBuffer buf)
buf
- ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.protected abstract void putBody(ByteBuffer buf)
buf
- ByteBufferprotected abstract byte[] getBodyBytes(ByteBuffer buf, int length)
buf
- ByteBufferlength
- packet total length
包总长度
public abstract int getFamily()
protected abstract void putTail(ByteBuffer buf)
buf
- ByteBuffer object whicn packet need to write into
写入的ByteBuffer对象.protected abstract byte[] encryptBody(byte[] b, int offset, int length)
b
- unencrypt byte array
æœªåŠ å¯†çš„å—节数组offset
- offset of packet body begin
包体开始的åç§»length
- packet body length
包体长度
protected abstract byte[] decryptBody(byte[] body, int offset, int length)
body
- byte array of packet body
包体å—节数组offset
- offset of packet body begin
包体开始åç§»length
- packet length
包体长度
protected abstract int getCryptographStart()
protected abstract void parseBody(ByteBuffer buf) throws PacketParseException
buf
- ByteBuffer
PacketParseException
- if parse error
如果解æžå‡ºé”™protected abstract void parseHeader(ByteBuffer buf) throws PacketParseException
buf
- ByteBuffer
PacketParseException
- if parse error
如果解æžå‡ºé”™protected abstract void parseTail(ByteBuffer buf) throws PacketParseException
buf
- ByteBuffer
PacketParseException
- if parse error
如果解æžå‡ºé”™public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public static int hash(char sequence, char command)
header
- sequence
- command
-
public char getCommand()
public char getSequence()
public void setSequence(char sequence)
sequence
- The sequence to set.public String getPacketName()
public char getSource()
public boolean isDuplicated()
public void setDuplicated(boolean duplicated)
duplicated
- The duplicated to set.public byte getHeader()
public void setHeader(byte header)
header
- The header to set.
|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |