|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jqql.obsolete.FilePacket
public abstract class FilePacket
base class of sent packet in file transfer, packet header of packet in file transfer in 12 byte, format is 1. a byte mean packet type, since control data is 0x00, file data is 0x03 2. sender QQ version, or server version, this field is same as common-use pakcet of QQ 3. random cipher code, 1 byte, if this byte is 0x25, then cipher code is 0x23232323, this cipher code is use to encrypt sender and receiver QQ number 4. encrypt form of sender QQ number, 4 byte. encrypt arithmetic: QQ number negate then XOR with cipher code 5. encrypt form of receiver QQ number, 4 byte æ–‡ä»¶ä¼ è¾“æ—¶å‘é€çš„åŒ…çš„åŸºç±»ï¼Œæ–‡ä»¶ä¼ é€çš„包的包头为12个å—èŠ‚ï¼Œæ ¼å¼ä¸º 1. 一个å—èŠ‚è¡¨ç¤ºåŒ…çš„ç±»åž‹ï¼Œä¼¼ä¹ŽæŽ§åˆ¶æ•°æ®æ˜¯0x00ï¼Œæ–‡ä»¶æ•°æ®æ˜¯0x03 2. å‘逿–¹QQ版本,或者是æœåŠ¡å™¨ç‰ˆæœ¬ï¼Œè¿™ä¸ªå—æ®µå’ŒQQçš„æ™®é€šç”¨é€”åŒ…æ˜¯ä¸€æ ·çš„ 3. éšæœºå¯†é’¥ï¼Œ1å—节,如果这个å—节是0x23,那么密钥就是0x23232323,这个密钥用æ¥åР坆 å‘é€è€…和接å—者的QQå· 4. å‘é€è€…QQå·çš„åŠ å¯†å½¢å¼ï¼Œ4å—èŠ‚ã€‚åŠ å¯†ç®—æ³•: QQå·å–åå†ä¸Žå¯†é’¥å¼‚或 5. 接å—者QQå·çš„åŠ å¯†å½¢å¼ï¼Œ4å—节* @author luma
Field Summary | |
---|---|
protected static Crypter |
crypter
|
protected int |
key
|
protected static org.apache.commons.logging.Log |
log
|
protected static Random |
random
|
protected int |
receiver
|
protected int |
sender
|
protected char |
source
|
protected byte |
tag
|
protected FileWatcher |
watcher
|
Constructor Summary | |
---|---|
protected |
FilePacket(FileWatcher watcher)
create a FilePacket æž„é€ ä¸€ä¸ªFilePacket |
Method Summary | |
---|---|
protected int |
decryptQQ(int qq,
int key)
decrypt QQ number 解密QQå· |
protected int |
encryptQQ(int qq,
int key)
encrypt QQ number åŠ å¯†QQå· |
protected void |
fill(ByteBuffer out)
initialize packet content, subclass should overide this method, and first use this method in super class × content of input ByteBuffer will be clear, after complete, buffer position equal to packet length åˆå§‹åŒ–包内容,å类应该覆盖这个方法,并首先调用父类的这个方法 输入ByteBuffer原æ¥çš„内容将被清空,完æˆåŽï¼Œbufferçš„position ç‰äºŽåŒ…é•¿ |
protected void |
fill(ByteBuffer out,
int from)
initialize packet content, subclass should overide this method, and first use this method in super class content of input ByteBuffer won't be clear, new content start fill from from position, after complete, buffer position = packet length + from åˆå§‹åŒ–包内容,å类应该覆盖这个方法,并首先调用父类的这个方法 输入ByteBuffer的原æ¥å†…容ä¸è¢«æ¸…空,新的内容从fromä½ç½®å¼€å§‹ 填充,完æˆåŽï¼Œbufferçš„positionç‰äºŽåŒ…é•¿åŠ ä¸Šfrom |
protected int |
generateKey(byte b)
base on seed create a new key, inside key won't be refreshed æ ¹æ®ç§å生æˆä¸€ä¸ªæ–°çš„Key,内部的Keyä¸ä¼šè¢«åˆ·æ–° |
int |
getKey()
method for debugg 调试用方法 |
int |
getReceiver()
|
int |
getSender()
|
char |
getSource()
|
byte |
getTag()
|
protected abstract void |
initFixedFields()
init some fixed field toward fixed type packet åˆå§‹åŒ–一些对于固定类型的包æ¥è¯´å›ºå®šå€¼çš„å—æ®µ |
protected void |
parse(ByteBuffer in)
parse packet header, subclass should overide this method, and first use this method in super class parse start from current position of in, after parse complete, position of in will be after this packet è§£æžåŒ…头,å类应该覆盖该方法,并首先调用父类的这个方法 è§£æžä»Žin的当å‰ä½ç½®å¼€å§‹ï¼Œè§£æžå®Œæ¯•åŽinçš„positionå°†ä½äºŽ è¿™ä¸ªåŒ…ä¹‹åŽ |
protected int |
refreshKey()
inside refresh key 内部刷新Key |
void |
setReceiver(int receiver)
|
void |
setSender(int sender)
|
void |
setSource(char source)
|
void |
setTag(byte type)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
protected char source
protected byte tag
protected static Crypter crypter
protected static Random random
protected int key
protected int sender
protected int receiver
protected FileWatcher watcher
Constructor Detail |
---|
protected FilePacket(FileWatcher watcher)
watcher
- FileWatcher对象 // FileWatcher objectMethod Detail |
---|
protected int refreshKey()
protected int generateKey(byte b)
b
- ç§å // seedprotected void parse(ByteBuffer in) throws PacketParseException
in
- ByteBuffer对象,åšä¸ºè¾“入缓冲区 // ByteBuffer object, as input buffer
BadQQPacketException
- 如果包的长度ä¸å¯¹ // if packet length wrong
PacketParseException
protected void fill(ByteBuffer out)
initialize packet content, subclass should overide this method, and first use this method in super class × content of input ByteBuffer will be clear, after complete, buffer position equal to packet length åˆå§‹åŒ–包内容,å类应该覆盖这个方法,并首先调用父类的这个方法 输入ByteBuffer原æ¥çš„内容将被清空,完æˆåŽï¼Œbufferçš„position ç‰äºŽåŒ…é•¿
out
- ByteBuffer对象,åšä¸ºè¾“出缓冲区 // ByteBuffer object, use to output bufferprotected void fill(ByteBuffer out, int from)
initialize packet content, subclass should overide this method, and first use this method in super class content of input ByteBuffer won't be clear, new content start fill from from position, after complete, buffer position = packet length + from åˆå§‹åŒ–包内容,å类应该覆盖这个方法,并首先调用父类的这个方法 输入ByteBuffer的原æ¥å†…容ä¸è¢«æ¸…空,新的内容从fromä½ç½®å¼€å§‹ 填充,完æˆåŽï¼Œbufferçš„positionç‰äºŽåŒ…é•¿åŠ ä¸Šfrom
out
- ByteBuffer对象,åšä¸ºè¾“出缓冲区 // ByteBuffer object, use to output bufferfrom
- 开始填充的ä½ç½® //start fill positionprotected abstract void initFixedFields()
protected int encryptQQ(int qq, int key)
qq
- QQå· // QQ numberkey
- 密钥
protected int decryptQQ(int qq, int key)
qq
- QQå· // QQ numberkey
- 密钥 // cipher code
public char getSource()
public void setSource(char source)
source
- The source to set.public byte getTag()
public void setTag(byte type)
type
- The type to set.public int getKey()
public int getReceiver()
public void setReceiver(int receiver)
receiver
- The receiver to set.public int getSender()
public void setSender(int sender)
sender
- The sender to set.
|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |