飞鸽传输IPMsg协议+翻译
聲明:
下述協(xié)議內(nèi)容略去了一些在編寫程序過(guò)程中沒有用到協(xié)議內(nèi)容,最初的Ipmsg協(xié)議是用日文寫的,
下面協(xié)議內(nèi)容基于cugb_cat翻譯自Mr.Kanazawa的英文文檔。我(趙崇日)做一些補(bǔ)充說(shuō)明:)。本翻
譯文檔可任意傳播和使用。
----------------------------------------------------------------------
??????? IP信使傳輸協(xié)議(第9版草案)???????? 1996/02/21
??????????????? 2003/01/14 修訂
??????????????? H.Shirouzu
????????????shirouzu@h.email.ne.jp
YLT64-MKFFG-8A1DY-4M8ZK OR LCT4T-24GFE-A816V-4MTQQ?
----------------------------------------------------------------------
關(guān)于IP信使:
IP信使使用TCP/UDP協(xié)議提供收發(fā)消息及文件(目錄)。
特性:
IP信使能夠安裝在任何一個(gè)安裝了TCP/IP協(xié)議棧的操作系統(tǒng)上,使用在線用戶的動(dòng)態(tài)識(shí)別機(jī)制,
可以和在線所有用戶進(jìn)行信息交換。
運(yùn)行機(jī)制介紹:
使用TCP/UDP端口(默認(rèn)端口為2425),消息的收發(fā)使用UDP協(xié)議,文件(文件夾)的收發(fā)使用TCP協(xié)議。
1、?? 命令字:
1)?? 基本命令字(32位命令字的低8位)
??? IPMSG_NOOPERATION???? 不進(jìn)行任何操作
??? IPMSG_BR_ENTRY??????? 用戶上線(以廣播方式登陸)?
??? IPMSG_BR_EXIT???????? 用戶下線(以廣播方式退出)
??? IPMSG_ANSENTRY??????? 應(yīng)答用戶上線???
??? IPMSG_BR_ABSENCE????? 改為缺席模式???
??? IPMSG_BR_ISGETLIST??? 尋找有效的可以發(fā)送用戶列表的成員
??? IPMSG_OKGETLIST?????? 通知用戶列表已經(jīng)獲得
??? IPMSG_GETLIST???????? 用戶列表發(fā)送請(qǐng)求
??? IPMSG_ANSLIST???????? 應(yīng)答用戶列表發(fā)送請(qǐng)求
??? IPMSG_SENDMSG???????? 發(fā)送消息
??? IPMSG_RECVMSG???????? 消息接受驗(yàn)證
??? IPMSG_READMSG???????? 消息打開通知
??? IPMSG_DELMSG????????? 消息丟棄通知
??? IPMSG_ANSREADMSG????? 消息打開確認(rèn)通知(version-8中添加)
??? IPMSG_GETFILEDATA???? 文件傳輸請(qǐng)求
??? IPMSG_RELEASEFILES??? 丟棄附加文件
??? IPMSG_GETDIRFILES???? 附著同級(jí)文件請(qǐng)求
??? IPMSG_GETINFO???????? 獲得IPMSG版本信息
??? IPMSG_SENDINFO??????? 發(fā)送IPMSG版本信息
??? IPMSG_GETABSENCEINFO???? 獲得缺席信息
??? IPMSG_SENDABSENCEINFO??? 發(fā)送缺席信息
??? IPMSG_GETPUBKEY????????? 獲得RSA公鑰
??? IPMSG_ANSPUBKEY????????? 應(yīng)答RSA公鑰
2)?? 選項(xiàng)位(32位命令字的高24位)
??? IPMSG_ABSENCEOPT???? 缺席模式(Member recognition command)
??? IPMSG_SERVEROPT??????? 服務(wù)器(保留)
??? IPMSG_DIALUPOPT??????? 發(fā)送給個(gè)人 Send individual member recognition command
??? IPMSG_SENDCHECKOPT???? 傳送驗(yàn)證
??? IPMSG_SECRETOPT??????? 密封的消息
??? IPMSG_READCHECKOPT???? 密封消息驗(yàn)證(ver8中添加 )
??? IPMSG_PASSWORDOPT??? 密碼
??? IPMSG_BROADCASTOPT???? 廣播
??? IPMSG_MULTICASTOPT???? 多播
??? IPMSG_NEWMUTIOPT???? 新版本的多播(保留)
??? IPMSG_AUTORETOPT???? 自動(dòng)應(yīng)答(Ping-pong protection)
??? IPMSG_NOLOGOPT???????? 沒有日志文件
??? IPMSG_NOADDLISTOPT???? 不添加用戶列表Notice to the members outside of BR_ENTRY
??? IPMSG_FILEATTACHOPT??? 附加文件
??? IPMSG_ENCRYPTOPT???? 加密
??? IPMSG_NOPOPUPOPT???? (不再有效)
??? IPMSG_RETRYOPT???????? 重發(fā)標(biāo)志(用于請(qǐng)求用戶列表時(shí))
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)
??? 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)
??? 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、?? 數(shù)據(jù)包格式(使用字符串):
1)?? 數(shù)據(jù)包格式(版本1的格式)
版本號(hào)(1):包編號(hào):發(fā)送者姓名:發(fā)送者主機(jī)名:命令字:附加信息
2)?? 舉例如下
“1:100:shirouzu:Jupiter:32:Hello”
3、?? 數(shù)據(jù)包處理總述:
1)?? 用戶識(shí)別
當(dāng)IPMSG 啟動(dòng)時(shí),命令I(lǐng)PMSG_BR_ENTRY被廣播到網(wǎng)絡(luò)中,向所有在線的用戶提示一個(gè)新用戶的到達(dá)
(即表示“我來(lái)了”)。
所有在線用戶將把該新上線用戶添加到自己的用戶列表中,并向該新上線用戶發(fā)送IPMSG_ANSENTRY
命令(即表示“我在線”)。
該新上線用戶接收到IPMSG_ANSENTRY命令后即將在線用戶添加到自己的用戶列表中。只要IP包存在
所有用戶可以相互交流。
當(dāng)缺席模式或者昵稱改變時(shí),PMSG_BR_ABSENCE命令向所有用戶廣播。然而,IPMSG_ANSENTRY 命令
不同于IPMSG_BR_ENTRY命令,它不需要一個(gè)返回消息。
IPMSG_BR_ENTRY, IPMSG_ANSENTRY, 和 IPMSG_BR_ABSENCE命令在缺席模式下需要使用IPMSG_ABSENCEOPT標(biāo)志,在附加命令里添加一個(gè)昵稱。 IPMSG_DIALUPOPT標(biāo)志用于直連那些不能靠廣播來(lái)聯(lián)系的用戶。有這個(gè)選項(xiàng)時(shí),成員識(shí)別命令需要被單獨(dú)發(fā)送給這些用戶。
(Extended group)IPMSG_BR_ENTRY 和IPMSG_BR_ABSENCE命令發(fā)送一個(gè)組名是通過(guò)在現(xiàn)有的格式化的字符串后面加上這個(gè)新組名來(lái)實(shí)現(xiàn)的。(在現(xiàn)有命令和擴(kuò)展名之間加入'\0')
2)?? 收發(fā)消息
使用IPMSG_SENDMSG命令發(fā)送消息,消息內(nèi)容添加在附加信息中;在接收消息時(shí),如果對(duì)方要求回
信確認(rèn)(IPMSG_SENDCHECKOPT位打開),則需發(fā)送IPMSG_RECVMSG命令并將對(duì)方發(fā)送的數(shù)據(jù)包的編號(hào)放
在附加信息中一同發(fā)送至發(fā)送消息方。
發(fā)送廣播消息需要使用IPMSG_BOADCASTOPT標(biāo)志和IPMSG_SENDMSG命令。自動(dòng)發(fā)送包(缺席通知)還
需要加上IPMSG_AUTORETOPT標(biāo)志以得到請(qǐng)求-應(yīng)答保護(hù)(for ping-pong protection)。如果沒有任何
一個(gè)包應(yīng)答,那么確認(rèn)/自動(dòng)發(fā)送包就沒有返回。
??? (附加的IPMSG_NOADDLISTOPT)
??? 當(dāng)從一臺(tái)主機(jī)得到一個(gè)沒有在你的發(fā)送/接受列表中的IPMSG_SENDMSG包,IPMsg或者發(fā)送一個(gè)
IPMSG_BR_ENTRY命令或者把他的的主機(jī)名添加到發(fā)送/接受列表中。然而,需要避免single-shot消息的
發(fā)送/接受行為。它需要在IPMSG_SENDMSG命令上添加一個(gè)IPMSG_NOADDLISTOPT標(biāo)志。
????
??? (version8 中附加的IPMSG_READCHECKOPT)
??? 當(dāng)一個(gè)IPMSG_READMSG命令包含一個(gè)IPMSG_READCHECKOPT標(biāo)志時(shí);IPMsg處理IPMSG_SENDMSG同樣需要一個(gè) IPMSG_SENDCHECKOPT選項(xiàng)。但是,發(fā)送消息使用IPMSG_ANSREADMSG命令,而不是IPMSG_RECVMSG。
3) 收發(fā)消息|加密擴(kuò)展(添加于第9版)
??? 使用Public-key(RSA)和common key(RC2/Blowfish)雙重加密。(加密區(qū)使用十六進(jìn)制)
?? (Public-key獲得)發(fā)送IPMSG_GETPUBKEY 命令來(lái)得到。得到的消息中有IPMSG_ANSPUBKEY,意味著得到了RSA的Public-key。
??? IPMSG_GETPUBKEY/IPMSG_ANSPUBKEY都需要加密長(zhǎng)度值(例如IPMSG_RSA_1024)在擴(kuò)展的第一部分使用‘OR’標(biāo)志。
??? 另外,在IPMSG_ANSPUBKEY時(shí),public key需要以這種格式來(lái)寫:EE-NNNNNN E=Exponent丄N=method使用':'分隔,在E和N之間輸入分隔符Fdelimiter '-'
????
??? 在第二次收發(fā)處理記住了public key和加密數(shù)據(jù)后,這個(gè)順序可以略過(guò)。?
????
??? (加密消息)發(fā)送者創(chuàng)建了一個(gè)common key后,它可以加密一個(gè)消息。另外,接受者的public key加密common key
??? (加密消息傳輸)IPMSG_SENDMSG要使用IPMSG_ENCRYPTOPT。在擴(kuò)展的第一部分,輸入值
which is 'or' resoult from Convination of public key and common key type。接著使用被common key which encrypt with public key devide by ':',接著再輸入消息which is eccrypted by public key devide by ':'. If both supports IPMSG_SIGN_XXX, then add ':' and signeture.
??? Also, In the method of encode padding, PKCS#1ECB key is used for RSA,PKCS#5 CBC common key is used for RC2/blowfish.
??? Also, The Packet related to Entry manifestation the capability of ecryption support using IPMSG_ENCRYPTOPT
4)?? 附加文件的擴(kuò)充(添加于第9版)
帶有IPMSG_FILEATTACHOPT位的IPMSG_SENDMSG命令可用來(lái)傳輸文件,文件屬性及內(nèi)容添加在附加
信息中,文件內(nèi)容添加在消息內(nèi)容后并以’\0’與之分隔開。
??? 傳輸文件時(shí)以下信息將被添加到消息內(nèi)容之后(包括格式):
文件序號(hào):文件名:大小(單位:字節(jié)):最后修改時(shí)間:文件屬性[: 附加屬性=val1[,val2…][:附加
信息=…]]:\a:文件序號(hào)…(文件大小、最后修改時(shí)間和文件屬性為十六進(jìn)制數(shù),如果文件名中包含’:’
則使用“::”代替)。
??? 接收端開始接收文件時(shí),請(qǐng)求傳輸文件命令I(lǐng)PMSG_GETFILEDATA將發(fā)送到發(fā)送端的TCP端口(和UDP的
發(fā)送端口相同),并將發(fā)送端發(fā)送的包編號(hào):文件序號(hào):偏移量(全為十六進(jìn)制格式)寫到附加信息區(qū)一同發(fā)送,
文件發(fā)送端接收到該請(qǐng)求信息并進(jìn)行校驗(yàn)正確后即開始發(fā)送文件(不使用任何格式,亦不進(jìn)行加密)。
??? 當(dāng)接收端接收到目錄文件時(shí),將發(fā)送附加信息區(qū)為發(fā)送端發(fā)送的包編號(hào):文件序號(hào):偏移量(全為十六
進(jìn)制格式)的 IPMSG_GETDIRFILES命令,以用來(lái)請(qǐng)求傳輸目錄文件。
??? 發(fā)送端則將頭信息長(zhǎng)度:文件名:文件大小:文件屬性:文件內(nèi)容添加到附加信息區(qū)(除了文件名和文件內(nèi)容
外,其余皆為十六進(jìn)制)。
??? 頭信息長(zhǎng)度是從頭信息長(zhǎng)度開始到文件內(nèi)容前的‘:’分割符為止的字符個(gè)數(shù)。擴(kuò)展屬性被忽略并且使用
多個(gè)擴(kuò)展屬性。內(nèi)容輸入使用'='。
??? 當(dāng)文件屬性為IPMSG_FILE_DIR時(shí),IPMsg能夠自動(dòng)識(shí)別其為目錄,下一個(gè)文件的數(shù)據(jù)在該目錄之后。
??? 當(dāng)文件屬性為IPMSG_FILE_RETPARENT時(shí),IPMsg識(shí)別其動(dòng)作為返回上一級(jí)目錄,在這種情況下,文件名為‘.’其屬性為當(dāng)前目錄的值。
??? 發(fā)送處理直接開始于附加文件且返回IPMSG_FILE_RETPARENT命令來(lái)附加目錄。
??? 給Entry包添加一個(gè)IPMSG_FILEATTACHOPT標(biāo)志來(lái)支持附加文件。
5)?? 其他命令
??? 當(dāng)需要不同版本信息時(shí),發(fā)送IPMSG_GETINFO命令。接受方在擴(kuò)展信息區(qū)加上版本信息來(lái)回應(yīng)。
??? 發(fā)送IPMSG_GETABSENCEINFO命令來(lái)得到缺席模式時(shí)的信息。如果接受方是在缺席模式下,則發(fā)送
IPMSG_SENDABSENCEINFO;如果不是,則發(fā)送字符串"Not absence mode"。
6)?? 確認(rèn)/重發(fā)
??? 如果IPMSG_SENDMSG 和 IPMSG_RECVMSG的確認(rèn)包在一個(gè)設(shè)定的時(shí)間內(nèi)沒有返回,那就需要重發(fā)。重發(fā)次數(shù)和時(shí)間間隔依賴于當(dāng)前條件。
????
4、其他
1)換行
??? 發(fā)送消息中換行符是UNIX的類型('0x0a'),如果需要可以改變。
2)分隔符':'
??? 你不能在用戶名和主機(jī)名中使用分隔符':'。如果用戶名/主機(jī)名包含了':',請(qǐng)用其他的符號(hào)替換,
比如';'。使用分隔符不是問(wèn)題所在,可以創(chuàng)建一個(gè)escape sequence。??
//水平有限,僅作參考,有什么問(wèn)題或建議請(qǐng)聯(lián)系:zhaochongri@gmail.com
附IPMSG協(xié)議英文版:
QUOTE:
Original ipmsg protocol specification is written in Japanese.
This document was translated by Mr.Kanazawa.
This document is not verified yet.
----------------------------------------------------------------------
??? IP Messenger communication protocol (Draft-9)?? 1996/02/21
??????????????????????????????? Modified 2003/01/14
??????????????????????????????????? H.Shirouzu
??????????????????????????????shirouzu@h.email.ne.jp
----------------------------------------------------------------------
About IP Messenger
??? This is a Send/Receive message service using the TCP/UDP Port.
Characteristics
??? IP Messenger can be installed in any OS if TCP/IP is used on your machine.
??? 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
??? (Message Send/Receive: UDP, File Send/Receive: TCP)
1. Command
1) Command functions (Low 8 bits from command number 32 bits)
??? 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 )
??? IPMSG_GETFILEDATA???? File Transfer request by 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)
??? 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 )
??? 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)
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)
??? 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)
??? 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)
??? 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.
??? 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.
??? The new member gets the current member data by a
??? IPMSG_ANSENTRY command. All members can communicate as long as an
??? IP packet exists.
??? 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_ENTRY, IPMSG_ANSENTRY, and IPMSG_BR_ABSENCE commands
??? use an IPMSG_ABSENCEOPT flag for absence mode. Input a nickname to
??? additional command.
??? 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.
??? (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).
2) Send/Receive Message
??? Send Message uses an IPMSG_SENDMSG command that can input a message
??? in the extended area.
??? 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.
??? Broadcast Message Send uses an IPMSG_BOADCASTOPT command
??? and an IPMSG_SENDMSG flag should be ON.
??? 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.
??? 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.
??? (Additional 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.
??? However, single-shot Message Send/Receive action needs to be avoided.
??? Add an IPMSG_NOADDLISTOPT flag to an IPMSG_SENDMSG command.
??? (Additional IPMSG_READCHECKOPT from version-8 )
??? When an IPMSG_READMSG command contains an IPMSG_READCHECKOPT flag,
??? IPMsg process is the same as IPMSG_SENDMSG with an
??? IPMSG_SENDCHECKOPT flag.
??? However, Send Message uses an IPMSG_ANSREADMSG command,
??? not IPMSG_RECVMSG.
3) Message Send/Receive 亅encrypted extension (Added in the version-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 both require the value which is
??? encryption capability (Exp. IPMSG_RSA_1024) flag uses "OR" at first
??? part of extension
??? 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.
??? 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.
??? Also, In the method of encode padding, PKCS#1ECB key is used for RSA,
??? PKCS#5 CBC common key is used for RC2/blowfish.
??? Also, The Packet related to Entry manifestation the capability of
??? ecryption support using IPMSG_ENCRYPTOPT
4) Extension with file attachment(Available from version-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.
??
??? 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.)
??? 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)
??? 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.
??? When fileattr is IPMSG_FILE_DIR, IPMsg recognizes that it is automatically
??? in the directory, the next file data is after the directory.
??? 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.
??? Sending process starts from the attachment directly and returns the
??? IPMSG_FILE_RETPARENT command to the attachment directory.
??? Add an IPMSG_FILEATTACHOPT flag for an Entry packet to support the
??? attachment file.
5) Other commands
??? When acquiring different versions, send an IPMSG_GETINFO command.
??? Receiving side sends the version information character string to
??? extended area.
??? 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.
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.
4. Other
1) Linefeed
??? Linefeed characters in Send Message is standardized with UNIX type ('0x0a').
??? Please change if needed.
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?shirouzu@h.email.ne.jp
Note
??? See ipmsg.h for command codes.
??? Please e-mail me your comments and suggestions.
轉(zhuǎn)載于:https://my.oschina.net/sexgirl/blog/354248
總結(jié)
以上是生活随笔為你收集整理的飞鸽传输IPMsg协议+翻译的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 一道算法题——合并有交集的集合
- 下一篇: 我自己在学习建站的时候,通常都会找一些比