Original ipmsg protocol specification is written in Japanese. 最初的飞鸽传书协议说明书是日文书写。 This document was translated by Mr.Kanazawa. 本文档是Mr.Kanazawa.翻译完成。 This document is not verified yet. 本文档尚未被认证。 ---------------------------------------------------------------------- IP Messenger communication protocol (Draft-9) 1996/02/21 飞鸽传书传书协议(草案-9) 1996/02/21 Modified 2003/01/14 修订于2003/01/14 H.Shirouzu 白水 启章 [email protected] (作者邮箱) ---------------------------------------------------------------------- About IP Messenger 关于飞鸽传书 This is a Send/Receive message service using the TCP/UDP Port. 它是基于TCP/IP端口的收发信息服务。 Characteristics 特点 IP Messenger can be installed in any OS if TCP/IP is used on your machine. 飞鸽传书可以安装在任一使用TCP/IP协议的的操作系统上。 Dynamic member recognition can be done within your network or specified network. 在网络中完成了动态用户识别机制。 You can exchange messages between all IPMsg members. 所有飞鸽用户之间可以相互交换信息。 Function description 功能描述 Use TCP/UDP port(default:2425). See the following descriptions 使用TCP/UDP端口(默认端口:2425)。见下述描述 (Message Send/Receive: UDP, File Send/Receive: TCP) (信息 发送/接收:UDP, 文件发送/接收:TCP) 1. Command 命令 1) Command functions (Low 8 bits from command number 32 bits) 命令功能(32位命令字的低8位) IPMSG_NOOPERATION No Operation 没有任何操作 IPMSG_BR_ENTRY Entry to service (Start-up with a Broadcast command) 上线(开始于广播此命令) IPMSG_BR_EXIT Exit from service (End with a Broadcast command) 下线(结束于广播此命令) IPMSG_ANSENTRY Notify a new entry 通报新上线 IPMSG_BR_ABSENCE Change absence mode 更改为离开状态 IPMSG_BR_ISGETLIST Search valid sending host members 搜寻有效的主机用户 IPMSG_OKGETLIST Host list sending notice 主机列表发送通知 IPMSG_GETLIST Host list sending request 主机列表发送请求 IPMSG_ANSLIST Host list sending 主机列表发送 IPMSG_SENDMSG Message transmission 消息传送 IPMSG_RECVMSG Message receiving check 接收消息确认 IPMSG_READMSG Message open notice 消息打开通知 IPMSG_DELMSG Message discarded notice 消息丢弃通知 IPMSG_ANSREADMSG Message open confirmation notice(added from version-8 ) 消息打开确认通知(版本8中加入) IPMSG_GETFILEDATA File Transfer request by TCP 基于TCP的文件传送请求 IPMSG_RELEASEFILES Discard attachment file 丢弃(取消)附件文件的接收 IPMSG_GETDIRFILES Attachment hierarchical file request 文件夹传书请求 IPMSG_GETINFO Get IPMSG version info. 飞鸽版本信息 IPMSG_SENDINFO Send IPMSG version info. 传送飞鸽版本信息 IPMSG_GETABSENCEINFO Get absence sentence 获取离线判定 IPMSG_SENDABSENCEINFO Send absence sentence 发送离线判定 IPMSG_GETPUBKEY RSA Public Key Acquisition 公钥获取 IPMSG_ANSPUBKEY RSA Public Key Response 公钥相应 2) Option flag (High 24 bits from command number 32 bits) 选项位(32位命令字的高24位) IPMSG_ABSENCEOPT Absence mode(Member recognition command) 离开状态(用户识别命令) IPMSG_SERVEROPT Server(Reserved) 服务器(保留) IPMSG_DIALUPOPT Send individual member recognition command 发送个人用户识别命令 IPMSG_SENDCHECKOPT Transmission check 传送检查 IPMSG_SECRETOPT Sealed message 封闭信息 IPMSG_READCHECKOPT Sealed message check(added from ver8 ) 封闭信息检查(版本8中加入) IPMSG_PASSWORDOPT Lock 锁 IPMSG_BROADCASTOPT Broadcast message 广播信息 IPMSG_MULTICASTOPT Multi-cast(Multiple casts selection) 多播 IPMSG_NEWMUTIOPT New version multi-cast(reserved) 新版本多播 IPMSG_AUTORETOPT Automatic response(Ping-pong protection) 自动回复 IPMSG_NOLOGOPT No log files 无日志文件 IPMSG_NOADDLISTOPT Notice to the members outside of BR_ENTRY 不在线用户通知 IPMSG_FILEATTACHOPT File attachment 文件附件选项 IPMSG_ENCRYPTOPT Code 编码 IPMSG_NOPOPUPOPT (No longer valid) (不可用) IPMSG_RETRYOPT Re-send flag(Use when acquiring HOSTLIST) 重发位(在获取hostlist时使用) 3) Extended code flag (hex format combination) 扩展编码位(十六进制格式组合) IPMSG_RSA_512 IPMSG_RSA_1024 IPMSG_RSA_2048 IPMSG_RC2_40 IPMSG_RC2_128 IPMSG_RC2_256 IPMSG_BLOWFISH_128 IPMSG_BLOWFISH_256 IPMSG_SIGN_MD5 4) Extended files for attachment (fileattr low 8 bits) 文件附件扩展(文件属性低8位) IPMSG_FILE_REGULAR IPMSG_FILE_DIR IPMSG_FILE_RETPARENT IPMSG_FILE_SYMLINK IPMSG_FILE_CDEV IPMSG_FILE_BDEV IPMSG_FILE_FIFO IPMSG_FILE_RESFORK 5) Attachment file extended attribute(fileattr high 24 bits) 附件文件属性(文件属性高24位) IPMSG_FILE_RONLYOPT IPMSG_FILE_HIDDENOPT IPMSG_FILE_EXHIDDENOPT IPMSG_FILE_ARCHIVEOPT IPMSG_FILE_SYSTEMOPT 6) Extended file attribute for attachment file 附件文件的扩展文件属性 IPMSG_FILE_UID IPMSG_FILE_USERNAME IPMSG_FILE_GID IPMSG_FILE_GROUPNAME IPMSG_FILE_PERM IPMSG_FILE_MAJORNO IPMSG_FILE_MINORNO IPMSG_FILE_CTIME IPMSG_FILE_MTIME IPMSG_FILE_ATIME IPMSG_FILE_CREATETIME IPMSG_FILE_CREATOR IPMSG_FILE_FILETYPE IPMSG_FILE_FINDERINFO IPMSG_FILE_ACL IPMSG_FILE_ALIASFNAME IPMSG_FILE_UNICODEFNAME 2.Command format(Use all character strings) 数据包格式(使用字符串形式) 1) Command(Format version-1) 命令(格式 版本-1) Ver(1) : PacketNo : SenderName : SenderHost : CommandNo : AdditionalSection 版本:包编号:发送者名字:发送主机:命令编号:附加信息区域 2) An example for Message Send/Receive by using the current command format 一个使用当前命令格式收发信息的例子 "1:100:shirouzu:jupiter:32:Hello" 3.Command process overview 数据包过程总览 1) Member recognition 用户识别 An IPMSG_BR_ENTRY command notifies a new entry to the current members at start-up. 飞鸽启动时IPMSG_BR_ENTRY命令向当前所有用户发送上线通知。 All members add the new member to their list after getting a notification message. 所有用户当受到通知信息时把用户加入列表。 An IPMSG_ANSENTRY command sends a message back to the new member. IPMSG_ANSENTRY命令回发到上线新用户。 The new member gets the current member data by a IPMSG_ANSENTRY command. All members can communicate as long as an IP packet exists. 新用户通过IPMSG_ANSENTRY命令得到当前在线用户信息。所有用户在IP存在时可以互相通信。 An IPMSG_BR_ABSENCE command broadcasts absence mode cancel or nickname change to all members. However, an IPMSG_ANSENTRY command does not send a message back, which is different from an IPMSG_BR_ENTRY command. IPMSG_BR_ABSENCE信息广播给所有用户该用户离开状态取消或者昵称改变。但是和IPMSG_BR_ENTRY命令不同的 是IPMSG_BR_ABSENCE命令 不回发信息。 IPMSG_BR_ENTRY, IPMSG_ANSENTRY, and IPMSG_BR_ABSENCE commands use an IPMSG_ABSENCEOPT flag for absence mode. Input a nickname to additional command. IPMSG_BR_ENTRY, IPMSG_ANSENTRY, 和 IPMSG_BR_ABSENCE命令使用IPMSG_ABSENCEOPT位for离 开状态。输入昵称到附加命令中。 Add an IPMSG_DIALUPOPT flag for dial-up users who can't be reached by a broadcast command. A member recognition command needs to be sent individually to the members with this optional flag. 添加IPMSG_DIALUPOPT位for广播信息不能达到的拨号用户。用户判定命令需要个别发任选位到用户。 (Extended group)IPMSG_BR_ENTRY and IPMSG_BR_ABSENCE commands sends a group name by adding the new group name after the current command format character strings (Input '\0' between the current command and extended name). (附加组)IPMSG_BR_ENTRY 和 IPMSG_BR_ABSENCE 命令可以发送组名,采用在当前命令格式串后添加组名。 (在当前命令和附加名字之间添加‘\0’) 2) Send/Receive Message 发送/接收信息 Send Message uses an IPMSG_SENDMSG command that can input a message in the extended area. 使用IPMSG_SENDMSG命令发送信息,采用在扩展区域添加信息。 Receive Message sends back an IPMSG_RECVMSG command only if an IPMSG_SENDCHECKOPT flag is ON. Input the original packet number to the extended area. 如果IPMSG_SENDCHECKOPT位打开,接收信息回发IPMSG_RECVMSG命令。添加最初的包编号到扩展区域中。 Broadcast Message Send uses an IPMSG_BOADCASTOPT command and an IPMSG_SENDMSG flag should be ON. 使用IPMSG_BOADCASTOPT命令发送广播信息,IPMSG_SENDMSG位应该打开。 Auto-Send packet(absence notice) needs to be added to IPMSG_AUTORETOPT for ping-pong protection. If either one or another packet is ON, then confirmation/auto-send packet is not sent back. 自动发送包(离开通知)需要添加进IPMSG_AUTORETOPTfor ping-pong 保护,如果一个或者另外一个是打开 状态, 确认/自动发送包不回发。 Send Message Sealing needs to be an IPMSG_SECRETOPT packet ON. In this case, Receive Message sends an IPMSG_READMSG command. Input the original packet number to the extended area. 发送信息时 密封需要IPMSG_SECRETOPT包打开。这种情况之下,接收信息发送一个IPMSG_READMSG命令。在 附加 区域加入最初包号。 (Additional IPMSG_NOADDLISTOPT) (附加 IPMSG_NOADDLISTOPT) When receiving an IPMSG_SENDMSG packet from a host that is not on your Send/Receive list, IPMsg will either confirm a host by sending an IPMSG_BR_ENTRY command or add a host name to the Send/Receive list. 当接收文件时,来自主机的IPMSG_SENDMSG 包没有在你的发送/接收列表,飞鸽将确认主机通过发送 IPMSG_BR_ENTRY 命令,或者添加主机名到发送/接收列表。 However, single-shot Message Send/Receive action needs to be avoided. Add an IPMSG_NOADDLISTOPT flag to an IPMSG_SENDMSG command. 但是,单脉冲信息发送/接收行为需要被禁止。添加IPMSG_NOADDLISTOPT位到IPMSG_SENDMSG命令。 (Additional IPMSG_READCHECKOPT from version-8 ) (附加IPMSG_READCHECKOPT来自版本-8) When an IPMSG_READMSG command contains an IPMSG_READCHECKOPT flag, IPMsg process is the same as IPMSG_SENDMSG with an IPMSG_SENDCHECKOPT flag. 当IPMSG_READMSG命令含有IPMSG_READCHECKOPT位,飞鸽处理过程和IPMSG_SENDMSG同样 具有IPMSG_SENDCHECKOPT位。 However, Send Message uses an IPMSG_ANSREADMSG command, not IPMSG_RECVMSG. 但是,发送信息使用IPMSG_ANSREADMSG命令,不是IPMSG_RECVMSG。 3) Message Send/Receive 亅encrypted extension (Added in the version-9 ) 信息发送/接收 加密扩展(在版本-9中加入) Use the combination of Public-key(RSA) and common key(RC2/Blowfish). (Encrypted extension area is used in hex format.) 使用公钥和普通密钥的结合。 (加密扩展区域使用十六进制格式) (Public key acquisition)Send an IPMSG_GETPUBKEY command to Receive Message. Receive Message gets an IPMSG_ANSPUBKEY that means receiving RSA public key from Send Message. (公钥获得)发送IPMSG_GETPUBKEY命令接收文件。接收文件时得到意味着接收到发送端公钥的 命令IPMSG_ANSPUBKEY。 IPMSG_GETPUBKEY/IPMSG_ANSPUBKEY both require the value which is encryption capability (Exp. IPMSG_RSA_1024) flag uses "OR" at first part of extension IPMSG_GETPUBKEY/IPMSG_ANSPUBKEY 都需要加密容量位 在扩展区域的开始处 使用OR 。 In addition, In IPMSG_ANSPUBKEY, public key written as EE-NNNNNN E=Exponent丄N=method)devide by ':'. and Input the Fdelimiter '-' between E and N. 另外,在IPMSG_ANSPUBKEY中,公钥按照以下形式EE-NNNNNN E=Exponent丄N=method)用':'分开。 同时, 在E和N中间添加‘-’. This sequence can be skipped after the 2nd Send/Receive process by memorizing public key and encrypted data. 这个序列可以在第二次发送/接收处理时通过记录公钥和加密信息跳过。 (Encrypted message)After a sender creates a common key that is supported both sender and receiver, a common key can encrypt a message. In addition, a receiver's public key encrypts the common key. (加密信息)当发送方建立一个发送方和接收方的 普通密钥后,它就能加密信息。 另外,接收方的公钥加密 普通密钥。 (Encrypted message transmission) IPMSG_ENCRYPTOPT is used in IPMSG_SENDMSG. At the first part of extension, input the value which is 'or' resoult from Convination of public key and common key type . Then use common key which encrypt with public key devide by ':'. Then input message which is eccrypted by public key devide by ':'. If both supports IPMSG_SIGN_XXX, then add ':' and signeture. (加密信息传输)IPMSG_ENCRYPTOPT在IPMSG_SENDMSG中使用。在扩展区域的开始,加入 公钥和 普通密钥的or值。然后使用使用以':'为分隔符的公钥加密的 普通密钥
。然后加入使用':'为分隔符的加密 信息。 如果都是IPMSG_SIGN_XXX,则添加‘:’和签名。 Also, In the method of encode padding, PKCS#1ECB key is used for RSA, PKCS#5 CBC common key is used for RC2/blowfish. 当然,在编码填充的方法上,PKCS#1ECB被用于RSA,PKCS#5 CBC被用于RC2/blowfish。 Also, The Packet related to Entry manifestation the capability of ecryption support using IPMSG_ENCRYPTOPT 当然,包关联于使用IPMSG_ENCRYPTOPT加密支持的容量的入口表现 4) Extension with file attachment(Available from version-9 ) 文件附件扩展(从版本-9时可以使用) An IPMSG_SENDMSG command with an IPMSG_FILEATTACHOPT flag for File transfer (download permission)notification sends a message with attachment. Input '\0' after the message and attachment file data. 包含IPMSG_FILEATTACHOPT位的IPMSG_SENDMSG文件传输命令标志着有附件信息。 在信息后和附件信息后加入'\0' fileID:filename:size:mtime:fileattr[:extend-attr=val1 [,val2...][:extend-attr2=...]]:\a:fileID... (size, mtime, and fileattr describe hex format. If a filename contains ':', please replace with "::".) (大小,修改时间,十六进制描述的文件属性,如果文件名中含有':',请用" ::"替代。) When Receive Message downloads an attachment file, an IPMSG_GETFILEDATA command requests a data transmission packet to the TCP port that is the same number as the UDP sending port number. Input packetID:fileID: offset to the extended area. (Use all hex format.) 当接收信息下载附件文件时,IPMSG_GETFILEDATA命令请求和UDP一样的TCP数据传输包端口。在扩展区域 添加packetID:fileID: offset(均使用十六进制格式) File Transfer side receives the request. After recognizing that it's a correct request, then send the specified data (no format) 文件发送方收到请求。当判定它是正确的请求之后发送指定数据。(无格式) When the data receiving side downloads a hierarchical attachment file, use an IPMSG_GETDIRFILES command and input a packetID:fileID to the extended area and send a data transmission request packet. (all hex format) 当数据接收方下载划分的附件文件时,使用IPMSG_GETDIRFILES命令,并且将packetID:fileID写入扩展区域, 发送数据 传输请求包。(均使用十六进制) Data sending side sends the following hierarchical data format. 数据发送方发送下面划分的数据格式: header-size:filename:file-size:fileattr[:extend-attr=val1 [,val2...][:extend-attr2=...]]:contents-data Next headersize: Next filename... (All hex format except for filename and contetns-data) (除了文件名和内容数据之外均使用十六进制格式) header-size is from the beginning of header-size to the delimiter ':' that is before contents-data. extend-attr can be omitted and used multiple extended attributes. Use '=' for data input. 头-大小是从头-大小开始到内容数据前的分隔符':'结束。扩展属性可以忽略并且使用多扩展属性。使用'='for 数 据输入。 When fileattr is IPMSG_FILE_DIR, IPMsg recognizes that it is automatically in the directory, the next file data is after the directory. 当文件属性是 IPMSG_FILE_DIR,飞鸽判定它是自动在目录中,下一个文件数据在目录之后。 When fileattr is IPMSG_FILE_RETPARENT, IMPsg recognizes that it returns to the parent directory. In this case, File name is always "." and the attribute value is the current directory data. 当文件属性是 IPMSG_FILE_RETPARENT,飞鸽判定它返回到父目录。在这种情况之下,文件名总是'.'并且属性值 是当前目录信息。 Sending process starts from the attachment directly and returns the IPMSG_FILE_RETPARENT command to the attachment directory. 发送过程直接开始于附件并且返回 IPMSG_FILE_RETPARENT命令到附件目录。 Add an IPMSG_FILEATTACHOPT flag for an Entry packet to support the attachment file. 添加 IPMSG_FILEATTACHOPT位for入口包来支持附件文件。 5) Other commands 其他命令 When acquiring different versions, send an IPMSG_GETINFO command. Receiving side sends the version information character string to extended area. 当获得不同的版本时,发送 IPMSG_GETINFO命令。接收方发送版本信息字符串到扩展区域。 Send an IPMSG_GETABSENCEINFO command for acquiring an absence message. Receiving side sends an IPMSG_SENDABSENCEINFO back if the status is absence mode. If the status is not absence mode, a character string "Not absence mode" will be sent back. 发送 IPMSG_GETABSENCEINFO命令来
获取离开信息,如果接收方是离开状态,则回发IPMSG_SENDABSENCEINFO。 如果状态不是离开状态,字符串" Not absence mode " 将会被发送。 6) Confirmation/Retry 确认/重发 If a confirmation packet for IPMSG_SENDMSG or IPMSG_RECVMSG is not delivered within a specified time, then it will be sent again. A number of retry actions or interval period is depended on the current condition. 如果 IPMSG_SENDMSG 或者 IPMSG_RECVMSG的确认包没有在指定时间内投递,它将会被重发。 重发行为或者间隔的时间段将依赖于当前的条件。 4. Other 其他 1) Linefeed 换行 Linefeed characters in Send Message is standardized with UNIX type ('0x0a'). Please change if needed. 在发送信息中的换行符是以Unix类型为标准的。如果需要可以改变。 2) Delimiter ':' 分隔符 ':' is used as a delimiter. You can't use this delimiter for user name and host name.
':'被用做分隔符。你不可以在用户名和主机名中使用这个分隔符。 If the use/host names contain a ':', please replace with another sign, for an example ';'. 如果用户/主机中含有':',请使用其他符号替换,例如';'. Although using this delimiter isn't problem as yet, I may create an escape sequence. 尽管使用这个分隔符到目前为止还没有问题,但是我可能创建了一个逃避的序列。 3) Kanji codes 日文编写 SJIS 5. Contact e-mail address 联系邮箱地址 E-Mail [email][email protected][/email] Note 注释 See ipmsg.h for command codes. 参见ipmsg.h中命令的代码。 Please e-mail me your comments and suggestions. 请把你的建议使用邮件发送给我。 |