-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_samba_proxy.cc
120 lines (93 loc) · 4.14 KB
/
fake_samba_proxy.cc
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
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "smbprovider/fake_samba_proxy.h"
#include <utility>
#include <base/logging.h>
namespace smbprovider {
SambaInterface::SambaInterfaceId FakeSambaProxy::count_ = 0;
FakeSambaProxy::FakeSambaProxy(FakeSambaInterface* fake_samba_interface)
: fake_samba_interface_(fake_samba_interface) {
DCHECK(fake_samba_interface_);
}
int32_t FakeSambaProxy::OpenDirectory(const std::string& directory_path,
int32_t* dir_id) {
return fake_samba_interface_->OpenDirectory(directory_path, dir_id);
}
int32_t FakeSambaProxy::CloseDirectory(int32_t dir_id) {
return fake_samba_interface_->CloseDirectory(dir_id);
}
int32_t FakeSambaProxy::GetDirectoryEntry(int32_t dir_id,
const struct smbc_dirent** dirent) {
return fake_samba_interface_->GetDirectoryEntry(dir_id, dirent);
}
int32_t FakeSambaProxy::GetDirectoryEntryWithMetadata(
int32_t dir_id, const struct libsmb_file_info** file_info) {
return fake_samba_interface_->GetDirectoryEntryWithMetadata(dir_id,
file_info);
}
int32_t FakeSambaProxy::GetEntryStatus(const std::string& entry_path,
struct stat* stat) {
return fake_samba_interface_->GetEntryStatus(entry_path, stat);
}
SambaInterface::SambaInterfaceId FakeSambaProxy::GetSambaInterfaceId() {
return samba_interface_id_;
}
SambaInterface::WeakPtr FakeSambaProxy::AsWeakPtr() {
return weak_factory_.GetWeakPtr();
}
int32_t FakeSambaProxy::OpenFile(const std::string& file_path,
int32_t flags,
int32_t* file_id) {
return fake_samba_interface_->OpenFile(file_path, flags, file_id);
}
int32_t FakeSambaProxy::CloseFile(int32_t file_id) {
return fake_samba_interface_->CloseFile(file_id);
}
int32_t FakeSambaProxy::ReadFile(int32_t file_id,
uint8_t* buffer,
size_t buffer_size,
size_t* bytes_read) {
return fake_samba_interface_->ReadFile(file_id, buffer, buffer_size,
bytes_read);
}
int32_t FakeSambaProxy::Seek(int32_t file_id, int64_t offset) {
return fake_samba_interface_->Seek(file_id, offset);
}
int32_t FakeSambaProxy::Unlink(const std::string& file_path) {
return fake_samba_interface_->Unlink(file_path);
}
int32_t FakeSambaProxy::RemoveDirectory(const std::string& dir_path) {
return fake_samba_interface_->RemoveDirectory(dir_path);
}
int32_t FakeSambaProxy::CreateFile(const std::string& file_path,
int32_t* file_id) {
return fake_samba_interface_->CreateFile(file_path, file_id);
}
int32_t FakeSambaProxy::Truncate(int32_t file_id, size_t size) {
return fake_samba_interface_->Truncate(file_id, size);
}
int32_t FakeSambaProxy::WriteFile(int32_t file_id,
const uint8_t* buffer,
size_t buffer_size) {
return fake_samba_interface_->WriteFile(file_id, buffer, buffer_size);
}
int32_t FakeSambaProxy::CreateDirectory(const std::string& directory_path) {
return fake_samba_interface_->CreateDirectory(directory_path);
}
int32_t FakeSambaProxy::MoveEntry(const std::string& source_path,
const std::string& target_path) {
return fake_samba_interface_->MoveEntry(source_path, target_path);
}
int32_t FakeSambaProxy::CopyFile(const std::string& source_path,
const std::string& target_path) {
return fake_samba_interface_->CopyFile(source_path, target_path);
}
int32_t FakeSambaProxy::SpliceFile(int32_t source_fd,
int32_t target_fd,
off_t length,
off_t* bytes_written) {
return fake_samba_interface_->SpliceFile(source_fd, target_fd, length,
bytes_written);
}
} // namespace smbprovider