aboutsummaryrefslogtreecommitdiff
path: root/dbus/smbprovider/directory_entry.proto
blob: 6a6ffa5d8efc466b765552db94c27f15b4986e9d (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
229
230
231
232
233
234
235
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package smbprovider;

// ErrorType matches 1:1 to FileSystemProvider#ProviderError in Chromium up
// until ERROR_PROVIDER_ERROR_COUNT. The ErrorTypes past that are specific to
// SmbProvider.
enum ErrorType {
  ERROR_NONE = 0;
  ERROR_OK = 1;
  ERROR_FAILED = 2;
  ERROR_IN_USE = 3;
  ERROR_EXISTS = 4;
  ERROR_NOT_FOUND = 5;
  ERROR_ACCESS_DENIED = 6;
  ERROR_TOO_MANY_OPENED = 7;
  ERROR_NO_MEMORY = 8;
  ERROR_NO_SPACE = 9;
  ERROR_NOT_A_DIRECTORY = 10;
  ERROR_INVALID_OPERATION = 11;
  ERROR_SECURITY = 12;
  ERROR_ABORT = 13;
  ERROR_NOT_A_FILE = 14;
  ERROR_NOT_EMPTY = 15;
  ERROR_INVALID_URL = 16;
  ERROR_IO = 17;
  // Count of ProviderError.
  ERROR_PROVIDER_ERROR_COUNT = 18;
  // The following errors are not ProviderErrors, instead they are specific to
  // SmbProvider. The jump in int value is to account for possible future
  // additions to ProviderError.
  ERROR_DBUS_PARSE_FAILED = 50;
  ERROR_COPY_PENDING = 51;
  ERROR_COPY_FAILED = 52;
  ERROR_SMB1_UNSUPPORTED = 53;
  ERROR_OPERATION_PENDING = 54;
  ERROR_OPERATION_FAILED = 55;
}

message DirectoryEntryProto {
  optional bool is_directory = 1;
  optional string name = 2;
  // Size in bytes.
  optional int64 size = 3;
  // Seconds since unix epoch.
  optional int64 last_modified_time = 4;
}

// DirectoryEntryListProto is included in responses to ReadDirectory D-Bus
// method calls.
message DirectoryEntryListProto { repeated DirectoryEntryProto entries = 1; }

// Used for passing inputs into SmbProvider.Mount().
message MountOptionsProto {
  // Path of the share to be mounted. (e.g. "smb://qnap/testshare")
  optional string path = 1;

  // Authentication parameters.
  optional string workgroup = 2;
  optional string username = 3;
}

// Used for passing inputs into SmbProvider.Unmount().
message UnmountOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
}

// Used for passing inputs into SmbProvider.ReadDirectory().
message ReadDirectoryOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Path of the directory to be read. The paths are relative to the mount root.
  // (e.g. "/testfolder")
  optional string directory_path = 2;
}

// Used for passing inputs into SmbProvider.GetMetadataEntry().
message GetMetadataEntryOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Path of the entry to be read. This can be a file or directory path.
  // The paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
  optional string entry_path = 2;
}

// Used for passing inputs into SmbProvider.OpenFile().
message OpenFileOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Path of the file to be opened. This must be a file path.
  // Paths are relative to the mount root, e.g. "/animals/dog.jpg".
  optional string file_path = 2;
  // Boolean indicating write status. False indicates read only.
  optional bool writeable = 3;
}

// Used for passing inputs into SmbProvider.CloseFile().
message CloseFileOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // ID of the file returned from OpenFile().
  optional int32 file_id = 2;
}

// Used for passing inputs into SmbProvider.ReadFile().
message ReadFileOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // ID of the file returned from OpenFile().
  optional int32 file_id = 2;
  // Offset of the file to be read.
  optional int64 offset = 3;
  // Length in bytes to be read.
  optional int32 length = 4;
}

// Used for passing inputs into SmbProvider.DeleteEntry().
message DeleteEntryOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Path of the entry to be deleted. This can be a file or directory path.
  // The paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
  optional string entry_path = 2;
  // Boolean indicating whether the delete should be recursive for directories.
  optional bool recursive = 3;
}

// Used for passing inputs into SmbProvider.CreateFile().
message CreateFileOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Path of the file to be created. Paths are relative to the mount root,
  // e.g. "/animals/dog.jpg".
  optional string file_path = 2;
}

// Used for passing inputs into SmbProvider.Truncate().
message TruncateOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Path of the file to be truncated. Paths are relative to the mount root,
  // e.g. "/animals/dog.jpg".
  optional string file_path = 2;
  // New desired length of the file.
  optional int64 length = 3;
}

// Used for passing inputs into SmbProvider.WriteFile().
message WriteFileOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // ID of the file returned from OpenFile().
  optional int32 file_id = 2;
  // Offset of the file for the write.
  optional int64 offset = 3;
  // Length of data being written.
  optional int32 length = 4;
}

// Used for passing inputs into SmbProvider.CreateDirectory().
message CreateDirectoryOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Path of the directory to be created. Paths are relative to the mount root.
  // (e.g. "/testfolder/dogs")
  optional string directory_path = 2;
  // Boolean indicating whether the create should be recursive, meaning the
  // parent directories will also be created if they currently don't exist.
  optional bool recursive = 3;
}

// Used for passing inputs into SmbProvider.MoveEntry().
message MoveEntryOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Source path of the entry to be moved. This can be a file or directory path.
  // Paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
  optional string source_path = 2;
  // Destination path for the entry to be moved to. This must be a non-existent
  // file or directory path. Paths are relative to the mount
  // root. (e.g. "/testfolder/dog.jpg")
  optional string target_path = 3;
}

// Used for passing inputs into SmbProvider.CopyEntry().
message CopyEntryOptionsProto {
  // ID of the mount returned from Mount().
  optional int32 mount_id = 1;
  // Source path of the entry to be copied. This can be a file or directory
  // path. Paths are relative to the mount root. (e.g. "/testfolder/dog.jpg")
  optional string source_path = 2;
  // Destination path for the entry to be copied to. This must be a non-existent
  // file or directory path. Paths are relative to the mount root.
  // (e.g. "/testfolder/dog.jpg")
  optional string target_path = 3;
}

message GetDeleteListOptionsProto {
  optional int32 mount_id = 1;
  optional string entry_path = 2;
}

message DeleteListProto {
  repeated string entries = 1;
}

// Used for passing inputs into SmbProvider.GetShares().
message GetSharesOptionsProto {
  // Url of the server containing the shares. (e.g. "smb://192.168.0.1")
  optional string server_url = 1;
}

// Used for passing inputs into SmbProvider.Remount().
message RemountOptionsProto {
  // Path of the share to be remounted. (e.g. "smb://192.168.0.1/testshare")
  optional string path = 1;
  // ID to assign to the mount.
  optional int32 mount_id = 2;

  // Authentication parameters.
  optional string workgroup = 3;
  optional string username = 4;
}

// Used for returning a list of hostnames from a parsed NetBios response packet.
message HostnamesProto {
  repeated string hostnames = 1;
}