                           BackupPC Daemon 0.0.29

Release information:
   pkg: BakcupPC Daemon version 0.0.29
   url: http://www.rkeene.org/devel/backuppcd-0.0.29.tar.gz
  date: Sat Jul  9 21:32:02 CDT 2005
  mail: backuppcd-bugs@psislidell.com
        backuppcd@rkeene.org
author: Roy Keene
        Planning Systems Inc.
        Slidell, LA 70458
        United States
--------------------------------------------------------------------------

[COMMAND (8 bits)]{
	* command specific data *
}

COMMAND == 0x0:  Invalid must not be sent.

COMMAND == 0x1:  Authenticate.
	{
		[USERNAME_LENGTH (16 bits)]
		[PASSWORD_LENGTH (16 bits)]
		[USERNAME (USERNAME_LENGTH * 8 bits)]
		[PASSWORD (PASSWORD_LENGTH * 8 bits)]
	} (32 + ((USERNAME_LENGTH + PASSWORD_LENGTH) * 8) bits)

COMMAND == 0x2:  Enable SSL
	{
		[PUBLIC_KEY_LENGTH (16 bits)]
		[PUBLIC_KEY (PUBLIC_KEY_LENGTH * 8 bits)]
	} (16 + (PUBLIC_KEY_LENGTH * 8) bits)

COMMAND == 0x3:  Set session key
	{
		[CIPHER_ALGO_ID (32 bits)]
		[SESSION_KEY_LENGTH (16 bits)]
		[SESSION_KEY (SESSION_KEY_LENGTH * 8 bits)]
	} (48 + (SESSION_KEY_LENGTH * 8) bits)
  Notes:  This should be done after both ends have agreed to enable SSL.

COMMAND == 0x4:  List files
	{
		[OPTIONS (8 bits)]
		[EXCLUDE_SECTION_LENGTH (32 bits)]
		[INCLUDE_SECTION_LENGTH (32 bits)]
		[PATHNAME_LENGTH (32 bits)]
		[PATHNAME (PATHNAME_LENGTH * 8 bits)]
		EXCLUDE_PATS {
			[EXCLUDE_LENGTH (16 bits)]
			[EXCLUDE (EXCLUDE_LENGTH * 8 bits)]
		} (EXCLUDE_SECTION_LENGTH * 8 bits)
		INCLUDE_PATS {
			[INCLUDE_LENGTH (16 bits)]
			[INCLUDE (INCLUDE_LENGTH * 8 bits)]
		} (INCLUDE_SECTION_LENGTH * 8 bits)
	} (104 + ((PATHNAME_LENGTH + EXCLUDE_SECTION_LENGTH + INCLUDE_SECTION_LENGTH) * 8) bits)
  Notes:  Requires the user to authenticate with READ or RDWR access.

COMMAND == 0x5:  Get files
	{
		[OPTIONS (8 bits)]
		[EXCLUDE_SECTION_LENGTH (32 bits)]
		[INCLUDE_SECTION_LENGTH (32 bits)]
		[PATHNAME_LENGTH (32 bits)]
		[PATHNAME (PATHNAME_LENGTH * 8 bits)]
		EXCLUDE_PATS {
			[EXCLUDE_LENGTH (16 bits)]
			[EXCLUDE (EXCLUDE_LENGTH * 8 bits)]
		} (EXCLUDE_SECTION_LENGTH * 8 bits)
		INCLUDE_PATS {
			[INCLUDE_LENGTH (16 bits)]
			[INCLUDE (INCLUDE_LENGTH * 8 bits)]
		} (INCLUDE_SECTION_LENGTH * 8 bits)
	} (104 + ((PATHNAME_LENGTH + EXCLUDE_SECTION_LENGTH + INCLUDE_SECTION_LENGTH) * 8) bits)
  Notes:  Requires the user to authenticate with READ or RDWR access.

COMMAND == 0x6:  Put files
	{
		ENTRY {
			[FILE_TYPE (8 bits): == 0xFF indicates end-of-files]
			--- REMAINDER NOT SENT WHEN FILE_TYPE == 0xFF ---
			[ATTRIB_LENGTH (32 bits)]
			[FILE_SIZE (64 bits)]
			[BLOCK_SIZE (32 bits)]
			[PATHNAME_LENGTH (32 bits)]
			[PATHNAME (PATHNAME_LENGTH * 8 bits)]
			ATTRIB {
				[ATTRIB_TYPE_ID (16 bits)]
				[ATTRIB_LENGTH (32 bits)]
				[ATTRIB_VALUE (ATTRIB_LENGTH * 8 bits)]
			} (ATTRIB_LENGTH * 8 bits)
			DATA {
				[BLOCK_NUM (32 bits): == 0xFFFFFFFF indicates last block]
				--- REMAINDER NOT SENT WHEN BLOCK_NUM == 0xFFFFFFFF ---
				[BLOCK (BLOCK_SIZE * 8 bits)]
			} (... big...)
		} (... big...)
	} (... big...)
  Notes:  Requires the user to authenticate with WRITE or RDWR access.

COMMAND == 0x7:  Rdiff get file
	{
		[FILE_SIZE (64 bits): == 0xFFFFFFFFFFFFFFFF indicates non-existant]
		--- REMAINDER NOT SENT WHEN FILE_SIZE == 0xFFFFFFFFFFFFFFFF ---
		[RDIFF_BLOCK_SIZE (32 bits)]
		[RDIFF_INFO_LENGTH (32 bits)]
		[PATHNAME_LENGTH (32 bits)]
		[PATHNAME (PATHNAME_LENGTH * 8 bits)]
		RDIFF_INFO {
			[RDIFF_BLOCK_MD5 (128 bits)]
		} (RDIFF_INFO_LENGTH * 8 bits)
	} (160 + ((RDIFF_INFO_LENGTH + PATHNAME_LENGTH) * 8) bits)
  Notes:  Requires the user to authenticate with READ or RDWR access.

COMMAND == 0x81: Authenticate reply
	{
		[STATUS (8 bits): 0 == OKAY, 1 == FAILURE]
	} (8 bits)

COMMAND == 0x82: Enable SSL Reply
	{
		[STATUS (8 bits): 0 == OKAY, 1 == FAILURE]
	} (8 bits)

COMMAND == 0x83: Set session key reply
	{
		[STATUS (8 bits): 0 == OKAY, 1 == FAILURE]
	} (8 bits)

COMMAND == 0x84: List files reply
	{
		ENTRY {
			[FILE_TYPE (8 bits): == 0xFF indicates end-of-files]
			--- REMAINDER NOT SENT WHEN FILE_TYPE == 0xFF ---
			[ATTRIB_LENGTH (32 bits)]
			[FILE_SIZE (64 bits)]
			[BLOCK_SIZE (32 bits)]
			[PATHNAME_LENGTH (32 bits)]
			[PATHNAME (PATHNAME_LENGTH * 8 bits)]
			ATTRIB {
				[ATTRIB_TYPE_ID (16 bits)]
				[ATTRIB_LENGTH (32 bits)]
				[ATTRIB_VALUE (ATTRIB_LENGTH * 8 bits)]
			} (ATTRIB_LENGTH * 8 bits)
		} (136 + ((PATHNAME_LENGTH + ATTRIB_LENGTH) * 8) bits
	} (... big...)
  Note:  This is the same as Get files reply (0x85) and Put files (0x6)
         except that it lacks a DATA section.

COMMAND == 0x85: Get files reply
  Notes:  Same as put files (0x6)

COMMAND == 0x86: Put files reply
	{
		[STATUS (8 bits): 0 == OKAY, 1 == FAILURE]
	} (8 bits)

COMMAND == 0x87: Rdiff get file reply
	{
		[FILE_SIZE (64 bits): == 0xFFFFFFFFFFFFFFFF indicates non-existant]
		--- REMAINDER NOT SENT WHEN FILE_SIZE == 0xFFFFFFFFFFFFFFFF ---
		[RDIFF_PARTS_LENGTH (64 bits)
		[PATHNAME_LENGTH (32 bits)]
		[PATHNAME (PATHNAME_LENGTH * 8 bits)]
		RDIFF_PARTS {
			[PART_BEGIN (64 bits)]
			[PART_LENGTH (64 bits)]
			[PART_DATA (PART_LENGTH * 8 bits)]
		} (RDIFF_PARTS_LENGTH * 8 bits)
	} (160 + ((PATHNAME_LENGTH + RDIFF_PARTS_LENGTH) * 8) bits)

