1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
|
<html><head><title>SoulSeek Protocol Documentation</title></head>
<link rel="stylesheet" type="text/css" href="styles.css">
<body>
<h1>SoulSeek Protocol Documentation</h1>
<div align=center>
<h3>Table of Contents</h3>
<table border=0 cellspacing=0 cellpadding=0><tr><td>
<a href="#versionHistory">Version History</a><br>
<a href="#introduction">Introduction</a><br>
<a href="#overview">Overview</a><br>
<a href="#constants">Constants</a><br>
<a href="#messages">Messages</a><br>
<a href="#serverMessages">Server Messages</a><br>
<a href="#peerMessages">Peer Messages</a><br>
<a href="#messageSequences">Message Sequences</a><br>
</td></tr></table>
</div><br>
<a name="versionHistory"></a><h2>Version History</h2>
2003-01-26: Added peer messages and login sequence, had revelation about reusing existing peer socket from search result for file request, <a href="http://sourceforge.net/users/brienigma/">BriEnigma</a><br>
2003-01-20: Initial revision, <a href="http://sourceforge.net/users/brienigma/">BriEnigma</a><br>
CVS version ID: $Id: soulseek_protocol.html,v 1.1 2003/04/02 05:52:24 simon_mld Exp $<br>
Mental Note: When updating this document, remember to upload the
latest version to the <a href="http://sourceforge.net/docman/?group_id=69129">SourceForge
project documentation web page</a>.
<a name="introduction"></a><h2>Introduction</h2>
<p>
The SoulSeek protocol is not officially documented anywhere. This document is the result
of effort by members of the <a href="http://sourceforge.net/projects/soleseek/">SoleSeek</a>
project team. It was pieced together by examining the
<a href="http://www.sensi.org/~ak/pyslsk/">Python SoulSeek</a> source code, as well as
sniffing network packets.
(Hey, Nir! Please don't sue us inder the
<a href="http://www.eff.org/IP/DMCA/">DMCA</a> for reverse engineering the
protocol!)
This document should not be considered the official
specification. It is our best guess at how the protocol works.
</p>
<a name="overview"></a><h2>Overview</h2>
<p>
The SoulSeek protocol consists of a finite number of messages.
Some of these messages are used for communicating between the
client and server. Others are used for communications between
a client and a peer (another client). All of these messages
(with the exception of a couple of peer messages TODO:...are
PeerInit and PierceFW the only exceptions?...) follow a
standard format.
</p>
<p>
There are a few datatypes that the message blocks use:<br>
(TODO: endian-ness? I always get mixed up.)<br><br>
<table border=0 cellspacing=2 cellpadding=1>
<tr><td valign=top class=standout>Integer</td> <td valign=top class=standout>4 bytes, network byte ordering</td></tr>
<tr><td valign=top class=standout>Byte</td> <td valign=top class=standout>1 byte</td></tr>
<tr><td valign=top class=standout>String</td> <td valign=top class=standout>an integer (4 bytes) that specifies the length of the string, followed by the string data as 8-bit characters. The string is not null-terminated.</td></tr>
<tr><td valign=top class=standout>TODO:</td> <td valign=top class=standout>are other datatypes used?</td>
</table>
</p>
<p>
The standard message blocks start with an integer. This integer defines
the size of the message payload--everything contained in the message, but
not including the 4-bytes length. The payload starts with an integer
that we shall call the <b>message code</b> that describes what type of
message this is. The datatype and meaning of the remaining payload data
is dependant on the message code. For example, the following is a very
simple message, the Login message from the client to the server:<br>
<div align=center><table border=1 cellspacing=0 cellpadding=1>
<tr>
<td style="background-color:#ffcccc;">Message Length</td>
<td style="background-color:#ccffcc;" colspan=18>Message Payload</td>
</tr>
<tr>
<td nowrap style="color:#ff0000;">4-byte-integer: 30</td>
<td nowrap style="color:#009900;">4-byte-integer: 1</td>
<td nowrap style="color:#009900;">4-byte-integer: 8</td>
<td nowrap style="color:#009900;">J</td>
<td nowrap style="color:#009900;">o</td>
<td nowrap style="color:#009900;">h</td>
<td nowrap style="color:#009900;">n</td>
<td nowrap style="color:#009900;">G</td>
<td nowrap style="color:#009900;">a</td>
<td nowrap style="color:#009900;">l</td>
<td nowrap style="color:#009900;">t</td>
<td nowrap style="color:#009900;">4-byte-integer: 6</td>
<td nowrap style="color:#009900;">s</td>
<td nowrap style="color:#009900;">e</td>
<td nowrap style="color:#009900;">c</td>
<td nowrap style="color:#009900;">r</td>
<td nowrap style="color:#009900;">e</td>
<td nowrap style="color:#009900;">t</td>
<td nowrap style="color:#009900;">4-byte-integer: 200</td>
</tr>
<tr>
<td style="color:#ff0000;"></td>
<td style="color:#009900;">Message Code 1 == "Login" (4 bytes)</td>
<td style="color:#009900;" colspan=9>String, length 8 (12 bytes)</td>
<td style="color:#009900;" colspan=7>String, length 6 (10 bytes)</td>
<td style="color:#009900;">Version (4 bytes)</td>
</tr>
</table></div>
This sends a message to the server with message code 1. Since
message code 1 is the Login message, the server knows to expect
two strings and an integer. The fist string, we can see is
of length 8 and contains the letters "JohnGalt". The second
string is of length 6 and contains the letters "secret".
The remaining integer is the number 200.
</p>
<p>
It is worth noting that messages with the same code may have
different payloads, depending on the direction of the message:
client-to-server (generally, a request) or server-to-client
(generally, a response).
In the above example, the message is a Login message
from the client to the server. The server responds to the
client with message that also has the message code 1 ("Login"),
but has a different payload. Login messages originating at
the server (we can think of it as a Login response message)
contain a byte (1/0 for success/fail) followed by a string
(a message about the results of the login or a server greeting).
</p>
<a name="constants"></a><h2>Constants</h2>
<p>
The SoulSeek protocol makes use of several constants:
</p>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout colspan=2 align=center><b>Status Codes</b></td></tr>
<tr><td class=standout>-1</td> <td class=standout>Unknown</td></tr>
<tr><td class=standout>0</td> <td class=standout>Offline</td></tr>
<tr><td class=standout>1</td> <td class=standout>Away</td></tr>
<tr><td class=standout>2</td> <td class=standout>Online</td></tr>
<tr><td class=standout colspan=2 align=center><b>Transfer Direction</b></td></tr>
<tr><td class=standout>0</td> <td class=standout>Download</td></tr>
<tr><td class=standout>1</td> <td class=standout>Upload</td></tr>
<tr><td class=standout colspan=2 align=center><b>TODO: There are probably more...</b></td></tr>
</table>
<!-- =========================================================== -->
<!-- =========================================================== -->
<!-- =========================================================== -->
<a name="messages"></a><h2>Messages</h2>
<b>Jump directly to a server message:</b>
<a href="#S1">Login:1</a>
<a href="#S2">SetWaitPort:2</a>
<a href="#S3">GetPeerAddress:3</a>
<a href="#S5">AddUser:5</a>
<a href="#S7">GetUserStatus:7</a>
<a href="#S13">SayChatroom:13</a>
<a href="#S14">JoinRoom:14</a>
<a href="#S15">LeaveRoom:15</a>
<a href="#S16">UserJoinedRoom:16</a>
<a href="#S17">UserLeftRoom:17</a>
<a href="#S18">ConnectToPeer:18</a>
<a href="#S22">MessageUser:22</a>
<a href="#S23">MessageAcked:23</a>
<a href="#S26">FileSearch:26</a>
<a href="#S28">SetStatus:28</a>
<a href="#S35">SharedFoldersFiles:35</a>
<a href="#S36">GetUserStats:36</a>
<a href="#S40">QueuedDownloads:40</a>
<a href="#S60">PlaceInLineResponse:60</a>
<a href="#S62">RoomAdded:62</a>
<a href="#S63">RoomRemoved:63</a>
<a href="#S64">RoomList:64</a>
<a href="#S65">ExactFileSearch:65</a>
<a href="#S66">AdminMessage:66</a>
<a href="#S67">GlobalUserList:67</a>
<a href="#S68">TunneledMessage:68</a>
<a href="#S69">PrivilegedUsers:69</a>
<a href="#S91">AddToPrivileged:91</a>
<a href="#S92">CheckPrivileges:92</a>
<a href="#S1001">CantConnectToPeer:1001</a>
<br>
<b>Jump directly to a peer message:</b>
<a href="#Pinit">PeerInit</a>
<a href="#Pfw">PierceFW</a>
<a href="#P4">GetSharedFileList:4</a>
<a href="#P5">SharedFileList:5</a>
<a href="#P9">FileSearchResult:9</a>
<a href="#P15">UserInfoRequest:15</a>
<a href="#P16">UserInfoReply:16</a>
<a href="#P36">FolderContentsRequest:36</a>
<a href="#P37">FolderContentsResponse:37</a>
<a href="#P40">TransferRequest:40</a>
<a href="#P41">TransferResponse:41</a>
<a href="#P42">PlaceholdUpload:42</a>
<a href="#P43">QueueUpload:43</a>
<a href="#P44">PlaceInQueue:44</a>
<a href="#P46">UploadFailed:46</a>
<a href="#P50">QueueFailed:50</a>
<a href="#P51">PlaceInQueueRequest:51</a>
<br><br>
<!-- =========================================================== -->
<!-- =========================================================== -->
<!-- =========================================================== -->
<a name="serverMessages"></a><h2>Server Messages</h2>
<a name="S1"></a><h3>Login:1</h3>
Client-to-Server (attempt to login)<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>1 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>Username</td></tr>
<tr><td class=standout>string</td><td class=standout>Password</td></tr>
<tr><td class=standout>integer</td><td class=standout>Version</td></tr>
</table><br>
Server-to-Client (login success/fail)<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>1 (Message Code)</td></tr>
<tr><td class=standout>byte</td><td class=standout>success (0=fail, 1=success)</td></tr>
<tr><td class=standout>string</td><td class=standout>Login message (error message or greeting message)</td></tr>
</table><br>
<a name="S2"></a><h3>SetWaitPort:2</h3>
Client-to-Server<br>
This is sent to the server to tell it what port we are listening on.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>2 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>port number (generally 2234)</td></tr>
</table><br>
Server-to-Client<br>
It is believed that SetWaitPort messages are not sent from the server to the client.<br>
<a name="S3"></a><h3>GetPeerAddress:3</h3>
Client-to-Server<br>
This is sent to the server to ask for a peer's address (IP address and port), given
the peer's username.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>3 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
</table><br>
Server-to-Client<br>
This is the response from the server.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>3 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username this address belongs to</td></tr>
<tr><td class=standout>integer</td><td class=standout>IP address</td></tr>
<tr><td class=standout>integer</td><td class=standout>port number</td></tr>
</table><br>
<a name="S5"></a><h3>AddUser:5</h3>
Client-to-Server<br>
This message is sent when you want to start monitoring the online status of
a user. Once we start "watching" a user by sending this message, the
server will send (TODO: is the message AddUser or GetUserStatus)
messages to us whenever the user changes status (away, back, offline, etc).<br>
Note: There also seems to be a GetPeerAddress response message returned
automatically, along with the AddUser response message--even though the
GetPeerAddress request was never made. Can anyone confirm this?<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>5 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username to start watching</td></tr>
</table><br>
Server-to-Client<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>5 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username being watching</td></tr>
<tr><td class=standout>byte</td><td class=standout>whether the user exists</td></tr>
</table><br>
<a name="S7"></a><h3>GetUserStatus:7</h3>
Client-to-Server<br>
This message is used to request a user's current status.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>7 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username to get status of</td></tr>
</table><br>
Server-to-client<br>
This message is used by the server to report back to us a user's current status.
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>7 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username this status applies to</td></tr>
<tr><td class=standout>integer</td><td class=standout>status code, <a href="#constants">see above</a></td></tr>
</table><br>
<a name="S13"></a><h3>SayChatroom:13</h3>
Client-to-Server<br>
This message is sent to say something in a chatroom.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>13 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
<tr><td class=standout>string</td><td class=standout>message</td></tr>
</table><br>
Server-to-Client<br>
Somebody said something in a chatroom we are in.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>13 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>string</td><td class=standout>message</td></tr>
</table><br>
<a name="S14"></a><h3>JoinRoom:14</h3>
Client-to-Server<br>
We would like to join a chatroom.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>14 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
</table><br>
Server-to-Client<br>
We have joined the room. Here is a list of all the people in the room. (This
could very easily be a giant set of data!)<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>14 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
<tr><td class=standout>integer</td><td class=standout>number of users in this room</td></tr>
<tr><td class=standout>string</td><td class=standout>username #1</td></tr>
<tr><td class=standout>string</td><td class=standout>username #2</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>string</td><td class=standout>username #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>number of status code intgers (should be the same as number of users in the above field)</td></tr>
<tr><td class=standout>integer</td><td class=standout>status code of username #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>status code of username #2</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>integer</td><td class=standout>status code of username #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>number of statistics records (should be the same as number of users in the above field)</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 1: avgspeed of username #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 1: downloadnum of username #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 1: something of username #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 1: files of username #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 1: dirs of username #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 2: avgspeed of username #2</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 2: downloadnum of username #2</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 2: something of username #2</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 2: files of username #2</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record 2: dirs of username #2</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record n: avgspeed of username #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record n: downloadnum of username #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record n: something of username #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record n: files of username #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>stats record n: dirs of username #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>number of slotsfull records</td></tr>
<tr><td class=standout>integer</td><td class=standout>slotsfull field of username #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>slotsfull field of username #2</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>integer</td><td class=standout>slotsfull field of username #n</td></tr>
</table><br>
<a name="S15"></a><h3>LeaveRoom:15</h3>
Client-to-Server<br>
We would like to leave a chatroom.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>15 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
</table><br>
Server-to-Client<br>
Server tells us we have left the room. Note that, in theory, this could
happen at any time--it may not necessarily be a response to a LeaveRoom
message. It is entirely possible that the server could send this to kick
you out of a room (although this author has never seen it happen).
<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>15 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
</table><br>
<a name="S16"></a><h3>UserJoinedRoom:16</h3>
Client-to-Server<br>
This message is not sent from the client.<br><br>
Server-to-Client<br>
User "x" has entered chat room "y".<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>16 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
</table><br>
<a name="S17"></a><h3>UserLeftRoom:17</h3>
Client-to-Server<br>
This message is not sent from the client.<br><br>
Server-to-Client<br>
User "x" has left chat room "y".<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>17 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
</table><br>
<a name="S18"></a><h3>ConnectToPeer:18</h3>
Client-to-Server
If we cannot establish a direct connection to a user (for example,
they are behind a firewall), we send this message to the server, which
will tell the peer to connect back to us.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>18 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>string</td><td class=standout>type: "P"/"F" (see PeerInit)</td></tr>
</table><br>
Server-to-Client<br>
If someone cannot establish a connection with us (for instance, we are behind
a firewall), the server sends this message to us. We then attempt to
establish a direct connection to the peer.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>18 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>string</td><td class=standout>type: "P"/"F" (see PeerInit)</td></tr>
<tr><td class=standout>integer</td><td class=standout>ip address</td></tr>
<tr><td class=standout>integer</td><td class=standout>port</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
</table><br>
<a name="S22"></a><h3>MessageUser:22</h3>
Client-to-Server<br>
Send a private chat message to a user<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>22 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>string</td><td class=standout>message</td></tr>
</table><br>
Server-to-Client<br>
Somebody sent us a private chat message<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>22 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>message ID</td></tr>
<tr><td class=standout>integer</td><td class=standout>timestamp</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>string</td><td class=standout>message</td></tr>
</table><br>
<a name="S23"></a><h3>MessageAcked:23</h3>
Client-to-Server<br>
Confirmation of receiving a private chat message. If we do not send it,
the server will keep sending the chat phrase to us.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>23 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>message ID</td></tr>
</table><br>
Server-to-Client<br>
This message is not sent from the server to the client.<br>
<a name="S26"></a><h3>FileSearch:26</h3>
Client-to-Server<br>
We send this to the server when we want to search for something.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>26 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
<tr><td class=standout>string</td><td class=standout>search text</td></tr>
</table><br>
Server-to-Client
The server sends this to tell us someone is searching for something.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>26 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
<tr><td class=standout>string</td><td class=standout>search text</td></tr>
</table><br>
<a name="S28"></a><h3>SetStatus:28</h3>
Client-to-Server<br>
Change my away/online status.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>28 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>new status, <a href="#constants">see above</a></td></tr>
</table><br>
Server-to-Client<br>
This message is not sent from the server to the client.
<a name="S35"></a><h3>SharedFoldersFiles:35</h3>
Server-to-Client<br>
We send this to the server to tell it how many files and folders we are
sharing.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>35 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>folder count</td></tr>
<tr><td class=standout>integer</td><td class=standout>file count</td></tr>
</table><br>
Server-to-Client<br>
This message is not sent from the server to the client.
<a name="S36"></a><h3>GetUserStats:36</h3>
Client-to-Server
This message is not sent from the client to the server.<br><br>
Server-to-Client<br>
The server sends this message to us to indicate a change in a user's
statistics.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>36 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>integer</td><td class=standout>avgspeed</td></tr>
<tr><td class=standout>integer</td><td class=standout>downloadnum</td></tr>
<tr><td class=standout>integer</td><td class=standout>something</td></tr>
<tr><td class=standout>integer</td><td class=standout>files</td></tr>
<tr><td class=standout>integer</td><td class=standout>dirs</td></tr>
</table><br>
<a name="S40"></a><h3>QueuedDownloads:40</h3>
Client-to-Server<br>
It is unknown whether this is valid.
<br><br>
Server-to-Client<br>
The server sends this to indicate if someone has download slots available.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>40 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>integer</td><td class=standout>slotsfull</td></tr>
</table><br>
<a name="S60"></a><h3>PlaceInLineResponse:60</h3>
Client-to-Server<br>
Ask the server what place in line we are ...?<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>60 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>integer</td><td class=standout>token (token of original file request?)</td></tr>
<tr><td class=standout>integer</td><td class=standout>place (...?)</td></tr>
</table><br>
Server-to-Client
The server sends this to indicate change in place in queue while we're waiting
for files from the other peer.
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>60 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>integer</td><td class=standout>token (token of original file request?)</td></tr>
<tr><td class=standout>integer</td><td class=standout>place</td></tr>
</table><br>
<a name="S62"></a><h3>RoomAdded:62</h3>
Client-to-Server<br>
Unknown if this is valid.<br><br>
Server-to-Client<br>
The server tells us a new room has been added<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>62 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room name</td></tr>
</table><br>
<a name="S63"></a><h3>RoomRemoved:63</h3>
Client-to-Server<br>
Unknown if this is valid.<br><br>
Server-to-Client<br>
The server tells us a room has been removed<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>62 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>room name</td></tr>
</table><br>
<a name="S64"></a><h3>RoomList:64</h3>
Client-to-Server<br>
Request a list of rooms?
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>64 (Message Code)</td></tr>
</table><br>
Server-to-Client<br>
The server tells us a list of rooms.
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>64 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>number of rooms</td></tr>
<tr><td class=standout>string</td><td class=standout>name of room #1</td></tr>
<tr><td class=standout>string</td><td class=standout>name of room #2</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>string</td><td class=standout>name of room #n</td></tr>
<tr><td class=standout>integer</td><td class=standout>user count records</td></tr>
<tr><td class=standout>integer</td><td class=standout>user count in room #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>user count in room #2</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>integer</td><td class=standout>user count in room #n</td></tr>
</table><br>
<a name="S65"></a><h3>ExactFileSearch:65</h3>
Client-to-Server<br>
It is unknown whether this is valid. Normal file search is a symmetric
operation (the Client-to-Server and Server-to-Client messages are exactly
the same and both valid), which would lead one to believe that maybe the
ExactFileSearch works the same way.
<br><br>
Server-to-Client<br>
Someone is searching for a file with an exact name<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>65 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
<tr><td class=standout>string</td><td class=standout>filename</td></tr>
<tr><td class=standout>string</td><td class=standout>folder</td></tr>
<tr><td class=standout>integer</td><td class=standout>size</td></tr>
<tr><td class=standout>integer</td><td class=standout>checksum</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
</table><br>
<a name="S66"></a><h3>AdminMessage:66</h3>
Client-to-Server<br>
unknown if this is valid<br><br>
Server-to-Client<br>
The admin is sending a broadcast message. ("The service is going down
for maintenance in 10 minutes!")<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>66 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>message</td></tr>
</table><br>
<a name="S67"></a><h3>GlobalUserList:67</h3>
Client-to-Server<br>
We send this to get a global list of all users online.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>67 (Message Code)</td></tr>
</table><br>
Server-to-Client<br>
The list of users.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>67 (Message Code)</td></tr>
<tr><td class=standout colspan=2 align=center>See user list format in JoinRoom message</td></tr>
</table><br>
<a name="S68"></a><h3>TunneledMessage:68</h3>
Used to tunnel a message through the server, I would assume...(?)<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>68 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username (to? from? depends on direction?)</td></tr>
<tr><td class=standout>integer</td><td class=standout>code</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
<tr><td class=standout>integer</td><td class=standout>IP address</td></tr>
<tr><td class=standout>integer</td><td class=standout>port</td></tr>
<tr><td class=standout>string</td><td class=standout>message</td></tr>
</table><br>
<a name="S69"></a><h3>PrivilegedUsers:69</h3>
Client-to-Server<br>
Get a list of all users that made a donation<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>69 (Message Code)</td></tr>
</table><br>
Server-to-Client<br>
The returned list of users<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>69 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>number of users</td></tr>
<tr><td class=standout>string</td><td class=standout>username #1</td></tr>
<tr><td class=standout>string</td><td class=standout>username #2</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>string</td><td class=standout>username #n</td></tr>
</table><br>
<a name="S91"></a><h3>AddToPrivileged:91</h3>
TODO, but likely something only an admin can do. We would assume it
takes a username and a duration.
<a name="S92"></a><h3>CheckPrivileges:92</h3>
Client-to-Server<br>
How much privileged time do I have left from my donation?<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>92 (Message Code)</td></tr>
</table><br>
Server-to-Client<br>
You have this many days.
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>69 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>number of days(?)</td></tr>
</table><br>
<a name="S1001"></a><h3>CantConnectToPeer:1001</h3>
Client-to-Server<br>
We send this to say we cannot connect to a peer after it has asked us to connect.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>1001 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
</table><br>
Server-to-Client<br>
The server sends this if we asked a peer to connect and it cannot do it. This means
a connection cannot be established in either direction--both parties are
firewalled.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>1001 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
</table><br>
<br><br>
<h3>Relogged?</h3>
Server sends this if someone else logged in under our nickname then
disconnects us.<br>
<h3>RemoveUser?</h3>
Client-to-Server<br>
Used when we no longer want to be kept updated about a user's status. This
message is defined in the Python code, but not associated with a message
code. Maybe it falls into one of the message code gaps?<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>??? (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>username to stop watching</td></tr>
</table><br>
<h3>CantCreateRoom?</h3>
Server-to-Client<br>
The server sends this to tell us a new room cannot be created?<br>
<!-- =========================================================== -->
<!-- =========================================================== -->
<!-- =========================================================== -->
<a name="peerMessages"></a><h2>Peer Messages</h2>
<b>Jump directly to a peer message:</b>
<a href="#Pinit">PeerInit</a>
<a href="#Pfw">PierceFW</a>
<a href="#P4">GetSharedFileList:4</a>
<a href="#P5">SharedFileList:5</a>
<a href="#P9">FileSearchResult:9</a>
<a href="#P15">UserInfoRequest:15</a>
<a href="#P16">UserInfoReply:16</a>
<a href="#P36">FolderContentsRequest:36</a>
<a href="#P37">FolderContentsResponse:37</a>
<a href="#P40">TransferRequest:40</a>
<a href="#P41">TransferResponse:41</a>
<a href="#P42">PlaceholdUpload:42</a>
<a href="#P43">QueueUpload:43</a>
<a href="#P44">PlaceInQueue:44</a>
<a href="#P46">UploadFailed:46</a>
<a href="#P50">QueueFailed:50</a>
<a href="#P51">PlaceInQueueRequest:51</a>
<br><br>
<a name="Pfw"></a><h3>PierceFW</h3>
This is the very first message send by peer that established a
connection, if it has been asked by other peer to do so. Token is taken
from ConnectToPeer server message.<br>
<a name="Pinit"></a><h3>PeerInit</h3>
This message is sent by peer that initiated a connection, not
necessarily a peer that actually established it. Token apparently
can be anything. Type is 'P' if it's anything but filetransfer, 'F'
otherwise.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout><b>byte</b></td><td class=standout>1 (Message Code) <b>Note that this is a BYTE!</a></td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>string</td><td class=standout>type</td></tr>
<tr><td class=standout>integer</td><td class=standout>??? This seems to always be a constant (300 or 0x0000012c)</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
</table><br>
<a name="P4"></a><h3>GetSharedFileList:4</h3>
Client-to-Peer<br>
The client sends this to a peer to ask for a list of files.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>4 (Message Code)</td></tr>
</table><br>
Peer-to-Client<br>
It is unknown whether this is used.<br>
<a name="P5"></a><h3>SharedFileList:5</h3>
Client-to-Peer<br>
It is unknown whether this is used.<br><br>
Peer-to-Client<br>
A peer responds with this message when sent a GetSharedFileList.
This message can be a little complex, considering it
contains data from three nested loops: directories, which contain files,
which contain attributes. When implementing parsing of this message,
it may be helpful to note that within each directory, the list of
files (each with its own list of sttributes) is in the exact same format
as the list of files returned from FileSearchResult.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>5 (Message Code)</td></tr>
<tr><td class=standout colspan=2 align=center>The following data is zlib compressed:</td></tr>
<tr><td class=standout>integer</td><td class=standout>Number of directories</td></tr>
<tr><td class=standout>string</td><td class=standout>Directory name #1</td></tr>
<tr><td class=standout>integer</td><td class=standout>Number of files in directory #1</td></tr>
<tr><td class=standout>byte?</td><td class=standout>Dir#1, File#1 code(?)</td></tr>
<tr><td class=standout>string</td><td class=standout>Dir#1, File#1 filename</td></tr>
<tr><td class=standout>integer</td><td class=standout>Dir#1, File#1 size1</td></tr>
<tr><td class=standout>integer</td><td class=standout>Dir#1, File#1 size2</td></tr>
<tr><td class=standout>string</td><td class=standout>Dir#1, File#1 ext</td></tr>
<tr><td class=standout>integer</td><td class=standout>Dir#1, File#1 number of attributes</td></tr>
<tr><td class=standout>integer</td><td class=standout>Dir#1, File#1, Attr#1 type</td></tr>
<tr><td class=standout>integer</td><td class=standout>Dir#1, File#1, Attr#1 value</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>integer</td><td class=standout>Dir#1, File#1, Attr#n value</td></tr>
<tr><td colspan=2 align=center>:<br>:<br>:<br>:</td></tr>
<tr><td class=standout>integer</td><td class=standout>Dir#n, File#n, Attr#n value</td></tr>
</table><br>
<a name="P9"></a><h3>FileSearchResult:9</h3>
Client-to-Peer<br>
It is unknown whether this is used.<br><br>
Peer-to-Client<br>
This is sent in response to a file search match. Token is taken from original
FileSearch message. You will note that the file data is similar to that of
SharedFileList, only without the outermost loop (directories). It contains
simply a list of files, each with a list of attributes.
<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>9 (Message Code)</td></tr>
<tr><td class=standout colspan=2 align=center>The following data is zlib compressed:</td></tr>
<tr><td class=standout>string</td><td class=standout>username</td></tr>
<tr><td class=standout>integer</td><td class=standout>token</td></tr>
<tr><td class=standout>integer</td><td class=standout>Number of files</td></tr>
<tr><td class=standout>byte</td><td class=standout>File #1, code</td></tr>
<tr><td class=standout>string</td><td class=standout>File #1, filename</td></tr>
<tr><td class=standout>integer</td><td class=standout>File #1, size1</td></tr>
<tr><td class=standout>integer</td><td class=standout>File #1, size2</td></tr>
<tr><td class=standout>string</td><td class=standout>File #1, ext</td></tr>
<tr><td class=standout>integer</td><td class=standout>File #1, number of attributes</td></tr>
<tr><td class=standout>integer</td><td class=standout>File #1, Attr #1 type</td></tr>
<tr><td class=standout>integer</td><td class=standout>File #1, Attr #1 value</td></tr>
<tr><td colspan=2 align=center>:<br>:</td></tr>
<tr><td class=standout>integer</td><td class=standout>File #n, Attr #n value</td></tr>
<tr><td class=standout>byte</td><td class=standout>Free upload slots</td></tr>
<tr><td class=standout>integer</td><td class=standout>Upload speed</td></tr>
<tr><td class=standout>integer</td><td class=standout>In Queue</td></tr>
</table><br>
<a name="P15"></a><h3>UserInfoRequest:15</h3>
Client-to-Peer<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>15 (Message Code)</td></tr>
</table><br>
Peer-to-Client<br>
It is unknown whether this is used.<br><br>
<a name="P16"></a><h3>UserInfoReply:16</h3>
Client-to-Peer<br>
It is unknown whether this is used.<br><br>
Peer-to-Client<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>16 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>User's description</td></tr>
<tr><td class=standout>byte</td><td class=standout>Does this user have a pic?</td></tr>
<tr><td class=standout>string</td><td class=standout>This data element is only present if the previous byte is true. This string contains the user pic file content</td></tr>
<tr><td class=standout>integer</td><td class=standout>User uploads</td></tr>
<tr><td class=standout>integer</td><td class=standout>Total uploads</td></tr>
<tr><td class=standout>integer</td><td class=standout>Queue size</td></tr>
<tr><td class=standout>integer</td><td class=standout>Slots available</td></tr>
</table><br>
<a name="P36"></a><h3>FolderContentsRequest:36</h3>
<a name="P37"></a><h3>FolderContentsResponse:37</h3>
<a name="P40"></a><h3>TransferRequest:40</h3>
Client-to-Peer<br>
Ask a peer for a file. See the sequences section at the bottom of this
document. Token is [new, unique token? taken from another message?].<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>40 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>Direction constant, <a href="#constants">see above</a></td></tr>
<tr><td class=standout>integer</td><td class=standout>Token</a></td></tr>
<tr><td class=standout>string</td><td class=standout>filename</a></td></tr>
<tr><td class=standout>integer</td><td class=standout>This data field is only present if direction==1. File size.</a></td></tr>
</table><br>
Peer-to-Client<br>
Tell a peer we are about to send them a file. (Used when piercing a
firewall?) The message format is exactly the same as the client-to-peer
version.<br><br>
<a name="P41"></a><h3>TransferResponse:41</h3>
Client-to-Peer or Peer-to-Client<br>
This is the proper response to a TransferRequest message. "Yes, I agree to
take the file" or "no, I do not agree to take the file." Token is taken
from TransferRequest message.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>41 (Message Code)</td></tr>
<tr><td class=standout>integer</td><td class=standout>Token</td></tr>
<tr><td class=standout>byte</td><td class=standout>Allowed?</td></tr>
<tr><td colspan=2 align=center>If Allowed is true:</td></tr>
<tr><td class=standout>integer</td><td class=standout>Optionally, the file size</td></tr>
<tr><td colspan=2 align=center>If Allowed is false:</td></tr>
<tr><td class=standout>string</td><td class=standout>Optionally, a message explaining why the request was denied</td></tr>
</table><br>
<a name="P42"></a><h3>PlaceholdUpload:42</h3>
Not sure yet.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>42 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>Filename</td></tr>
</table><br>
<a name="P43"></a><h3>QueueUpload:43</h3>
Not sure yet.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>43 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>Filename</td></tr>
</table><br>
<a name="P44"></a><h3>PlaceInQueue:44</h3>
Client-to-Peer<br>
It is unknown whether this is used.<br><br>
Peer-to-Client<br>
You are in queue position x for file y. This is the response to a
PlaceInQueueRequest.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>44 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>filename</td></tr>
<tr><td class=standout>integer</td><td class=standout>place</td></tr>
</table><br>
<a name="P46"></a><h3>UploadFailed:46</h3>
Not sure yet.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>46 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>Filename</td></tr>
</table><br>
<a name="P50"></a><h3>QueueFailed:50</h3>
Not sure yet.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>50 (Message Code)</td></tr>
<tr><td class=standout>string</td><td class=standout>Filename</td></tr>
<tr><td class=standout>string</td><td class=standout>Reason</td></tr>
</table><br>
<a name="P51"></a><h3>PlaceInQueueRequest:51</h3>
Client-to-Peer<br>
What place in your queue am I? The response is a PlaceInQueue message.<br>
<table border=0 cellspacing=2 cellpadding=2>
<tr><td class=standout>integer</td><td class=standout>51 (Message Code)</td></tr>
</table><br>
Peer-to-Client<br>
It is unknown whether this is used.<br><br>
<a name="messageSequences"></a><h2>Message Sequences</h2>
<p>
This section will attempt to describe the message sequences for
common operations.
</p>
<h3>Login</h3>
User logs in successfully, gets server greeting, gets privileged
user list, gets chat room list, starts monitoring buddies
<ul>
<li>client sends Login message</li>
<li>client sends SetWaitPort message</li>
<li>server sends Login response message</li>
<li>server automatically sends a RoomList response</li>
<li>server automatically sends a PrivilegedUsers response</li>
<li>client sends SharedFoldersFiles message</li>
<li>client sends AddUser message for each buddy in buddy list</li>
<li>server sends AddUser response for each buddy in the buddy list</li>
</ul>
<h3>Search</h3>
TODO: User performs a search
<h3>Chat</h3>
TODO: User enters a room, listens, speaks, then exits room
<h3>Obtaining Peer Address, basic</h3>
This sequence will grab a peer's address (ip+port), given the username, in the most simple manner.
<ul>
<li>Client sends GetPeerAddress message</li>
<li>Server sends GetPeerAddress response</li>
</ul>
<h3>Obtaining Peer Address, advanced</h3>
This sequence will start monitoring a user (as if that user were on your buddy
list), and use that information to not only obtain the address, but get
notified if the user goes offline.</b> This is the method that the Python
SoulSeek client uses.
<ul>
<li>client sends GetUserStatus message to server</li>
<li>server responds with GetUserStatus message with status</li>
<li>client sends AddUser message to server</li>
<li>server responds with AddUser message</li>
<li>server sends unsolicited GetPeerAddress message</li>
</ul>
<h2> </h2>
<table border=1 cellspacing=0 cellpadding=7>
<tr><td>
<b>Note:</b> The following File Transfer scenarios cover every combination and permutation of
the three states (client FW, peer FW, queue). They all assume the peer address has
been obtained by one of the above methods.
</td></tr></table>
<h3>File Transfer, basic</h3>
Client may or may not be firewalled, peer is not firewalled, peer has no wait queue<br>
<ul>
<li>client opens a "P" type socket to the peer. This need not be a NEW
socket. If a "P" type connection to the peer has already been established (for
instance, because the peer has sent you a search result), it can be
reused.</li>
<li>client sends PeerInit "P" message immediately followed by TransferRequest message</li>
<li>peer optionally sends back 12 bytes (the 5th is zero or one)<br>
(Note from Brian: I am a little bit worried about the random 12 bytes that
sometimes get sent before a TransferResponse message. The first four bytes
are obviously not a message length. Like I said in the comments, the
Python code (slskproto.py:SlskProtoThread..process_peer_input()) has some
wacky if-elseif-else logic in there that gets called only if it is a non
"F" peer connection and it is the first message received.)</li>
<li>peer sends back TransferResponse message</li>
<li>client opens second socket to peer</li>
<li>client sends PeerInit "F" message to peer</li>
<li>peer sends file</li>
<li>client closes second socket to peer</li>
</ul>
<h3>File Transfer, firewall</h3>
TODO: Client is not firewalled, peer is firewalled, peer has no wait queue
<h3>File Transfer, two firewalls</h3>
Client is firewalled, peer is firewalled, wait queue does not matter<br>
<ul><li>A peer-to-peer connection in this situation is impossible</li></ul>
<h3>File Transfer, queue 1</h3>
TODO: Client is not firewalled, peer is not firewalled, peer has wait queue
<h3>File Transfer, queue 2</h3>
TODO: Client is not firewalled, peer is firewalled, peer has wait queue
<h3>File Transfer, queue 3</h3>
TODO: Client is firewalled, peer is not firewalled, peer has no wait queue
<hr size=2 noshade>
End of Document
</body>
|