1 #ifndef _CMD_H
2 #define _CMD_H
3 
4 #include <unistd.h>
5 
6 enum cmd
7 {
8 /* These things appear at the beginning of each line of communication on the
9    network, and in the manifest. */
10 
11 // This comes before any file type entries.
12 	CMD_ATTRIBS='r',	/* File stat information */
13 
14 	CMD_ATTRIBS_SIGS='R',	/* File stat information preceding sigs */
15 	CMD_SIG		='S',	/* Signature of a block */
16 	CMD_DATA_REQ	='D',	/* Request for block data */
17 	CMD_DATA	='B',	/* Block data */
18 	CMD_WRAP_UP	='W',	/* Control packet - client can free blocks up
19 				   to the given index. */
20 
21 // File types
22 	CMD_FILE	='f',	/* Plain file */
23 	CMD_ENC_FILE	='y',	/* Encrypted file */
24 	CMD_DIRECTORY	='d',	/* Directory */
25 	CMD_SOFT_LINK	='l',	/* Soft link */
26 	CMD_HARD_LINK	='L',	/* Hard link */
27 	CMD_SPECIAL	='s',	/* Fifo, socket, device node... */
28 	CMD_METADATA	='m',	/* Extra meta data */
29 	CMD_ENC_METADATA='n',	/* Encrypted extra meta data */
30 	CMD_EFS_FILE 	='k',	/* Windows EFS file */
31 
32 // Commands
33 	CMD_GEN		='c',	/* Generic command */
34 	CMD_ERROR	='e',	/* Error message */
35 	CMD_APPEND	='a',	/* Append to a file */
36 	CMD_INTERRUPT	='i',	/* Please interrupt the current data flow */
37 	CMD_MESSAGE	='p',	/* A message */
38 	CMD_WARNING	='w',	/* A warning */
39 	CMD_END_FILE	='x',	/* End of file transmission - also appears at
40 				   the end of the manifest and contains
41 				   size/checksum info. */
42 
43 // CMD_FILE_UNCHANGED only used in counting stats on the client, for humans
44 	CMD_FILE_CHANGED='z',
45 
46 	CMD_TIMESTAMP	='b',	/* Backup timestamp (in response to list) */
47 
48 
49 	CMD_MANIFEST	='M',	/* Path to a manifest */
50 	CMD_FINGERPRINT	='F',	/* Fingerprint part of a signature */
51 	CMD_SAVE_PATH   ='q',   /* Save path part of a signature */
52 
53 
54 // These things are for the status server/client
55 
56 	CMD_TOTAL	='Y',
57 	CMD_GRAND_TOTAL	='Z',
58 
59 	CMD_BYTES_ESTIMATED='G',
60 	CMD_BYTES	='O',
61 	CMD_BYTES_RECV	='P',
62 	CMD_BYTES_SENT	='Q',
63 	CMD_TIMESTAMP_END='E',
64 
65 // Protocol1 only.
66 	CMD_DATAPTH	='t',	/* Path to data on the server */
67 	CMD_VSS		='v',	/* Windows VSS metadata */
68 	CMD_ENC_VSS	='V',	/* Encrypted Windows VSS metadata */
69 	CMD_VSS_T	='u',	/* Windows VSS footer */
70 	CMD_ENC_VSS_T	='U',	/* Encrypted Windows VSS footer */
71 };
72 
73 
74 extern void cmd_print_all(void);
75 extern char *cmd_to_text(enum cmd cmd);
76 extern int cmd_is_filedata(enum cmd cmd);
77 extern int cmd_is_vssdata(enum cmd cmd);
78 extern int cmd_is_link(enum cmd cmd);
79 extern int cmd_is_endfile(enum cmd cmd);
80 extern int cmd_is_encrypted(enum cmd cmd);
81 extern int cmd_is_metadata(enum cmd cmd);
82 extern int cmd_is_estimatable(enum cmd cmd);
83 
84 #endif
85