|
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.FileAgentPacket
public class FileAgentPacket
file transfer packet, the format of the packet are different from FilePacket's subclass format, thus it's a independent class. it need to use FileDataPacket, for it's transfer packet, it contain transfer data. When it's not used to transfer data, it has his own format: file transfer request packet(send from client), begin with 0x04, content is: 1. 0x04 2. client version number, 2 byte 3. the whole packet length, 2 byte 4. command, 2 byte 5. sequence, 2 byte 6. my QQ number, 4 byte 7. unknown 8 byte, no rules 8. different command has different content: a. If the command is 0x0001, it means apply transfter service, format: i. authenticate token length, 2 byte ii. authenticate token iii. unknown 2 byte, 0x07D0, decimal value 2000(begin to encode from this field) iv. file transfter target's QQ number, 4 byte 文件ä¸è½¬åŒ…ï¼Œè¿™ä¸ªåŒ…çš„æ ¼å¼å’ŒFilePacketçš„åç±»æ ¼å¼ç›¸åŒç”šå°‘ï¼Œå› æ¤æ˜¯ä¸€ä¸ªç‹¬ç«‹çš„类,它 需è¦ä½¿ç”¨FileDataPacketï¼Œå› ä¸ºå®ƒæ˜¯ä¸è½¬åŒ…,会包å«ä¸è½¬æ•°æ®ã€‚当它ä¸ç”¨æ¥ä¸è½¬æ•°æ®æ—¶ï¼Œ ä¹Ÿæœ‰è‡ªå·±çš„æ ¼å¼ã€‚å…·ä½“æ ¼å¼å¦‚下: 文件ä¸è½¬è¯·æ±‚包(从客户端å‘出)以0x04开头,内容如下: 1. 0x04 2. 客户端版本å·ï¼Œ2å—节 3. 整个的包长,2å—节 4. 命令,2å—节 5. åºå·ï¼Œ2å—节 6. 我的QQå·ï¼Œ4å—节 7. 未知的8å—èŠ‚ï¼Œæ— è§„å¾‹ 8. æ ¹æ®å‘½ä»¤çš„ä¸åŒï¼ŒåŽé¢çš„内容ä¸åŒ: a. 如果命令是0x0001时,表示请求ä¸è½¬æœåŠ¡ï¼Œæ ¼å¼ä¸º i. 认è¯ä»¤ç‰Œé•¿åº¦ï¼Œ2å—节 ii. 认è¯ä»¤ç‰Œ iii. 未知2å—节,0x07D0,å进制值2000 (ä»Žè¿™ä¸ªå—æ®µå¼€å§‹åР坆) iv. æ–‡ä»¶ä¼ è¾“å¦ä¸€æ–¹çš„QQå·ï¼Œ4å—节 b. If the command is 0x0002, it means receiveer reports to transfer server, format: i. file session ID, 4 byte ii, authenticate token length, 2 byte(begin to encode from here) iii. authenticate token c. If the command is 0x0003, it's thepacket to wrap file data, format is: i. file session ID, 4 byte ii, unknwon 4 byte iii. length of data packet to be wrapped, 2 byte iv, data packet, same format as FileDataPacket. d. If the command is 0x0004, it's transfter finished packet, format is: i. file session ID, 4 byte ii. my QQ number(begin to encode from this field) iii. unknown 2 byte, often 0, maybe to indicate success. e. I fthe command is 0x0005, it's the reply to the server 0x0005. And part 7 are all 0. Format is: i.file session ID, 4 byte ii, unknown 4 byte, all 9(encoded) f. If the command is 0x0006, part 6 is all 0. Format is: i. file session ID, 4 byte ii. unknown 2 byte, all 0( encoded) 9. tail 0x3 b. 如果命令是0x0002,表示接收者å‘ä¸è½¬æœåŠ¡å™¨æŠ¥åˆ°ï¼Œæ ¼å¼ä¸º: i. 文件会è¯ID,4å—节 ii. 认è¯ä»¤ç‰Œé•¿åº¦ï¼Œ2å—节(ä»Žè¿™é‡Œå¼€å§‹åŠ å¯†) iii. 认è¯ä»¤ç‰Œ c. 如果命令是0x0003,为å°è£…文件数æ®çš„åŒ…ï¼Œæ ¼å¼ä¸º(å‡ä¸åР坆) i. 文件会è¯ID,4å—节 ii. 未知的4å—节 iii. 被å°è£…的数æ®åŒ…长度,2å—节 iv. æ•°æ®åŒ…,也就是FileDataPacketçš„æ ¼å¼ d. 如果命令是0x0004,为ä¸è½¬ç»“æŸåŒ…ï¼Œæ ¼å¼ä¸º: i. 文件会è¯ID,4å—节 ii. 我的QQå· (ä»Žè¿™ä¸ªå—æ®µå¼€å§‹åР坆) iii. 未知的两å—节,一般为全0,å¯èƒ½è¡¨ç¤ºæˆåŠŸ e. 如果命令是0x0005,是对æœåС噍0x0005的回å¤ï¼Œå…¶ä¸7部分全0ã€‚æ ¼å¼ä¸º: i. 文件会è¯ID,4å—节 ii. 未知的4å—节,全0 (åŠ å¯†) f. 如果命令是0x0006,6部分全0ã€‚æ ¼å¼ä¸º: i. 文件会è¯ID,4å—节 ii. 未知的2å—节,全0 (åŠ å¯†) 9. 尾部0x3 file transfer reply packet(send from server), begin with 0x04, format is: 1. 0x4 2. transfer server version number 3. the while packet length, 2 byte 4. command, 2 byte 5. sequence, 2 byte 6. my QQ number, 4 byte 7. unknown 8 byte, no rule 8. different command has different content: A. If the command is 0x0001, it's the reply to the transfer request, and the part 6 is same as the one of request. format (encoded)is : a, response code, 2 byte, different code, different content I, If it's 0x0000, means accept transfer requst, format behind is : i. transfer server IP, little-endian format, 4 byte ii. transfer server port, 2 byte iii. file session ID, 4 byte iv, 4 byte redirect IP, all 0 v. 2 byte redirect port, all 0 vi. unknown 2 byte, all 0 II. If it's 0x0001, means redirection, format is: i. transfer server IP,all 0 ii. transfer server port, 2 byte, all 0 iii. file session ID, 4 byte, all 0 iv, 4 byte redirect IP, little-endian format v. 2 byte redirect port vi. unknown 2 byte, all 0 文件ä¸è½¬å›žå¤åŒ…(从æœåŠ¡å™¨ç«¯å‘出)以0x04å¼€å¤´ï¼Œæ ¼å¼ä¸º: 1. 0x04 2. ä¸è½¬æœåŠ¡å™¨ç‰ˆæœ¬å· 3. 整个的包长,2å—节 4. 命令,2å—节 5. åºå·ï¼Œ2å—节 6. 我的QQå·ï¼Œ4å—节 7. 未知的8å—èŠ‚ï¼Œæ— è§„å¾‹ 8. æ ¹æ®å‘½ä»¤çš„ä¸åŒï¼ŒåŽé¢çš„内容ä¸åŒ: A. 如果命令是0x0001,表示对ä¸è½¬è¯·æ±‚的回应,且6部分和请求相åŒã€‚æ ¼å¼ä¸º(åŠ å¯†): a. 应ç”ç ,2å—èŠ‚ï¼Œæ ¹æ®åº”ç”ç ä¸åŒï¼Œå†…容ä¸åŒ I. 如果是0x0000,表示接å—ä¸è½¬è¯·æ±‚,åŽé¢çš„æ ¼å¼ä¸º: i. ä¸è½¬æœåС噍IP,little-endianæ ¼å¼ï¼Œ4å—节 ii. ä¸è½¬æœåŠ¡å™¨ç«¯å£ï¼Œ2å—节 iii. 文件会è¯ID,4å—节 iv. 4å—节é‡å®šå‘IP,全0 v. 2å—节é‡å®šå‘端å£ï¼Œå…¨0 vi. 未知的两å—节,全0 II. 如果是0x0001,表示é‡å®šå‘ï¼Œæ ¼å¼ä¸º i. ä¸è½¬æœåС噍IP,4å—节,全0 ii. ä¸è½¬æœåŠ¡å™¨ç«¯å£ï¼Œ2å—节,全0 iii. 文件会è¯ID,4å—节,全0 iv. 4å—节é‡å®šå‘IP,little-endianæ ¼å¼ v. 2å—节é‡å®šå‘ç«¯å£ vi. 未知的两å—节,全0 B. If the command is 0x0002, mean reply from transfer server to receiver, format is : a. file session ID, 4 byte b. unknown 4 byte, all 0(encoding begins here) C. If the command is 0x0003, mean data to transfer, formate is ( not encode) a. file session ID, 4 byte b. unknown 4 byte, c. length of data packet to wrap, 2 byte D. If the command is 0x0005, means notify the client to begin to send data, format is : a. file session ID, 4 byte b. count of file sent, two byte, (encoding begins here) c. length of message behind, 2 byte d. message, often "it's time for transfering data" E. If the command is )x0006, it's the reply to client 0x0005. Part 7 are all 0, format is: a. file session ID, 4 byte b. unknown 2 byte, all 0 c. unknown 4 byte, 0x00013880, decimal 80000 d. unknown 2 byte, 0x003C, decimal 60 e. unknown 4 byte, all 0 9. tail, 0x3 B. 如果命令是0x0002,表示ä¸è½¬æœåŠ¡å™¨å¯¹æŽ¥æ”¶è€…æŠ¥åˆ°çš„åº”ç”ï¼Œæ ¼å¼ä¸º: a. 文件会è¯ID,4å—节 b. 未知的4å—节,全0(ä»Žè¿™é‡Œå¼€å§‹åŠ å¯†) C. 如果命令是0x0003,表示ä¸è½¬çš„æ•°æ®ï¼Œæ ¼å¼ä¸º(å‡ä¸åР坆): a. 文件会è¯ID,4å—节 b. 未知的4å—节 c. 被å°è£…的数æ®åŒ…长度,2å—节 d. æ•°æ®åŒ…,也就是FileDataPacketçš„æ ¼å¼ D. 如果命令是0x0005,则是通知客户端å¯ä»¥å¼€å§‹ä¼ 逿•°æ®ï¼Œæ ¼å¼ä¸º: a. 文件会è¯ID,4å—节 b. å·²ç»ä¼ é€å®Œæˆçš„æ–‡ä»¶æ•°ï¼Œä¸¤å—节 (ä»Žè¿™ä¸ªå—æ®µå¼€å§‹åР坆) c. åŽé¢çš„æ¶ˆæ¯é•¿åº¦ï¼Œ2å—节 d. 消æ¯ï¼Œä¸€èˆ¬æ˜¯"it's time for transfering data" E. 如果命令是0x0006,则是对客户端0x0006的回å¤ï¼Œ7部分全0ï¼Œæ ¼å¼ä¸º: a. 文件会è¯ID,4å—节 b. 未知的两å—节,全0 c. 未知的4å—节,0x00013880,å进制值80000 d. 未知的2å—节,0x003C,å进制值60 e. 未知的4å—节,全0 9. 尾部,0x3
Field Summary | |
---|---|
protected static ByteBuffer |
buffer
|
protected char |
command
|
protected static Crypter |
crypter
|
protected FileDataPacket |
fdp
|
protected static org.apache.commons.logging.Log |
log
|
protected char |
sequence
|
Constructor Summary | |
---|---|
FileAgentPacket(FileWatcher watcher)
constructor |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
void |
fill(ByteBuffer out)
fill packet content to out, previous content in out will be clear. |
void |
fill(ByteBuffer out,
int from)
fill packet content to out, previous content in out 填充包内容到outä¸ï¼Œoutä¸åŽŸæ¥çš„内容 |
char |
getCommand()
|
char |
getSequence()
|
int |
hashCode()
|
void |
parse(ByteBuffer in)
parse file transfer packet from current position of in. |
void |
setCommand(char command)
|
void |
setSequence(char sequence)
|
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 char command
protected char sequence
protected static Crypter crypter
protected FileDataPacket fdp
protected static ByteBuffer buffer
Constructor Detail |
---|
public FileAgentPacket(FileWatcher watcher)
watcher
- file water
æž„é€ å‡½æ•°watcher
- 文件守望者对象Method Detail |
---|
public void fill(ByteBuffer out)
out
- ByteBuffer objectout
- ByteBuffer对象public void fill(ByteBuffer out, int from)
out
- from
- public void parse(ByteBuffer in) throws PacketParseException
in
-
PacketParseException
public char getCommand()
public void setCommand(char command)
command
- The command to set.public char getSequence()
public void setSequence(char sequence)
sequence
- The sequence to set.public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
JML | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |