JML

net.sf.jqql.obsolete
Class FileControlPacket

java.lang.Object
  extended by net.sf.jqql.obsolete.FilePacket
      extended by net.sf.jqql.obsolete.FileControlPacket

public class FileControlPacket
extends FilePacket

 file control packet.file control packet has a common format, only fewness packet form si defferent
 1. 16 byte session key and QQ number md5 form, use to session key in file transfer 
 2. command type, 2 byte
 3. sequence number, 2 byte
 4. sending time, 4 byte
 5. a unknown byte 0 
 6. sender face, 1 byte
 7. 19 unused byte, all 0
 8. fixed byte 0x65
 9. 1 unknown byte, maybe is connection mode
 10. Internet Ip, 4 byte
 11. Internet port, 2 byte
 13. first monitor port, 2 byte
 14. real IP, 4 byte
 15. second monitor port, 2 byte

 total is 61 byte

 for some command type, haven't part10-15, but at part9 follow a unknown byte, this unknown byte since 
 need original sample return, such command is 0x0031, 0x0032, 0x0033, 0x0034
  
 文件控制信息包,文件控制信息包有一个很普遍的格式,只有少数包的格式有所不同
 1. 16个字节的session key和qq号的md5形式,用来做为文件传输时的会话密钥
 2. 命令类型,2字节
 3. 序号,2字节
 4. 发送时间,4字节
 5. 一个未知字节0
 6. 发送者头像,1字节
 7. 19个未用字节,全0
 8. 固定字节0x65
 9. 1个未知字节,可能是连接方式
 10. 外部IP,4字节
 11. 外部端口,2字节
 13. 第一个监听端口,2字节
 14. 真实IP,4字节
 15. 第二个监听端口,2字节
 
 一共61字节
 
 对于有些命令类型,不存在10-15部分,而是在9部分之后带一个未知字节,这个未知字节似乎
 需要原样返回,这样的命令有0x0031, 0x0032, 0x0033, 0x0034
 

Author:
luma

Field Summary
 
Fields inherited from class net.sf.jqql.obsolete.FilePacket
crypter, key, log, random, receiver, sender, source, tag, watcher
 
Constructor Summary
FileControlPacket(FileWatcher watcher)
          create a fil control packet object 构造一个文件控制信息包对象
 
Method Summary
 boolean equals(Object obj)
           
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
 char getCommand()
           
 byte getHelloByte()
           
 byte[] getInternetIp()
           
 int getInternetPort()
           
 byte[] getLocalIp()
           
 int getMajorPort()
           
 int getMinorPort()
           
 long getTime()
           
 int hashCode()
           
protected  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将位于 这个包之后
 void setCommand(char command)
           
 void setHelloByte(byte helloByte)
           
 void setInternetIp(byte[] internetIp)
           
 void setInternetPort(int internetPort)
           
 void setLocalIp(byte[] localIp)
           
 void setMajorPort(int directPort)
           
 void setMinorPort(int localPort)
           
 void setTime(long time)
           
 
Methods inherited from class net.sf.jqql.obsolete.FilePacket
decryptQQ, encryptQQ, generateKey, getKey, getReceiver, getSender, getSource, getTag, refreshKey, setReceiver, setSender, setSource, setTag
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileControlPacket

public FileControlPacket(FileWatcher watcher)
create a fil control packet object 构造一个文件控制信息包对象

Parameters:
watcher - FileWatcher对象 //object
Method Detail

fill

protected void fill(ByteBuffer out)
Description copied from class: FilePacket
 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
 等于包长
 

Overrides:
fill in class FilePacket
Parameters:
out - ByteBuffer对象,做为输出缓冲区 // ByteBuffer object, use to output buffer

fill

protected void fill(ByteBuffer out,
                    int from)
Description copied from class: FilePacket
 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
 

Overrides:
fill in class FilePacket
Parameters:
out - ByteBuffer对象,做为输出缓冲区 // ByteBuffer object, use to output buffer
from - 开始填充的位置 //start fill position

parse

protected void parse(ByteBuffer in)
              throws PacketParseException
Description copied from class: FilePacket
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将位于 这个包之后

Overrides:
parse in class FilePacket
Parameters:
in - ByteBuffer对象,做为输入缓冲区 // ByteBuffer object, as input buffer
Throws:
PacketParseException

getHelloByte

public byte getHelloByte()
Returns:
Returns the helloByte.

setHelloByte

public void setHelloByte(byte helloByte)
Parameters:
helloByte - The helloByte to set.

getTime

public long getTime()
Returns:
Returns the time.

setTime

public void setTime(long time)
Parameters:
time - The time to set.

initFixedFields

protected void initFixedFields()
Description copied from class: FilePacket
init some fixed field toward fixed type packet 初始化一些对于固定类型的包来说固定值的字段

Specified by:
initFixedFields in class FilePacket

getCommand

public char getCommand()
Returns:
Returns the command.

setCommand

public void setCommand(char command)
Parameters:
command - The command to set.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getMajorPort

public int getMajorPort()
Returns:
Returns the majorPort.

setMajorPort

public void setMajorPort(int directPort)
Parameters:
majorPort - The majorPort to set.

getInternetIp

public byte[] getInternetIp()
Returns:
Returns the internetIp.

setInternetIp

public void setInternetIp(byte[] internetIp)
Parameters:
internetIp - The internetIp to set.

getInternetPort

public int getInternetPort()
Returns:
Returns the internetPort.

setInternetPort

public void setInternetPort(int internetPort)
Parameters:
internetPort - The internetPort to set.

getLocalIp

public byte[] getLocalIp()
Returns:
Returns the localIp.

setLocalIp

public void setLocalIp(byte[] localIp)
Parameters:
localIp - The localIp to set.

getMinorPort

public int getMinorPort()
Returns:
Returns the minorPort.

setMinorPort

public void setMinorPort(int localPort)
Parameters:
minorPort - The minorPort to set.

JML