• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8
9package 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.
14enum 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  ERROR_COPY_PENDING = 51;
40  ERROR_COPY_FAILED = 52;
41  ERROR_SMB1_UNSUPPORTED = 53;
42  ERROR_OPERATION_PENDING = 54;
43  ERROR_OPERATION_FAILED = 55;
44}
45
46message DirectoryEntryProto {
47  optional bool is_directory = 1;
48  optional string name = 2;
49  // Size in bytes.
50  optional int64 size = 3;
51  // Seconds since unix epoch.
52  optional int64 last_modified_time = 4;
53}
54
55// DirectoryEntryListProto is included in responses to ReadDirectory D-Bus
56// method calls.
57message DirectoryEntryListProto { repeated DirectoryEntryProto entries = 1; }
58
59// Used for passing inputs into SmbProvider.Mount().
60message MountOptionsProto {
61  // Path of the share to be mounted. (e.g. "smb://qnap/testshare")
62  optional string path = 1;
63
64  // Authentication parameters.
65  optional string workgroup = 2;
66  optional string username = 3;
67
68  // Mount options set by the client.
69  optional MountConfigProto mount_config = 4;
70}
71
72message MountConfigProto {
73  // Boolean indication whether or not to enable NTLM protocol. False
74  // disables the NTLM protocol.
75  optional bool enable_ntlm = 1;
76}
77
78// Used for passing inputs into SmbProvider.Unmount().
79message UnmountOptionsProto {
80  // ID of the mount returned from Mount().
81  optional int32 mount_id = 1;
82}
83
84// Used for passing inputs into SmbProvider.ReadDirectory().
85message ReadDirectoryOptionsProto {
86  // ID of the mount returned from Mount().
87  optional int32 mount_id = 1;
88  // Path of the directory to be read. The paths are relative to the mount root.
89  // (e.g. "/testfolder")
90  optional string directory_path = 2;
91}
92
93// Used for passing inputs into SmbProvider.GetMetadataEntry().
94message GetMetadataEntryOptionsProto {
95  // ID of the mount returned from Mount().
96  optional int32 mount_id = 1;
97  // Path of the entry to be read. This can be a file or directory path.
98  // The paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
99  optional string entry_path = 2;
100}
101
102// Used for passing inputs into SmbProvider.OpenFile().
103message OpenFileOptionsProto {
104  // ID of the mount returned from Mount().
105  optional int32 mount_id = 1;
106  // Path of the file to be opened. This must be a file path.
107  // Paths are relative to the mount root, e.g. "/animals/dog.jpg".
108  optional string file_path = 2;
109  // Boolean indicating write status. False indicates read only.
110  optional bool writeable = 3;
111}
112
113// Used for passing inputs into SmbProvider.CloseFile().
114message CloseFileOptionsProto {
115  // ID of the mount returned from Mount().
116  optional int32 mount_id = 1;
117  // ID of the file returned from OpenFile().
118  optional int32 file_id = 2;
119}
120
121// Used for passing inputs into SmbProvider.ReadFile().
122message ReadFileOptionsProto {
123  // ID of the mount returned from Mount().
124  optional int32 mount_id = 1;
125  // ID of the file returned from OpenFile().
126  optional int32 file_id = 2;
127  // Offset of the file to be read.
128  optional int64 offset = 3;
129  // Length in bytes to be read.
130  optional int32 length = 4;
131}
132
133// Used for passing inputs into SmbProvider.DeleteEntry().
134message DeleteEntryOptionsProto {
135  // ID of the mount returned from Mount().
136  optional int32 mount_id = 1;
137  // Path of the entry to be deleted. This can be a file or directory path.
138  // The paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
139  optional string entry_path = 2;
140  // Boolean indicating whether the delete should be recursive for directories.
141  optional bool recursive = 3;
142}
143
144// Used for passing inputs into SmbProvider.CreateFile().
145message CreateFileOptionsProto {
146  // ID of the mount returned from Mount().
147  optional int32 mount_id = 1;
148  // Path of the file to be created. Paths are relative to the mount root,
149  // e.g. "/animals/dog.jpg".
150  optional string file_path = 2;
151}
152
153// Used for passing inputs into SmbProvider.Truncate().
154message TruncateOptionsProto {
155  // ID of the mount returned from Mount().
156  optional int32 mount_id = 1;
157  // Path of the file to be truncated. Paths are relative to the mount root,
158  // e.g. "/animals/dog.jpg".
159  optional string file_path = 2;
160  // New desired length of the file.
161  optional int64 length = 3;
162}
163
164// Used for passing inputs into SmbProvider.WriteFile().
165message WriteFileOptionsProto {
166  // ID of the mount returned from Mount().
167  optional int32 mount_id = 1;
168  // ID of the file returned from OpenFile().
169  optional int32 file_id = 2;
170  // Offset of the file for the write.
171  optional int64 offset = 3;
172  // Length of data being written.
173  optional int32 length = 4;
174}
175
176// Used for passing inputs into SmbProvider.CreateDirectory().
177message CreateDirectoryOptionsProto {
178  // ID of the mount returned from Mount().
179  optional int32 mount_id = 1;
180  // Path of the directory to be created. Paths are relative to the mount root.
181  // (e.g. "/testfolder/dogs")
182  optional string directory_path = 2;
183  // Boolean indicating whether the create should be recursive, meaning the
184  // parent directories will also be created if they currently don't exist.
185  optional bool recursive = 3;
186}
187
188// Used for passing inputs into SmbProvider.MoveEntry().
189message MoveEntryOptionsProto {
190  // ID of the mount returned from Mount().
191  optional int32 mount_id = 1;
192  // Source path of the entry to be moved. This can be a file or directory path.
193  // Paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
194  optional string source_path = 2;
195  // Destination path for the entry to be moved to. This must be a non-existent
196  // file or directory path. Paths are relative to the mount
197  // root. (e.g. "/testfolder/dog.jpg")
198  optional string target_path = 3;
199}
200
201// Used for passing inputs into SmbProvider.CopyEntry().
202message CopyEntryOptionsProto {
203  // ID of the mount returned from Mount().
204  optional int32 mount_id = 1;
205  // Source path of the entry to be copied. This can be a file or directory
206  // path. Paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
207  optional string source_path = 2;
208  // Destination path for the entry to be copied to. This must be a non-existent
209  // file or directory path. Paths are relative to the mount root.
210  // (e.g. "/testfolder/dog.jpg")
211  optional string target_path = 3;
212}
213
214message GetDeleteListOptionsProto {
215  optional int32 mount_id = 1;
216  optional string entry_path = 2;
217}
218
219message DeleteListProto {
220  repeated string entries = 1;
221}
222
223// Used for passing inputs into SmbProvider.GetShares().
224message GetSharesOptionsProto {
225  // Url of the server containing the shares. (e.g. "smb://192.168.0.1")
226  optional string server_url = 1;
227}
228
229// Used for passing inputs into SmbProvider.Remount().
230message RemountOptionsProto {
231  // Path of the share to be remounted. (e.g. "smb://192.168.0.1/testshare")
232  optional string path = 1;
233  // ID to assign to the mount.
234  optional int32 mount_id = 2;
235
236  // Authentication parameters.
237  optional string workgroup = 3;
238  optional string username = 4;
239}
240
241// Used for returning a list of hostnames from a parsed NetBios response packet.
242message HostnamesProto {
243  repeated string hostnames = 1;
244}