summaryrefslogtreecommitdiff
path: root/bin/bbstored/backupprotocol.txt
blob: 106ac24c26fc5a01b0043bfadd9d5bb619d0d20b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#
# backup protocol definition
#

Name 				Backup
IdentString			Box-Backup:v=B
ServerContextClass	BackupContext	BackupContext.h

ClientType		Filename	BackupStoreFilenameClear	BackupStoreFilenameClear.h
ServerType		Filename	BackupStoreFilename			BackupStoreFilename.h

ImplementLog	Server	syslog
ImplementLog	Client	syslog
ImplementLog	Client	file

LogTypeToText	Client	Filename	\"%s\"	VAR.GetClearFilename().c_str()

BEGIN_OBJECTS

# -------------------------------------------------------------------------------------
#  Session commands
# -------------------------------------------------------------------------------------

Error		0	IsError(Type,SubType)	Reply
	int32		Type
	int32		SubType
	CONSTANT	ErrorType						1000
	CONSTANT	Err_WrongVersion				1
	CONSTANT	Err_NotInRightProtocolPhase		2
	CONSTANT	Err_BadLogin					3
	CONSTANT	Err_CannotLockStoreForWriting	4
	CONSTANT	Err_SessionReadOnly				5
	CONSTANT	Err_FileDoesNotVerify			6
	CONSTANT	Err_DoesNotExist				7
	CONSTANT	Err_DirectoryAlreadyExists		8
	CONSTANT	Err_CannotDeleteRoot			9
	CONSTANT	Err_TargetNameExists			10
	CONSTANT	Err_StorageLimitExceeded		11
	CONSTANT	Err_DiffFromFileDoesNotExist	12
	CONSTANT	Err_DoesNotExistInDirectory		13
	CONSTANT	Err_PatchConsistencyError		14

Version		1	Command(Version)	Reply
	int32	Version


Login		2	Command(LoginConfirmed)
	int32		ClientID
	int32		Flags
	CONSTANT	Flags_ReadOnly	1


LoginConfirmed	3	Reply
	int64		ClientStoreMarker
	int64		BlocksUsed
	int64		BlocksSoftLimit
	int64		BlocksHardLimit


Finished	4	Command(Finished)	Reply	EndsConversation


# generic success object
Success		5	Reply
	int64		ObjectID


SetClientStoreMarker	6	Command(Success)
	int64		ClientStoreMarker


# -------------------------------------------------------------------------------------
#  Generic object commands
# -------------------------------------------------------------------------------------

GetObject	10	Command(Success)
	int64		ObjectID
	CONSTANT	NoObject	0
	# reply has stream following, if ObjectID != NoObject


MoveObject	11	Command(Success)
	int64		ObjectID
	int64		MoveFromDirectory
	int64		MoveToDirectory
	int32		Flags
	Filename	NewFilename
	
	CONSTANT Flags_MoveAllWithSameName			1
	CONSTANT Flags_AllowMoveOverDeletedObject	2

# consider this an object command as, although it deals with directory entries,
# it's not specific to either a file or a directory


GetObjectName	12	Command(ObjectName)
	int64		ObjectID
	int64		ContainingDirectoryID
	CONSTANT	ObjectID_DirectoryOnly	0

	# set ObjectID to ObjectID_DirectoryOnly to only get info on the directory


ObjectName		13	Reply
	int32		NumNameElements
	int64		ModificationTime
	int64		AttributesHash
	int16		Flags
	# NumNameElements is zero if the object doesn't exist
	CONSTANT	NumNameElements_ObjectDoesntExist	0
	# a stream of Filename objects follows, if and only if NumNameElements > 0


# -------------------------------------------------------------------------------------
#  Directory commands
# -------------------------------------------------------------------------------------

CreateDirectory	20	Command(Success)	StreamWithCommand
	int64		ContainingDirectoryID
	int64		AttributesModTime
	Filename	DirectoryName
	# stream following containing attributes


ListDirectory	21	Command(Success)
	int64		ObjectID
	int16		FlagsMustBeSet
	int16		FlagsNotToBeSet
	bool		SendAttributes
	# make sure these flags are synced with those in BackupStoreDirectory
	CONSTANT	Flags_INCLUDE_EVERYTHING 	-1
	CONSTANT	Flags_EXCLUDE_NOTHING 		0
	CONSTANT	Flags_EXCLUDE_EVERYTHING	15
	CONSTANT	Flags_File			1
	CONSTANT	Flags_Dir			2
	CONSTANT	Flags_Deleted			4
	CONSTANT	Flags_OldVersion		8
	# make sure this is the same as in BackupStoreConstants.h
	CONSTANT	RootDirectory			1

	# reply has stream following Success object, containing a stored BackupStoreDirectory


ChangeDirAttributes	22	Command(Success)	StreamWithCommand
	int64		ObjectID
	int64		AttributesModTime
	# stream following containing attributes


DeleteDirectory	23	Command(Success)
	int64		ObjectID

UndeleteDirectory	24	Command(Success)
	int64		ObjectID
	# may not have exactly the desired effect if files within in have been deleted before the directory was deleted.


# -------------------------------------------------------------------------------------
#  File commands
# -------------------------------------------------------------------------------------

StoreFile	30	Command(Success)	StreamWithCommand
	int64		DirectoryObjectID
	int64		ModificationTime
	int64		AttributesHash
	int64		DiffFromFileID		# 0 if the file is not a diff
	Filename	Filename
	# then send a stream containing the encoded file


GetFile		31	Command(Success)
	int64		InDirectory
	int64		ObjectID
	# error returned if not a file, or does not exist
	# reply has stream following, containing an encoded file IN STREAM ORDER
	# (use GetObject to get it in file order)


SetReplacementFileAttributes	32	Command(Success)	StreamWithCommand
	int64		InDirectory
	int64		AttributesHash
	Filename	Filename
	# stream follows containing attributes


DeleteFile	33	Command(Success)
	int64		InDirectory
	Filename	Filename
	# will return 0 if the object couldn't be found in the specified directory


GetBlockIndexByID	34	Command(Success)
	int64		ObjectID

	# stream of the block index follows the reply
	# returns an error if the object didn't exist


GetBlockIndexByName	35	Command(Success)
	int64		InDirectory
	Filename	Filename

	# Success object contains the found ID -- or 0 if the entry wasn't found in the directory
	# stream of the block index follows the reply if found ID != 0


# -------------------------------------------------------------------------------------
#  Information commands
# -------------------------------------------------------------------------------------

GetAccountUsage	40	Command(AccountUsage)
	# no data members

AccountUsage	41	Reply
	int64	BlocksUsed
	int64	BlocksInOldFiles
	int64	BlocksInDeletedFiles
	int64	BlocksInDirectories
	int64	BlocksSoftLimit
	int64	BlocksHardLimit
	int32	BlockSize

GetIsAlive	42	Command(IsAlive)
	# no data members

IsAlive	43	Reply
	# no data members