Protocols/MSNP/MSNC/P2Pv2 Headers

From NINA Wiki
Revision as of 00:23, 29 May 2020 by AD (talk | contribs) (1 revision imported)
Jump to navigation Jump to search

| style="font-size: 95%; text-align:center; color:#000000; background-color:#499feb" | MSNC |- | OverviewMSNObject |- | Client Capabilities |- | style="font-size: 95%; color:#000000; background-color:#499feb; text-align:center;"|P2P protocol |- | TransportsMSNSLP |- | style="font-size: 95%; color:#000000; background-color:#499feb; text-align:center;"|Headers |- | P2Pv1 Binary headers |- | P2Pv2 Binary headers |- | style="font-size: 95%; color:#000000; background-color:#499feb; text-align:center;"|Transfers |- | Display Pictures |- | Custom Emoticons |- | File Transfer |-

| style="font-size: 120%; color:#000000; margin-top: 0.5em; background-color:#499feb; text-align:center;"|Overview |-

P2Pv2 Binary Headers (from MSNP16)

When the client Alice logs in using MSNP18, and starts a session to another WLM 2009 client Bob (I believe Alice knows the client type of Bob by the GUID that is attached to the email in Bob's JOI command) then the file transfer binary header is substantially changed.

All data is Big Endian. The binary header size is dynamic - It can be between 8(0x08) and 252(0xfc). The new P2P protocol always has header and message part is optional. Ex: Ack packets haven't message part.

0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|L|O|Len|Base ID|if L>8 then TLVs = read(L - 8) else skip  ....
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| if Len > 0 then Payload = (DH and D) else skip           ....
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

For all of them - (DWORD is a 32-bit, 4 byte, unsigned integer and QWORD is 64 bits, 8 bytes.)

1 BYTE HL Length of header.
2 BYTE OP Operation code. 0: None, 2: Ack, 3: Init session.
3 WORD ML Message length without header length. (but included the header's message length)
4 DWORD BaseID Initially random (?) To get the next one add the payload length.
TLVs BYTE[HL-8] TLV Data TLV list consists of TLV-encoded pairs (type, length, value). A whole TLV list is padded with zeros to fit 4-byte boundary. TLVs: T=0x1(1) L=0xc(12): IPv6 address of sender/receiver. T=0x2(2) L=0x4(4): ACK identifier.
DH DHL Data Header
BYTE DHL: Data header length
BYTE TFCombination: 0x1=First, 0x4=Msn object (display picture, emoticon etc), 0x6=File transfer
WORD PackageNumber: Package number
DWORD SessionID: Session Identifier
BYTE[DHL-8] Data packets TLVs: if (DHL>8) then read bytes(DHL - 8). T=0x1(1) L=0x8(8): Data remaining.
D ML-DHL Data Packet SLP messsage or data packet
F DWORD Footer The footer.

Examples

First P2P message

H: 18 03 05 4e 13 63 d5 a0 01 0c 00 02 00 00 00 0e 76 2d 0f 01 00 00 00 00 DH: 08 01 00 00 00 00 00 00 D: SLPMessage

All type of header has the follow fields:

1 0x18 Length of header 24
2 0x03 Operation code Initialize session.
3 0x05 0x4e Size of message 1358 = 1350+8(0x08)
4 0x13 0x63 0xd5 0xa0 Base ID The next Base ID += Size of message
TLVs 01 0c 00020000 000e762d 0f010000 (00 00) TLV data TLV = 24 - 8 = 16 bytes. T=01,L=12,V=00020000 000e762d 0f010000. (00 00 = Padded with zeros to fit 4-byte boundary.)
DH 08 01 00 00 00 00 00 00 Data Header
08=DataHeaderLength
01=TFCombination
00 00=PackageNumber
00 00 00 00 = Session ID
No TLV because DataHeaderLength - 8 = 0.
D SLP SLP SLP Message


An acknowledgement

H: 08 02 00 00 93 e7 20 56 DH: (no data) D: (no data) F: 00 00 00 00

1 0x08 Length of header 8
2 0x02 Operation code Acknowledgement
3 0x00 0x00 Size of message 0
4 0x93 0xe7 0x20 0x56 Base ID AckIdentifier = Base ID + Size of Message
TLVs (No tlv data) TLVs Length of header <= 8, so no TLVs in this sample package.
DH (no data) Data Header Size of message is 0.
D (no data) Data Size of message is 0.
F 0x00 0x00 0x00 0x00 Footer Footer is 0 (always).


File Transfer

H: 08 00 05 70 13 63 da ee DH: 14 07 00 00 d1 c5 26 da 01 08 00 00 00 00 00 02 04 1c 00 00 D: ...

1 0x08 Length of header 8
2 0x00 Operation code None
3 0x05 0x70 Size of message 1392 = 1372+20(0x14)
4 0x13 0x63 0xda 0xee Base ID The next Base ID += Size of message
TLVs (No tlv data) TLVs Length of header <= 8, so no TLVs in this sample package.
DH 14 07 0000 d1c526da 01 08 00000000 0002041c 0000 Data Header
0x14(20)=DataHeaderLength
0x07=TFCombination(The first file transfer message. 0x06 is all other file transfer message)
0x00 0x00=PackageNumber
0xd1 0xc5 0x26 0xda = Session ID from SLP
TLVs = 20-8=12 bytes. T(01) L(08) V(00 00 00 00 00 02 04 1c - data remaining) Padding(00 00)
D Data Data File data


Display Picture

H: 08 00 05 70 03 a3 da ee DH: 14 05 00 00 d1 c5 26 dc 01 08 00 00 00 00 00 00 34 f5 00 00 D: ...

1 0x08 Length of header 8
2 0x00 Operation code None
3 0x05 0x70 Size of message 1392 = 1372+20(0x14)
4 0x03 0xa3 0xda 0xee Base ID The next Base ID += Size of message
TLVs (No tlv data) TLVs Length of header <= 8, so no TLVs in this sample package.
DH 14 05 0000 d1c526da 01 08 00000000 000034f5 0000 Data Header
0x14(20)=DataHeaderLength
0x5=TFCombination(The first display picture message. 0x04 is all other display picture message)
0x0 0x0=PackageNumber
0xd1 0xc5 0x26 0xda = Session ID from SLP
TLVs = 20-8=12 bytes. T(01) L(08) V(00 00 00 00 00 00 34 f5 - data remaining) Padding(00 00)
D Data Data Picture data


For more information

P2Pv1 and P2Pv2 Header Definitions

Binary header research on MSNC10 (The new P2P protocol used in WLM 2009 and MSNP18)