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. I should also like to thing Marc Warne and Eric Seidel for their help
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 :
.mp3
. Shared files
should be longer than 32k.Clients connecting for normal accounts should resolve garlic.audiogalaxy.com and connect to that for server redirection. Multiple results may be returned for this host and clients should step through these in order. Clients should not attempt to connect to all hosts simultaneously as this will increase the load on the server and negate the point of having multiple addresses. The address order will be rotated by the server in order to reduce the load on the redirection servers.
Clients connecting for 'Gold' accounts should resolve gold.audiogalaxy.com and perform the same sequence as those for the normal accounts. As with normal accounts, multiple addresses may be returned but do not, at present, appear to be.
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 Message_NewSharedFile 0.520L or Message_NewSharedFile 0.608W, 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.
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.
The server may send to a client a file named
AGSatellite.exe
. This file is an upgrade for the
client and will be run by the Windows client. It does not appear that
a normal user can share such a file.
It is strongly recommended that clients not handle such cases and possibly warn the user of attempts to upgrade clients in this manner. Whilst unlikely, this may be a means in future to execute unauthorised content on a machine if the AudioGalaxy servers are compromised. Since no security checks can be performed on the executable it is impossible to tell whether it is from AudioGalaxy or not. This is quite aside from the fact that the file will be an x86 executable.
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) |
For the most part, the text encoding of strings is unspecified. However, some of the strings are in particular encoding formats :
Field | Encoding |
---|---|
ID3v1_TITLE | Unspecified (ID3v1 restriction) |
ID3v1_ARTIST | Unspecified (ID3v1 restriction) |
ID3v1_ALBUM | Unspecified (ID3v1 restriction) |
ID3v2_TITLE | ISO-8859-1 (ID3v2 restriction) |
ID3v2_ARTIST | ISO-8859-1 (ID3v2 restriction) |
ID3v2_ALBUM | ISO-8859-1 (ID3v2 restriction) |
For ID3v2 data, if the encoding is not ISO-8859-1 then it will be necessary for the client to either discard the data or to convert it to ISO-8859-1.
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 (in lower case), 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'.
The MD5HASH is sent as 16 bytes within the packet. No length preceeds the 16 bytes.
This message is sent by the Client to notify the Server that it is disconnecting.
Type | Name | Contents | ||||||
---|---|---|---|---|---|---|---|---|
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 | ID3v2 AudioGalaxy tag (XAG1/XAG) |
This is the simple share message sent by Client. It is used by the 0.520L client. The ID3v1 data should only be sent if FLAG_ID3v1 indicates that it is present. The ID3v2 data should only be sent if FLAG_ID3v2 indicates that it is present.
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.
Type | Name | Contents |
---|---|---|
Block | FILE_ID | Identifier for file transfer |
Integer | SPEED | Transfer speed in bytes/second |
Integer | UNKNOWN | 0 |
Integer | PROGRESS | Position through the transfer that has been reached (offset into transfer) |
This message is sent by the Client to notify the Server that it is still alive and available for transferring files. The data attached to this message should be repeated for each transfer in progress.
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 one of the NewSharedFile messages.
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 issue Message_FileTransferState type 1 for the file.
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 | SERVER_ID | Server file ID (usually 0) |
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
|
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 | SERVER_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 | TYPE | Bit mask describing type:
| ||||||||||||||
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 | ||||||||||||||
16 Bytes | FILE_HASH | MD5 hash of data from the file | ||||||||||||||
String | ID3v1_TITLE | ID3v1 song title field | ||||||||||||||
String | ID3v1_ARTIST | ID3v1 artist field | ||||||||||||||
String | ID3v1_ALBUM | ID3v1 album field | ||||||||||||||
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 | ID3v2 AudioGalaxy tag (XAG1/XAG) |
This is the advanced share message sent by Client. It is used by 0.608W clients.
The ID3v1 data should only be sent if TYPE indicates that it is present. The ID3v2 data should only be sent if TYPE indicates that it is present.
MD5 data is calculated on a 32k buffer as follows :
For example :
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.608W) |
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
| ||||||
Integer | COUNT | Count of songs to play/queue | ||||||
Integer | LOCAL_ID | Local file identifier | ||||||
Integer | SERVER_ID | Server file identifier |
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. |
Maintainer(s): | Justin Fletcher <gerph@innocent.com> | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
History: |
| ||||||||||||
Related: | None | ||||||||||||
Disclaimer: |
This document is based on documentation initially created by Mity, and development of the RISC OS client !Satellite. This is not an official document from AudioGalaxy, nor is it endorsed by them. |