Pymsn/MSNP2P

MSNP2P

This protocol is sort of documented here, but because the understanding of the protocol there is fundamentally flawed we will document it from scratch here and merge back to msnpiki as soon as it's done.

MSNP2P is a multi-layer protocol where you have a transport layer taking care of reliably delivering arbitrarily sized blobs of data back and forth, and a SIP-like protocol on top of that.

Transport

The transport layer provides reliable transport of arbitrarily sized blobs. Each blob is transferred in one or more chunks. One or more transport bridges are responsible for transferring these chunks, and the current transport bridge can be changed mid-transfer of a blob if a more suitable bridge becomes available (for example if the client succeeds in opening ports in a router using uPnP shortly after starting a file transfer). There are two kinds of blobs, control blobs and bulk blobs. All bulk blobs must be acknowledged, and each chunk too if the bridge doesn't provide a reliable transport mechanism. All blobs have a 48 byte header that we'll call TLPHEADER.

TLPHEADER

Name

Description

Offset

Size

SessionID

The Session ID.

0

DWORD

BlobID

Identifier of the blob.

4

DWORD

BlobOffset

Offset in the current blob.

8

QWORD

BlobSize

Size of the blob.

16

QWORD

ChunkSize

Size of this chunk.

24

DWORD

Flags

Flags.

28

WORD

Unknown

Padding?

30

WORD

DW1

Depends on blob.

32

DWORD

DW2

Depends on blob.

36

DWORD

QW1

Depends on blob.

40

QWORD

Flags

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

Description

-

-

-

-

-

-

-

X

-

-

-

-

-

-

-

-

First blob on this bridge, or after migrating bridge (not yet known).

-

-

-

-

-

-

X

-

-

-

-

-

-

-

-

-

Encrypted.

General Overview