OurMx OpenNap Protocol Specification



"OpenNap" is the collective name for both a Server application, a P2P network and a network protocol, we are interested in the protocol here but its important to note that the network architectural model used is the classic centralised model and thus all traffic goes via the Server except for file transfers, these are undertaken strictly client to client with the Server acting as a transfers manager.




Below you will find a modified form of the Open Napster Specification that was reverse engineered back in 2000-2001, I have made some changes in its layout and formatting to suit the WPN developers who might find the specification a bit of a challenge at first sight.


Foreward


This is meant to be an open specification. It benefits the entire community to have a complete and accurate protocol specification.  Not only does it allow for clients to be developed for multiple platforms, but also decreases the strain on the Server having to parse out bad Client messages.

The original protocol information was created by "Dr Scholl" and others analyzing the traffic between network Clients and the Napster Server, however over time further packet types have been created for usage by OpenNap/SlavaNap supporting Clients and these are shown below.


Client-Server Protocol


OpenNap uses TCP for Client to Server communication.  Typically the Servers run on ports 8888 and 7777.
Note that this is different from the `metaserver'(or redirector) which runs on port 8875.


Each message packet to/from the Server takes the following form :

<Packet Length><Packet Type><data>




  <Packet Length> and <Packet Type> are 2 bytes each.

   
  <Packet Length> specifies the length in bytes of the <data> portion of the message.

       Be aware that <Packet Length> and <Packet Type> are in little-endian format (least significant byte goes first).

       For example, in the C language you would encode the number 1 as

             const unsigned char num[2] = { 0x01, 0x00 };

       and 256 would be encoded as

             const unsigned char num[2] = { 0x00, 0x01 };

       This field specifies exactly how much data you should read into the buffer.
       Measures should be employed to reject packets exceeding the length specified as these can cause unwanted buffer overflows.

  <Packet Type> This is the packet type number, the format of the fields of <data> will be different depending on its value
     Most packet types have specific roles within a protocol and if similar operations are grouped together can be helpful.  

 <data> This portion of the packet consists of individual fields of data.

      The format of the varying fields of data are specific to each packet type and each field is separated by a single space character (ASCII 32 or 0x20 hex), each field is shown enclosed by < > brackets.

 

Packet Type Index


Where possible, visual diagrams and examples of the <data> section for each packet are given on the relevant packet page.
Click on the packet number below for a detailed protocol level view.


     [ Packet Type      0 ] - 0x00 - Server to Client - Logout/Error Message From Server
     [ Packet Type      2 ] - 0x02 - Client to Server - Registered Login Request
     [ Packet Type      3 ] - 0x03 - Server to Client - Login Acknowledge
     [ Packet Type      4 ] - 0x04 - Client or Server - Version Number Request
     [ Packet Type      6 ] - 0x06 - Client to Server - New User Register/Login Request
     [ Packet Type      7 ] - 0x07 - Client to Server - UserName Free Query
     [ Packet Type      8 ] - 0x08 - Server to Client - Username Not Registered Notification
     [ Packet Type      9 ] - 0x09 - Server to Client - UserName Already In Usage Notification
     [ Packet Type     10 ] - 0x0A - Server to Client - UserName Invalid Notification
     [ Packet Type     11 ] - 0x0B - Client to Server - Password Check Query
     [ Packet Type     12 ] - 0x0C - Server to Client - Password Ok Notification
     [ Packet Type   100 ] - 0x64 - Client to Server - Add A File To Shared File Index
     [ Packet Type   102 ] - 0x66 - Client to Server - Unshare A Single File From The Shared File Index
     [ Packet Type   110 ] - 0x6E - Client or Server - Unshare All Files From The Shared File Index

     [ Packet Type   200 ] - 0xC8 - Client to Server - Search Query Request
     [ Packet Type   201 ] - 0xC9 - Server to Client - Search Query Results
     [ Packet Type   202 ] - 0xCA - Server to Client - Search Query Results End Notification
     [ Packet Type   203 ] - 0xCB - Client to Server - Download Request
     [ Packet Type   204 ] - 0xCC - Server to Client - Download Ackknowledge Notification
     [ Packet Type   205 ] - 0xCD - Client or Server - Private Message
     [ Packet Type   206 ] - 0xCE - Server to Client - Download Error Notification
     [ Packet Type   207 ] - 0xCF - Client to Server - Add An Additional Entry To Hotlist - Post Login
     [ Packet Type   208 ] - 0xD0 - Client to Server - Initial Add Entry To Hotlist - At Login
     [ Packet Type   209 ] - 0xD1 - Server to Client - Hotlisted User Signed In Notification
     [ Packet Type   210 ] - 0xD2 - Server to Client - Hotlisted User Signed Out Notification
     [ Packet Type   211 ] - 0xD3 - Client to Server - Browse A Specified User
     [ Packet Type   212 ] - 0xD4 - Server to Client - Browse Query Results
     [ Packet Type   213 ] - 0xD5 - Server to Client - Browse Query Results End Notification
     [ Packet Type   214 ] - 0xD6 - Client or Server - Statistics Update Request
     [ Packet Type   215 ] - 0xD7 - Client to Server - Resume Search Request - Checksum Match Search
     [ Packet Type   216 ] - 0xD8 - Server to Client - Resume Search Results
     [ Packet Type   217 ] - 0xD9 - Server to Client - Resume Search Results End Notification
     [ Packet Type   218 ] - 0xDA - Client to Server - Download Started Notification
     [ Packet Type   219 ] - 0xDB - Client to Server - Download Completed Notification
     [ Packet Type   220 ] - 0xDC - Client to Server - Upload Started Notification
     [ Packet Type   221 ] - 0xDD - Client to Server - Upload Complete Notification

     [ Packet Type   301 ] - 0x12D - Server to Client - Hotlist Acknowledge Notification
     [ Packet Type   302 ] - 0x12E - Server to Client - Hotlist Error
     [ Packet Type   303 ] - 0x12F - Client to Server - Remove Specified Client From Hotlist
     [ Packet Type   316 ] - 0x13C - Client or Server - Disconnection Notification
     [ Packet Type   320 ] - 0x140 - Client or Server - Ignore List Request
     [ Packet Type   321 ] - 0x141 - Server to Client - User Ignore List Result
     [ Packet Type   322 ] - 0x142 - Client or Server - Ignore Specified User
     [ Packet Type   323 ] - 0x143 - Client or Server - Unignore Specified User
     [ Packet Type   324 ] - 0x144 - Server to Client - User Is Not On Ignored List Notification
     [ Packet Type   325 ] - 0x145 - Server to Client - User Already On Ignored List Notification
     [ Packet Type   326 ] - 0x146 - Client or Server - Clear Ignored List
     [ Packet Type   330 ] - 0x14A - Client to Server - Banned IP List Request
     [ Packet Type   331 ] - 0x14B - Server to Client - Banned IP Result
     [ Packet Type   332 ] - 0x14C - Client to Server - Ban Specified IP
     [ Packet Type   333 ] - 0x14D - Client to Server - Unban Specified IP

     [ Packet Type   400 ] - 0x190 - Client to Server - Join Specified Chat Channel
     [ Packet Type   401 ] - 0x191 - Client or Server - Part Specified Chat Channel
     [ Packet Type   402 ] - 0x192 - Client to Server - Client Public Message To Chat Channel
     [ Packet Type   403 ] - 0x193 - Server to Client - Server Public Message To Chat Channel
     [ Packet Type   404 ] - 0x194 - Server to Client - Error Message Notification
     [ Packet Type   405 ] - 0x195 - Server to Client - Chat Channel Join Acknowledge Notification
     [ Packet Type   406 ] - 0x196 - Server to Client - Chat Channel Joined Notification
     [ Packet Type   407 ] - 0x197 - Server to Client - Left Chat Channel Notification
     [ Packet Type   408 ] - 0x198 - Server to Client - Chat Channel User List Notification
     [ Packet Type   409 ] - 0x199 - Server to Client - Chat Channel User List End Notification
     [ Packet Type   410 ] - 0x19A - Client or Server - Change Topic
     [ Packet Type   420 ] - 0x1A4 - Client or Server - Chat Channel Ban List Request
     [ Packet Type   421 ] - 0x1A5 - Server to Client - Chat Channel Ban List Result
     [ Packet Type   422 ] - 0x1A6 - Client to Server - Ban Specified User From Chat Channel
     [ Packet Type   423 ] - 0x1A7 - Client to Server - Unban Specified User From Chat Channel
     [ Packet Type   424 ] - 0x1A8 - Client to Server - Clear All Chat Channel Bans
     [ Packet Type   430 ] - 0x1AE - Client or Server - Invite Specified User To Chat Channel
     [ Packet Type   431 ] - 0x1AF - Client to Server - Invitation Accepted Notification
     [ Packet Type   432 ] - 0x1B0 - Client to Server - Invitation Declined Notification

     [ Packet Type   500 ] - 0x1F4 - Client to Server - Firewalled Download Request
     [ Packet Type   501 ] - 0x1F5 - Server to Client - Firewalled Download Acknowledged Notification

     [ Packet Type   600 ] - 0x258 - Client to Server - Link Speed Request
     [ Packet Type   601 ] - 0x259 - Server to Client - Link Speed Request Response
     [ Packet Type   603 ] - 0x25B - Client to Server - Whois Request
     [ Packet Type   604 ] - 0x25C - Server to Client - Whois Request Response
     [ Packet Type   605 ] - 0x25D - Server to Client - Who Was Response
     [ Packet Type   606 ] - 0x25E - Client to Server - Change Specified User's Level
     [ Packet Type   607 ] - 0x25F - Server to Client - Upload Request Notification
     [ Packet Type   608 ] - 0x260 - Client to Server -  Upload Request Accepted Notification
     [ Packet Type   609 ] - 0x261 - Client or Server - Accept Failed
     [ Packet Type   610 ] - 0x262 - Client to Server - Request To Disconnect A Specified User
     [ Packet Type   611 ] - 0x263 - Client to Server - Request To Nuke A Specified User's Account
     [ Packet Type   612 ] - 0x264 - Client to Server - Ban A User From The Server
     [ Packet Type   613 ] - 0x265 - Client or Server - Dataport Change Request
     [ Packet Type   614 ] - 0x266 - Client to Server - Unban A User From The Server
     [ Packet Type   615 ] - 0x267 - Client to Server - Request Server Ban List
     [ Packet Type   616 ] - 0x268 - Server to Client - Server Ban List Response
     [ Packet Type   617 ] - 0x269 - Client or Server - Channel List Request
     [ Packet Type   618 ] - 0x26A - Server to Client - Channel List Request Response
     [ Packet Type   619 ] - 0x26B - Client to Server - Download Denied: Local Upload Limit Reached
     [ Packet Type   620 ] - 0x26C - Server to Client - Downloader Notification - Remote Uploader Has Reached Limit
     [ Packet Type   621 ] - 0x26D - Client or Server - Server MOTD Request
     [ Packet Type   622 ] - 0x26E - Client to Server - Muzzle A User
     [ Packet Type   623 ] - 0x26F - Client to Server - Unmuzzle User
     [ Packet Type   625 ] - 0x271 - Client to Server - Set User Linespeed
     [ Packet Type   626 ] - 0x272 - Client or Server - Data Port Error
     [ Packet Type   627 ] - 0x273 - Client or Server - Message To All Mods
     [ Packet Type   628 ] - 0x274 - Client or Server - Message To All Users
     [ Packet Type   640 ] - 0x280 - Client or Server - Direct Browse Request
     [ Packet Type   641 ] - 0x281 - Client or Server - Direct Browse Accept
     [ Packet Type   642 ] - 0x282 - Server to Client - Direct Browse Error
     [ Packet Type   652 ] - 0x28C - Client to Server - Cloak User

     [ Packet Type   700 ] - 0x2BC - Client to Server - Linespeed Change Notification
     [ Packet Type   701 ] - 0x2BD - Client to Server - Password Change Notification
     [ Packet Type   702 ] - 0x2BE - Client to Server - Change Email Address Notification
     [ Packet Type   703 ] - 0x2BF - Client to Server - Data Port Change Notification - File Transfers Port
     [ Packet Type   748 ] - 0x2EC - Server to Client - Same Name Login Attempt Notification
     [ Packet Type   750 ] - 0x2EE - Client or Server - Server Ping
     [ Packet Type   751 ] - 0x2EF - Client or Server - Ping Specified User Request
     [ Packet Type   752 ] - 0x2F0 - Client or Server - Pong Response
     [ Packet Type   753 ] - 0x2F1 - Client to Server - Specified User Password Change - Admin Forced Change

     [ Packet Type   800 ] - 0x320 - Client to Server - Reload Server config
     [ Packet Type   801 ] - 0x321 - Client to Server - Server Version Request
     [ Packet Type   810 ] - 0x32A - Client to Server - Set Server Item Config
     [ Packet Type   820 ] - 0x334 - Client to Server - Clear All users From A Channel
     [ Packet Type   821 ] - 0x335 - Client or Server - Redirect Client To Specified Server
     [ Packet Type   822 ] - 0x336 - Client or Server - Cycle Client
     [ Packet Type   823 ] - 0x337 - Client to Server - Change Channel's Minimum User Level
     [ Packet Type   824 ] - 0x338 - Client or Server - Emote/ Action Message (/me)
     [ Packet Type   825 ] - 0x339 - Server to Client - Channel User List Request Response
     [ Packet Type   826 ] - 0x33A - Client to Server - Set Channel User Limit
     [ Packet Type   827 ] - 0x33B - Client or Server - Get Full Channel List Request
     [ Packet Type   828 ] - 0x33C - Server to Client - Channel List Request Response
     [ Packet Type   829 ] - 0x33D - Client to Server - Kick User From A Channel
     [ Packet Type   830 ] - 0x33E - Client or Server - Channel User List
     [ Packet Type   831 ] - 0x33F - Client or Server - Global User List Request
     [ Packet Type   832 ] - 0x340 - Server to Client - Global User List Request Response
     [ Packet Type   870 ] - 0x366 - Client to Server - Add File(s) To Shared Index

     [ Packet Type   920 ] - 0x398 - Client to Server - Socket Test
     [ Packet Type   931 ] - 0x3A3 - Server to Client - File Blocked Notification


      OpenNap/SlavaNap Specific Packets

     [ Packet Type 10112 ] - 0x2780 - Client or Server - Display Server Links Data
     [ Packet Type 10115 ] - 0x2783 - Client or Server - Display Server Statistics Data
     [ Packet Type 10118 ] - 0x2786 - Client or Server - Display Client Information Statistics Request
     [ Packet Type 10121 ] - 0x2789 - Client to Server - Who Was Request - Info On Recently Logged Out User
     [ Packet Type 10200 ] - 0x27D8 - Client to Server - Register New User - Force Registration Admin Command
     [ Packet Type 10204 ] - 0x27DC - Client to Server - Set Channel Operator - Create Admin
     [ Packet Type 10205 ] - 0x27DD - Client to Server - Remove Channel Operator - Remove Admin
     [ Packet Type 10206 ] - 0x27DE - Client to Server - Channel Operators List Request
     [ Packet Type 10207 ] - 0x27DF - Client to Server - Drop Channel
     [ Packet Type 10209 ] - 0x27E1 - Client or Server - Change Channel Mode
     [ Packet Type 10211 ] - 0x27E3 - Client to Server - Give Voice To Specified User In A Moderated Channel
     [ Packet Type 10212 ] - 0x27E4 - Client to Server - Remove Voice From Specified User In A Moderated Channel
     [ Packet Type 10213 ] - 0x27E5 - Client to Server - Muzzle A User In A Specified Channel
     [ Packet Type 10214 ] - 0x27E6 - Client to Server - Un-Muzzle A User In A Specified Channel
     [ Packet Type 10300 ] - 0x283C - Client to Server - Add Mime-Type File To Share Index    


Client To Client Transfers


File transfers occur directly between network Clients, no files pass through the Server, instead the file names themselves are indexed and its this "Shared Library" index data that is delivered to requesting Clients if a match is found with their query string.
To begin the routine the downloading Client will first issue either a search <200> or browse <211> packet to the Server.
This returns a list of files and information on the Client sharing the required file.
There are four transfer modes, Upload, Download, Firewalled Upload, Firewalled Download.

The normal method of transfer is that the Client wishing to download a file makes a TCP connection to the Client holding the file on their data port.  However, in the case where the client sharing the file is behind a firewall, it is necessary for them to "push" the data by making a TCP connection to the downloader's data port.

See "The Opennap Filesharing Reference" for an explanation and a visual representation of the system used to manage the transfers by the central Server.


Client Browsing


See "The Opennap Browse System", for details on the "Browse" function, the simple system in usage is shown.


Client To Client Direct Browsing


See "The Opennap Direct Browse System", for details on this alternative "Browse" function.


Logging In To An OpenNap Server


When you log into an OpenNap Server you will need to undertake a few housekeeping operations such as registering your desired username, adding your file names to the global library and some other important operations, lets look at them here in a visual format:
See "OpenNap UserName Registration" for information on registering A username and "Slavanap Login" for information on logging into a Server.



MD5 Hashing


MP3 files are hashed using the first 300,032 bytes of the file.
WMA files are not hashed and Napster sends "WMA-FILE" instead of MD5 for .wma

The current method seems to be: skip id3v2, seek to frame sync and hash.

Note: the linux nap Client (versions 0.7 - 0.9) hash exactly 300,000 bytes, which is NOT what the official windows client does.

Correct format for MD5 is something like "58dc354f81bf37b050799ead7ca8d3bc-5333975"
where "58dc354f81bf37b050799ead7ca8d3bc" is MD5 hash and "5333975" is file length - length of ID3 tags (v1 and v2).

Some clients ignore MD5 or send incorrect values.
For example, WinMX sends MD5 without file size and FileNavigator sends "AAAAAA" (32 "A" characters) instead of MD5.
OpenNap and SlavaNap ignore md5 and do not support it by default unless recompiled using special options.


WSX File Format Information


A rough reference on WSX file formatting can be found here.


Existing Src Code Implementations


Further developer information can be obtained from reviewing known open src code examples and I have compiled a small list here, I,m sure there are more examples to be located so please drop me a line if you find further material.


References And Credits


The information in this guide was collated and compiled from the following sources

Reference 1 , Reference 2 , Reference 3 .


My thanks to the relevant contributors for sharing their hard work so others can continue the legacy, cheers to you all.

©2005-2024 WinMXWorld.com. All rights reserved. Page last updated Wed Sep 07 2016