1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 syntax = "proto2"; 6 7 option optimize_for = LITE_RUNTIME; 8 9 package smbprovider; 10 11 // ErrorType matches 1:1 to FileSystemProvider#ProviderError in Chromium up 12 // until ERROR_PROVIDER_ERROR_COUNT. The ErrorTypes past that are specific to 13 // SmbProvider. 14 enum ErrorType { 15 ERROR_NONE = 0; 16 ERROR_OK = 1; 17 ERROR_FAILED = 2; 18 ERROR_IN_USE = 3; 19 ERROR_EXISTS = 4; 20 ERROR_NOT_FOUND = 5; 21 ERROR_ACCESS_DENIED = 6; 22 ERROR_TOO_MANY_OPENED = 7; 23 ERROR_NO_MEMORY = 8; 24 ERROR_NO_SPACE = 9; 25 ERROR_NOT_A_DIRECTORY = 10; 26 ERROR_INVALID_OPERATION = 11; 27 ERROR_SECURITY = 12; 28 ERROR_ABORT = 13; 29 ERROR_NOT_A_FILE = 14; 30 ERROR_NOT_EMPTY = 15; 31 ERROR_INVALID_URL = 16; 32 ERROR_IO = 17; 33 // Count of ProviderError. 34 ERROR_PROVIDER_ERROR_COUNT = 18; 35 // The following errors are not ProviderErrors, instead they are specific to 36 // SmbProvider. The jump in int value is to account for possible future 37 // additions to ProviderError. 38 ERROR_DBUS_PARSE_FAILED = 50; 39 } 40 41 message DirectoryEntryProto { 42 optional bool is_directory = 1; 43 optional string name = 2; 44 // Size in bytes. 45 optional int64 size = 3; 46 // Seconds since unix epoch. 47 optional int64 last_modified_time = 4; 48 } 49 50 // DirectoryEntryListProto is included in responses to ReadDirectory D-Bus 51 // method calls. 52 message DirectoryEntryListProto { repeated DirectoryEntryProto entries = 1; } 53 54 // Used for passing inputs into SmbProvider.Mount(). 55 message MountOptionsProto { 56 // Path of the share to be mounted. (e.g. "smb://qnap/testshare") 57 optional string path = 1; 58 } 59 60 // Used for passing inputs into SmbProvider.Unmount(). 61 message UnmountOptionsProto { 62 // ID of the mount returned from Mount(). 63 optional int32 mount_id = 1; 64 } 65 66 // Used for passing inputs into SmbProvider.ReadDirectory(). 67 message ReadDirectoryOptionsProto { 68 // ID of the mount returned from Mount(). 69 optional int32 mount_id = 1; 70 // Path of the directory to be read. The paths are relative to the mount root. 71 // (e.g. "/testfolder") 72 optional string directory_path = 2; 73 } 74 75 // Used for passing inputs into SmbProvider.GetMetadataEntry(). 76 message GetMetadataEntryOptionsProto { 77 // ID of the mount returned from Mount(). 78 optional int32 mount_id = 1; 79 // Path of the entry to be read. This can be a file or directory path. 80 // The paths are relative to the mount root. (e.g. "/testfolder/dog.jpg") 81 optional string entry_path = 2; 82 } 83 84 // Used for passing inputs into SmbProvider.OpenFile(). 85 message OpenFileOptionsProto { 86 // ID of the mount returned from Mount(). 87 optional int32 mount_id = 1; 88 // Path of the file to be opened. This must be a file path. 89 // Paths are relative to the mount root, e.g. "/animals/dog.jpg". 90 optional string file_path = 2; 91 // Boolean indicating write status. False indicates read only. 92 optional bool writeable = 3; 93 } 94 95 // Used for passing inputs into SmbProvider.CloseFile(). 96 message CloseFileOptionsProto { 97 // ID of the mount returned from Mount(). 98 optional int32 mount_id = 1; 99 // ID of the file returned from OpenFile(). 100 optional int32 file_id = 2; 101 } 102 103 // Used for passing inputs into SmbProvider.ReadFile(). 104 message ReadFileOptionsProto { 105 // ID of the mount returned from Mount(). 106 optional int32 mount_id = 1; 107 // ID of the file returned from OpenFile(). 108 optional int32 file_id = 2; 109 // Offset of the file to be read. 110 optional int64 offset = 3; 111 // Length in bytes to be read. 112 optional int32 length = 4; 113 } 114 115 // Used for passing inputs into SmbProvider.DeleteEntry(). 116 message DeleteEntryOptionsProto { 117 // ID of the mount returned from Mount(). 118 optional int32 mount_id = 1; 119 // Path of the entry to be deleted. This can be a file or directory path. 120 // The paths are relative to the mount root. (e.g. "/testfolder/dog.jpg") 121 optional string entry_path = 2; 122 // Boolean indicating whether the delete should be recursive for directories. 123 optional bool recursive = 3; 124 } 125 126 // Used for passing inputs into SmbProvider.CreateFile(). 127 message CreateFileOptionsProto { 128 // ID of the mount returned from Mount(). 129 optional int32 mount_id = 1; 130 // Path of the file to be created. Paths are relative to the mount root, 131 // e.g. "/animals/dog.jpg". 132 optional string file_path = 2; 133 } 134 135 // Used for passing inputs into SmbProvider.Truncate(). 136 message TruncateOptionsProto { 137 // ID of the mount returned from Mount(). 138 optional int32 mount_id = 1; 139 // Path of the file to be truncated. Paths are relative to the mount root, 140 // e.g. "/animals/dog.jpg". 141 optional string file_path = 2; 142 // New desired length of the file. 143 optional int64 length = 3; 144 } 145 146 // Used for passing inputs into SmbProvider.WriteFile(). 147 message WriteFileOptionsProto { 148 // ID of the mount returned from Mount(). 149 optional int32 mount_id = 1; 150 // ID of the file returned from OpenFile(). 151 optional int32 file_id = 2; 152 // Offset of the file for the write. 153 optional int64 offset = 3; 154 // Length of data being written. 155 optional int32 length = 4; 156 } 157 158 // Used for passing inputs into SmbProvider.CreateDirectory(). 159 message CreateDirectoryOptionsProto { 160 // ID of the mount returned from Mount(). 161 optional int32 mount_id = 1; 162 // Path of the directory to be created. Paths are relative to the mount root. 163 // (e.g. "/testfolder/dogs") 164 optional string directory_path = 2; 165 // Boolean indicating whether the create should be recursive, meaning the 166 // parent directories will also be created if they currently don't exist. 167 optional bool recursive = 3; 168 } 169 170 // Used for passing inputs into SmbProvider.MoveEntry(). 171 message MoveEntryOptionsProto { 172 // ID of the mount returned from Mount(). 173 optional int32 mount_id = 1; 174 // Source path of the entry to be moved. This can be a file or directory path. 175 // Paths are relative to the mount root. (e.g. "/testfolder/dog.jpg") 176 optional string source_path = 2; 177 // Destination path for the entry to be moved to. This must be a non-existent 178 // file or directory path. Paths are relative to the mount 179 // root. (e.g. "/testfolder/dog.jpg") 180 optional string target_path = 3; 181 } 182 183 // Used for passing inputs into SmbProvider.CopyEntry(). 184 message CopyEntryOptionsProto { 185 // ID of the mount returned from Mount(). 186 optional int32 mount_id = 1; 187 // Source path of the entry to be copied. This can be a file or directory 188 // path. Paths are relative to the mount root. (e.g. "/testfolder/dog.jpg") 189 optional string source_path = 2; 190 // Destination path for the entry to be copied to. This must be a non-existent 191 // file or directory path. Paths are relative to the mount root. 192 // (e.g. "/testfolder/dog.jpg") 193 optional string target_path = 3; 194 }