RSMC methods

The RSMP (Remote Server Mangment Protocol) allows the distributed serevers and manager/s to communicate with each other using RSMC (Remote Server Mangement Commands). Each server has an RSNC daemon thread that listens on a specific port and waits for RSMC commands. The default RSMC is set to port 90 but it can be changed using command line modifiers. The RSMP syntax is very similar to the HTTP syntax. This allows the server to handle and resolve RSMC commands easily. The RSMP requests are initiated by the manager module and allow the manger a complete control of the server/s content.

The RSMC Methods:

Receive - Get files from a remote server to the local server.
Send - Send files to a remote server.
Erase - Delete files from the server.
Info - Get the file properties from a server.
Log - Send the contents of a server's log file to the manager.
 

The RSMC Specification:
 

RECEIVE - Create a local copy of a URL. The RECEIVE command tells the server to fetch objects from a specified place in the network and put them in a specified place in the server.
The RECIVE command format is:

where:

source url - The url that should be fetched. The source url must include the protocol, the server and a full path (such as "http://www.technosphere.org.uk/index.html"). The server generates an HTTP GET request to the source url and gets it's content. A RSMC header is added ("rsmc: required") to the request so if the source url is located in another rsmc server, the source url properties will also be sent.

destination path - The new local path and file name of the fetched url. This field may specify a new file and / or file name to the source url. In most cases it will probably be the same path and file name of the source url but we have the option to rename the url in the local server.

base local path - The base path of the received object (local) in the receiving server. The fetched url is located under this path. For example if the base local path is "/misc" and the fetched URL is http://www.microsoft.com/WinMine.html the address of the local copy of the URL will be "http://localhost/misc/WinMine.html. When the server is activated as Stand Alone the base path will probably be "/". when  the server functions as Proxy host, the base path can be the remote url host (In our example, the base path will be "www.microsoft.com" so the server will be able to distinguish between different urls with the same path on different servers.

protocol version - the RSMC protocol version.

url 1, url2, ... url n - the list of urls that should be fetched to the server. This list must begin with an empty line and end with an empty line. Each url must contain all the URL fields (protocol, host and path). the port field in the url is optional.
 

SEND - Send a local copy of a URL to a remote server. The SEND command tells the server to take an exsiting object from it's local objects and send it to another server. The SEND command format is:

SEND <base remote path> <protocol version>
<empty line>
[file1] [url1]
[file2] [url2]
[file3] [url3]
....
<empty line>

where:

base remote path - The base path of the sent object in the receiving server. The fetch url is located under this path.
For example -  if the base local path is "/misc" and the source file is WinMine.html then the http://localhost/misc/WinMine.html file will be sent to the remote server.

file1, file2, ... file n - The list of files (local) to send.

url 1, url2, ... url n - The list of destination (remote) urls.

*The list must begin and end with an empty line.
 

ERASE - Delete files from the server. Syntax:

where:

base path - The path prefix for all the files in the following lines.

protocol version - The RSMP protocol version.

File 1,file 2,..,file n - The files to be deleted. Each file name may include a path. The file name is concatinated to the base path and the whole path specifies the file to be deleted.

INFO - Send the properties of a local URL to the manager. The properties are taken from the url's enteries in the properties file which is located in the url's directory.
The INFO command format is:

INFO <remote URL> <protocol version>

where:

remote URL - The url for which the info is requested.
 

LOG - Send the content of the server's log file to the manager. The log file contains all the requests that were made to the server since it was started. All previous log files are backed up in the root directory of the server by the names of "server.log.x" where 'x' is the backup number. Each time the server is started, a new log file is created. (The backed up files can be retrieved by the GET method).
The LOG command format is:

LOG <protocol version>
 
 

The response for all the RSMC commands is similar to the standard HTTP response. It contains a global return code for the RSMC command and specific return codes for each referenced object. The RSMC response syntax is:
   Where:

Server Name - The name of the RSMC server.

Global Code - The global return code for the RSMC command

Object X - An object that was referenced in the RSMC command.

Return Code X - The return code for this object.
 

Note: If the RSMC command is not valid the response is undefined. The manager is responsible to send only valid RSMC commands.