mandriva

Poor Man RPC

Nicolas Rueff

$Id: database_documentation.xml 4145 2009-05-12 16:29:28Z nrueff $

Revision History
Revision 1.3.02009-11-20NR

First version

Abstract

The Imaging binary / GUI protocol


1. Specifications of PMRPC

The protocol is hand-made, based on the exchange of tokens.

To simplify :

  • The GUI listen (in our case: 127.0.0.1 on TCP port 7001)

  • the CLI issues a token (ie a command ID and command arguments)

  • GUI issues an ACK.

From a network point of view, a token consists in :

  • a UI32 (little endian) giving the token length,

  • a string the length previously announced.

In short, encoding "à la Pascal".

Similarly, an order is made of :

  • a token (command id)

  • a ui32 (little endian) giving the number of command arguments,

  • as many tokens as advertised.

Example of exchange from the interface point of view (a token is symbolized by ||) :

RECEIVED : |init_backup|
RECEIVED : |/dev/hda1|/home/LRS/noiraude_2007-07-05_18:19:44/P1|192,712|84,706|/home/nicolas/Devs/GhostKiller/lrs-bin/revobin/image_e2fs|
SEND     : |OK|
RECEIVED : |refresh_backup_progress|
RECEIVED : |0|
SEND     : |OK|
RECEIVED : |refresh_backup_progress|
RECEIVED : |818176|
RECEIVED : |close|
SEND     : |OK|

2. Commands available

2.1. Client side

[Note]

Undocumented arguments are not used in our case.

init_backup

The binary signals the beginning of a backup to the interface. The arguments given are, in that order :

  1. the source, i.e. the partition (Linux-compliant: /dev/hda4, /dev/sdc1, etc ...),

  2. the target, i.e. the file (and the folder) containing the backup (/home/LRS/P1, /net/LRS/tftpboot/imgs/test/P3, etc ...),

  3. the partition size (512 bytes blocks),

  4. the used space (512 bytes blocks),

  5. the name of the binary used to backup.

init_restore

The binary signals the beginning of a restoration to the interface. The arguments given are, in that order :

  1. the source, i.e. the file (and the folder) containing the backup (/home/LRS/P1, /net/LRS/tftpboot/imgs/test/P3, etc ...),

  2. the target, i.e. the partition (Linux-compliant: /dev/hda4, /dev/sdc1, etc ...),

  3. the amount of data to restore (512 bytes blocks).

refresh_file

The binary tells the interface it changes from backup file. The arguments:

  1. the source,

  2. the target.

refresh_backup_progress

The binary gives the interface its progression. The arguments:

  • The progression (in bytes since the beginning of the image).

close

The binary tells the interface it will stop its execution (and the communication). No argument.

misc_error

The binary reports an error to the interface. Two arguments:

  • the error title,

  • the error description.

backup_write_error

The binary reports an write error (while backuping) to the interface. No argument.

zlib_error

The binary reports a zlib error (while restoring). Argument:

  • The ZLib error message.

2.2. Server side

All token no argument can act as ACK. In practice, by convention we use "OK" token.