| 1 | # |
|---|
| 2 | # backup protocol definition |
|---|
| 3 | # |
|---|
| 4 | |
|---|
| 5 | Name Backup |
|---|
| 6 | IdentString Box-Backup:v=C |
|---|
| 7 | ServerContextClass BackupStoreContext BackupStoreContext.h |
|---|
| 8 | |
|---|
| 9 | AddType Filename BackupStoreFilenameClear BackupStoreFilenameClear.h |
|---|
| 10 | |
|---|
| 11 | ImplementLog Server syslog |
|---|
| 12 | ImplementLog Client syslog |
|---|
| 13 | ImplementLog Client file |
|---|
| 14 | |
|---|
| 15 | LogTypeToText Filename "%s" VAR.GetClearFilenameIfPossible("OPAQUE").c_str() |
|---|
| 16 | |
|---|
| 17 | BEGIN_OBJECTS |
|---|
| 18 | |
|---|
| 19 | # ------------------------------------------------------------------------------------- |
|---|
| 20 | # Session commands |
|---|
| 21 | # ------------------------------------------------------------------------------------- |
|---|
| 22 | |
|---|
| 23 | Error 0 IsError(Type,SubType) Reply |
|---|
| 24 | int32 Type |
|---|
| 25 | int32 SubType |
|---|
| 26 | CONSTANT ErrorType 1000 |
|---|
| 27 | CONSTANT Err_WrongVersion 1 |
|---|
| 28 | CONSTANT Err_NotInRightProtocolPhase 2 |
|---|
| 29 | CONSTANT Err_BadLogin 3 |
|---|
| 30 | CONSTANT Err_CannotLockStoreForWriting 4 |
|---|
| 31 | CONSTANT Err_SessionReadOnly 5 |
|---|
| 32 | CONSTANT Err_FileDoesNotVerify 6 |
|---|
| 33 | CONSTANT Err_DoesNotExist 7 |
|---|
| 34 | CONSTANT Err_DirectoryAlreadyExists 8 |
|---|
| 35 | CONSTANT Err_CannotDeleteRoot 9 |
|---|
| 36 | CONSTANT Err_TargetNameExists 10 |
|---|
| 37 | CONSTANT Err_StorageLimitExceeded 11 |
|---|
| 38 | CONSTANT Err_DiffFromFileDoesNotExist 12 |
|---|
| 39 | CONSTANT Err_DoesNotExistInDirectory 13 |
|---|
| 40 | CONSTANT Err_PatchConsistencyError 14 |
|---|
| 41 | CONSTANT Err_MultiplyReferencedObject 15 |
|---|
| 42 | |
|---|
| 43 | Version 1 Command(Version) Reply |
|---|
| 44 | int32 Version |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | Login 2 Command(LoginConfirmed) |
|---|
| 48 | int32 ClientID |
|---|
| 49 | int32 Flags |
|---|
| 50 | CONSTANT Flags_ReadOnly 1 |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | LoginConfirmed 3 Reply |
|---|
| 54 | int64 ClientStoreMarker |
|---|
| 55 | int64 BlocksUsed |
|---|
| 56 | int64 BlocksSoftLimit |
|---|
| 57 | int64 BlocksHardLimit |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | Finished 4 Command(Finished) Reply EndsConversation |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | # generic success object |
|---|
| 64 | Success 5 Reply |
|---|
| 65 | int64 ObjectID |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | SetClientStoreMarker 6 Command(Success) |
|---|
| 69 | int64 ClientStoreMarker |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | # ------------------------------------------------------------------------------------- |
|---|
| 73 | # Generic object commands |
|---|
| 74 | # ------------------------------------------------------------------------------------- |
|---|
| 75 | |
|---|
| 76 | GetObject 10 Command(Success) |
|---|
| 77 | int64 ObjectID |
|---|
| 78 | CONSTANT NoObject 0 |
|---|
| 79 | # reply has stream following, if ObjectID != NoObject |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | MoveObject 11 Command(Success) |
|---|
| 83 | int64 ObjectID |
|---|
| 84 | int64 MoveFromDirectory |
|---|
| 85 | int64 MoveToDirectory |
|---|
| 86 | int32 Flags |
|---|
| 87 | Filename NewFilename |
|---|
| 88 | |
|---|
| 89 | CONSTANT Flags_MoveAllWithSameName 1 |
|---|
| 90 | CONSTANT Flags_AllowMoveOverDeletedObject 2 |
|---|
| 91 | |
|---|
| 92 | # consider this an object command as, although it deals with directory entries, |
|---|
| 93 | # it's not specific to either a file or a directory |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | GetObjectName 12 Command(ObjectName) |
|---|
| 97 | int64 ObjectID |
|---|
| 98 | int64 ContainingDirectoryID |
|---|
| 99 | CONSTANT ObjectID_DirectoryOnly 0 |
|---|
| 100 | |
|---|
| 101 | # set ObjectID to ObjectID_DirectoryOnly to only get info on the directory |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | ObjectName 13 Reply |
|---|
| 105 | int32 NumNameElements |
|---|
| 106 | int64 ModificationTime |
|---|
| 107 | int64 AttributesHash |
|---|
| 108 | int16 Flags |
|---|
| 109 | # NumNameElements is zero if the object doesn't exist |
|---|
| 110 | CONSTANT NumNameElements_ObjectDoesntExist 0 |
|---|
| 111 | # a stream of Filename objects follows, if and only if NumNameElements > 0 |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | # ------------------------------------------------------------------------------------- |
|---|
| 115 | # Directory commands |
|---|
| 116 | # ------------------------------------------------------------------------------------- |
|---|
| 117 | |
|---|
| 118 | CreateDirectory 20 Command(Success) StreamWithCommand |
|---|
| 119 | int64 ContainingDirectoryID |
|---|
| 120 | int64 AttributesModTime |
|---|
| 121 | Filename DirectoryName |
|---|
| 122 | # stream following containing attributes |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | ListDirectory 21 Command(Success) |
|---|
| 126 | int64 ObjectID |
|---|
| 127 | int16 FlagsMustBeSet |
|---|
| 128 | int16 FlagsNotToBeSet |
|---|
| 129 | bool SendAttributes |
|---|
| 130 | # make sure these flags are synced with those in BackupStoreDirectory |
|---|
| 131 | CONSTANT Flags_INCLUDE_EVERYTHING -1 |
|---|
| 132 | CONSTANT Flags_EXCLUDE_NOTHING 0 |
|---|
| 133 | CONSTANT Flags_EXCLUDE_EVERYTHING 15 |
|---|
| 134 | CONSTANT Flags_File 1 |
|---|
| 135 | CONSTANT Flags_Dir 2 |
|---|
| 136 | CONSTANT Flags_Deleted 4 |
|---|
| 137 | CONSTANT Flags_OldVersion 8 |
|---|
| 138 | # make sure this is the same as in BackupStoreConstants.h |
|---|
| 139 | CONSTANT RootDirectory 1 |
|---|
| 140 | |
|---|
| 141 | # reply has stream following Success object, containing a stored BackupStoreDirectory |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | ChangeDirAttributes 22 Command(Success) StreamWithCommand |
|---|
| 145 | int64 ObjectID |
|---|
| 146 | int64 AttributesModTime |
|---|
| 147 | # stream following containing attributes |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | DeleteDirectory 23 Command(Success) |
|---|
| 151 | int64 ObjectID |
|---|
| 152 | |
|---|
| 153 | UndeleteDirectory 24 Command(Success) |
|---|
| 154 | int64 ObjectID |
|---|
| 155 | # may not have exactly the desired effect if files within in have been deleted before the directory was deleted. |
|---|
| 156 | |
|---|
| 157 | |
|---|
| 158 | # ------------------------------------------------------------------------------------- |
|---|
| 159 | # File commands |
|---|
| 160 | # ------------------------------------------------------------------------------------- |
|---|
| 161 | |
|---|
| 162 | StoreFile 30 Command(Success) StreamWithCommand |
|---|
| 163 | int64 DirectoryObjectID |
|---|
| 164 | int64 ModificationTime |
|---|
| 165 | int64 AttributesHash |
|---|
| 166 | int64 DiffFromFileID # 0 if the file is not a diff |
|---|
| 167 | Filename Filename |
|---|
| 168 | # then send a stream containing the encoded file |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | GetFile 31 Command(Success) |
|---|
| 172 | int64 InDirectory |
|---|
| 173 | int64 ObjectID |
|---|
| 174 | # error returned if not a file, or does not exist |
|---|
| 175 | # reply has stream following, containing an encoded file IN STREAM ORDER |
|---|
| 176 | # (use GetObject to get it in file order) |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | SetReplacementFileAttributes 32 Command(Success) StreamWithCommand |
|---|
| 180 | int64 InDirectory |
|---|
| 181 | int64 AttributesHash |
|---|
| 182 | Filename Filename |
|---|
| 183 | # stream follows containing attributes |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | DeleteFile 33 Command(Success) |
|---|
| 187 | int64 InDirectory |
|---|
| 188 | Filename Filename |
|---|
| 189 | # will return 0 if the object couldn't be found in the specified directory |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | GetBlockIndexByID 34 Command(Success) |
|---|
| 193 | int64 ObjectID |
|---|
| 194 | |
|---|
| 195 | # stream of the block index follows the reply |
|---|
| 196 | # returns an error if the object didn't exist |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | GetBlockIndexByName 35 Command(Success) |
|---|
| 200 | int64 InDirectory |
|---|
| 201 | Filename Filename |
|---|
| 202 | |
|---|
| 203 | # Success object contains the found ID -- or 0 if the entry wasn't found in the directory |
|---|
| 204 | # stream of the block index follows the reply if found ID != 0 |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | UndeleteFile 36 Command(Success) |
|---|
| 208 | int64 InDirectory |
|---|
| 209 | int64 ObjectID |
|---|
| 210 | # will return 0 if the object couldn't be found in the specified directory |
|---|
| 211 | |
|---|
| 212 | |
|---|
| 213 | # ------------------------------------------------------------------------------------- |
|---|
| 214 | # Information commands |
|---|
| 215 | # ------------------------------------------------------------------------------------- |
|---|
| 216 | |
|---|
| 217 | GetAccountUsage 40 Command(AccountUsage) |
|---|
| 218 | # no data members |
|---|
| 219 | |
|---|
| 220 | AccountUsage 41 Reply |
|---|
| 221 | int64 BlocksUsed |
|---|
| 222 | int64 BlocksInOldFiles |
|---|
| 223 | int64 BlocksInDeletedFiles |
|---|
| 224 | int64 BlocksInDirectories |
|---|
| 225 | int64 BlocksSoftLimit |
|---|
| 226 | int64 BlocksHardLimit |
|---|
| 227 | int32 BlockSize |
|---|
| 228 | |
|---|
| 229 | GetIsAlive 42 Command(IsAlive) |
|---|
| 230 | # no data members |
|---|
| 231 | |
|---|
| 232 | IsAlive 43 Reply |
|---|
| 233 | # no data members |
|---|
| 234 | |
|---|