Museek Daemon - Protocol draft
Generic message format:
    uint message_len  -- Length of the message (including the message code)
    uint message_code -- Message code
    Message specific data
   
Data types, primitive:
    bool   -- 8bit character (0 == false, not 0 == true)
    uint   -- 32bit unsigned little endian ordered integer
    off_t  -- 64bit signed little endian ordered integer
    string -- the length of the string (as an uint) + character data
              (all strings are UTF8)
   
Data types, complex:
     userdata           -- statistics about a user
       uint status      -- user's status
       uint avgspeed    -- user's average upload speed
       uint downloadnum -- (unknown)
       uint files       -- number of files a user has shared
       uint dirs        -- number of dirs a user has shared
       bool slotsfull   -- wether or not the user has an upload slot available
     
     
     transfer           -- information about a transfer
       bool is_upload   -- Is this an upload or a download?
       string user      -- The user associated with this transfer
       string path      -- The original path to the transfer
       uint place       -- Place in queue or (uint)-1 if unknown (only valid for downloads)
       uint state       -- The transfer's state
                           00: Finished
                           01: Transferring
                           02: Negotiating
                           03: Waiting
                           04: Establishing
                           05: Initiating
                           06: Connecting
                           07: Queued
                           08: Getting address
                           09: Getting status
                           10: Awaiting user
                           11: Connection closed
                           12: Cannot connect
                           13: Aborted
                           14: Error
       string error     -- If the transfer's in error state, this contains the error
       off_t position   -- How far has the transfer proceded
       off_t size       -- Total size of this transfer
       uint rate        -- How fast the transfer is proceding
       
       
     fileentry          -- information about a shared file
       off_t filesize   -- the file's size
       string ext       -- the file's extended attribute format
                           (only 'mp3' or an empty string are supported)
       uint numattrs    -- number of extended attributes
       *repeat numattrs*
         uint attr      -- an attribute
      
       The 'mp3' extended attribute format holds 3 attributes:
         uint bitrate   -- the bitrate of the file
         uint length    -- duration of the file in seconds
         uint vbr       -- wether the mp3 has a variable bitrate or not
    
     
     folder             -- information about a shared folder
       uint numfiles    -- how many files the folder contains
       *repeat numfiles*
         string file    -- the filename or full path (depends on context)
         fileentry info -- the file's information
    
     
     shares             -- information about a user's shares
       uint numfolders  -- how many folders there are
       *repeat numfolders*
         string folder  -- the folder's path
         folder files   -- the files contained in this folder (filenames are relative)
     
     
     cipher             -- AES (aka Rijndael) encrypted string
       Configuration strings are sent over the communication layer encrypted 
       as they may contain sensitive information. The keyphrase of the AES cipher
       equals the password used to log in. This complex data type start with the
       length of the unencrypted string (n), followed by the encrypted string
       data. Crucial note: The amount of encrypted characters sent is n rounded
       up to the nearest 16 byte block size. For exmaple: if the original string
       was 6 characters long, n will be 6 but is following by 16 characters of data.

   
Message types:

(Red blocks indicate general information about the message: the message code, the message's name, and a short description. Green blocks specify the message-specific data sent by the interface to the Museek daemon. Blue blocks specify the message-specific data sent by the Museek daemon to the interface.)
0x0000 Ping Ask the daemon to respond
uint idUnique identifier
uint idUnique identifier (same as what was sent)
0x0001 Challenge Daemon sends this authentication challenge when connected
*not sent*
uint versionDaemon interface protocol revision
string challengeThe challenge. Stick interface password at the end of this and generate a hash
0x0002 Login Request a login to the daemon
string algorithmDigest algorithm, one of the following:
SHA1SHA-1 algorithm
SHA256SHA256 algorithm
MD5MD5 algorithm
string chresponseChallenge response (hex string version of challenge digest)
uint maskInterface interest mask, bitwise OR-ed value of:
0x01Receive chat related messages
0x02Receive private messages
0x04Receive transfer messages
0x08Receive user info message
0x10Receive user shares messages
0x20Receive interest and recommendation messages
0x40Receive config messages
bool okWether login was successful
string messageIn case of failure, what was the error:
INVHASHInvalid digest algorithm
INVPASSInvalid password
string challengeNew challenge, in case the interface wishes to try again
0x0003 Server state Network connection status
*not sent*
bool connectedWether the daemon is connected to the soulseek network
string usernameIf connected, this contains the username
0x0004 Check privileges Check how many seconds of privileges you have left
*empty*
uint secondsThe number of seconds of privileges you have
0x0005 Set status Set away status
uint statusSet away status (0 == online, 1 == away)
uint statusAway status set (0 == online, 1 == away)
0x0010 Status Message Forward messages to the clients
*not sent*
bool messagetypeMessage type ( 0 == Server, 1 == Peer )
string messageIf connected, this contains the message
0x0100 Configuration state Contents of the configuration database
*not sent*
uint ndomainsnumber of domains registered
*repeat ndomains*
cipher domaindomain name
uint nkeysnumber of keys registered in this domain
*repeat nkeys*
cipher keyname of this key
cipher valueciphered value of this key
0x0101 Config set Make a change to the configuration database
cipher domainDomain to make a change in
cipher keyKey to change
cipher valueValue to change it to
cipher domainThe domain a change took place in
cipher keyThe key that was changed
cipher valueThe new value
0x0102 Config remove Remove a key from the configuration database
cipher domainDomain to remove a key from
cipher keyKey to remove
cipher domainDomain that a key was removed from
cipher keyName of the key that was removed
0x103 Set user image Set the image that gets sent with the user info
string imageThe image data
*not sent*
0x0201 Peer exists Check if a certain username is valid
string usernameName of the user to check
string usernameUsername that was checked
bool existsWether the username is valid or not
0x0202 Peer status Get a user's status
string usernameName of the user to get the status of
string usernameName of the user that changed status
uint statusUser's current status, one of the following:
0x00Offline
0x01Away
0x02Online
0x0203 Peer statistics Get a users's statistics
string usernameName of the user to get the stats of
string usernameName of the user daemon is reporting statistics for
uint avgspeedUser's average speed
uint numdownloadsUser's total download count (?)
uint numfilesUser's file-count
uint numdirsUser's directory-count
0x0206 Peer address Get a user's IP address and port
string usernameUser to get the IP of
string usernameUser we got the IP of
string IPUser's IP address
uint portUser's client port number
0x0204 User info Get a user's user-info
string usernameUser to get the userinfo of
string usernameUser we got userinfo of
string infoUser's self-description
string pictureUser's picture
uint uploadsUser's total upload count
uint queuelenUser's queue length
bool slotfreeWether user has a free upload slot
0x0205 User shares Get a user's shares
string usernameUser to get the shares of
string usernameUser the daemon got the shares of
shares sharesThe shares
0x0207 Give privileges Donate (part) of your privileges to another user
string usernameUsername of the person to donate privileges to
uint daysHow many days of privileges to donate
*not sent*
0x0300 Room state List of rooms and joined rooms and their users
*not sent*
uint numroomsNumber of rooms in the room list
*repeat numrooms*
string roomnameName of the room
uint numusersNumber of users in this room
uint numjoinedNumber of rooms we've joined
*repeat numjoined*
string roomnameName of the room
uint numusersNumber of users in this room
*repeat numusers*
string usernameName of the user
userdata dataUser's statistics
uint numtickersNumber of tickers set for this room
*repeat numtickers*
string usernameName of the ticker owner
string messageContents of the ticker
0x0301 Room list refresh room list
*empty*
uint numroomsNumber of rooms in the room list
*repeat numroos*
string roomnameName of the room
uint numusersNumber of users in this room
0x0302 Private message Send / receive a private message
string usernameThe user to send a message to
string messageThe actual message
uint directionDirection (0 = incoming, 1 = outgoing)
uint timestampTimestamp of when the message was received (server's timezone)
string usernameThe user that sent the message
string messageThe actual message
0x0303 Join room Join(ed) a room
string roomThe name of the room to join
string roomThe name of the room we joined
uint numusersNumber of users in this room
*repeat numusers*
string usernameName of the user
userdata dataUser's statistics
0x0304 Leave room Leave / left a room
string roomName of the room to leave
string roomName of the room we left
0x0305 User joined room A user joined a room
*not sent*
string roomRoom the user joined
string usernameUser that joined
userdata dataUser's statistics
0x0306 User left room A user left a room
*not sent*
string roomRoom the user left
string usernameUser that left
0x0307 Say in room Say something in a chatroom
string roomThe name of the room to say someting in
string lineWhat you want to say
string roomThe name of the room someone said something in
string userUser that said something
string lineWhat the user said
0x0308 Room tickers List of tickers set for a room
*not sent*
string roomWhich room the tickers are reported for
uint numtickersHow many tickers are set
*repeat numtickers*
string userThe user that this ticker belongs to
string messageThe actual ticker message
0x0309 Set room ticker Set your room ticker / a room ticker was set
string roomThe room to set the ticker in
string messageThe actual ticker message
string roomThe room a ticker was set in
string userThe user that set the ticker
string messageThe actual ticker message
0x0401 Search Start a new search
uint typeSearch type (0 = global, 1 = buddies, 2 = room)
string queryWhat you want to search for
string queryThe query we're delivering a ticket for
uint ticketThe search ticket
0x0402 Search reply Terminate a search, or results delivered by peers
uint ticketThe ticket of the search you wish to terminate
uint ticketTicket the search results are for
string usernameUser that delivered the results
bool slotfreeWether the user has a free upload slot
uint avgspeedUser's average speed
uint queuelenUser's queue length
folder resultsThe actual results
0x0403 User Search Start a new search of only users shares
string userWho's shares you wish to search
string queryWhat you want to search for
*not sent*
0x0405 WishList Search Start a new wishlist search
string queryWhat you want to search for
*not sent*
0x0500 Transfer state Actual state of all transfers
*not sent*
uint numtransfersNumber of transfers
*repeat numtransfers*
transfer entryThe transfer entry
0x0501 Transfer update Status update of a transfer
string usernameUser to update a transfer of
string pathPath of the transfer to update (place in queue)
transfer entryThe new state of the transfer
0x0502 Transfer remove Remove a transfer from the list
bool uploadRemove upload? (if false, remove download)
string usernameUser to clear a transfer from
string pathPath of the transfer to clear
bool uploadWas an upload removed? (if false, download was removed)
string usernameUser a transfer was removed from
string pathPath of the transfer that was removed
0x0503 Download file Download a file from someone (or retry an existing transfer)
string usernameUsername to download a file from
string pathPath of the file to download
string localpathPath to store the file name
off_t sizeFile's size (can be 0)
*not sent*
0x0507 Download file to Download a file to a directory
string usernameUsername to download a file from
string pathPath of the file to download
string localpathPath to store the file name
off_t sizeFile's size (can be 0)
*not sent*
0x0504 Download folder Download a folder recursively
string usernameUser to download a folder from
string folderPath to the folder to download
*not sent*
0x0505 Abort transfer Terminate a transfer
bool uploadAbort an upload? (if false, abort download)
string usernameUser to abort the transfer from
string pathPath of the transfer to abort
*not sent*
0x0506 Upload file Upload a file from your shares to someone
string usernameUsername to upload a file to
string pathPath of the file in your shares to upload
*not sent*
0x0600 Get Recommendations Refresh Recommendations list
*empty*
uint numrecommendations Number of recommendations
*repeat numrecommendations*
string recommendationName of recommend
uint numrecommendationNumber of users with recommend
0x0601 Get Global Recommendations Refresh Global Recommendations list
*empty*
uint numrecommendations Number of recommendations
*repeat numrecommendations*
string recommendationName of recommend
uint numrecommendationNumber of users with recommend
0x0602 Get Similar Users Refresh Similar Users list
*empty*
uint numusers Number of users
*repeat numusers*
string usersName of user
uint numuserNumber of user
0x0603 Get Item Recommendations Refresh Recommendations list that matches item
stringitem
stringitem
uint numrecommendations Number of recommendations
*repeat numrecommendations*
string recommendationName of recommend
uint numrecommendation0
0x0604 Get Item Similar Users Refresh Similar Users that match item
stringitem
stringitem
uint numusers Number of users
*repeat numusers*
string usersName of user
uint numuserNumber of user
0x0610 Add Like Interest Liked Interest added
string interestName of the Interest to add
string interestName of the Interest added
0x0611 Remove Interest Interest Removed
string interestName of the Interest to remove
string interestName of the Interest remove
0x0612 Add Hated Interest Hated Interest added
string interestName of the Interest to add
string interestName of the Interest added
0x0613 Remove Hated Interest Hated Interest removed
string interestName of the Interest to remove
string interestName of the Interest remove
0x0700 Connect to Server Manually Connect to server
*empty*
*not sent*
0x0701 Disconnect from Server Manually Disconnects from server
*empty*
*not sent*
0x0703 Reload Shares Reload the Shares Database
*empty*
*not sent*