This document describes the way in which the AudioGalaxy software communicates with server. It describes the structure of messages, between 2 clients, and the messages used. This document is a simple instruction guide, for public use. It can be enriched by any one who has an information related to the topic of this document. If you have found any faults, or you wish to add anything, just mail me (insert original author details). The following information was received by analysing the traffic from AGSatelite.exe (client version 0.606W, 0.608W, and the linux version 0.520L).
This document was constructed from an original document written by Mity. This document was written by Justin Fletcher, using the RISC OS client (by Marc Warne) as a test platform for the messages. It is Mity who should get the praise for the information in this document - he's the one who worked out 99% of it.
The AudioGalaxy Satellite (in future referred to as the 'Client') uses TCP for data transmission. The connection to servers is made through port 21. The connecting client will contact 2 servers. The first of these is the redirection server. This provides the address of the second server (in future referred to as the 'Server') with which the client will communicate.
In order to connect to the Server, the client connects first to the redirection server, then attempts a connection to the Server itself. The sequence a Client should use to connect and hold a connection to the Server is :
Client makes connection to the redirection server (squash.audiogalaxy.com or garlic.audiogalaxy.com).
Client receives a REDIRECTION message.
Client disconnects from redirection server and connects to the Server as given in the REDIRECTION message.
If the connection fails, the client should retry the redirection server for another host to connect to.
Clients using the 0.608W protocol should send Message_MagicRequest. The server will reply with Message_MagicResponse.
Client then sends Message_Login 0.606W or Message_Login 0.608W message, using the appropriate variant.
Server tests the abilities of the client to Listen, and to Connect (further proxy test)
Inform server of shared files.
Every 30 seconds, you send Message_ReadyForTransfer to inform the server that you are still alive.
The Server sends Message_FileTransfer message which makes the Client download the 'proxy test' file. Connection is made with client-client protocol. After connecting to server or opening port, the Client sends message Message_FileTransferState with status 3. After the Client sends FileRequest, server closes the connection without sending any data (this stage checks that the connection is available and is able to function as a means of transferring files). After connection is closed, the Client sends Message_FileTransferState with status 5. There are 3 tests. 2 - test for an ability to Listen, 1 - test for ability to Connect.
The server sends Message_SendSharesStandBy a few times, to which you reply with message 7. Then server sends Message_SendShares message. This message shows that you can send your shares. If you have any new files (which don't have server id) in the database you send it's info with the Message_NewSharedFile, then the server will reply with message Message_NewShareReply with the server IDs for the file. To inform the server about the files which already have server id, and that they are online, you send Message_OldShares. If you don't have any files to share, you reply with Message_ReadyToSendShares, but if so you will not be able to download more then 1 file at a time.
After going through Message_Login 0.606W or Message_Login 0.608W process, the client may receive Message_FileTransfer message. This is an notification from the server to start a file transfer. It may inform you to upload or download file, and also includes information about whether the client should Listen or Connect.
The Client opens a port defined in the message Message_FileTransfer. The IP given in the message is just a mask, it shows only first 2 bytes.
The Client sends Message_FileTransferState status 3
The Client makes a connection to the IP and port defined in message Message_FileTransfer
The Client sends Message_FileTransferState status 3
After connection is done Client sends FileRequest message which consists of FILE_ID received from Message_FileTransfer. The size of the file to be downloaded, and the position to resume (the first byte of the file is at position 0).
If the file was found, the sender sends a response to the receiver (see below). After finishing, both sides send Message_FileTransferState status 0. And the downloader sends Message_NewSharedFile with the information on new file.
During file transfer server may send message Message_StopFileTransfer with the FILE_ID of the transfer to be shutdown. After the file transfer connection is closed, the Client sends Message_FileTransferState status 8.
Within messages passed between clients, values are passed in big-endian format, ie the largest byte value appears first in the stream. A number of data types are used to describe the content of the stream.
Data type | Meaning |
---|---|
String | A variable length field which contains textual data. It consists of 2-bytes which describe the string length (excluding the 2-bytes themselves) followed by the string. |
Block | A variable length field which contains binary data. It consists of 2-bytes which describe the data block length (excluding the 2-bytes themselves) followed by the block. |
Byte | A single byte value |
Word | A 2-byte value |
Integer | A 4-byte value |
When the Client connects to the redirection server, a reply is sent back to indicate the Server that the Client should connect to.
Type | Name | Contents |
---|---|---|
Integer | START_SIGNAL | 0x455FD0D5 |
Integer | MESSAGE_SIZE | Size of the whole message without START_SIGNAL |
Integer | ID | Message count |
Integer | PORT | Port to connect to |
String | SERVER_IP | IP to connect to |
Peer-to-peer connections supply a 'message count' (ID) which is not used by either end of the connection. It is usual to start a counter at zero and with every FileRequest or FileRequestReply to increment this counter. Whilst it might seem obvious to use this field as an additional check to return to the client, this is not done. Using an incrementing counter might be useful for tracing transactions more easily.
When the Client connects to the another Client to transfer a file, the Client receiving the file should send a request of the form :
Type | Name | Contents |
---|---|---|
Integer | START_SIGNAL | 0x455FD0D5 |
Integer | MESSAGE_SIZE | Size of the whole message without START_SIGNAL |
Integer | ID | Message count |
Block | FILE_ID | Server file ID request |
Integer | FILESIZE | Size of the file |
Integer | RESUME_OFFSET | Offset in file to start at |
The Client sending the file will send a similar message as a response :
Type | Name | Contents |
---|---|---|
Integer | START_SIGNAL | 0x455FD0D5 |
Integer | MESSAGE_SIZE | Size of the whole message without START_SIGNAL |
Integer | ID | Message count (need not be the same as that in the FileRequest) |
String | OK | "OK" |
Communication with the server takes a similar form to the redirection message.
Type | Name | Contents |
---|---|---|
Word | START_SIGNAL | 0x455F |
Word | MESSAGE_SIZE | Size of the whole message without START_SIGNAL |
Byte | MESSAGE_TYPE | Message type (see below) |
Type | Name | Contents |
---|---|---|
Integer | START_SIGNAL | 0x455FD0D5 |
Integer | MESSAGE_SIZE | Size of the whole message without START_SIGNAL |
Integer | ID | Message count (starting at 0) |
Word | MESSAGE_TYPE | Message type (see below) |
Type | Name | Contents |
---|---|---|
Integer | UNKNOWN | Usage is unknown (use 0) |
String | LOGIN | Login name |
String | PASSWORD | Password |
String | SATELLITE_VERSION | Satellite version "0.606W" |
String | CLIENT_IP | Client IP in dotted-quad format |
String | CLIENT_HOSTNAME | Client hostname |
Word | FILES_SENT | Conjecture: Number of files sent (use 0) |
Word | FILES_RECEIVED | Conjecture: Number of files received (use 0) |
This message is sent by the Client to notify the Server of the user name and client information required.
Type | Name | Contents |
---|---|---|
Integer | UNKNOWN | Usage is unknown (use 0) |
String | LOGIN | Login name |
String | NULL | Empty string |
String | SATELLITE_VERSION | Satellite version "0.608W" |
String | CLIENT_IP | Client IP in dotted-quad format |
String | CLIENT_HOSTNAME | Client hostname |
Word | FILES_SENT | Conjecture: Number of files sent (use 0) |
Word | FILES_RECEIVED | Conjecture: Number of files received (use 0) |
16 Bytes | MD5HASH | 16 byte MD5 hash of the password, prefixed by the magic value |
This message is sent by the Client to notify the Server of the user name and client information required. This version of the Login message is only applicable to 0.608W. You should respond to Message_MagicResponse with this message. If the magic prefix were 'teapot' and the users password was 'thursday', the MD5 has would be calculated of the string 'teapotthursday'.
This message is sent by the Client to notify the Server that it is disconnecting.
Type | Name | Contents |
---|---|---|
Integer | LOCAL_ID | Client identifier number |
Integer | FILESIZE | Size of file |
This message is sent by the Client to inform the server that a file that was shared is no longer available.
This message is sent by the Client to notify the Server that it is still alive and available for transferring files.
Type | Name | Contents | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Block | FILE_ID | Identifier for file transfer | ||||||||||||||||||
Integer | STATE | File transfer state :
|
This message is sent by the Client to notify the Server of the state of a file transfer.
This message is sent by the Client to notify the Server that it is ready to send its shared files. The Client should send it in response to messages Message_SendSharesStandBy and Message_SendShares.
This message is sent by the Server to notify the Client that it should prepare shares for sending to the server. The Client should not send the shares until Message_SendShares is received. This message is sent when the proxy test completes.
This message is sent by the Server to notify the Client that it should send its list of shared files to the Server. The client should acknowledge this message with Message_ReadyToSendShares, followed by a list of shared files.
Within the list, files which are known to AudioGalaxy should be provided with Message_OldShares which includes the server file identifier. Any files which are not known to the AudioGalaxy server (or for which you do not keep a record of their server file id) should be provided with Message_NewSharedFile.
Type | Name | Contents | ||||||
---|---|---|---|---|---|---|---|---|
Block | FILE_ID | Identifier for file transfer | ||||||
Byte | CONNECT | Connection type :
| ||||||
Byte | DIRECTION | Connection direction :
| ||||||
String | IP | IP to connect to/mask to accept from | ||||||
Integer | PORT | Port to connect on/listen on | ||||||
Integer | LOCAL_ID | Client identifier number | ||||||
String | FILENAME | Suggested filename to transfer as | ||||||
Integer | FILESIZE | Size of file being transferred |
This message is sent by the Server to request that the Client begin a file transfer. If the file does not exist, the client should
Type | Name | Contents |
---|---|---|
Block | FILE_ID | Server file ID |
This message is sent by the Server to terminate a current file transfer.
Type | Name | Contents |
---|---|---|
Integer | LOCAL_ID | Client identifier number |
String | FILE_SET | Server file set |
Integer | FILE_ID | Server file ID |
Integer | SONG_ID | Server song ID |
Integer | FILESIZE | Size of file |
This message is sent by the Server to inform the client of the server identifer.
Type | Name | Contents | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Integer | ERROR TYPE | Error type :
|
This message is sent by the Server to inform the client that there was a problem with its login, or current connection to the Server.
Type | Name | Contents |
---|---|---|
Integer | LOCAL_ID | Client identifier number |
Integer | SONG_ID | Server song ID |
Integer | OPERATION | Play operation (usually 1) |
This message appears to be sent by the Server to request that the Client start playing the file specified.
Type | Name | Contents |
---|---|---|
String | SATELLITE_VERSION | Satellite version number (use 0.606W) |
String | LOGIN | Login name |
String | PASSWORD | Password |
This message is sent by the Client to query the Server about the existence of an account. The client does not have to be logged in for this message to be used
Type | Name | Contents |
---|---|---|
Integer | LOCAL_ID | Client identifier number |
String | FILE_SET | Server file set |
Integer | FILE_ID | Server file ID |
Integer | SONG_ID | Server song ID |
Integer | FILESIZE | Size of file |
Word | BITRATE | Bit rate in KB/s |
Integer | LASTMODDATE | Last modified date, in seconds past Midnight, 1st Jan 1970 |
This message is sent by the Client to inform the server of the reappearance of a file which had previously been shared and had received server identifiers.
Type | Name | Contents | ||||||
---|---|---|---|---|---|---|---|---|
Word | UNKNOWN | Unknown value (use 0) | ||||||
Integer | LOCAL_ID | Client identifier number | ||||||
String | FILENAME | Local filename | ||||||
String | FOLDER | Local folder name | ||||||
Integer | FILESIZE | Size of file | ||||||
Word | BITRATE | Bit rate in KB/s | ||||||
Integer | SECLENGTH | Length of the file in seconds | ||||||
Integer | LASTMODDATE | Last modified date, in seconds past Midnight, 1st Jan 1970 UTC | ||||||
Byte | FLAG_ID3v1 | Flag marker for ID3v1 data following :
| ||||||
String | ID3v1_TITLE | ID3v1 song title field | ||||||
String | ID3v1_ARTIST | ID3v1 artist field | ||||||
String | ID3v1_ALBUM | ID3v1 album field | ||||||
Byte | FLAG_ID3v2 | Flag marker for ID3v2 data following :
| ||||||
String | ID3v2_TITLE | ID3v2 song title field (TIT2/TT2) | ||||||
String | ID3v2_ARTIST | ID3v2 artist field (TPE1/TP1) | ||||||
String | ID3v2_ALBUM | ID3v2 album field (TALB/TAL) | ||||||
Word | ID3v2_TRACK | ID3v2 track number field (TRCK/TRK) | ||||||
String | ID3v2_TAG | AudioGalaxy tag (XAG1/XAG) |
This message is sent by the Client to inform the Server of the existence of shared files which were not previously known to the Server.
Type | Name | Contents | ||||||
---|---|---|---|---|---|---|---|---|
Block | FILE_ID | Server file identifier | ||||||
Byte | STATE | State of the delete :
|
This message is sent by the Client to inform the server that it received and processed the delete operation. This message is a reply to Message_DeleteRequest.
Type | Name | Contents |
---|---|---|
String | SATELLITE_VERSION | Client version (use 0.606W) |
String | LOGIN | Login user name (max 23 characters) |
String | Email address | |
String | AGE | Age |
String | SEX | Sex |
String | CITY | City |
String | STATE | State |
String | ZIP | Zip code |
String | COUNTRY | Country |
String | HOW HEARD | How you heard about AudioGalaxy |
Integer | UNKNOWN | Unknown value (use 0) |
This message is sent by the Client to request the creation of an account.
This message is sent by the Client immediately after it connects to request an magic value to prefix the password for MD5 hashing.
Type | Name | Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Integer | RESPONSE | Response type for the account
creation :
|
This message is sent by the Server to inform you whether the creation of the account succeeded.
Type | Name | Contents | ||||||
---|---|---|---|---|---|---|---|---|
Integer | RESPONSE | Response type for the account
existence check :
|
This message is sent by the Server to inform you about the existence (or not) of an account queried with Message_AccountExistence.
Type | Name | Contents |
---|---|---|
Block | FILE_ID | Server file identifier |
String | FILENAME | Filename |
This message is sent by the Server to request that it delete the file referenced in the message. When the deletion has been processed, the Client should send message Message_DeleteReply.
Type | Name | Contents |
---|---|---|
Integer | OPERATION | Play operation (usually 1) |
Integer | COUNT | Count of songs to play/queue |
Integer | LOCAL_ID | Local file identifier |
Integer | UNKNOWN | Unknown value (?) |
This message appears to be sent by the Server to request that the Client start playing, or queue the file or files specified. The local file identifier and the unknown value are repeated COUNT times.
Type | Name | Contents |
---|---|---|
String | PREFIX | Magic MD5 prefix |
This message is sent by the Server to inform it of the magic prefix to use with the password to generate hashes. This message is only applicable to the protocol 0.608W. The client will, after this message, send the login message with the appropriate hash.
Type | Name | Contents |
---|---|---|
String | LOGIN_STRING | String to pass to servers for login |
This message is sent by the Server to inform it that the 'Go' button should be activated (unfaded). This message is only applicable to the protocol 0.608W.
LOGIN_STRING is a string which may be used with the AudioGalaxy servers to login. Usually it is appended to 'http://www.audiogalaxy.com/serverlogin?' to cause the client to log in and display their home page on the AudioGalaxy servers.
The current format of this string is : cli=<userid>g<magic-hash>g<time>
Where:
Value | Meaning |
---|---|
userid | Hexadecimal version of the users id number |
magic-hash | MD5 hash as sent to the server on login |
time | Some time value, believed to be the server start, or server build, time measured in centi-seconds since midnight 1st January 1970. |