Merge "delta_generator: Add --out_metadata_size_file flag."
diff --git a/Android.mk b/Android.mk
index a1edf1c..45fa10f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -97,29 +97,32 @@
LOCAL_MODULE := libupdate_engine
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_C_INCLUDES += \
- external/e2fsprogs/lib \
- $(LOCAL_PATH)/include
+ $(LOCAL_PATH)/include \
+ external/cros/system_api/dbus \
+ external/e2fsprogs/lib
LOCAL_EXPORT_C_INCLUDE_DIRS += \
- $(LOCAL_PATH)/include
+ $(LOCAL_PATH)/include \
+ external/cros/system_api/dbus
LOCAL_STATIC_LIBRARIES += \
update_metadata-protos \
update_engine-dbus-adaptor \
update_engine-dbus-libcros-client \
update_engine_client-dbus-proxies \
+ libxz \
libbz \
- libfs_mgr \
- libxz
+ libfs_mgr
LOCAL_SHARED_LIBRARIES += \
libprotobuf-cpp-lite-rtti \
libdbus \
libcrypto \
libcurl \
- libcutils \
- libhardware \
libmetrics \
+ libshill-client \
libssl \
libexpat \
- libchromeos-policy
+ libchromeos-policy \
+ libhardware \
+ libcutils
LOCAL_SRC_FILES := \
action_processor.cc \
boot_control_android.cc \
@@ -194,22 +197,23 @@
libupdate_engine \
libbz \
libfs_mgr \
- libxz \
update_metadata-protos \
update_engine-dbus-adaptor \
update_engine-dbus-libcros-client \
- update_engine_client-dbus-proxies
+ update_engine_client-dbus-proxies \
+ libxz
LOCAL_SHARED_LIBRARIES += \
libprotobuf-cpp-lite-rtti \
libdbus \
libcrypto \
libcurl \
- libcutils \
- libhardware \
libmetrics \
+ libshill-client \
libssl \
libexpat \
- libchromeos-policy
+ libchromeos-policy \
+ libhardware \
+ libcutils
LOCAL_SRC_FILES := \
main.cc
LOCAL_INIT_RC := update_engine.rc
@@ -242,20 +246,23 @@
libupdate_engine \
libbz \
libfs_mgr \
- libxz \
update_metadata-protos \
update_engine-dbus-adaptor \
update_engine-dbus-libcros-client \
update_engine_client-dbus-proxies \
+ libxz \
update_metadata-protos
LOCAL_SHARED_LIBRARIES += \
libdbus \
libcrypto \
libcurl \
libmetrics \
+ libshill-client \
libssl \
libexpat \
libchromeos-policy \
+ libhardware \
+ libcutils \
libprotobuf-cpp-lite-rtti \
libext2fs
LOCAL_SRC_FILES := \
@@ -293,19 +300,22 @@
libupdate_engine \
libbz \
libfs_mgr \
- libxz \
update_metadata-protos \
update_engine-dbus-adaptor \
update_engine-dbus-libcros-client \
- update_engine_client-dbus-proxies
+ update_engine_client-dbus-proxies \
+ libxz
LOCAL_SHARED_LIBRARIES += \
libdbus \
libcrypto \
libcurl \
libmetrics \
+ libshill-client \
libssl \
libexpat \
libchromeos-policy \
+ libhardware \
+ libcutils \
libprotobuf-cpp-lite-rtti \
libext2fs
LOCAL_SRC_FILES := \
diff --git a/delta_performer.cc b/delta_performer.cc
index 8aff634..df128f3 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -65,7 +65,7 @@
const uint64_t DeltaPerformer::kDeltaMetadataSignatureSizeSize = 4;
const uint64_t DeltaPerformer::kMaxPayloadHeaderSize = 24;
const uint64_t DeltaPerformer::kSupportedMajorPayloadVersion = 1;
-const uint64_t DeltaPerformer::kSupportedMinorPayloadVersion = 2;
+const uint32_t DeltaPerformer::kSupportedMinorPayloadVersion = 2;
const unsigned DeltaPerformer::kProgressLogMaxChunks = 10;
const unsigned DeltaPerformer::kProgressLogTimeoutSeconds = 30;
@@ -109,9 +109,8 @@
// Opens path for read/write. On success returns an open FileDescriptor
// and sets *err to 0. On failure, sets *err to errno and returns nullptr.
-FileDescriptorPtr OpenFile(const char* path, int* err) {
+FileDescriptorPtr OpenFile(const char* path, int mode, int* err) {
FileDescriptorPtr fd = CreateFileDescriptor(path);
- int mode = O_RDWR;
#if USE_MTD
// On NAND devices, we can either read, or write, but not both. So here we
// use O_WRONLY.
@@ -252,58 +251,9 @@
return false;
}
-int DeltaPerformer::Open(const char* path, int flags, mode_t mode) {
- int err;
- fd_ = OpenFile(path, &err);
- if (fd_)
- path_ = path;
- return -err;
-}
-
-bool DeltaPerformer::OpenKernel(const char* kernel_path) {
- int err;
- kernel_fd_ = OpenFile(kernel_path, &err);
- if (kernel_fd_)
- kernel_path_ = kernel_path;
- return static_cast<bool>(kernel_fd_);
-}
-
-bool DeltaPerformer::OpenSourceRootfs(const string& source_path) {
- int err;
- source_fd_ = OpenFile(source_path.c_str(), &err);
- return static_cast<bool>(source_fd_);
-}
-
-bool DeltaPerformer::OpenSourceKernel(const string& source_kernel_path) {
- int err;
- source_kernel_fd_ = OpenFile(source_kernel_path.c_str(), &err);
- return static_cast<bool>(source_kernel_fd_);
-}
-
int DeltaPerformer::Close() {
- int err = 0;
- if (kernel_fd_ && !kernel_fd_->Close()) {
- err = errno;
- PLOG(ERROR) << "Unable to close kernel fd:";
- }
- if (!fd_->Close()) {
- err = errno;
- PLOG(ERROR) << "Unable to close rootfs fd:";
- }
- if (source_fd_ && !source_fd_->Close()) {
- err = errno;
- PLOG(ERROR) << "Unable to close source rootfs fd:";
- }
- if (source_kernel_fd_ && !source_kernel_fd_->Close()) {
- err = errno;
- PLOG(ERROR) << "Unable to close source kernel fd:";
- }
+ int err = -CloseCurrentPartition();
LOG_IF(ERROR, !hash_calculator_.Finalize()) << "Unable to finalize the hash.";
- fd_.reset(); // Set to invalid so that calls to Open() will fail.
- kernel_fd_.reset();
- source_fd_.reset();
- source_kernel_fd_.reset();
- path_ = "";
if (!buffer_.empty()) {
LOG(INFO) << "Discarding " << buffer_.size() << " unused downloaded bytes";
if (err >= 0)
@@ -312,6 +262,61 @@
return -err;
}
+int DeltaPerformer::CloseCurrentPartition() {
+ int err = 0;
+ if (source_fd_ && !source_fd_->Close()) {
+ err = errno;
+ PLOG(ERROR) << "Error closing source partition";
+ if (!err)
+ err = 1;
+ }
+ source_fd_.reset();
+ source_path_.clear();
+
+ if (target_fd_ && !target_fd_->Close()) {
+ err = errno;
+ PLOG(ERROR) << "Error closing target partition";
+ if (!err)
+ err = 1;
+ }
+ target_fd_.reset();
+ target_path_.clear();
+ return -err;
+}
+
+bool DeltaPerformer::OpenCurrentPartition() {
+ if (current_partition_ >= partitions_.size())
+ return false;
+
+ const PartitionUpdate& partition = partitions_[current_partition_];
+ // Open source fds if we have a delta payload with minor version 2.
+ if (!install_plan_->is_full_update &&
+ GetMinorVersion() == kSourceMinorPayloadVersion) {
+ source_path_ = install_plan_->partitions[current_partition_].source_path;
+ int err;
+ source_fd_ = OpenFile(source_path_.c_str(), O_RDONLY, &err);
+ if (!source_fd_) {
+ LOG(ERROR) << "Unable to open source partition "
+ << partition.partition_name() << " on slot "
+ << BootControlInterface::SlotName(install_plan_->source_slot)
+ << ", file " << source_path_;
+ return false;
+ }
+ }
+
+ target_path_ = install_plan_->partitions[current_partition_].target_path;
+ int err;
+ target_fd_ = OpenFile(target_path_.c_str(), O_RDWR, &err);
+ if (!target_fd_) {
+ LOG(ERROR) << "Unable to open target partition "
+ << partition.partition_name() << " on slot "
+ << BootControlInterface::SlotName(install_plan_->target_slot)
+ << ", file " << target_path_;
+ return false;
+ }
+ return true;
+}
+
namespace {
void LogPartitionInfoHash(const PartitionInfo& info, const string& tag) {
@@ -320,15 +325,13 @@
<< " size: " << info.size();
}
-void LogPartitionInfo(const DeltaArchiveManifest& manifest) {
- if (manifest.has_old_kernel_info())
- LogPartitionInfoHash(manifest.old_kernel_info(), "old_kernel_info");
- if (manifest.has_old_rootfs_info())
- LogPartitionInfoHash(manifest.old_rootfs_info(), "old_rootfs_info");
- if (manifest.has_new_kernel_info())
- LogPartitionInfoHash(manifest.new_kernel_info(), "new_kernel_info");
- if (manifest.has_new_rootfs_info())
- LogPartitionInfoHash(manifest.new_rootfs_info(), "new_rootfs_info");
+void LogPartitionInfo(const std::vector<PartitionUpdate>& partitions) {
+ for (const PartitionUpdate& partition : partitions) {
+ LogPartitionInfoHash(partition.old_partition_info(),
+ "old " + partition.partition_name());
+ LogPartitionInfoHash(partition.new_partition_info(),
+ "new " + partition.partition_name());
+ }
}
} // namespace
@@ -560,37 +563,33 @@
// Clear the download buffer.
DiscardBuffer(false);
+
+ // This populates |partitions_| and the |install_plan.partitions| with the
+ // list of partitions from the manifest.
+ if (!ParseManifestPartitions(error))
+ return false;
+
+ num_total_operations_ = 0;
+ for (const auto& partition : partitions_) {
+ num_total_operations_ += partition.operations_size();
+ acc_num_operations_.push_back(num_total_operations_);
+ }
+
LOG_IF(WARNING, !prefs_->SetInt64(kPrefsManifestMetadataSize,
metadata_size_))
<< "Unable to save the manifest metadata size.";
- LogPartitionInfo(manifest_);
if (!PrimeUpdateState()) {
*error = ErrorCode::kDownloadStateInitializationError;
LOG(ERROR) << "Unable to prime the update state.";
return false;
}
- // Open source fds if we have a delta payload with minor version 2.
- if (!install_plan_->is_full_update &&
- GetMinorVersion() == kSourceMinorPayloadVersion) {
- if (!OpenSourceRootfs(install_plan_->source_path)) {
- LOG(ERROR) << "Unable to open source rootfs partition file "
- << install_plan_->source_path;
- Close();
- return false;
- }
- if (!OpenSourceKernel(install_plan_->kernel_source_path)) {
- LOG(ERROR) << "Unable to open source kernel partition file "
- << install_plan_->kernel_source_path;
- Close();
- return false;
- }
+ if (!OpenCurrentPartition()) {
+ *error = ErrorCode::kInstallDeviceOpenError;
+ return false;
}
- num_rootfs_operations_ = manifest_.install_operations_size();
- num_total_operations_ =
- num_rootfs_operations_ + manifest_.kernel_install_operations_size();
if (next_operation_num_ > 0)
UpdateOverallProgress(true, "Resuming after ");
LOG(INFO) << "Starting to apply update payload operations";
@@ -599,17 +598,25 @@
while (next_operation_num_ < num_total_operations_) {
// Check if we should cancel the current attempt for any reason.
// In this case, *error will have already been populated with the reason
- // why we're cancelling.
+ // why we're canceling.
if (system_state_->update_attempter()->ShouldCancel(error))
return false;
- const bool is_kernel_partition =
- (next_operation_num_ >= num_rootfs_operations_);
+ // We know there are more operations to perform because we didn't reach the
+ // |num_total_operations_| limit yet.
+ while (next_operation_num_ >= acc_num_operations_[current_partition_]) {
+ CloseCurrentPartition();
+ current_partition_++;
+ if (!OpenCurrentPartition()) {
+ *error = ErrorCode::kInstallDeviceOpenError;
+ return false;
+ }
+ }
+ const size_t partition_operation_num = next_operation_num_ - (
+ current_partition_ ? acc_num_operations_[current_partition_ - 1] : 0);
+
const InstallOperation& op =
- is_kernel_partition ?
- manifest_.kernel_install_operations(next_operation_num_ -
- num_rootfs_operations_) :
- manifest_.install_operations(next_operation_num_);
+ partitions_[current_partition_].operations(partition_operation_num);
CopyDataToBuffer(&c_bytes, &count, op.data_length());
@@ -649,23 +656,23 @@
case InstallOperation::REPLACE:
case InstallOperation::REPLACE_BZ:
case InstallOperation::REPLACE_XZ:
- op_result = PerformReplaceOperation(op, is_kernel_partition);
+ op_result = PerformReplaceOperation(op);
break;
case InstallOperation::ZERO:
case InstallOperation::DISCARD:
- op_result = PerformZeroOrDiscardOperation(op, is_kernel_partition);
+ op_result = PerformZeroOrDiscardOperation(op);
break;
case InstallOperation::MOVE:
- op_result = PerformMoveOperation(op, is_kernel_partition);
+ op_result = PerformMoveOperation(op);
break;
case InstallOperation::BSDIFF:
- op_result = PerformBsdiffOperation(op, is_kernel_partition);
+ op_result = PerformBsdiffOperation(op);
break;
case InstallOperation::SOURCE_COPY:
- op_result = PerformSourceCopyOperation(op, is_kernel_partition);
+ op_result = PerformSourceCopyOperation(op);
break;
case InstallOperation::SOURCE_BSDIFF:
- op_result = PerformSourceBsdiffOperation(op, is_kernel_partition);
+ op_result = PerformSourceBsdiffOperation(op);
break;
default:
op_result = false;
@@ -684,6 +691,94 @@
return manifest_valid_;
}
+bool DeltaPerformer::ParseManifestPartitions(ErrorCode* error) {
+ if (major_payload_version_ == kBrilloMajorPayloadVersion) {
+ partitions_.clear();
+ for (const PartitionUpdate& partition : manifest_.partitions()) {
+ partitions_.push_back(partition);
+ }
+ manifest_.clear_partitions();
+ } else if (major_payload_version_ == kChromeOSMajorPayloadVersion) {
+ LOG(INFO) << "Converting update information from old format.";
+ PartitionUpdate root_part;
+ root_part.set_partition_name(kLegacyPartitionNameRoot);
+ root_part.set_run_postinstall(true);
+ if (manifest_.has_old_rootfs_info()) {
+ *root_part.mutable_old_partition_info() = manifest_.old_rootfs_info();
+ manifest_.clear_old_rootfs_info();
+ }
+ if (manifest_.has_new_rootfs_info()) {
+ *root_part.mutable_new_partition_info() = manifest_.new_rootfs_info();
+ manifest_.clear_new_rootfs_info();
+ }
+ *root_part.mutable_operations() = manifest_.install_operations();
+ manifest_.clear_install_operations();
+ partitions_.push_back(std::move(root_part));
+
+ PartitionUpdate kern_part;
+ kern_part.set_partition_name(kLegacyPartitionNameKernel);
+ kern_part.set_run_postinstall(false);
+ if (manifest_.has_old_kernel_info()) {
+ *kern_part.mutable_old_partition_info() = manifest_.old_kernel_info();
+ manifest_.clear_old_kernel_info();
+ }
+ if (manifest_.has_new_kernel_info()) {
+ *kern_part.mutable_new_partition_info() = manifest_.new_kernel_info();
+ manifest_.clear_new_kernel_info();
+ }
+ *kern_part.mutable_operations() = manifest_.kernel_install_operations();
+ manifest_.clear_kernel_install_operations();
+ partitions_.push_back(std::move(kern_part));
+ }
+
+ // TODO(deymo): Remove this block of code once we switched to optional
+ // source partition verification. This list of partitions in the InstallPlan
+ // is initialized with the expected hashes in the payload major version 1,
+ // so we need to check those now if already set. See b/23182225.
+ if (!install_plan_->partitions.empty()) {
+ if (!VerifySourcePartitions()) {
+ *error = ErrorCode::kDownloadStateInitializationError;
+ return false;
+ }
+ }
+
+ // Fill in the InstallPlan::partitions based on the partitions from the
+ // payload.
+ install_plan_->partitions.clear();
+ for (const auto& partition : partitions_) {
+ InstallPlan::Partition install_part;
+ install_part.name = partition.partition_name();
+ install_part.run_postinstall =
+ partition.has_run_postinstall() && partition.run_postinstall();
+
+ if (partition.has_old_partition_info()) {
+ const PartitionInfo& info = partition.old_partition_info();
+ install_part.source_size = info.size();
+ install_part.source_hash.assign(info.hash().begin(), info.hash().end());
+ }
+
+ if (!partition.has_new_partition_info()) {
+ LOG(ERROR) << "Unable to get new partition hash info on partition "
+ << install_part.name << ".";
+ *error = ErrorCode::kDownloadNewPartitionInfoError;
+ return false;
+ }
+ const PartitionInfo& info = partition.new_partition_info();
+ install_part.target_size = info.size();
+ install_part.target_hash.assign(info.hash().begin(), info.hash().end());
+
+ install_plan_->partitions.push_back(install_part);
+ }
+
+ if (!install_plan_->LoadPartitionsFromSlots(system_state_)) {
+ LOG(ERROR) << "Unable to determine all the partition devices.";
+ *error = ErrorCode::kInstallDeviceOpenError;
+ return false;
+ }
+ LogPartitionInfo(partitions_);
+ return true;
+}
+
bool DeltaPerformer::CanPerformInstallOperation(
const chromeos_update_engine::InstallOperation& operation) {
// Move and source_copy operations don't require any data blob, so they can
@@ -702,8 +797,8 @@
buffer_offset_ + buffer_.size());
}
-bool DeltaPerformer::PerformReplaceOperation(const InstallOperation& operation,
- bool is_kernel_partition) {
+bool DeltaPerformer::PerformReplaceOperation(
+ const InstallOperation& operation) {
CHECK(operation.type() == InstallOperation::REPLACE ||
operation.type() == InstallOperation::REPLACE_BZ ||
operation.type() == InstallOperation::REPLACE_XZ);
@@ -733,9 +828,7 @@
extents.push_back(operation.dst_extents(i));
}
- FileDescriptorPtr fd = is_kernel_partition ? kernel_fd_ : fd_;
-
- TEST_AND_RETURN_FALSE(writer->Init(fd, extents, block_size_));
+ TEST_AND_RETURN_FALSE(writer->Init(target_fd_, extents, block_size_));
TEST_AND_RETURN_FALSE(writer->Write(buffer_.data(), operation.data_length()));
TEST_AND_RETURN_FALSE(writer->End());
@@ -745,8 +838,7 @@
}
bool DeltaPerformer::PerformZeroOrDiscardOperation(
- const InstallOperation& operation,
- bool is_kernel_partition) {
+ const InstallOperation& operation) {
CHECK(operation.type() == InstallOperation::DISCARD ||
operation.type() == InstallOperation::ZERO);
@@ -757,7 +849,6 @@
int request =
(operation.type() == InstallOperation::ZERO ? BLKZEROOUT : BLKDISCARD);
- FileDescriptorPtr fd = is_kernel_partition ? kernel_fd_ : fd_;
bool attempt_ioctl = true;
chromeos::Blob zeros;
for (int i = 0; i < operation.dst_extents_size(); i++) {
@@ -766,7 +857,7 @@
const uint64_t length = extent.num_blocks() * block_size_;
if (attempt_ioctl) {
int result = 0;
- if (fd->BlkIoctl(request, start, length, &result) && result == 0)
+ if (target_fd_->BlkIoctl(request, start, length, &result) && result == 0)
continue;
attempt_ioctl = false;
zeros.resize(16 * block_size_);
@@ -776,14 +867,13 @@
uint64_t chunk_length = min(length - offset,
static_cast<uint64_t>(zeros.size()));
TEST_AND_RETURN_FALSE(
- utils::PWriteAll(fd, zeros.data(), chunk_length, start + offset));
+ utils::PWriteAll(target_fd_, zeros.data(), chunk_length, start + offset));
}
}
return true;
}
-bool DeltaPerformer::PerformMoveOperation(const InstallOperation& operation,
- bool is_kernel_partition) {
+bool DeltaPerformer::PerformMoveOperation(const InstallOperation& operation) {
// Calculate buffer size. Note, this function doesn't do a sliding
// window to copy in case the source and destination blocks overlap.
// If we wanted to do a sliding window, we could program the server
@@ -800,8 +890,6 @@
DCHECK_EQ(blocks_to_write, blocks_to_read);
chromeos::Blob buf(blocks_to_write * block_size_);
- FileDescriptorPtr fd = is_kernel_partition ? kernel_fd_ : fd_;
-
// Read in bytes.
ssize_t bytes_read = 0;
for (int i = 0; i < operation.src_extents_size(); i++) {
@@ -809,7 +897,7 @@
const Extent& extent = operation.src_extents(i);
const size_t bytes = extent.num_blocks() * block_size_;
TEST_AND_RETURN_FALSE(extent.start_block() != kSparseHole);
- TEST_AND_RETURN_FALSE(utils::PReadAll(fd,
+ TEST_AND_RETURN_FALSE(utils::PReadAll(target_fd_,
&buf[bytes_read],
bytes,
extent.start_block() * block_size_,
@@ -825,7 +913,7 @@
const Extent& extent = operation.dst_extents(i);
const size_t bytes = extent.num_blocks() * block_size_;
TEST_AND_RETURN_FALSE(extent.start_block() != kSparseHole);
- TEST_AND_RETURN_FALSE(utils::PWriteAll(fd,
+ TEST_AND_RETURN_FALSE(utils::PWriteAll(target_fd_,
&buf[bytes_written],
bytes,
extent.start_block() * block_size_));
@@ -860,8 +948,7 @@
} // namespace
bool DeltaPerformer::PerformSourceCopyOperation(
- const InstallOperation& operation,
- bool is_kernel_partition) {
+ const InstallOperation& operation) {
if (operation.has_src_length())
TEST_AND_RETURN_FALSE(operation.src_length() % block_size_ == 0);
if (operation.has_dst_length())
@@ -879,10 +966,6 @@
DCHECK_EQ(src_blocks.size(), blocks_to_read);
DCHECK_EQ(src_blocks.size(), dst_blocks.size());
- FileDescriptorPtr src_fd =
- is_kernel_partition ? source_kernel_fd_ : source_fd_;
- FileDescriptorPtr dst_fd = is_kernel_partition? kernel_fd_ : fd_;
-
chromeos::Blob buf(block_size_);
ssize_t bytes_read = 0;
// Read/write one block at a time.
@@ -893,7 +976,7 @@
// Read in bytes.
TEST_AND_RETURN_FALSE(
- utils::PReadAll(src_fd,
+ utils::PReadAll(source_fd_,
buf.data(),
block_size_,
src_block * block_size_,
@@ -901,7 +984,7 @@
// Write bytes out.
TEST_AND_RETURN_FALSE(
- utils::PWriteAll(dst_fd,
+ utils::PWriteAll(target_fd_,
buf.data(),
block_size_,
dst_block * block_size_));
@@ -936,8 +1019,7 @@
return true;
}
-bool DeltaPerformer::PerformBsdiffOperation(const InstallOperation& operation,
- bool is_kernel_partition) {
+bool DeltaPerformer::PerformBsdiffOperation(const InstallOperation& operation) {
// Since we delete data off the beginning of the buffer as we use it,
// the data we need should be exactly at the beginning of the buffer.
TEST_AND_RETURN_FALSE(buffer_offset_ == operation.data_offset());
@@ -970,8 +1052,7 @@
// file is written out.
DiscardBuffer(true);
- const string& path = is_kernel_partition ? kernel_path_ : path_;
- vector<string> cmd{kBspatchPath, path, path, temp_filename,
+ vector<string> cmd{kBspatchPath, target_path_, target_path_, temp_filename,
input_positions, output_positions};
int return_code = 0;
@@ -990,16 +1071,14 @@
const uint64_t begin_byte =
end_byte - (block_size_ - operation.dst_length() % block_size_);
chromeos::Blob zeros(end_byte - begin_byte);
- FileDescriptorPtr fd = is_kernel_partition ? kernel_fd_ : fd_;
TEST_AND_RETURN_FALSE(
- utils::PWriteAll(fd, zeros.data(), end_byte - begin_byte, begin_byte));
+ utils::PWriteAll(target_fd_, zeros.data(), end_byte - begin_byte, begin_byte));
}
return true;
}
bool DeltaPerformer::PerformSourceBsdiffOperation(
- const InstallOperation& operation,
- bool is_kernel_partition) {
+ const InstallOperation& operation) {
// Since we delete data off the beginning of the buffer as we use it,
// the data we need should be exactly at the beginning of the buffer.
TEST_AND_RETURN_FALSE(buffer_offset_ == operation.data_offset());
@@ -1036,11 +1115,7 @@
// file is written out.
DiscardBuffer(true);
- const string& src_path = is_kernel_partition ?
- install_plan_->kernel_source_path :
- install_plan_->source_path;
- const string& dst_path = is_kernel_partition ? kernel_path_ : path_;
- vector<string> cmd{kBspatchPath, src_path, dst_path, temp_filename,
+ vector<string> cmd{kBspatchPath, source_path_, target_path_, temp_filename,
input_positions, output_positions};
int return_code = 0;
@@ -1354,29 +1429,12 @@
return ErrorCode::kSuccess;
}
-bool DeltaPerformer::GetNewPartitionInfo(uint64_t* kernel_size,
- chromeos::Blob* kernel_hash,
- uint64_t* rootfs_size,
- chromeos::Blob* rootfs_hash) {
- TEST_AND_RETURN_FALSE(manifest_valid_ &&
- manifest_.has_new_kernel_info() &&
- manifest_.has_new_rootfs_info());
- *kernel_size = manifest_.new_kernel_info().size();
- *rootfs_size = manifest_.new_rootfs_info().size();
- chromeos::Blob new_kernel_hash(manifest_.new_kernel_info().hash().begin(),
- manifest_.new_kernel_info().hash().end());
- chromeos::Blob new_rootfs_hash(manifest_.new_rootfs_info().hash().begin(),
- manifest_.new_rootfs_info().hash().end());
- kernel_hash->swap(new_kernel_hash);
- rootfs_hash->swap(new_rootfs_hash);
- return true;
-}
-
namespace {
-void LogVerifyError(bool is_kern,
+void LogVerifyError(const string& type,
+ const string& device,
+ uint64_t size,
const string& local_hash,
const string& expected_hash) {
- const char* type = is_kern ? "kernel" : "rootfs";
LOG(ERROR) << "This is a server-side error due to "
<< "mismatched delta update image!";
LOG(ERROR) << "The delta I've been given contains a " << type << " delta "
@@ -1387,19 +1445,10 @@
<< "system. The " << type << " partition I have has hash: "
<< local_hash << " but the update expected me to have "
<< expected_hash << " .";
- if (is_kern) {
- LOG(INFO) << "To get the checksum of a kernel partition on a "
- << "booted machine, run this command (change /dev/sda2 "
- << "as needed): dd if=/dev/sda2 bs=1M 2>/dev/null | "
- << "openssl dgst -sha256 -binary | openssl base64";
- } else {
- LOG(INFO) << "To get the checksum of a rootfs partition on a "
- << "booted machine, run this command (change /dev/sda3 "
- << "as needed): dd if=/dev/sda3 bs=1M count=$(( "
- << "$(dumpe2fs /dev/sda3 2>/dev/null | grep 'Block count' "
- << "| sed 's/[^0-9]*//') / 256 )) | "
- << "openssl dgst -sha256 -binary | openssl base64";
- }
+ LOG(INFO) << "To get the checksum of the " << type << " partition run this"
+ "command: dd if=" << device << " bs=1M count=" << size
+ << " iflag=count_bytes 2>/dev/null | openssl dgst -sha256 -binary "
+ "| openssl base64";
LOG(INFO) << "To get the checksum of partitions in a bin file, "
<< "run: .../src/scripts/sha256_partitions.sh .../file.bin";
}
@@ -1413,41 +1462,43 @@
LOG(INFO) << "Verifying source partitions.";
CHECK(manifest_valid_);
CHECK(install_plan_);
- if (manifest_.has_old_kernel_info()) {
- const PartitionInfo& info = manifest_.old_kernel_info();
- bool valid =
- !install_plan_->source_kernel_hash.empty() &&
- install_plan_->source_kernel_hash.size() == info.hash().size() &&
- memcmp(install_plan_->source_kernel_hash.data(),
- info.hash().data(),
- install_plan_->source_kernel_hash.size()) == 0;
- if (!valid) {
- LogVerifyError(true,
- StringForHashBytes(
- install_plan_->source_kernel_hash.data(),
- install_plan_->source_kernel_hash.size()),
- StringForHashBytes(info.hash().data(),
- info.hash().size()));
- }
- TEST_AND_RETURN_FALSE(valid);
+ if (install_plan_->partitions.size() != partitions_.size()) {
+ DLOG(ERROR) << "The list of partitions in the InstallPlan doesn't match the "
+ "list received in the payload. The InstallPlan has "
+ << install_plan_->partitions.size()
+ << " partitions while the payload has " << partitions_.size()
+ << " partitions.";
+ return false;
}
- if (manifest_.has_old_rootfs_info()) {
- const PartitionInfo& info = manifest_.old_rootfs_info();
+ for (size_t i = 0; i < partitions_.size(); ++i) {
+ if (partitions_[i].partition_name() != install_plan_->partitions[i].name) {
+ DLOG(ERROR) << "The InstallPlan's partition " << i << " is \""
+ << install_plan_->partitions[i].name
+ << "\" but the payload expects it to be \""
+ << partitions_[i].partition_name()
+ << "\". This is an error in the DeltaPerformer setup.";
+ return false;
+ }
+ if (!partitions_[i].has_old_partition_info())
+ continue;
+ const PartitionInfo& info = partitions_[i].old_partition_info();
+ const InstallPlan::Partition& plan_part = install_plan_->partitions[i];
bool valid =
- !install_plan_->source_rootfs_hash.empty() &&
- install_plan_->source_rootfs_hash.size() == info.hash().size() &&
- memcmp(install_plan_->source_rootfs_hash.data(),
+ !plan_part.source_hash.empty() &&
+ plan_part.source_hash.size() == info.hash().size() &&
+ memcmp(plan_part.source_hash.data(),
info.hash().data(),
- install_plan_->source_rootfs_hash.size()) == 0;
+ plan_part.source_hash.size()) == 0;
if (!valid) {
- LogVerifyError(false,
- StringForHashBytes(
- install_plan_->source_rootfs_hash.data(),
- install_plan_->source_rootfs_hash.size()),
+ LogVerifyError(partitions_[i].partition_name(),
+ plan_part.source_path,
+ info.hash().size(),
+ StringForHashBytes(plan_part.source_hash.data(),
+ plan_part.source_hash.size()),
StringForHashBytes(info.hash().data(),
info.hash().size()));
+ return false;
}
- TEST_AND_RETURN_FALSE(valid);
}
return true;
}
@@ -1531,13 +1582,13 @@
last_updated_buffer_offset_ = buffer_offset_;
if (next_operation_num_ < num_total_operations_) {
- const bool is_kernel_partition =
- next_operation_num_ >= num_rootfs_operations_;
+ size_t partition_index = current_partition_;
+ while (next_operation_num_ >= acc_num_operations_[partition_index])
+ partition_index++;
+ const size_t partition_operation_num = next_operation_num_ - (
+ partition_index ? acc_num_operations_[partition_index - 1] : 0);
const InstallOperation& op =
- is_kernel_partition
- ? manifest_.kernel_install_operations(next_operation_num_ -
- num_rootfs_operations_)
- : manifest_.install_operations(next_operation_num_);
+ partitions_[partition_index].operations(partition_operation_num);
TEST_AND_RETURN_FALSE(prefs_->SetInt64(kPrefsUpdateStateNextDataLength,
op.data_length()));
} else {
@@ -1559,7 +1610,6 @@
next_operation == kUpdateStateOperationInvalid ||
next_operation <= 0) {
// Initiating a new update, no more state needs to be initialized.
- TEST_AND_RETURN_FALSE(VerifySourcePartitions());
return true;
}
next_operation_num_ = next_operation;
diff --git a/delta_performer.h b/delta_performer.h
index 34cb137..64ad4af 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -57,7 +57,7 @@
static const uint64_t kDeltaMetadataSignatureSizeSize;
static const uint64_t kMaxPayloadHeaderSize;
static const uint64_t kSupportedMajorPayloadVersion;
- static const uint64_t kSupportedMinorPayloadVersion;
+ static const uint32_t kSupportedMinorPayloadVersion;
// Defines the granularity of progress logging in terms of how many "completed
// chunks" we want to report at the most.
@@ -77,44 +77,7 @@
InstallPlan* install_plan)
: prefs_(prefs),
system_state_(system_state),
- install_plan_(install_plan),
- fd_(nullptr),
- kernel_fd_(nullptr),
- source_fd_(nullptr),
- source_kernel_fd_(nullptr),
- manifest_parsed_(false),
- manifest_valid_(false),
- metadata_size_(0),
- manifest_size_(0),
- major_payload_version_(0),
- next_operation_num_(0),
- buffer_offset_(0),
- last_updated_buffer_offset_(kuint64max),
- block_size_(0),
- public_key_path_(constants::kUpdatePayloadPublicKeyPath),
- total_bytes_received_(0),
- num_rootfs_operations_(0),
- num_total_operations_(0),
- overall_progress_(0),
- last_progress_chunk_(0),
- forced_progress_log_wait_(
- base::TimeDelta::FromSeconds(kProgressLogTimeoutSeconds)),
- supported_major_version_(kSupportedMajorPayloadVersion),
- supported_minor_version_(kSupportedMinorPayloadVersion) {}
-
- // Opens the kernel. Should be called before or after Open(), but before
- // Write(). The kernel file will be close()d when Close() is called.
- bool OpenKernel(const char* kernel_path);
-
- // Opens the source partition. The file will be closed when Close() is called.
- bool OpenSourceRootfs(const std::string& kernel_path);
-
- // Opens the source kernel. The file will be closed when Close() is called.
- bool OpenSourceKernel(const std::string& source_kernel_path);
-
- // flags and mode ignored. Once Close()d, a DeltaPerformer can't be
- // Open()ed again.
- int Open(const char* path, int flags, mode_t mode) override;
+ install_plan_(install_plan) {}
// FileWriter's Write implementation where caller doesn't care about
// error codes.
@@ -131,6 +94,15 @@
// Closes both 'path' given to Open() and the kernel path.
int Close() override;
+ // Open the target and source (if delta payload) file descriptors for the
+ // |current_partition_|. The manifest needs to be already parsed for this to
+ // work. Returns whether the required file descriptors were successfully open.
+ bool OpenCurrentPartition();
+
+ // Closes the current partition file descriptors if open. Returns 0 on success
+ // or -errno on error.
+ int CloseCurrentPartition();
+
// Returns |true| only if the manifest has been processed and it's valid.
bool IsManifestValid();
@@ -144,17 +116,6 @@
ErrorCode VerifyPayload(const std::string& update_check_response_hash,
const uint64_t update_check_response_size);
- // Reads from the update manifest the expected sizes and hashes of the target
- // kernel and rootfs partitions. These values can be used for applied update
- // hash verification. This method must be called after the update manifest has
- // been parsed (e.g., after closing the stream). Returns true on success, and
- // false on failure (e.g., when the values are not present in the update
- // manifest).
- bool GetNewPartitionInfo(uint64_t* kernel_size,
- chromeos::Blob* kernel_hash,
- uint64_t* rootfs_size,
- chromeos::Blob* rootfs_hash);
-
// Converts an ordered collection of Extent objects which contain data of
// length full_length to a comma-separated string. For each Extent, the
// string will have the start offset and then the length in bytes.
@@ -226,6 +187,11 @@
friend class DeltaPerformerIntegrationTest;
FRIEND_TEST(DeltaPerformerTest, UsePublicKeyFromResponse);
+ // Parse and move the update instructions of all partitions into our local
+ // |partitions_| variable based on the version of the payload. Requires the
+ // manifest to be parsed and valid.
+ bool ParseManifestPartitions(ErrorCode* error);
+
// Appends up to |*count_p| bytes from |*bytes_p| to |buffer_|, but only to
// the extent that the size of |buffer_| does not exceed |max|. Advances
// |*cbytes_p| and decreases |*count_p| by the actual number of bytes copied,
@@ -277,18 +243,12 @@
bool PerformInstallOperation(const InstallOperation& operation);
// These perform a specific type of operation and return true on success.
- bool PerformReplaceOperation(const InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformZeroOrDiscardOperation(const InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformMoveOperation(const InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformBsdiffOperation(const InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformSourceCopyOperation(const InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformSourceBsdiffOperation(const InstallOperation& operation,
- bool is_kernel_partition);
+ bool PerformReplaceOperation(const InstallOperation& operation);
+ bool PerformZeroOrDiscardOperation(const InstallOperation& operation);
+ bool PerformMoveOperation(const InstallOperation& operation);
+ bool PerformBsdiffOperation(const InstallOperation& operation);
+ bool PerformSourceCopyOperation(const InstallOperation& operation);
+ bool PerformSourceBsdiffOperation(const InstallOperation& operation);
// Returns true if the payload signature message has been extracted from
// |operation|, false otherwise.
@@ -325,43 +285,61 @@
// Install Plan based on Omaha Response.
InstallPlan* install_plan_;
- // File descriptor of open device.
- FileDescriptorPtr fd_;
+ // File descriptor of the source partition. Only set while updating a
+ // partition when using a delta payload.
+ FileDescriptorPtr source_fd_{nullptr};
- // File descriptor of the kernel device.
- FileDescriptorPtr kernel_fd_;
+ // File descriptor of the target partition. Only set while performing the
+ // operations of a given partition.
+ FileDescriptorPtr target_fd_{nullptr};
- // File descriptor of the source device.
- FileDescriptorPtr source_fd_;
+ // Paths the |source_fd_| and |target_fd_| refer to.
+ std::string source_path_;
+ std::string target_path_;
- // File descriptor of the source kernel device.
- FileDescriptorPtr source_kernel_fd_;
-
- std::string path_; // Path that fd_ refers to.
- std::string kernel_path_; // Path that kernel_fd_ refers to.
-
+ // Parsed manifest. Set after enough bytes to parse the manifest were
+ // downloaded.
DeltaArchiveManifest manifest_;
- bool manifest_parsed_;
- bool manifest_valid_;
- uint64_t metadata_size_;
- uint64_t manifest_size_;
- uint64_t major_payload_version_;
+ bool manifest_parsed_{false};
+ bool manifest_valid_{false};
+ uint64_t metadata_size_{0};
+ uint64_t manifest_size_{0};
+ uint64_t major_payload_version_{0};
- // Index of the next operation to perform in the manifest.
- size_t next_operation_num_;
+ // Accumulated number of operations per partition. The i-th element is the
+ // sum of the number of operations for all the partitions from 0 to i
+ // inclusive. Valid when |manifest_valid_| is true.
+ std::vector<size_t> acc_num_operations_;
+
+ // The total operations in a payload. Valid when |manifest_valid_| is true,
+ // otherwise 0.
+ size_t num_total_operations_{0};
+
+ // The list of partitions to update as found in the manifest major version 2.
+ // When parsing an older manifest format, the information is converted over to
+ // this format instead.
+ std::vector<PartitionUpdate> partitions_;
+
+ // Index in the list of partitions (|partitions_| member) of the current
+ // partition being processed.
+ size_t current_partition_{0};
+
+ // Index of the next operation to perform in the manifest. The index is linear
+ // on the total number of operation on the manifest.
+ size_t next_operation_num_{0};
// A buffer used for accumulating downloaded data. Initially, it stores the
// payload metadata; once that's downloaded and parsed, it stores data for the
// next update operation.
chromeos::Blob buffer_;
// Offset of buffer_ in the binary blobs section of the update.
- uint64_t buffer_offset_;
+ uint64_t buffer_offset_{0};
// Last |buffer_offset_| value updated as part of the progress update.
- uint64_t last_updated_buffer_offset_;
+ uint64_t last_updated_buffer_offset_{kuint64max};
// The block size (parsed from the manifest).
- uint32_t block_size_;
+ uint32_t block_size_{0};
// Calculates the payload hash.
OmahaHashCalculator hash_calculator_;
@@ -374,32 +352,29 @@
// The public key to be used. Provided as a member so that tests can
// override with test keys.
- std::string public_key_path_;
+ std::string public_key_path_{constants::kUpdatePayloadPublicKeyPath};
// The number of bytes received so far, used for progress tracking.
- size_t total_bytes_received_;
-
- // The number rootfs and total operations in a payload, once we know them.
- size_t num_rootfs_operations_;
- size_t num_total_operations_;
+ size_t total_bytes_received_{0};
// An overall progress counter, which should reflect both download progress
// and the ratio of applied operations. Range is 0-100.
- unsigned overall_progress_;
+ unsigned overall_progress_{0};
// The last progress chunk recorded.
- unsigned last_progress_chunk_;
+ unsigned last_progress_chunk_{0};
// The timeout after which we should force emitting a progress log (constant),
// and the actual point in time for the next forced log to be emitted.
- const base::TimeDelta forced_progress_log_wait_;
+ const base::TimeDelta forced_progress_log_wait_{
+ base::TimeDelta::FromSeconds(kProgressLogTimeoutSeconds)};
base::Time forced_progress_log_time_;
// The payload major payload version supported by DeltaPerformer.
- uint64_t supported_major_version_;
+ uint64_t supported_major_version_{kSupportedMajorPayloadVersion};
// The delta minor payload version supported by DeltaPerformer.
- uint32_t supported_minor_version_;
+ uint32_t supported_minor_version_{kSupportedMinorPayloadVersion};
DISALLOW_COPY_AND_ASSIGN(DeltaPerformer);
};
diff --git a/delta_performer_integration_test.cc b/delta_performer_integration_test.cc
index cdba884..036b7c1 100644
--- a/delta_performer_integration_test.cc
+++ b/delta_performer_integration_test.cc
@@ -25,8 +25,8 @@
#include <base/files/file_path.h>
#include <base/files/file_util.h>
-#include <base/strings/stringprintf.h>
#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
#include <google/protobuf/repeated_field.h>
#include <gtest/gtest.h>
@@ -46,11 +46,11 @@
using std::string;
using std::vector;
-using testing::Return;
-using testing::_;
-using test_utils::kRandomString;
using test_utils::ScopedLoopMounter;
using test_utils::System;
+using test_utils::kRandomString;
+using testing::Return;
+using testing::_;
extern const char* kUnittestPrivateKeyPath;
extern const char* kUnittestPublicKeyPath;
@@ -81,6 +81,10 @@
chromeos::Blob result_kernel_data;
size_t kernel_size;
+ // The InstallPlan referenced by the DeltaPerformer. This needs to outlive
+ // the DeltaPerformer.
+ InstallPlan install_plan;
+
// The in-memory copy of delta file.
chromeos::Blob delta;
@@ -699,12 +703,18 @@
}
// Update the A image in place.
- InstallPlan install_plan;
- install_plan.hash_checks_mandatory = hash_checks_mandatory;
- install_plan.metadata_size = state->metadata_size;
- install_plan.is_full_update = full_kernel && full_rootfs;
- install_plan.source_path = state->a_img.c_str();
- install_plan.kernel_source_path = state->old_kernel.c_str();
+ InstallPlan* install_plan = &state->install_plan;
+ install_plan->hash_checks_mandatory = hash_checks_mandatory;
+ install_plan->metadata_size = state->metadata_size;
+ install_plan->is_full_update = full_kernel && full_rootfs;
+ install_plan->source_slot = 0;
+ install_plan->target_slot = 1;
+
+ InstallPlan::Partition root_part;
+ root_part.name = kLegacyPartitionNameRoot;
+
+ InstallPlan::Partition kernel_part;
+ kernel_part.name = kLegacyPartitionNameKernel;
LOG(INFO) << "Setting payload metadata size in Omaha = "
<< state->metadata_size;
@@ -712,12 +722,12 @@
state->delta.data(),
state->metadata_size,
kUnittestPrivateKeyPath,
- &install_plan.metadata_signature));
- EXPECT_FALSE(install_plan.metadata_signature.empty());
+ &install_plan->metadata_signature));
+ EXPECT_FALSE(install_plan->metadata_signature.empty());
*performer = new DeltaPerformer(&prefs,
&state->fake_system_state,
- &install_plan);
+ install_plan);
EXPECT_TRUE(utils::FileExists(kUnittestPublicKeyPath));
(*performer)->set_public_key_path(kUnittestPublicKeyPath);
DeltaPerformerIntegrationTest::SetSupportedVersion(*performer, minor_version);
@@ -726,21 +736,34 @@
OmahaHashCalculator::RawHashOfFile(
state->a_img,
state->image_size,
- &install_plan.source_rootfs_hash));
+ &root_part.source_hash));
EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(
state->old_kernel_data,
- &install_plan.source_kernel_hash));
+ &kernel_part.source_hash));
+
+ // This partitions are normally filed by the FilesystemVerifierAction with
+ // the source hashes used for deltas.
+ install_plan->partitions = {root_part, kernel_part};
// With minor version 2, we want the target to be the new image, result_img,
// but with version 1, we want to update A in place.
+ string target_root, target_kernel;
if (minor_version == kSourceMinorPayloadVersion) {
- EXPECT_EQ(0, (*performer)->Open(state->result_img.c_str(), 0, 0));
- EXPECT_TRUE((*performer)->OpenKernel(state->result_kernel.c_str()));
+ target_root = state->result_img;
+ target_kernel = state->result_kernel;
} else {
- EXPECT_EQ(0, (*performer)->Open(state->a_img.c_str(), 0, 0));
- EXPECT_TRUE((*performer)->OpenKernel(state->old_kernel.c_str()));
+ target_root = state->a_img;
+ target_kernel = state->old_kernel;
}
+ state->fake_system_state.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameRoot, install_plan->source_slot, state->a_img);
+ state->fake_system_state.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameKernel, install_plan->source_slot, state->old_kernel);
+ state->fake_system_state.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameRoot, install_plan->target_slot, target_root);
+ state->fake_system_state.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameKernel, install_plan->target_slot, target_kernel);
ErrorCode expected_error, actual_error;
bool continue_writing;
@@ -844,26 +867,24 @@
EXPECT_TRUE(std::equal(std::begin(kNewData), std::end(kNewData),
updated_kernel_partition.begin()));
- uint64_t new_kernel_size;
- chromeos::Blob new_kernel_hash;
- uint64_t new_rootfs_size;
- chromeos::Blob new_rootfs_hash;
- EXPECT_TRUE(performer->GetNewPartitionInfo(&new_kernel_size,
- &new_kernel_hash,
- &new_rootfs_size,
- &new_rootfs_hash));
- EXPECT_EQ(kDefaultKernelSize, new_kernel_size);
+ const auto& partitions = state->install_plan.partitions;
+ EXPECT_EQ(2, partitions.size());
+ EXPECT_EQ(kLegacyPartitionNameRoot, partitions[0].name);
+ EXPECT_EQ(kLegacyPartitionNameKernel, partitions[1].name);
+
+ EXPECT_EQ(kDefaultKernelSize, partitions[1].target_size);
chromeos::Blob expected_new_kernel_hash;
EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(state->new_kernel_data,
&expected_new_kernel_hash));
- EXPECT_TRUE(expected_new_kernel_hash == new_kernel_hash);
- EXPECT_EQ(state->image_size, new_rootfs_size);
+ EXPECT_EQ(expected_new_kernel_hash, partitions[1].target_hash);
+
+ EXPECT_EQ(state->image_size, partitions[0].target_size);
chromeos::Blob expected_new_rootfs_hash;
EXPECT_EQ(state->image_size,
OmahaHashCalculator::RawHashOfFile(state->b_img,
state->image_size,
&expected_new_rootfs_hash));
- EXPECT_TRUE(expected_new_rootfs_hash == new_rootfs_hash);
+ EXPECT_EQ(expected_new_rootfs_hash, partitions[0].target_hash);
}
void VerifyPayload(DeltaPerformer* performer,
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index 12dd1d3..fa0692f 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -84,6 +84,10 @@
class DeltaPerformerTest : public ::testing::Test {
protected:
+ void SetUp() override {
+ install_plan_.source_slot = 0;
+ install_plan_.target_slot = 1;
+ }
// Test helper placed where it can easily be friended from DeltaPerformer.
void RunManifestValidation(const DeltaArchiveManifest& manifest,
@@ -118,11 +122,17 @@
PartitionConfig old_part(kLegacyPartitionNameRoot);
PartitionConfig new_part(kLegacyPartitionNameRoot);
- new_part.path = blob_path;
- new_part.size = blob_data.size();
+ new_part.path = "/dev/zero";
+ new_part.size = 1234;
payload.AddPartition(old_part, new_part, aops);
+ // We include a kernel partition without operations.
+ old_part.name = kLegacyPartitionNameKernel;
+ new_part.name = kLegacyPartitionNameKernel;
+ new_part.size = 0;
+ payload.AddPartition(old_part, new_part, {});
+
string payload_path;
EXPECT_TRUE(utils::MakeTempFile("Payload-XXXXXX", &payload_path, nullptr));
ScopedPathUnlinker payload_unlinker(payload_path);
@@ -154,13 +164,17 @@
EXPECT_TRUE(utils::WriteFile(new_part.c_str(), target_data.data(),
target_data.size()));
- install_plan_.source_path = source_path;
- install_plan_.kernel_source_path = "/dev/null";
- install_plan_.install_path = new_part;
- install_plan_.kernel_install_path = "/dev/null";
+ // We installed the operations only in the rootfs partition, but the
+ // delta performer needs to access all the partitions.
+ fake_system_state_.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameRoot, install_plan_.target_slot, new_part);
+ fake_system_state_.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameRoot, install_plan_.source_slot, source_path);
+ fake_system_state_.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameKernel, install_plan_.target_slot, "/dev/null");
+ fake_system_state_.fake_boot_control()->SetPartitionDevice(
+ kLegacyPartitionNameKernel, install_plan_.source_slot, "/dev/null");
- EXPECT_EQ(0, performer_.Open(new_part.c_str(), 0, 0));
- EXPECT_TRUE(performer_.OpenSourceRootfs(source_path.c_str()));
EXPECT_TRUE(performer_.Write(payload_data.data(), payload_data.size()));
EXPECT_EQ(0, performer_.Close());
@@ -178,8 +192,6 @@
uint64_t actual_metadata_size,
bool hash_checks_mandatory) {
install_plan_.hash_checks_mandatory = hash_checks_mandatory;
- EXPECT_EQ(0, performer_.Open("/dev/null", 0, 0));
- EXPECT_TRUE(performer_.OpenKernel("/dev/null"));
// Set a valid magic string and version number 1.
EXPECT_TRUE(performer_.Write("CrAU", 4));
@@ -503,8 +515,6 @@
TEST_F(DeltaPerformerTest, BrilloMetadataSignatureSizeTest) {
SetSupportedMajorVersion(kBrilloMajorPayloadVersion);
- EXPECT_EQ(0, performer_.Open("/dev/null", 0, 0));
- EXPECT_TRUE(performer_.OpenKernel("/dev/null"));
EXPECT_TRUE(performer_.Write(kDeltaMagic, sizeof(kDeltaMagic)));
uint64_t major_version = htobe64(kBrilloMajorPayloadVersion);
@@ -530,17 +540,12 @@
}
TEST_F(DeltaPerformerTest, BadDeltaMagicTest) {
- EXPECT_EQ(0, performer_.Open("/dev/null", 0, 0));
- EXPECT_TRUE(performer_.OpenKernel("/dev/null"));
EXPECT_TRUE(performer_.Write("junk", 4));
EXPECT_FALSE(performer_.Write("morejunk", 8));
EXPECT_LT(performer_.Close(), 0);
}
TEST_F(DeltaPerformerTest, WriteUpdatesPayloadState) {
- EXPECT_EQ(0, performer_.Open("/dev/null", 0, 0));
- EXPECT_TRUE(performer_.OpenKernel("/dev/null"));
-
EXPECT_CALL(*(fake_system_state_.mock_payload_state()),
DownloadProgress(4)).Times(1);
EXPECT_CALL(*(fake_system_state_.mock_payload_state()),
diff --git a/download_action.cc b/download_action.cc
index a31c8a3..97bdd12 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -17,6 +17,7 @@
#include "update_engine/download_action.h"
#include <errno.h>
+
#include <algorithm>
#include <string>
#include <vector>
@@ -185,24 +186,6 @@
&install_plan_));
writer_ = delta_performer_.get();
}
- int rc = writer_->Open(install_plan_.install_path.c_str(),
- O_TRUNC | O_WRONLY | O_CREAT | O_LARGEFILE,
- 0644);
- if (rc < 0) {
- LOG(ERROR) << "Unable to open output file " << install_plan_.install_path;
- // report error to processor
- processor_->ActionComplete(this, ErrorCode::kInstallDeviceOpenError);
- return;
- }
- if (delta_performer_.get() &&
- !delta_performer_->OpenKernel(
- install_plan_.kernel_install_path.c_str())) {
- LOG(ERROR) << "Unable to open kernel file "
- << install_plan_.kernel_install_path.c_str();
- writer_->Close();
- processor_->ActionComplete(this, ErrorCode::kKernelDeviceOpenError);
- return;
- }
if (delegate_) {
delegate_->SetDownloadStatus(true); // Set to active.
}
@@ -319,13 +302,6 @@
// Delete p2p file, if applicable.
if (!p2p_file_id_.empty())
CloseP2PSharingFd(true);
- } else if (!delta_performer_->GetNewPartitionInfo(
- &install_plan_.kernel_size,
- &install_plan_.kernel_hash,
- &install_plan_.rootfs_size,
- &install_plan_.rootfs_hash)) {
- LOG(ERROR) << "Unable to get new partition hash info.";
- code = ErrorCode::kDownloadNewPartitionInfoError;
}
}
diff --git a/download_action_unittest.cc b/download_action_unittest.cc
index d1f4bc9..e5f78d6 100644
--- a/download_action_unittest.cc
+++ b/download_action_unittest.cc
@@ -51,11 +51,11 @@
using std::string;
using std::unique_ptr;
using std::vector;
+using test_utils::ScopedTempFile;
using testing::AtLeast;
using testing::InSequence;
using testing::Return;
using testing::_;
-using test_utils::ScopedTempFile;
class DownloadActionTest : public ::testing::Test { };
@@ -139,10 +139,12 @@
// TODO(adlr): see if we need a different file for build bots
ScopedTempFile output_temp_file;
TestDirectFileWriter writer;
+ EXPECT_EQ(0, writer.Open(output_temp_file.GetPath().c_str(),
+ O_WRONLY | O_CREAT,
+ 0));
writer.set_fail_write(fail_write);
// We pull off the first byte from data and seek past it.
-
string hash =
OmahaHashCalculator::OmahaHashOfBytes(&data[1], data.size() - 1);
uint64_t size = data.size();
@@ -153,10 +155,6 @@
hash,
0,
"",
- output_temp_file.GetPath(),
- "",
- "",
- "",
"");
install_plan.source_slot = 0;
install_plan.target_slot = 1;
@@ -277,11 +275,13 @@
ScopedTempFile temp_file;
{
DirectFileWriter writer;
+ EXPECT_EQ(0, writer.Open(temp_file.GetPath().c_str(),
+ O_WRONLY | O_CREAT,
+ 0));
// takes ownership of passed in HttpFetcher
ObjectFeederAction<InstallPlan> feeder_action;
- InstallPlan install_plan(false, false, "", 0, "", 0, "",
- temp_file.GetPath(), "", "", "", "");
+ InstallPlan install_plan(false, false, "", 0, "", 0, "", "");
feeder_action.set_obj(install_plan);
FakeSystemState fake_system_state_;
MockPrefs prefs;
@@ -375,6 +375,7 @@
loop.SetAsCurrent();
DirectFileWriter writer;
+ EXPECT_EQ(0, writer.Open("/dev/null", O_WRONLY | O_CREAT, 0));
// takes ownership of passed in HttpFetcher
InstallPlan install_plan(false,
@@ -384,10 +385,6 @@
OmahaHashCalculator::OmahaHashOfString("x"),
0,
"",
- "/dev/null",
- "/dev/null",
- "/dev/null",
- "/dev/null",
"");
ObjectFeederAction<InstallPlan> feeder_action;
feeder_action.set_obj(install_plan);
@@ -417,36 +414,6 @@
EXPECT_EQ(true, test_action.did_run_);
}
-TEST(DownloadActionTest, BadOutFileTest) {
- chromeos::FakeMessageLoop loop(nullptr);
- loop.SetAsCurrent();
-
- const string path("/fake/path/that/cant/be/created/because/of/missing/dirs");
- DirectFileWriter writer;
-
- // takes ownership of passed in HttpFetcher
- InstallPlan install_plan(
- false, false, "", 0, "", 0, "", path, "", "", "", "");
- ObjectFeederAction<InstallPlan> feeder_action;
- feeder_action.set_obj(install_plan);
- MockPrefs prefs;
- FakeSystemState fake_system_state_;
- DownloadAction download_action(&prefs, &fake_system_state_,
- new MockHttpFetcher("x", 1, nullptr));
- download_action.SetTestFileWriter(&writer);
-
- BondActions(&feeder_action, &download_action);
-
- ActionProcessor processor;
- processor.EnqueueAction(&feeder_action);
- processor.EnqueueAction(&download_action);
- processor.StartProcessing();
- ASSERT_FALSE(processor.IsRunning());
-
- loop.Run();
- EXPECT_FALSE(loop.PendingTasks());
-}
-
// Test fixture for P2P tests.
class P2PDownloadActionTest : public testing::Test {
protected:
@@ -493,6 +460,9 @@
ScopedTempFile output_temp_file;
TestDirectFileWriter writer;
+ EXPECT_EQ(0, writer.Open(output_temp_file.GetPath().c_str(),
+ O_WRONLY | O_CREAT,
+ 0));
InstallPlan install_plan(false,
false,
"",
@@ -500,10 +470,6 @@
"1234hash",
0,
"",
- output_temp_file.GetPath(),
- "",
- "",
- "",
"");
ObjectFeederAction<InstallPlan> feeder_action;
feeder_action.set_obj(install_plan);
diff --git a/file_writer.h b/file_writer.h
index 3652b86..fbda009 100644
--- a/file_writer.h
+++ b/file_writer.h
@@ -39,9 +39,6 @@
FileWriter() {}
virtual ~FileWriter() {}
- // Wrapper around open. Returns 0 on success or -errno on error.
- virtual int Open(const char* path, int flags, mode_t mode) = 0;
-
// Wrapper around write. Returns true if all requested bytes
// were written, or false on any error, regardless of progress.
virtual bool Write(const void* bytes, size_t count) = 0;
@@ -69,16 +66,19 @@
class DirectFileWriter : public FileWriter {
public:
- DirectFileWriter() : fd_(-1) {}
+ DirectFileWriter() = default;
- int Open(const char* path, int flags, mode_t mode) override;
+ // FileWriter overrides.
bool Write(const void* bytes, size_t count) override;
int Close() override;
+ // Wrapper around open. Returns 0 on success or -errno on error.
+ int Open(const char* path, int flags, mode_t mode);
+
int fd() const { return fd_; }
private:
- int fd_;
+ int fd_{-1};
DISALLOW_COPY_AND_ASSIGN(DirectFileWriter);
};
diff --git a/filesystem_verifier_action.cc b/filesystem_verifier_action.cc
index 2291bc9..5ca80b1 100644
--- a/filesystem_verifier_action.cc
+++ b/filesystem_verifier_action.cc
@@ -30,7 +30,6 @@
#include "update_engine/boot_control_interface.h"
#include "update_engine/payload_constants.h"
-#include "update_engine/system_state.h"
#include "update_engine/utils.h"
using std::string;
@@ -41,27 +40,11 @@
const off_t kReadFileBufferSize = 128 * 1024;
} // namespace
-string PartitionTypeToString(const PartitionType partition_type) {
- // TODO(deymo): The PartitionType class should be replaced with just the
- // string name that comes from the payload. This function should be deleted
- // then.
- switch (partition_type) {
- case PartitionType::kRootfs:
- case PartitionType::kSourceRootfs:
- return kLegacyPartitionNameRoot;
- case PartitionType::kKernel:
- case PartitionType::kSourceKernel:
- return kLegacyPartitionNameKernel;
- }
- return "<unknown>";
-}
-
FilesystemVerifierAction::FilesystemVerifierAction(
- SystemState* system_state,
- PartitionType partition_type)
- : partition_type_(partition_type),
- remaining_size_(kint64max),
- system_state_(system_state) {}
+ const BootControlInterface* boot_control,
+ VerifierMode verifier_mode)
+ : verifier_mode_(verifier_mode),
+ boot_control_(boot_control) {}
void FilesystemVerifierAction::PerformAction() {
// Will tell the ActionProcessor we've failed if we return.
@@ -73,68 +56,48 @@
}
install_plan_ = GetInputObject();
- if (install_plan_.is_full_update &&
- (partition_type_ == PartitionType::kSourceRootfs ||
- partition_type_ == PartitionType::kSourceKernel)) {
- // No hash verification needed. Done!
- LOG(INFO) << "filesystem verifying skipped on full update.";
+ // For delta updates (major version 1) we need to populate the source
+ // partition hash if not pre-populated.
+ if (!install_plan_.is_full_update && install_plan_.partitions.empty() &&
+ verifier_mode_ == VerifierMode::kComputeSourceHash) {
+ LOG(INFO) << "Using legacy partition names.";
+ InstallPlan::Partition part;
+ string part_path;
+
+ part.name = kLegacyPartitionNameRoot;
+ if (!boot_control_->GetPartitionDevice(
+ part.name, install_plan_.source_slot, &part_path))
+ return;
+ int block_count = 0, block_size = 0;
+ if (utils::GetFilesystemSize(part_path, &block_count, &block_size)) {
+ part.source_size = static_cast<int64_t>(block_count) * block_size;
+ LOG(INFO) << "Partition " << part.name << " size: " << part.source_size
+ << " bytes (" << block_count << "x" << block_size << ").";
+ }
+ install_plan_.partitions.push_back(part);
+
+ part.name = kLegacyPartitionNameKernel;
+ if (!boot_control_->GetPartitionDevice(
+ part.name, install_plan_.source_slot, &part_path))
+ return;
+ off_t kernel_part_size = utils::FileSize(part_path);
+ if (kernel_part_size < 0)
+ return;
+ LOG(INFO) << "Partition " << part.name << " size: " << kernel_part_size
+ << " bytes.";
+ part.source_size = kernel_part_size;
+ install_plan_.partitions.push_back(part);
+ }
+
+ if (install_plan_.partitions.empty()) {
+ LOG(INFO) << "No partitions to verify.";
if (HasOutputPipe())
SetOutputObject(install_plan_);
abort_action_completer.set_code(ErrorCode::kSuccess);
return;
}
- string target_path;
- string partition_name = PartitionTypeToString(partition_type_);
- switch (partition_type_) {
- case PartitionType::kRootfs:
- target_path = install_plan_.install_path;
- if (target_path.empty()) {
- system_state_->boot_control()->GetPartitionDevice(
- partition_name, install_plan_.target_slot, &target_path);
- }
- break;
- case PartitionType::kKernel:
- target_path = install_plan_.kernel_install_path;
- if (target_path.empty()) {
- system_state_->boot_control()->GetPartitionDevice(
- partition_name, install_plan_.target_slot, &target_path);
- }
- break;
- case PartitionType::kSourceRootfs:
- target_path = install_plan_.source_path;
- if (target_path.empty()) {
- system_state_->boot_control()->GetPartitionDevice(
- partition_name, install_plan_.source_slot, &target_path);
- }
- break;
- case PartitionType::kSourceKernel:
- target_path = install_plan_.kernel_source_path;
- if (target_path.empty()) {
- system_state_->boot_control()->GetPartitionDevice(
- partition_name, install_plan_.source_slot, &target_path);
- }
- break;
- }
-
- chromeos::ErrorPtr error;
- src_stream_ = chromeos::FileStream::Open(
- base::FilePath(target_path),
- chromeos::Stream::AccessMode::READ,
- chromeos::FileStream::Disposition::OPEN_EXISTING,
- &error);
-
- if (!src_stream_) {
- LOG(ERROR) << "Unable to open " << target_path << " for reading";
- return;
- }
-
- DetermineFilesystemSize(target_path);
- buffer_.resize(kReadFileBufferSize);
-
- // Start the first read.
- ScheduleRead();
-
+ StartPartitionHashing();
abort_action_completer.set_should_complete(false);
}
@@ -159,6 +122,52 @@
processor_->ActionComplete(this, code);
}
+void FilesystemVerifierAction::StartPartitionHashing() {
+ if (partition_index_ == install_plan_.partitions.size()) {
+ Cleanup(ErrorCode::kSuccess);
+ return;
+ }
+ InstallPlan::Partition& partition =
+ install_plan_.partitions[partition_index_];
+
+ string part_path;
+ switch (verifier_mode_) {
+ case VerifierMode::kComputeSourceHash:
+ boot_control_->GetPartitionDevice(
+ partition.name, install_plan_.source_slot, &part_path);
+ remaining_size_ = partition.source_size;
+ break;
+ case VerifierMode::kVerifyTargetHash:
+ boot_control_->GetPartitionDevice(
+ partition.name, install_plan_.target_slot, &part_path);
+ remaining_size_ = partition.target_size;
+ break;
+ }
+ LOG(INFO) << "Hashing partition " << partition_index_ << " ("
+ << partition.name << ") on device " << part_path;
+ if (part_path.empty())
+ return Cleanup(ErrorCode::kFilesystemVerifierError);
+
+ chromeos::ErrorPtr error;
+ src_stream_ = chromeos::FileStream::Open(
+ base::FilePath(part_path),
+ chromeos::Stream::AccessMode::READ,
+ chromeos::FileStream::Disposition::OPEN_EXISTING,
+ &error);
+
+ if (!src_stream_) {
+ LOG(ERROR) << "Unable to open " << part_path << " for reading";
+ return Cleanup(ErrorCode::kFilesystemVerifierError);
+ }
+
+ buffer_.resize(kReadFileBufferSize);
+ read_done_ = false;
+ hasher_.reset(new OmahaHashCalculator());
+
+ // Start the first read.
+ ScheduleRead();
+}
+
void FilesystemVerifierAction::ScheduleRead() {
size_t bytes_to_read = std::min(static_cast<int64_t>(buffer_.size()),
remaining_size_);
@@ -188,16 +197,27 @@
} else {
remaining_size_ -= bytes_read;
CHECK(!read_done_);
- if (!hasher_.Update(buffer_.data(), bytes_read)) {
+ if (!hasher_->Update(buffer_.data(), bytes_read)) {
LOG(ERROR) << "Unable to update the hash.";
Cleanup(ErrorCode::kError);
return;
}
}
- // We either terminate the action or have more data to read.
- if (!CheckTerminationConditions())
- ScheduleRead();
+ // We either terminate the current partition or have more data to read.
+ if (cancelled_)
+ return Cleanup(ErrorCode::kError);
+
+ if (read_done_ || remaining_size_ == 0) {
+ if (remaining_size_ != 0) {
+ LOG(ERROR) << "Failed to read the remaining " << remaining_size_
+ << " bytes from partition "
+ << install_plan_.partitions[partition_index_].name;
+ return Cleanup(ErrorCode::kFilesystemVerifierError);
+ }
+ return FinishPartitionHashing();
+ }
+ ScheduleRead();
}
void FilesystemVerifierAction::OnReadErrorCallback(
@@ -207,70 +227,33 @@
Cleanup(ErrorCode::kError);
}
-bool FilesystemVerifierAction::CheckTerminationConditions() {
- if (cancelled_) {
- Cleanup(ErrorCode::kError);
- return true;
- }
-
- if (!read_done_)
- return false;
-
- // We're done!
- ErrorCode code = ErrorCode::kSuccess;
- if (hasher_.Finalize()) {
- LOG(INFO) << "Hash: " << hasher_.hash();
- switch (partition_type_) {
- case PartitionType::kRootfs:
- if (install_plan_.rootfs_hash != hasher_.raw_hash()) {
- code = ErrorCode::kNewRootfsVerificationError;
- LOG(ERROR) << "New rootfs verification failed.";
- }
- break;
- case PartitionType::kKernel:
- if (install_plan_.kernel_hash != hasher_.raw_hash()) {
- code = ErrorCode::kNewKernelVerificationError;
- LOG(ERROR) << "New kernel verification failed.";
- }
- break;
- case PartitionType::kSourceRootfs:
- install_plan_.source_rootfs_hash = hasher_.raw_hash();
- break;
- case PartitionType::kSourceKernel:
- install_plan_.source_kernel_hash = hasher_.raw_hash();
- break;
- }
- } else {
+void FilesystemVerifierAction::FinishPartitionHashing() {
+ if (!hasher_->Finalize()) {
LOG(ERROR) << "Unable to finalize the hash.";
- code = ErrorCode::kError;
+ return Cleanup(ErrorCode::kError);
}
- Cleanup(code);
- return true;
-}
+ InstallPlan::Partition& partition =
+ install_plan_.partitions[partition_index_];
+ LOG(INFO) << "Hash of " << partition.name << ": " << hasher_->hash();
-void FilesystemVerifierAction::DetermineFilesystemSize(const string& path) {
- switch (partition_type_) {
- case PartitionType::kRootfs:
- remaining_size_ = install_plan_.rootfs_size;
- LOG(INFO) << "Filesystem size: " << remaining_size_ << " bytes.";
+ switch (verifier_mode_) {
+ case VerifierMode::kComputeSourceHash:
+ partition.source_hash = hasher_->raw_hash();
break;
- case PartitionType::kKernel:
- remaining_size_ = install_plan_.kernel_size;
- LOG(INFO) << "Filesystem size: " << remaining_size_ << " bytes.";
- break;
- case PartitionType::kSourceRootfs:
- {
- int block_count = 0, block_size = 0;
- if (utils::GetFilesystemSize(path, &block_count, &block_size)) {
- remaining_size_ = static_cast<int64_t>(block_count) * block_size;
- LOG(INFO) << "Filesystem size: " << remaining_size_ << " bytes ("
- << block_count << "x" << block_size << ").";
- }
+ case VerifierMode::kVerifyTargetHash:
+ if (partition.target_hash != hasher_->raw_hash()) {
+ LOG(ERROR) << "New '" << partition.name
+ << "' partition verification failed.";
+ return Cleanup(ErrorCode::kNewRootfsVerificationError);
}
break;
- default:
- break;
}
+ // Start hashing the next partition, if any.
+ partition_index_++;
+ hasher_.reset();
+ buffer_.clear();
+ src_stream_->CloseBlocking(nullptr);
+ StartPartitionHashing();
}
} // namespace chromeos_update_engine
diff --git a/filesystem_verifier_action.h b/filesystem_verifier_action.h
index 7a6930e..bfcac43 100644
--- a/filesystem_verifier_action.h
+++ b/filesystem_verifier_action.h
@@ -30,28 +30,27 @@
#include "update_engine/install_plan.h"
#include "update_engine/omaha_hash_calculator.h"
-// This action will only do real work if it's a delta update. It will
-// copy the root partition to install partition, and then terminate.
+// This action will hash all the partitions of a single slot involved in the
+// update (either source or target slot). The hashes are then either stored in
+// the InstallPlan (for source partitions) or verified against it (for target
+// partitions).
namespace chromeos_update_engine {
-class SystemState;
-
-// The type of filesystem that we are verifying.
-enum class PartitionType {
- kSourceRootfs,
- kSourceKernel,
- kRootfs,
- kKernel,
+// The mode we are running the FilesystemVerifier on. On kComputeSourceHash mode
+// it computes the source_hash of all the partitions in the InstallPlan, based
+// on the already populated source_size values. On kVerifyTargetHash it computes
+// the hash on the target partitions based on the already populated size and
+// verifies it matches the one in the target_hash in the InstallPlan.
+enum class VerifierMode {
+ kComputeSourceHash,
+ kVerifyTargetHash,
};
-// Return the partition name string for the passed partition type.
-std::string PartitionTypeToString(const PartitionType partition_type);
-
class FilesystemVerifierAction : public InstallPlanAction {
public:
- FilesystemVerifierAction(SystemState* system_state,
- PartitionType partition_type);
+ FilesystemVerifierAction(const BootControlInterface* boot_control,
+ VerifierMode verifier_mode);
void PerformAction() override;
void TerminateProcessing() override;
@@ -71,6 +70,10 @@
FRIEND_TEST(FilesystemVerifierActionTest,
RunAsRootDetermineFilesystemSizeTest);
+ // Starts the hashing of the current partition. If there aren't any partitions
+ // remaining to be hashed, if finishes the action.
+ void StartPartitionHashing();
+
// Schedules the asynchronous read of the filesystem.
void ScheduleRead();
@@ -79,22 +82,24 @@
void OnReadDoneCallback(size_t bytes_read);
void OnReadErrorCallback(const chromeos::Error* error);
- // Based on the state of the read buffer, terminates read process and the
- // action. Return whether the action was terminated.
- bool CheckTerminationConditions();
+ // When the read is done, finalize the hash checking of the current partition
+ // and continue checking the next one.
+ void FinishPartitionHashing();
// Cleans up all the variables we use for async operations and tells the
// ActionProcessor we're done w/ |code| as passed in. |cancelled_| should be
// true if TerminateProcessing() was called.
void Cleanup(ErrorCode code);
- // Determine, if possible, the source file system size to avoid copying the
- // whole partition. Currently this supports only the root file system assuming
- // it's ext3-compatible.
- void DetermineFilesystemSize(const std::string& path);
-
// The type of the partition that we are verifying.
- PartitionType partition_type_;
+ const VerifierMode verifier_mode_;
+
+ // The BootControlInterface used to get the partitions based on the slots.
+ const BootControlInterface* const boot_control_;
+
+ // The index in the install_plan_.partitions vector of the partition currently
+ // being hashed.
+ size_t partition_index_{0};
// If not null, the FileStream used to read from the device.
chromeos::StreamPtr src_stream_;
@@ -109,15 +114,12 @@
InstallPlan install_plan_;
// Calculates the hash of the data.
- OmahaHashCalculator hasher_;
+ std::unique_ptr<OmahaHashCalculator> hasher_;
// Reads and hashes this many bytes from the head of the input stream. This
- // field is initialized when the action is started and decremented as more
- // bytes get read.
- int64_t remaining_size_;
-
- // The global context for update_engine.
- SystemState* system_state_;
+ // field is initialized from the corresponding InstallPlan::Partition size,
+ // when the partition starts to be hashed.
+ int64_t remaining_size_{0};
DISALLOW_COPY_AND_ASSIGN(FilesystemVerifierAction);
};
diff --git a/filesystem_verifier_action_unittest.cc b/filesystem_verifier_action_unittest.cc
index 8280328..96bcb72 100644
--- a/filesystem_verifier_action_unittest.cc
+++ b/filesystem_verifier_action_unittest.cc
@@ -26,14 +26,15 @@
#include <base/posix/eintr_wrapper.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
+#include <chromeos/bind_lambda.h>
#include <chromeos/message_loops/fake_message_loop.h>
#include <chromeos/message_loops/message_loop_utils.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_hardware.h"
+#include "update_engine/fake_boot_control.h"
#include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/payload_constants.h"
#include "update_engine/test_utils.h"
#include "update_engine/utils.h"
@@ -57,10 +58,10 @@
// Returns true iff test has completed successfully.
bool DoTest(bool terminate_early,
bool hash_fail,
- PartitionType partition_type);
+ VerifierMode verifier_mode);
chromeos::FakeMessageLoop loop_{nullptr};
- FakeSystemState fake_system_state_;
+ FakeBootControl fake_boot_control_;
};
class FilesystemVerifierActionTestDelegate : public ActionProcessorDelegate {
@@ -120,17 +121,17 @@
// issue with the chroot environment, library versions we use, etc.
TEST_F(FilesystemVerifierActionTest, DISABLED_RunAsRootSimpleTest) {
ASSERT_EQ(0, getuid());
- bool test = DoTest(false, false, PartitionType::kKernel);
+ bool test = DoTest(false, false, VerifierMode::kComputeSourceHash);
EXPECT_TRUE(test);
if (!test)
return;
- test = DoTest(false, false, PartitionType::kRootfs);
+ test = DoTest(false, false, VerifierMode::kVerifyTargetHash);
EXPECT_TRUE(test);
}
bool FilesystemVerifierActionTest::DoTest(bool terminate_early,
bool hash_fail,
- PartitionType partition_type) {
+ VerifierMode verifier_mode) {
string a_loop_file;
if (!(utils::MakeTempFile("a_loop_file.XXXXXX", &a_loop_file, nullptr))) {
@@ -144,7 +145,6 @@
chromeos::Blob a_loop_data(kLoopFileSize);
test_utils::FillWithData(&a_loop_data);
-
// Write data to disk
if (!(test_utils::WriteFileVector(a_loop_file, a_loop_data))) {
ADD_FAILURE();
@@ -167,47 +167,36 @@
InstallPlan install_plan;
install_plan.source_slot = 0;
install_plan.target_slot = 1;
- switch (partition_type) {
- case PartitionType::kRootfs:
- install_plan.rootfs_size = kLoopFileSize - (hash_fail ? 1 : 0);
- install_plan.install_path = a_dev;
- if (!OmahaHashCalculator::RawHashOfData(
- a_loop_data, &install_plan.rootfs_hash)) {
+ InstallPlan::Partition part;
+ part.name = "part";
+ switch (verifier_mode) {
+ case VerifierMode::kVerifyTargetHash:
+ part.target_size = kLoopFileSize - (hash_fail ? 1 : 0);
+ part.target_path = a_dev;
+ fake_boot_control_.SetPartitionDevice(
+ part.name, install_plan.target_slot, a_dev);
+ if (!OmahaHashCalculator::RawHashOfData(a_loop_data, &part.target_hash)) {
ADD_FAILURE();
success = false;
}
break;
- case PartitionType::kKernel:
- install_plan.kernel_size = kLoopFileSize - (hash_fail ? 1 : 0);
- install_plan.kernel_install_path = a_dev;
- if (!OmahaHashCalculator::RawHashOfData(
- a_loop_data, &install_plan.kernel_hash)) {
- ADD_FAILURE();
- success = false;
- }
- break;
- case PartitionType::kSourceRootfs:
- install_plan.source_path = a_dev;
- if (!OmahaHashCalculator::RawHashOfData(
- a_loop_data, &install_plan.source_rootfs_hash)) {
- ADD_FAILURE();
- success = false;
- }
- break;
- case PartitionType::kSourceKernel:
- install_plan.kernel_source_path = a_dev;
- if (!OmahaHashCalculator::RawHashOfData(
- a_loop_data, &install_plan.source_kernel_hash)) {
+ case VerifierMode::kComputeSourceHash:
+ part.source_size = kLoopFileSize;
+ part.source_path = a_dev;
+ fake_boot_control_.SetPartitionDevice(
+ part.name, install_plan.source_slot, a_dev);
+ if (!OmahaHashCalculator::RawHashOfData(a_loop_data, &part.source_hash)) {
ADD_FAILURE();
success = false;
}
break;
}
+ install_plan.partitions = {part};
ActionProcessor processor;
ObjectFeederAction<InstallPlan> feeder_action;
- FilesystemVerifierAction copier_action(&fake_system_state_, partition_type);
+ FilesystemVerifierAction copier_action(&fake_boot_control_, verifier_mode);
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&feeder_action, &copier_action);
@@ -236,11 +225,7 @@
return (ErrorCode::kError == delegate.code());
}
if (hash_fail) {
- ErrorCode expected_exit_code =
- ((partition_type == PartitionType::kKernel ||
- partition_type == PartitionType::kSourceKernel) ?
- ErrorCode::kNewKernelVerificationError :
- ErrorCode::kNewRootfsVerificationError);
+ ErrorCode expected_exit_code = ErrorCode::kNewRootfsVerificationError;
EXPECT_EQ(expected_exit_code, delegate.code());
return (expected_exit_code == delegate.code());
}
@@ -283,8 +268,8 @@
processor.set_delegate(&delegate);
- FilesystemVerifierAction copier_action(&fake_system_state_,
- PartitionType::kRootfs);
+ FilesystemVerifierAction copier_action(&fake_boot_control_,
+ VerifierMode::kVerifyTargetHash);
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&copier_action, &collector_action);
@@ -311,14 +296,16 @@
"",
0,
"",
- "/no/such/file",
- "/no/such/file",
- "/no/such/file",
- "/no/such/file",
"");
+ InstallPlan::Partition part;
+ part.name = "nope";
+ part.source_path = "/no/such/file";
+ part.target_path = "/no/such/file";
+ install_plan.partitions = {part};
+
feeder_action.set_obj(install_plan);
- FilesystemVerifierAction verifier_action(&fake_system_state_,
- PartitionType::kRootfs);
+ FilesystemVerifierAction verifier_action(&fake_boot_control_,
+ VerifierMode::kVerifyTargetHash);
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&verifier_action, &collector_action);
@@ -334,26 +321,25 @@
TEST_F(FilesystemVerifierActionTest, RunAsRootVerifyHashTest) {
ASSERT_EQ(0, getuid());
- EXPECT_TRUE(DoTest(false, false, PartitionType::kRootfs));
- EXPECT_TRUE(DoTest(false, false, PartitionType::kKernel));
- EXPECT_TRUE(DoTest(false, false, PartitionType::kSourceRootfs));
- EXPECT_TRUE(DoTest(false, false, PartitionType::kSourceKernel));
+ EXPECT_TRUE(DoTest(false, false, VerifierMode::kVerifyTargetHash));
+ EXPECT_TRUE(DoTest(false, false, VerifierMode::kComputeSourceHash));
}
TEST_F(FilesystemVerifierActionTest, RunAsRootVerifyHashFailTest) {
ASSERT_EQ(0, getuid());
- EXPECT_TRUE(DoTest(false, true, PartitionType::kRootfs));
- EXPECT_TRUE(DoTest(false, true, PartitionType::kKernel));
+ EXPECT_TRUE(DoTest(false, true, VerifierMode::kVerifyTargetHash));
}
TEST_F(FilesystemVerifierActionTest, RunAsRootTerminateEarlyTest) {
ASSERT_EQ(0, getuid());
- EXPECT_TRUE(DoTest(true, false, PartitionType::kKernel));
+ EXPECT_TRUE(DoTest(true, false, VerifierMode::kVerifyTargetHash));
// TerminateEarlyTest may leak some null callbacks from the Stream class.
while (loop_.RunOnce(false)) {}
}
-TEST_F(FilesystemVerifierActionTest, RunAsRootDetermineFilesystemSizeTest) {
+// Test that the rootfs and kernel size used for hashing in delta payloads for
+// major version 1 is properly read.
+TEST_F(FilesystemVerifierActionTest, RunAsRootDetermineLegacySizeTest) {
string img;
EXPECT_TRUE(utils::MakeTempFile("img.XXXXXX", &img, nullptr));
ScopedPathUnlinker img_unlinker(img);
@@ -361,19 +347,41 @@
// Extend the "partition" holding the file system from 10MiB to 20MiB.
EXPECT_EQ(0, truncate(img.c_str(), 20 * 1024 * 1024));
- {
- FilesystemVerifierAction action(&fake_system_state_,
- PartitionType::kSourceKernel);
- EXPECT_EQ(kint64max, action.remaining_size_);
- action.DetermineFilesystemSize(img);
- EXPECT_EQ(kint64max, action.remaining_size_);
- }
- {
- FilesystemVerifierAction action(&fake_system_state_,
- PartitionType::kSourceRootfs);
- action.DetermineFilesystemSize(img);
- EXPECT_EQ(10 * 1024 * 1024, action.remaining_size_);
- }
+ InstallPlan install_plan;
+ install_plan.source_slot = 1;
+
+ fake_boot_control_.SetPartitionDevice(
+ kLegacyPartitionNameRoot, install_plan.source_slot, img);
+ fake_boot_control_.SetPartitionDevice(
+ kLegacyPartitionNameKernel, install_plan.source_slot, img);
+ FilesystemVerifierAction action(&fake_boot_control_,
+ VerifierMode::kComputeSourceHash);
+
+ ObjectFeederAction<InstallPlan> feeder_action;
+ feeder_action.set_obj(install_plan);
+
+ ObjectCollectorAction<InstallPlan> collector_action;
+
+ BondActions(&feeder_action, &action);
+ BondActions(&action, &collector_action);
+ ActionProcessor processor;
+ processor.EnqueueAction(&feeder_action);
+ processor.EnqueueAction(&action);
+ processor.EnqueueAction(&collector_action);
+
+ loop_.PostTask(FROM_HERE,
+ base::Bind([&processor]{ processor.StartProcessing(); }));
+ loop_.Run();
+ install_plan = collector_action.object();
+
+ ASSERT_EQ(2, install_plan.partitions.size());
+ // When computing the size of the rootfs on legacy delta updates we use the
+ // size of the filesystem, but when updating the kernel we use the whole
+ // partition.
+ EXPECT_EQ(10 * 1024 * 1024, install_plan.partitions[0].source_size);
+ EXPECT_EQ(kLegacyPartitionNameRoot, install_plan.partitions[0].name);
+ EXPECT_EQ(20 * 1024 * 1024, install_plan.partitions[1].source_size);
+ EXPECT_EQ(kLegacyPartitionNameKernel, install_plan.partitions[1].name);
}
} // namespace chromeos_update_engine
diff --git a/include/shill/dbus-constants.h b/include/shill/dbus-constants.h
deleted file mode 100644
index b3ad4bc..0000000
--- a/include/shill/dbus-constants.h
+++ /dev/null
@@ -1,710 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef SYSTEM_API_DBUS_SHILL_DBUS_CONSTANTS_H_
-#define SYSTEM_API_DBUS_SHILL_DBUS_CONSTANTS_H_
-
-// TODO(benchan): Reorganize shill constants and remove deprecated ones.
-namespace shill {
-// Flimflam D-Bus service identifiers.
-const char kFlimflamManagerInterface[] = "org.chromium.flimflam.Manager";
-const char kFlimflamServiceName[] = "org.chromium.flimflam";
-const char kFlimflamServicePath[] = "/"; // crosbug.com/20135
-const char kFlimflamServiceInterface[] = "org.chromium.flimflam.Service";
-const char kFlimflamIPConfigInterface[] = "org.chromium.flimflam.IPConfig";
-const char kFlimflamDeviceInterface[] = "org.chromium.flimflam.Device";
-const char kFlimflamProfileInterface[] = "org.chromium.flimflam.Profile";
-const char kFlimflamNetworkInterface[] = "org.chromium.flimflam.Network";
-const char kFlimflamThirdPartyVpnInterface[] =
- "org.chromium.flimflam.ThirdPartyVpn";
-
-// Flimflam function names.
-const char kGetPropertiesFunction[] = "GetProperties";
-const char kSetPropertyFunction[] = "SetProperty";
-const char kClearPropertyFunction[] = "ClearProperty";
-const char kConnectFunction[] = "Connect";
-const char kDisconnectFunction[] = "Disconnect";
-const char kRequestScanFunction[] = "RequestScan";
-const char kGetServiceFunction[] = "GetService";
-const char kGetWifiServiceFunction[] = "GetWifiService";
-const char kGetVPNServiceFunction[] = "GetVPNService";
-const char kRemoveServiceFunction[] = "Remove";
-const char kEnableTechnologyFunction[] = "EnableTechnology";
-const char kDisableTechnologyFunction[] = "DisableTechnology";
-const char kAddIPConfigFunction[] = "AddIPConfig";
-const char kRemoveConfigFunction[] = "Remove";
-const char kGetEntryFunction[] = "GetEntry";
-const char kDeleteEntryFunction[] = "DeleteEntry";
-const char kActivateCellularModemFunction[] = "ActivateCellularModem";
-const char kRequirePinFunction[] = "RequirePin";
-const char kEnterPinFunction[] = "EnterPin";
-const char kUnblockPinFunction[] = "UnblockPin";
-const char kChangePinFunction[] = "ChangePin";
-const char kProposeScanFunction[] = "ProposeScan";
-const char kRegisterFunction[] = "Register";
-const char kConfigureServiceFunction[] = "ConfigureService";
-const char kConfigureWifiServiceFunction[] = "ConfigureWifiService";
-const char kFindMatchingServiceFunction[] = "FindMatchingService";
-
-// Flimflam Service property names.
-const char kSecurityProperty[] = "Security";
-const char kPriorityProperty[] = "Priority";
-const char kPriorityWithinTechnologyProperty[] = "PriorityWithinTechnology";
-const char kPassphraseProperty[] = "Passphrase";
-const char kIdentityProperty[] = "Identity";
-const char kAuthorityPathProperty[] = "AuthorityPath";
-const char kPassphraseRequiredProperty[] = "PassphraseRequired";
-const char kSaveCredentialsProperty[] = "SaveCredentials";
-const char kSignalStrengthProperty[] = "Strength";
-const char kNameProperty[] = "Name";
-const char kGuidProperty[] = "GUID";
-const char kStateProperty[] = "State";
-const char kTypeProperty[] = "Type";
-const char kDeviceProperty[] = "Device";
-const char kProfileProperty[] = "Profile";
-const char kConnectivityStateProperty[] = "ConnectivityState";
-const char kConnectableProperty[] = "Connectable";
-const char kAutoConnectProperty[] = "AutoConnect";
-const char kIsActiveProperty[] = "IsActive";
-const char kModeProperty[] = "Mode";
-const char kErrorProperty[] = "Error";
-const char kProviderProperty[] = "Provider";
-const char kHostProperty[] = "Host";
-const char kDomainProperty[] = "Domain";
-const char kProxyConfigProperty[] = "ProxyConfig";
-const char kCheckPortalProperty[] = "CheckPortal";
-const char kSSIDProperty[] = "SSID";
-const char kConnectedProperty[] = "Connected";
-const char kUIDataProperty[] = "UIData";
-const char kConnectionIdProperty[] = "ConnectionId";
-const char kVisibleProperty[] = "Visible";
-const char kDnsAutoFallbackProperty[] = "DNSAutoFallback";
-const char kPortalDetectionFailedPhaseProperty[] =
- "PortalDetectionFailedPhase";
-const char kPortalDetectionFailedStatusProperty[] =
- "PortalDetectionFailedStatus";
-const char kSavedIPConfigProperty[] = "SavedIPConfig";
-const char kStaticIPConfigProperty[] = "StaticIPConfig";
-const char kLinkMonitorDisableProperty[] = "LinkMonitorDisable";
-const char kSecurityClassProperty[] = "SecurityClass";
-
-// Flimflam provider property names.
-const char kProviderHostProperty[] = "Provider.Host";
-const char kProviderNameProperty[] = "Provider.Name";
-const char kProviderTypeProperty[] = "Provider.Type";
-
-// Flimflam Wifi Service property names.
-const char kWifiBSsid[] = "WiFi.BSSID";
-const char kWifiHexSsid[] = "WiFi.HexSSID";
-const char kWifiFrequency[] = "WiFi.Frequency";
-const char kWifiHiddenSsid[] = "WiFi.HiddenSSID";
-const char kWifiPhyMode[] = "WiFi.PhyMode";
-const char kWifiAuthMode[] = "WiFi.AuthMode";
-const char kWifiChannelProperty[] = "WiFi.Channel";
-const char kWifiPreferredDeviceProperty[] = "WiFi.PreferredDevice";
-const char kWifiRoamThresholdProperty[] = "WiFi.RoamThreshold";
-
-// Flimflam EAP property names.
-const char kEapIdentityProperty[] = "EAP.Identity";
-const char kEapMethodProperty[] = "EAP.EAP";
-const char kEapPhase2AuthProperty[] = "EAP.InnerEAP";
-const char kEapAnonymousIdentityProperty[] = "EAP.AnonymousIdentity";
-const char kEapClientCertProperty[] = "EAP.ClientCert";
-const char kEapCertIdProperty[] = "EAP.CertID";
-const char kEapClientCertNssProperty[] = "EAP.ClientCertNSS";
-const char kEapPrivateKeyProperty[] = "EAP.PrivateKey";
-const char kEapPrivateKeyPasswordProperty[] = "EAP.PrivateKeyPassword";
-const char kEapKeyIdProperty[] = "EAP.KeyID";
-const char kEapCaCertProperty[] = "EAP.CACert";
-const char kEapCaCertIdProperty[] = "EAP.CACertID";
-const char kEapCaCertNssProperty[] = "EAP.CACertNSS";
-const char kEapUseSystemCasProperty[] = "EAP.UseSystemCAs";
-const char kEapUseProactiveKeyCachingProperty[] = "EAP.UseProactiveKeyCaching";
-const char kEapPinProperty[] = "EAP.PIN";
-const char kEapPasswordProperty[] = "EAP.Password";
-const char kEapKeyMgmtProperty[] = "EAP.KeyMgmt";
-
-// Flimflam Cellular Service property names.
-const char kTechnologyFamilyProperty[] = "Cellular.Family";
-const char kActivationStateProperty[] = "Cellular.ActivationState";
-const char kNetworkTechnologyProperty[] = "Cellular.NetworkTechnology";
-const char kRoamingStateProperty[] = "Cellular.RoamingState";
-const char kOperatorNameProperty[] = "Cellular.OperatorName";
-const char kOperatorCodeProperty[] = "Cellular.OperatorCode";
-const char kServingOperatorProperty[] = "Cellular.ServingOperator";
-const char kPaymentPortalProperty[] = "Cellular.Olp";
-const char kUsageURLProperty[] = "Cellular.UsageUrl";
-const char kCellularApnProperty[] = "Cellular.APN";
-const char kCellularLastGoodApnProperty[] = "Cellular.LastGoodAPN";
-const char kCellularApnListProperty[] = "Cellular.APNList";
-
-// Flimflam Manager property names.
-const char kProfilesProperty[] = "Profiles";
-const char kServicesProperty[] = "Services";
-const char kServiceWatchListProperty[] = "ServiceWatchList";
-const char kAvailableTechnologiesProperty[] = "AvailableTechnologies";
-const char kEnabledTechnologiesProperty[] = "EnabledTechnologies";
-const char kConnectedTechnologiesProperty[] = "ConnectedTechnologies";
-const char kDefaultTechnologyProperty[] = "DefaultTechnology";
-const char kOfflineModeProperty[] = "OfflineMode";
-const char kActiveProfileProperty[] = "ActiveProfile";
-const char kDevicesProperty[] = "Devices";
-const char kCheckPortalListProperty[] = "CheckPortalList";
-const char kArpGatewayProperty[] = "ArpGateway";
-const char kCountryProperty[] = "Country";
-const char kPortalURLProperty[] = "PortalURL";
-const char kConnectionStateProperty[] = "ConnectionState";
-const char kClaimedDevicesProperty[] = "ClaimedDevices";
-
-// Flimflam Profile property names.
-const char kEntriesProperty[] = "Entries";
-
-// Flimflam Device property names.
-const char kScanningProperty[] = "Scanning";
-const char kPoweredProperty[] = "Powered";
-const char kNetworksProperty[] = "Networks";
-const char kScanIntervalProperty[] = "ScanInterval";
-const char kBgscanMethodProperty[] = "BgscanMethod";
-const char kBgscanShortIntervalProperty[] = "BgscanShortInterval";
-const char kRoamThresholdProperty[] = "RoamThreshold";
-const char kDBusObjectProperty[] = "DBus.Object";
-const char kDBusServiceProperty[] = "DBus.Service";
-const char kBgscanSignalThresholdProperty[] = "BgscanSignalThreshold";
-const char kWakeToScanPeriodSecondsProperty[] = "WakeToScanPeriodSeconds";
-const char kNetDetectScanPeriodSecondsProperty[] = "NetDetectScanPeriodSeconds";
-const char kForceWakeToScanTimerProperty[] = "ForceWakeToScanTimer";
-// The name of the network interface, ie. wlan0, eth0, etc.
-const char kInterfaceProperty[] = "Interface";
-const char kSelectedServiceProperty[] = "SelectedService";
-const char kIPConfigsProperty[] = "IPConfigs";
-
-// Flimflam Cellular Device property names.
-const char kCarrierProperty[] = "Cellular.Carrier";
-const char kCellularAllowRoamingProperty[] = "Cellular.AllowRoaming";
-const char kHomeProviderProperty[] = "Cellular.HomeProvider";
-const char kMeidProperty[] = "Cellular.MEID";
-const char kImeiProperty[] = "Cellular.IMEI";
-const char kIccidProperty[] = "Cellular.ICCID";
-const char kImsiProperty[] = "Cellular.IMSI";
-const char kEsnProperty[] = "Cellular.ESN";
-const char kMdnProperty[] = "Cellular.MDN";
-const char kMinProperty[] = "Cellular.MIN";
-const char kModelIDProperty[] = "Cellular.ModelID";
-const char kManufacturerProperty[] = "Cellular.Manufacturer";
-const char kFirmwareRevisionProperty[] = "Cellular.FirmwareRevision";
-const char kHardwareRevisionProperty[] = "Cellular.HardwareRevision";
-const char kPRLVersionProperty[] = "Cellular.PRLVersion";
-const char kSelectedNetworkProperty[] = "Cellular.SelectedNetwork";
-const char kSupportNetworkScanProperty[] = "Cellular.SupportNetworkScan";
-const char kFoundNetworksProperty[] = "Cellular.FoundNetworks";
-
-// Flimflam state options.
-const char kStateIdle[] = "idle";
-const char kStateCarrier[] = "carrier";
-const char kStateAssociation[] = "association";
-const char kStateConfiguration[] = "configuration";
-const char kStateReady[] = "ready";
-const char kStatePortal[] = "portal";
-const char kStateOffline[] = "offline";
-const char kStateOnline[] = "online";
-const char kStateDisconnect[] = "disconnect";
-const char kStateFailure[] = "failure";
-const char kStateActivationFailure[] = "activation-failure";
-
-// Flimflam portal phase and status.
-const char kPortalDetectionPhaseConnection[] = "Connection";
-const char kPortalDetectionPhaseDns[] = "DNS";
-const char kPortalDetectionPhaseHttp[] = "HTTP";
-const char kPortalDetectionPhaseContent[] = "Content";
-const char kPortalDetectionPhaseUnknown[] = "Unknown";
-const char kPortalDetectionStatusFailure[] = "Failure";
-const char kPortalDetectionStatusTimeout[] = "Timeout";
-const char kPortalDetectionStatusSuccess[] = "Success";
-
-// Flimflam property names for SIMLock status.
-const char kSIMLockStatusProperty[] = "Cellular.SIMLockStatus";
-const char kSIMLockTypeProperty[] = "LockType";
-const char kSIMLockRetriesLeftProperty[] = "RetriesLeft";
-const char kSIMLockEnabledProperty[] = "LockEnabled";
-
-// Flimflam property names for Cellular.FoundNetworks.
-const char kLongNameProperty[] = "long_name";
-const char kStatusProperty[] = "status";
-const char kShortNameProperty[] = "short_name";
-const char kTechnologyProperty[] = "technology";
-const char kNetworkIdProperty[] = "network_id";
-
-// Flimflam SIMLock status types.
-const char kSIMLockPin[] = "sim-pin";
-const char kSIMLockPuk[] = "sim-puk";
-
-// APN info property names.
-const char kApnProperty[] = "apn";
-const char kApnNetworkIdProperty[] = "network_id";
-const char kApnUsernameProperty[] = "username";
-const char kApnPasswordProperty[] = "password";
-const char kApnNameProperty[] = "name";
-const char kApnLocalizedNameProperty[] = "localized_name";
-const char kApnLanguageProperty[] = "language";
-
-// Payment Portal property names.
-const char kPaymentPortalURL[] = "url";
-const char kPaymentPortalMethod[] = "method";
-const char kPaymentPortalPostData[] = "postdata";
-
-// Operator info property names.
-const char kOperatorNameKey[] = "name";
-const char kOperatorCodeKey[] = "code";
-const char kOperatorCountryKey[] = "country";
-
-// Flimflam network technology options.
-const char kNetworkTechnology1Xrtt[] = "1xRTT";
-const char kNetworkTechnologyEvdo[] = "EVDO";
-const char kNetworkTechnologyGsm[] = "GSM";
-const char kNetworkTechnologyGprs[] = "GPRS";
-const char kNetworkTechnologyEdge[] = "EDGE";
-const char kNetworkTechnologyUmts[] = "UMTS";
-const char kNetworkTechnologyHspa[] = "HSPA";
-const char kNetworkTechnologyHspaPlus[] = "HSPA+";
-const char kNetworkTechnologyLte[] = "LTE";
-const char kNetworkTechnologyLteAdvanced[] = "LTE Advanced";
-
-// Flimflam roaming state options
-const char kRoamingStateHome[] = "home";
-const char kRoamingStateRoaming[] = "roaming";
-const char kRoamingStateUnknown[] = "unknown";
-
-// Flimflam activation state options
-const char kActivationStateActivated[] = "activated";
-const char kActivationStateActivating[] = "activating";
-const char kActivationStateNotActivated[] = "not-activated";
-const char kActivationStatePartiallyActivated[] = "partially-activated";
-const char kActivationStateUnknown[] = "unknown";
-
-// Flimflam EAP method options.
-const char kEapMethodPEAP[] = "PEAP";
-const char kEapMethodTLS[] = "TLS";
-const char kEapMethodTTLS[] = "TTLS";
-const char kEapMethodLEAP[] = "LEAP";
-
-// Flimflam EAP phase 2 auth options.
-const char kEapPhase2AuthPEAPMD5[] = "auth=MD5";
-const char kEapPhase2AuthPEAPMSCHAPV2[] = "auth=MSCHAPV2";
-const char kEapPhase2AuthPEAPGTC[] = "auth=GTC";
-const char kEapPhase2AuthTTLSMD5[] = "autheap=MD5"; // crosbug/26822
-const char kEapPhase2AuthTTLSEAPMD5[] = "autheap=MD5";
-const char kEapPhase2AuthTTLSEAPMSCHAPV2[] = "autheap=MSCHAPV2";
-const char kEapPhase2AuthTTLSMSCHAPV2[] = "auth=MSCHAPV2";
-const char kEapPhase2AuthTTLSMSCHAP[] = "auth=MSCHAP";
-const char kEapPhase2AuthTTLSPAP[] = "auth=PAP";
-const char kEapPhase2AuthTTLSCHAP[] = "auth=CHAP";
-const char kEapPhase2AuthTTLSGTC[] = "auth=GTC";
-const char kEapPhase2AuthTTLSEAPGTC[] = "autheap=GTC";
-
-// Flimflam VPN provider types.
-const char kProviderL2tpIpsec[] = "l2tpipsec";
-const char kProviderOpenVpn[] = "openvpn";
-const char kProviderThirdPartyVpn[] = "thirdpartyvpn";
-
-// Flimflam VPN service properties
-const char kVPNDomainProperty[] = "VPN.Domain";
-
-// Flimflam monitored properties
-const char kMonitorPropertyChanged[] = "PropertyChanged";
-
-// Flimflam type options.
-const char kTypeEthernet[] = "ethernet";
-const char kTypeWifi[] = "wifi";
-const char kTypeWimax[] = "wimax";
-const char kTypeBluetooth[] = "bluetooth";
-const char kTypeCellular[] = "cellular";
-const char kTypeVPN[] = "vpn";
-const char kTypePPPoE[] = "pppoe";
-
-// Flimflam mode options.
-const char kModeManaged[] = "managed";
-const char kModeAdhoc[] = "adhoc";
-
-// Flimflam security options.
-const char kSecurityWpa[] = "wpa";
-const char kSecurityWep[] = "wep";
-const char kSecurityRsn[] = "rsn";
-const char kSecurity8021x[] = "802_1x";
-const char kSecurityPsk[] = "psk";
-const char kSecurityNone[] = "none";
-
-// Flimflam L2TPIPsec property names.
-const char kL2tpIpsecAuthenticationType[] = "L2TPIPsec.AuthenticationType";
-const char kL2tpIpsecCaCertNssProperty[] = "L2TPIPsec.CACertNSS";
-const char kL2tpIpsecClientCertIdProperty[] = "L2TPIPsec.ClientCertID";
-const char kL2tpIpsecClientCertSlotProperty[] = "L2TPIPsec.ClientCertSlot";
-const char kL2tpIpsecIkeVersion[] = "L2TPIPsec.IKEVersion";
-const char kL2tpIpsecPinProperty[] = "L2TPIPsec.PIN";
-const char kL2tpIpsecPskProperty[] = "L2TPIPsec.PSK";
-const char kL2tpIpsecPskRequiredProperty[] = "L2TPIPsec.PSKRequired";
-const char kL2tpIpsecUserProperty[] = "L2TPIPsec.User";
-const char kL2tpIpsecPasswordProperty[] = "L2TPIPsec.Password";
-
-// Flimflam OpenVPN property names.
-const char kOpenVPNAuthNoCacheProperty[] = "OpenVPN.AuthNoCache";
-const char kOpenVPNAuthProperty[] = "OpenVPN.Auth";
-const char kOpenVPNAuthRetryProperty[] = "OpenVPN.AuthRetry";
-const char kOpenVPNAuthUserPassProperty[] = "OpenVPN.AuthUserPass";
-const char kOpenVPNCaCertProperty[] = "OpenVPN.CACert";
-const char kOpenVPNCaCertNSSProperty[] = "OpenVPN.CACertNSS";
-const char kOpenVPNClientCertIdProperty[] = "OpenVPN.Pkcs11.ID";
-const char kOpenVPNClientCertSlotProperty[] = "OpenVPN.Pkcs11.Slot";
-const char kOpenVPNCipherProperty[] = "OpenVPN.Cipher";
-const char kOpenVPNCompLZOProperty[] = "OpenVPN.CompLZO";
-const char kOpenVPNCompNoAdaptProperty[] = "OpenVPN.CompNoAdapt";
-const char kOpenVPNIgnoreDefaultRouteProperty[] = "OpenVPN.IgnoreDefaultRoute";
-const char kOpenVPNKeyDirectionProperty[] = "OpenVPN.KeyDirection";
-const char kOpenVPNMgmtEnableProperty[] = "OpenVPN.Mgmt.Enable";
-const char kOpenVPNNsCertTypeProperty[] = "OpenVPN.NsCertType";
-const char kOpenVPNOTPProperty[] = "OpenVPN.OTP";
-const char kOpenVPNPasswordProperty[] = "OpenVPN.Password";
-const char kOpenVPNPinProperty[] = "OpenVPN.Pkcs11.PIN";
-const char kOpenVPNPortProperty[] = "OpenVPN.Port";
-const char kOpenVPNProtoProperty[] = "OpenVPN.Proto";
-const char kOpenVPNProviderProperty[] = "OpenVPN.Pkcs11.Provider";
-const char kOpenVPNPushPeerInfoProperty[] = "OpenVPN.PushPeerInfo";
-const char kOpenVPNRemoteCertEKUProperty[] = "OpenVPN.RemoteCertEKU";
-const char kOpenVPNRemoteCertKUProperty[] = "OpenVPN.RemoteCertKU";
-const char kOpenVPNRemoteCertTLSProperty[] = "OpenVPN.RemoteCertTLS";
-const char kOpenVPNRenegSecProperty[] = "OpenVPN.RenegSec";
-const char kOpenVPNServerPollTimeoutProperty[] = "OpenVPN.ServerPollTimeout";
-const char kOpenVPNShaperProperty[] = "OpenVPN.Shaper";
-const char kOpenVPNStaticChallengeProperty[] = "OpenVPN.StaticChallenge";
-const char kOpenVPNTLSAuthContentsProperty[] = "OpenVPN.TLSAuthContents";
-const char kOpenVPNTLSRemoteProperty[] = "OpenVPN.TLSRemote";
-const char kOpenVPNUserProperty[] = "OpenVPN.User";
-
-// FlimFlam PPPoE property names.
-const char kPPPoEUsernameProperty[] = "PPPoE.Username";
-const char kPPPoEPasswordProperty[] = "PPPoE.Password";
-const char kPPPoELCPEchoIntervalProperty[] = "PPPoE.LCPEchoInterval";
-const char kPPPoELCPEchoFailureProperty[] = "PPPoE.LCPEchoFailure";
-const char kPPPoEMaxAuthFailureProperty[] = "PPPoE.MaxAuthFailure";
-
-// FlimFlam technology family options
-const char kTechnologyFamilyCdma[] = "CDMA";
-const char kTechnologyFamilyGsm[] = "GSM";
-
-// IPConfig property names.
-const char kMethodProperty[] = "Method";
-const char kAddressProperty[] = "Address";
-const char kMtuProperty[] = "Mtu";
-const char kPrefixlenProperty[] = "Prefixlen";
-const char kBroadcastProperty[] = "Broadcast";
-const char kPeerAddressProperty[] = "PeerAddress";
-const char kGatewayProperty[] = "Gateway";
-const char kDomainNameProperty[] = "DomainName";
-const char kAcceptedHostnameProperty[] = "AcceptedHostname";
-const char kNameServersProperty[] = "NameServers";
-const char kDelegatedPrefixProperty[] = "DelegatedPrefix";
-const char kDelegatedPrefixLengthProperty[] = "DelegatedPrefixLength";
-
-// IPConfig type options.
-const char kTypeIPv4[] = "ipv4";
-const char kTypeIPv6[] = "ipv6";
-const char kTypeDHCP[] = "dhcp";
-const char kTypeBOOTP[] = "bootp";
-const char kTypeZeroConf[] = "zeroconf";
-const char kTypeDHCP6[] = "dhcp6";
-const char kTypePPP[] = "ppp";
-
-// Flimflam error options.
-const char kErrorAaaFailed[] = "aaa-failed";
-const char kErrorActivationFailed[] = "activation-failed";
-const char kErrorBadPassphrase[] = "bad-passphrase";
-const char kErrorBadWEPKey[] = "bad-wepkey";
-const char kErrorConnectFailed[] = "connect-failed";
-const char kErrorDNSLookupFailed[] = "dns-lookup-failed";
-const char kErrorDhcpFailed[] = "dhcp-failed";
-const char kErrorHTTPGetFailed[] = "http-get-failed";
-const char kErrorInternal[] = "internal-error";
-const char kErrorIpsecCertAuthFailed[] = "ipsec-cert-auth-failed";
-const char kErrorIpsecPskAuthFailed[] = "ipsec-psk-auth-failed";
-const char kErrorNeedEvdo[] = "need-evdo";
-const char kErrorNeedHomeNetwork[] = "need-home-network";
-const char kErrorOtaspFailed[] = "otasp-failed";
-const char kErrorOutOfRange[] = "out-of-range";
-const char kErrorPinMissing[] = "pin-missing";
-const char kErrorPppAuthFailed[] = "ppp-auth-failed";
-
-// Flimflam error result codes.
-const char kErrorResultSuccess[] = "org.chromium.flimflam.Error.Success";
-const char kErrorResultFailure[] = "org.chromium.flimflam.Error.Failure";
-const char kErrorResultAlreadyConnected[] =
- "org.chromium.flimflam.Error.AlreadyConnected";
-const char kErrorResultAlreadyExists[] =
- "org.chromium.flimflam.Error.AlreadyExists";
-const char kErrorResultIncorrectPin[] =
- "org.chromium.flimflam.Error.IncorrectPin";
-const char kErrorResultInProgress[] = "org.chromium.flimflam.Error.InProgress";
-const char kErrorResultInternalError[] =
- "org.chromium.flimflam.Error.InternalError";
-const char kErrorResultInvalidApn[] = "org.chromium.flimflam.Error.InvalidApn";
-const char kErrorResultInvalidArguments[] =
- "org.chromium.flimflam.Error.InvalidArguments";
-const char kErrorResultInvalidNetworkName[] =
- "org.chromium.flimflam.Error.InvalidNetworkName";
-const char kErrorResultInvalidPassphrase[] =
- "org.chromium.flimflam.Error.InvalidPassphrase";
-const char kErrorResultInvalidProperty[] =
- "org.chromium.flimflam.Error.InvalidProperty";
-const char kErrorResultNoCarrier[] = "org.chromium.flimflam.Error.NoCarrier";
-const char kErrorResultNotConnected[] =
- "org.chromium.flimflam.Error.NotConnected";
-const char kErrorResultNotFound[] = "org.chromium.flimflam.Error.NotFound";
-const char kErrorResultNotImplemented[] =
- "org.chromium.flimflam.Error.NotImplemented";
-const char kErrorResultNotOnHomeNetwork[] =
- "org.chromium.flimflam.Error.NotOnHomeNetwork";
-const char kErrorResultNotRegistered[] =
- "org.chromium.flimflam.Error.NotRegistered";
-const char kErrorResultNotSupported[] =
- "org.chromium.flimflam.Error.NotSupported";
-const char kErrorResultOperationAborted[] =
- "org.chromium.flimflam.Error.OperationAborted";
-const char kErrorResultOperationInitiated[] =
- "org.chromium.flimflam.Error.OperationInitiated";
-const char kErrorResultOperationTimeout[] =
- "org.chromium.flimflam.Error.OperationTimeout";
-const char kErrorResultPassphraseRequired[] =
- "org.chromium.flimflam.Error.PassphraseRequired";
-const char kErrorResultPermissionDenied[] =
- "org.chromium.flimflam.Error.PermissionDenied";
-const char kErrorResultPinBlocked[] = "org.chromium.flimflam.Error.PinBlocked";
-const char kErrorResultPinRequired[] =
- "org.chromium.flimflam.Error.PinRequired";
-const char kErrorResultWrongState[] = "org.chromium.flimflam.Error.WrongState";
-
-const char kUnknownString[] = "UNKNOWN";
-
-// Function names.
-const char kClearPropertiesFunction[] = "ClearProperties";
-const char kCompleteCellularActivationFunction[] = "CompleteCellularActivation";
-const char kConfigureServiceForProfileFunction[] = "ConfigureServiceForProfile";
-const char kConnectToBestServicesFunction[] = "ConnectToBestServices";
-const char kCreateConnectivityReportFunction[] = "CreateConnectivityReport";
-const char kAddWakeOnPacketConnectionFunction[] = "AddWakeOnPacketConnection";
-const char kRemoveWakeOnPacketConnectionFunction[] =
- "RemoveWakeOnPacketConnection";
-const char kRemoveAllWakeOnPacketConnectionsFunction[] =
- "RemoveAllWakeOnPacketConnections";
-const char kGetLoadableProfileEntriesFunction[] = "GetLoadableProfileEntries";
-const char kGetNetworksForGeolocation[] = "GetNetworksForGeolocation";
-const char kPerformTDLSOperationFunction[] = "PerformTDLSOperation";
-const char kRefreshFunction[] = "Refresh";
-const char kResetFunction[] = "Reset";
-const char kSetCarrierFunction[] = "SetCarrier";
-const char kSetPropertiesFunction[] = "SetProperties";
-const char kVerifyAndEncryptCredentialsFunction[] =
- "VerifyAndEncryptCredentials";
-const char kVerifyAndEncryptDataFunction[] = "VerifyAndEncryptData";
-const char kVerifyDestinationFunction[] = "VerifyDestination";
-
-// ThirdPartyVpn functions.
-const char kSetParametersFunction[] = "SetParameters";
-const char kSendPacketFunction[] = "SendPacket";
-const char kUpdateConnectionStateFunction[] = "UpdateConnectionState";
-const char kOnPacketReceivedFunction[] = "OnPacketReceived";
-const char kOnPlatformMessageFunction[] = "OnPlatformMessage";
-
-// Device property names.
-const char kEapAuthenticationCompletedProperty[] = "EapAuthenticationCompleted";
-const char kEapAuthenticatorDetectedProperty[] = "EapAuthenticatorDetected";
-const char kLinkMonitorResponseTimeProperty[] = "LinkMonitorResponseTime";
-const char kLinkUpProperty[] = "Ethernet.LinkUp";
-const char kProviderRequiresRoamingProperty[] =
- "Cellular.ProviderRequiresRoaming";
-const char kPPPoEProperty[] = "Ethernet.PPPoE";
-const char kReceiveByteCountProperty[] = "ReceiveByteCount";
-const char kSIMPresentProperty[] = "Cellular.SIMPresent";
-const char kSupportedCarriersProperty[] = "Cellular.SupportedCarriers";
-const char kTransmitByteCountProperty[] = "TransmitByteCount";
-
-// Technology types (augments "Flimflam type options" above).
-const char kTypeEthernetEap[] = "etherneteap";
-
-// Error strings.
-const char kErrorEapAuthenticationFailed[] = "eap-authentication-failed";
-const char kErrorEapLocalTlsFailed[] = "eap-local-tls-failed";
-const char kErrorEapRemoteTlsFailed[] = "eap-remote-tls-failed";
-
-// IPConfig property names.
-const char kSearchDomainsProperty[] = "SearchDomains";
-const char kVendorEncapsulatedOptionsProperty[] = "VendorEncapsulatedOptions";
-const char kWebProxyAutoDiscoveryUrlProperty[] = "WebProxyAutoDiscoveryUrl";
-
-// Manager property names.
-const char kDefaultServiceProperty[] = "DefaultService";
-const char kDisableWiFiVHTProperty[] = "DisableWiFiVHT";
-const char kHostNameProperty[] = "HostName";
-const char kIgnoredDNSSearchPathsProperty[] = "IgnoredDNSSearchPaths";
-const char kLinkMonitorTechnologiesProperty[] =
- "LinkMonitorTechnologies";
-const char kNoAutoConnectTechnologiesProperty[] = "NoAutoConnectTechnologies";
-const char kPortalCheckIntervalProperty[] = "PortalCheckInterval";
-const char kProhibitedTechnologiesProperty[] = "ProhibitedTechnologies";
-const char kServiceCompleteListProperty[] = "ServiceCompleteList";
-const char kShortDNSTimeoutTechnologiesProperty[] =
- "ShortDNSTimeoutTechnologies";
-const char kUninitializedTechnologiesProperty[] = "UninitializedTechnologies";
-const char kWakeOnLanEnabledProperty[] = "WakeOnLanEnabled";
-const char kWakeOnWiFiFeaturesEnabledProperty[] = "WakeOnWiFiFeaturesEnabled";
-
-// Service property names.
-const char kActivationTypeProperty[] = "Cellular.ActivationType";
-const char kDiagnosticsDisconnectsProperty[] = "Diagnostics.Disconnects";
-const char kDiagnosticsMisconnectsProperty[] = "Diagnostics.Misconnects";
-const char kEapRemoteCertificationProperty[] = "EAP.RemoteCertification";
-const char kEapCaCertPemProperty[] = "EAP.CACertPEM";
-const char kEapSubjectMatchProperty[] = "EAP.SubjectMatch";
-const char kErrorDetailsProperty[] = "ErrorDetails";
-const char kHTTPProxyPortProperty[] = "HTTPProxyPort";
-const char kIPConfigProperty[] = "IPConfig";
-const char kL2tpIpsecCaCertPemProperty[] = "L2TPIPsec.CACertPEM";
-const char kL2tpIpsecTunnelGroupProperty[] = "L2TPIPsec.TunnelGroup";
-const char kL2tpIpsecXauthPasswordProperty[] = "L2TPIPsec.XauthPassword";
-const char kL2tpIpsecXauthUserProperty[] = "L2TPIPsec.XauthUser";
-const char kL2tpIpsecLcpEchoDisabledProperty[] = "L2TPIPsec.LCPEchoDisabled";
-const char kManagedCredentialsProperty[] = "ManagedCredentials";
-const char kOpenVPNCaCertPemProperty[] = "OpenVPN.CACertPEM";
-const char kOpenVPNCertProperty[] = "OpenVPN.Cert";
-const char kOpenVPNExtraCertPemProperty[] = "OpenVPN.ExtraCertPEM";
-const char kOpenVPNKeyProperty[] = "OpenVPN.Key";
-const char kOpenVPNPingProperty[] = "OpenVPN.Ping";
-const char kOpenVPNPingExitProperty[] = "OpenVPN.PingExit";
-const char kOpenVPNPingRestartProperty[] = "OpenVPN.PingRestart";
-const char kOpenVPNTLSAuthProperty[] = "OpenVPN.TLSAuth";
-const char kOpenVPNTokenProperty[] = "OpenVPN.Token";
-const char kOpenVPNVerbProperty[] = "OpenVPN.Verb";
-const char kOpenVPNVerifyHashProperty[] = "OpenVPN.VerifyHash";
-const char kOpenVPNVerifyX509NameProperty[] = "OpenVPN.VerifyX509Name";
-const char kOpenVPNVerifyX509TypeProperty[] = "OpenVPN.VerifyX509Type";
-const char kOutOfCreditsProperty[] = "Cellular.OutOfCredits";
-const char kPhysicalTechnologyProperty[] = "PhysicalTechnology";
-const char kPreviousErrorProperty[] = "PreviousError";
-const char kPreviousErrorSerialNumberProperty[] = "PreviousErrorSerialNumber";
-const char kStaticIPAddressProperty[] = "StaticIP.Address";
-const char kStaticIPGatewayProperty[] = "StaticIP.Gateway";
-const char kStaticIPMtuProperty[] = "StaticIP.Mtu";
-const char kStaticIPNameServersProperty[] = "StaticIP.NameServers";
-const char kStaticIPPeerAddressProperty[] = "StaticIP.PeerAddress";
-const char kStaticIPPrefixlenProperty[] = "StaticIP.Prefixlen";
-const char kSavedIPAddressProperty[] = "SavedIP.Address";
-const char kSavedIPGatewayProperty[] = "SavedIP.Gateway";
-const char kSavedIPMtuProperty[] = "SavedIP.Mtu";
-const char kSavedIPNameServersProperty[] = "SavedIP.NameServers";
-const char kSavedIPPeerAddressProperty[] = "SavedIP.PeerAddress";
-const char kSavedIPPrefixlenProperty[] = "SavedIP.Prefixlen";
-const char kTetheringProperty[] = "Tethering";
-const char kVPNMTUProperty[] = "VPN.MTU";
-const char kWifiFrequencyListProperty[] = "WiFi.FrequencyList";
-const char kWifiVendorInformationProperty[] = "WiFi.VendorInformation";
-const char kWifiProtectedManagementFrameRequiredProperty[] =
- "WiFi.ProtectedManagementFrameRequired";
-
-// Profile property names.
-const char kUserHashProperty[] = "UserHash";
-
-// Service Tethering property values.
-const char kTetheringNotDetectedState[] = "NotDetected";
-const char kTetheringSuspectedState[] = "Suspected";
-const char kTetheringConfirmedState[] = "Confirmed";
-
-// WiFi Service Vendor Information dictionary properties.
-const char kVendorWPSManufacturerProperty[] = "Manufacturer";
-const char kVendorWPSModelNameProperty[] = "ModelName";
-const char kVendorWPSModelNumberProperty[] = "ModelNumber";
-const char kVendorWPSDeviceNameProperty[] = "DeviceName";
-const char kVendorOUIListProperty[] = "OUIList";
-
-// WiFi Device link property names.
-const char kLinkStatisticsProperty[] = "LinkStatistics";
-const char kAverageReceiveSignalDbmProperty[] = "AverageReceiveSignalDbm";
-const char kInactiveTimeMillisecondsProperty[] =
- "InactiveTimeMilliseconds";
-const char kLastReceiveSignalDbmProperty[] = "LastReceiveSignalDbm";
-const char kPacketReceiveSuccessesProperty[] = "PacketReceiveSuccesses";
-const char kPacketTransmitFailuresProperty[] = "PacketTransmitFailures";
-const char kPacketTransmitSuccessesProperty[] = "PacketTrasmitSuccesses";
-const char kTransmitBitrateProperty[] = "TransmitBitrate";
-const char kTransmitRetriesProperty[] = "TransmitRetries";
-
-// WiFi TDLS operations.
-const char kTDLSDiscoverOperation[] = "Discover";
-const char kTDLSSetupOperation[] = "Setup";
-const char kTDLSStatusOperation[] = "Status";
-const char kTDLSTeardownOperation[] = "Teardown";
-
-// WiFi TDLS states.
-const char kTDLSConnectedState[] = "Connected";
-const char kTDLSDisabledState[] = "Disabled";
-const char kTDLSDisconnectedState[] = "Disconnected";
-const char kTDLSNonexistentState[] = "Nonexistent";
-const char kTDLSUnknownState[] = "Unknown";
-
-// Wake on WiFi features.
-const char kWakeOnWiFiFeaturesEnabledPacket[] = "packet";
-const char kWakeOnWiFiFeaturesEnabledSSID[] = "ssid";
-const char kWakeOnWiFiFeaturesEnabledPacketSSID[] = "packet_and_ssid";
-const char kWakeOnWiFiFeaturesEnabledNone[] = "none";
-const char kWakeOnWiFiFeaturesEnabledNotSupported[] = "not_supported";
-
-// Cellular service carriers.
-const char kCarrierGenericUMTS[] = "Generic UMTS";
-const char kCarrierSprint[] = "Sprint";
-const char kCarrierVerizon[] = "Verizon Wireless";
-
-// Cellular activation types.
-const char kActivationTypeNonCellular[] = "NonCellular"; // For future use
-const char kActivationTypeOMADM[] = "OMADM"; // For future use
-const char kActivationTypeOTA[] = "OTA";
-const char kActivationTypeOTASP[] = "OTASP";
-
-// Geolocation property field names.
-// Reference:
-// https://devsite.googleplex.com/maps/documentation/business/geolocation/
-// Top level properties for a Geolocation request.
-const char kGeoHomeMobileCountryCodeProperty[] = "homeMobileCountryCode";
-const char kGeoHomeMobileNetworkCodeProperty[] = "homeMobileNetworkCode";
-const char kGeoRadioTypePropertyProperty[] = "radioType";
-const char kGeoCellTowersProperty[] = "cellTowers";
-const char kGeoWifiAccessPointsProperty[] = "wifiAccessPoints";
-// Cell tower object property names.
-const char kGeoCellIdProperty[] = "cellId";
-const char kGeoLocationAreaCodeProperty[] = "locationAreaCode";
-const char kGeoMobileCountryCodeProperty[] = "mobileCountryCode";
-const char kGeoMobileNetworkCodeProperty[] = "mobileNetworkCode";
-const char kGeoTimingAdvanceProperty[] = "timingAdvance";
-// WiFi access point property names.
-const char kGeoMacAddressProperty[] = "macAddress";
-const char kGeoChannelProperty[] = "channel";
-const char kGeoSignalToNoiseRatioProperty[] = "signalToNoiseRatio";
-// Common property names for geolocation objects.
-const char kGeoAgeProperty[] = "age";
-const char kGeoSignalStrengthProperty[] = "signalStrength";
-// ThirdPartyVpn parameters, properties and constants.
-const char kAddressParameterThirdPartyVpn[] = "address";
-const char kBroadcastAddressParameterThirdPartyVpn[] = "broadcast_address";
-const char kGatewayParameterThirdPartyVpn[] = "gateway";
-const char kBypassTunnelForIpParameterThirdPartyVpn[] = "bypass_tunnel_for_ip";
-const char kSubnetPrefixParameterThirdPartyVpn[] = "subnet_prefix";
-const char kMtuParameterThirdPartyVpn[] = "mtu";
-const char kDomainSearchParameterThirdPartyVpn[] = "domain_search";
-const char kDnsServersParameterThirdPartyVpn[] = "dns_servers";
-const char kInclusionListParameterThirdPartyVpn[] = "inclusion_list";
-const char kExclusionListParameterThirdPartyVpn[] = "exclusion_list";
-const char kObjectPathSuffixProperty[] = "ObjectPathSuffix";
-const char kExtensionNameProperty[] = "ExtensionName";
-const char kConfigurationNameProperty[] = "ConfigurationName";
-const char kObjectPathBase[] = "/thirdpartyvpn/";
-const char kNonIPDelimiter = ':';
-const char kIPDelimiter = ' ';
-} // namespace shill
-
-#endif // SYSTEM_API_DBUS_SHILL_DBUS_CONSTANTS_H_
diff --git a/include/shill/dbus-proxies.h b/include/shill/dbus-proxies.h
deleted file mode 100644
index 188322a..0000000
--- a/include/shill/dbus-proxies.h
+++ /dev/null
@@ -1,3972 +0,0 @@
-// Automatic generation of D-Bus interfaces:
-// - org.chromium.flimflam.Device
-// - org.chromium.flimflam.IPConfig
-// - org.chromium.flimflam.Manager
-// - org.chromium.flimflam.Profile
-// - org.chromium.flimflam.Service
-// - org.chromium.flimflam.Task
-// - org.chromium.flimflam.ThirdPartyVpn
-#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_SHILL_OUT_DEFAULT_GEN_INCLUDE_SHILL_DBUS_PROXIES_H
-#define ____CHROMEOS_DBUS_BINDING___BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_SHILL_OUT_DEFAULT_GEN_INCLUDE_SHILL_DBUS_PROXIES_H
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <base/bind.h>
-#include <base/callback.h>
-#include <base/logging.h>
-#include <base/macros.h>
-#include <base/memory/ref_counted.h>
-#include <chromeos/any.h>
-#include <chromeos/dbus/dbus_method_invoker.h>
-#include <chromeos/dbus/dbus_property.h>
-#include <chromeos/dbus/dbus_signal_handler.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/variant_dictionary.h>
-#include <dbus/bus.h>
-#include <dbus/message.h>
-#include <dbus/object_manager.h>
-#include <dbus/object_path.h>
-#include <dbus/object_proxy.h>
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Abstract interface proxy for org::chromium::flimflam::Device.
-class DeviceProxyInterface {
- public:
- virtual ~DeviceProxyInterface() = default;
-
- virtual bool AddWakeOnPacketConnection(
- const std::string& in_ip_endpoint,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void AddWakeOnPacketConnectionAsync(
- const std::string& in_ip_endpoint,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool RemoveWakeOnPacketConnection(
- const std::string& in_ip_endpoint,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RemoveWakeOnPacketConnectionAsync(
- const std::string& in_ip_endpoint,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool RemoveAllWakeOnPacketConnections(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RemoveAllWakeOnPacketConnectionsAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ClearProperty(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ClearPropertyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Enable(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void EnableAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Disable(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void DisableAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ProposeScan(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ProposeScanAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool AddIPConfig(
- const std::string& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void AddIPConfigAsync(
- const std::string& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Register(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RegisterAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool RequirePin(
- const std::string& in_1,
- bool in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RequirePinAsync(
- const std::string& in_1,
- bool in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool EnterPin(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void EnterPinAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool UnblockPin(
- const std::string& in_1,
- const std::string& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void UnblockPinAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ChangePin(
- const std::string& in_1,
- const std::string& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ChangePinAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool PerformTDLSOperation(
- const std::string& in_1,
- const std::string& in_2,
- std::string* out_3,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void PerformTDLSOperationAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Reset(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ResetAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ResetByteCounters(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ResetByteCountersAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetCarrier(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetCarrierAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool RequestRoam(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RequestRoamAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Interface proxy for org::chromium::flimflam::Device.
-class DeviceProxy final : public DeviceProxyInterface {
- public:
- DeviceProxy(
- const scoped_refptr<dbus::Bus>& bus,
- const dbus::ObjectPath& object_path) :
- bus_{bus},
- object_path_{object_path},
- dbus_object_proxy_{
- bus_->GetObjectProxy(service_name_, object_path_)} {
- }
-
- ~DeviceProxy() override {
- bus_->RemoveObjectProxy(
- service_name_, object_path_, base::Bind(&base::DoNothing));
- }
-
- void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "PropertyChanged",
- signal_callback,
- on_connected_callback);
- }
-
- void ReleaseObjectProxy(const base::Closure& callback) {
- bus_->RemoveObjectProxy(service_name_, object_path_, callback);
- }
-
- const dbus::ObjectPath& GetObjectPath() const {
- return object_path_;
- }
-
- dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
- bool AddWakeOnPacketConnection(
- const std::string& in_ip_endpoint,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "AddWakeOnPacketConnection",
- error,
- in_ip_endpoint);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void AddWakeOnPacketConnectionAsync(
- const std::string& in_ip_endpoint,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "AddWakeOnPacketConnection",
- success_callback,
- error_callback,
- in_ip_endpoint);
- }
-
- bool RemoveWakeOnPacketConnection(
- const std::string& in_ip_endpoint,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RemoveWakeOnPacketConnection",
- error,
- in_ip_endpoint);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RemoveWakeOnPacketConnectionAsync(
- const std::string& in_ip_endpoint,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RemoveWakeOnPacketConnection",
- success_callback,
- error_callback,
- in_ip_endpoint);
- }
-
- bool RemoveAllWakeOnPacketConnections(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RemoveAllWakeOnPacketConnections",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RemoveAllWakeOnPacketConnectionsAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RemoveAllWakeOnPacketConnections",
- success_callback,
- error_callback);
- }
-
- bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "GetProperties",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "GetProperties",
- success_callback,
- error_callback);
- }
-
- bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "SetProperty",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "SetProperty",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool ClearProperty(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ClearProperty",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ClearPropertyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ClearProperty",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool Enable(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Enable",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void EnableAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Enable",
- success_callback,
- error_callback);
- }
-
- bool Disable(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Disable",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void DisableAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Disable",
- success_callback,
- error_callback);
- }
-
- bool ProposeScan(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ProposeScan",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ProposeScanAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ProposeScan",
- success_callback,
- error_callback);
- }
-
- bool AddIPConfig(
- const std::string& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "AddIPConfig",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void AddIPConfigAsync(
- const std::string& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "AddIPConfig",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool Register(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Register",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RegisterAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Register",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool RequirePin(
- const std::string& in_1,
- bool in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RequirePin",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RequirePinAsync(
- const std::string& in_1,
- bool in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RequirePin",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool EnterPin(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "EnterPin",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void EnterPinAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "EnterPin",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool UnblockPin(
- const std::string& in_1,
- const std::string& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "UnblockPin",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void UnblockPinAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "UnblockPin",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool ChangePin(
- const std::string& in_1,
- const std::string& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ChangePin",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ChangePinAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ChangePin",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool PerformTDLSOperation(
- const std::string& in_1,
- const std::string& in_2,
- std::string* out_3,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "PerformTDLSOperation",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_3);
- }
-
- void PerformTDLSOperationAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "PerformTDLSOperation",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool Reset(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Reset",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ResetAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "Reset",
- success_callback,
- error_callback);
- }
-
- bool ResetByteCounters(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ResetByteCounters",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ResetByteCountersAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "ResetByteCounters",
- success_callback,
- error_callback);
- }
-
- bool SetCarrier(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "SetCarrier",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetCarrierAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "SetCarrier",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool RequestRoam(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RequestRoam",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RequestRoamAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Device",
- "RequestRoam",
- success_callback,
- error_callback,
- in_1);
- }
-
- private:
- scoped_refptr<dbus::Bus> bus_;
- const std::string service_name_{"org.chromium.flimflam"};
- dbus::ObjectPath object_path_;
- dbus::ObjectProxy* dbus_object_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(DeviceProxy);
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Abstract interface proxy for org::chromium::flimflam::IPConfig.
-class IPConfigProxyInterface {
- public:
- virtual ~IPConfigProxyInterface() = default;
-
- virtual bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ClearProperty(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ClearPropertyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Remove(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RemoveAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Refresh(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RefreshAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Interface proxy for org::chromium::flimflam::IPConfig.
-class IPConfigProxy final : public IPConfigProxyInterface {
- public:
- IPConfigProxy(
- const scoped_refptr<dbus::Bus>& bus,
- const dbus::ObjectPath& object_path) :
- bus_{bus},
- object_path_{object_path},
- dbus_object_proxy_{
- bus_->GetObjectProxy(service_name_, object_path_)} {
- }
-
- ~IPConfigProxy() override {
- bus_->RemoveObjectProxy(
- service_name_, object_path_, base::Bind(&base::DoNothing));
- }
-
- void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "PropertyChanged",
- signal_callback,
- on_connected_callback);
- }
-
- void ReleaseObjectProxy(const base::Closure& callback) {
- bus_->RemoveObjectProxy(service_name_, object_path_, callback);
- }
-
- const dbus::ObjectPath& GetObjectPath() const {
- return object_path_;
- }
-
- dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
- bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "GetProperties",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "GetProperties",
- success_callback,
- error_callback);
- }
-
- bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "SetProperty",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "SetProperty",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool ClearProperty(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "ClearProperty",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ClearPropertyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "ClearProperty",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool Remove(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "Remove",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RemoveAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "Remove",
- success_callback,
- error_callback);
- }
-
- bool Refresh(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "Refresh",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RefreshAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.IPConfig",
- "Refresh",
- success_callback,
- error_callback);
- }
-
- private:
- scoped_refptr<dbus::Bus> bus_;
- const std::string service_name_{"org.chromium.flimflam"};
- dbus::ObjectPath object_path_;
- dbus::ObjectProxy* dbus_object_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(IPConfigProxy);
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Abstract interface proxy for org::chromium::flimflam::Manager.
-class ManagerProxyInterface {
- public:
- virtual ~ManagerProxyInterface() = default;
-
- virtual bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetState(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetStateAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool CreateProfile(
- const std::string& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void CreateProfileAsync(
- const std::string& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool RemoveProfile(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RemoveProfileAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool PushProfile(
- const std::string& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void PushProfileAsync(
- const std::string& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool InsertUserProfile(
- const std::string& in_1,
- const std::string& in_2,
- dbus::ObjectPath* out_3,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void InsertUserProfileAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool PopProfile(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void PopProfileAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool PopAnyProfile(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void PopAnyProfileAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool PopAllUserProfiles(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void PopAllUserProfilesAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool RecheckPortal(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RecheckPortalAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool RequestScan(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RequestScanAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool EnableTechnology(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void EnableTechnologyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool DisableTechnology(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void DisableTechnologyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetWifiService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetWifiServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ConfigureService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ConfigureServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ConfigureServiceForProfile(
- const dbus::ObjectPath& in_1,
- const chromeos::VariantDictionary& in_2,
- dbus::ObjectPath* out_3,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ConfigureServiceForProfileAsync(
- const dbus::ObjectPath& in_1,
- const chromeos::VariantDictionary& in_2,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool FindMatchingService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void FindMatchingServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetVPNService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetVPNServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetDebugLevel(
- int32_t* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetDebugLevelAsync(
- const base::Callback<void(int32_t)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetDebugLevel(
- int32_t in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetDebugLevelAsync(
- int32_t in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetServiceOrder(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetServiceOrderAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetServiceOrder(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetServiceOrderAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetDebugTags(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetDebugTagsAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetDebugTags(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetDebugTagsAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ListDebugTags(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ListDebugTagsAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetNetworksForGeolocation(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetNetworksForGeolocationAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool VerifyDestination(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- bool* out_8,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void VerifyDestinationAsync(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const base::Callback<void(bool)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool VerifyAndEncryptCredentials(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const dbus::ObjectPath& in_network,
- std::string* out_9,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void VerifyAndEncryptCredentialsAsync(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const dbus::ObjectPath& in_network,
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool VerifyAndEncryptData(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const std::string& in_data,
- std::string* out_9,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void VerifyAndEncryptDataAsync(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const std::string& in_data,
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ConnectToBestServices(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ConnectToBestServicesAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool CreateConnectivityReport(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void CreateConnectivityReportAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ClaimInterface(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ClaimInterfaceAsync(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ReleaseInterface(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ReleaseInterfaceAsync(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetSchedScan(
- bool in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetSchedScanAsync(
- bool in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-
- virtual void RegisterStateChangedSignalHandler(
- const base::Callback<void(const std::string&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Interface proxy for org::chromium::flimflam::Manager.
-class ManagerProxy final : public ManagerProxyInterface {
- public:
- ManagerProxy(const scoped_refptr<dbus::Bus>& bus) :
- bus_{bus},
- dbus_object_proxy_{
- bus_->GetObjectProxy(service_name_, object_path_)} {
- }
-
- ~ManagerProxy() override {
- bus_->RemoveObjectProxy(
- service_name_, object_path_, base::Bind(&base::DoNothing));
- }
-
- void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PropertyChanged",
- signal_callback,
- on_connected_callback);
- }
-
- void RegisterStateChangedSignalHandler(
- const base::Callback<void(const std::string&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "StateChanged",
- signal_callback,
- on_connected_callback);
- }
-
- void ReleaseObjectProxy(const base::Closure& callback) {
- bus_->RemoveObjectProxy(service_name_, object_path_, callback);
- }
-
- const dbus::ObjectPath& GetObjectPath() const {
- return object_path_;
- }
-
- dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
- bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetProperties",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetProperties",
- success_callback,
- error_callback);
- }
-
- bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetProperty",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetProperty",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool GetState(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetState",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetStateAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetState",
- success_callback,
- error_callback);
- }
-
- bool CreateProfile(
- const std::string& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "CreateProfile",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void CreateProfileAsync(
- const std::string& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "CreateProfile",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool RemoveProfile(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "RemoveProfile",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RemoveProfileAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "RemoveProfile",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool PushProfile(
- const std::string& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PushProfile",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void PushProfileAsync(
- const std::string& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PushProfile",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool InsertUserProfile(
- const std::string& in_1,
- const std::string& in_2,
- dbus::ObjectPath* out_3,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "InsertUserProfile",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_3);
- }
-
- void InsertUserProfileAsync(
- const std::string& in_1,
- const std::string& in_2,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "InsertUserProfile",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool PopProfile(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PopProfile",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void PopProfileAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PopProfile",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool PopAnyProfile(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PopAnyProfile",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void PopAnyProfileAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PopAnyProfile",
- success_callback,
- error_callback);
- }
-
- bool PopAllUserProfiles(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PopAllUserProfiles",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void PopAllUserProfilesAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "PopAllUserProfiles",
- success_callback,
- error_callback);
- }
-
- bool RecheckPortal(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "RecheckPortal",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RecheckPortalAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "RecheckPortal",
- success_callback,
- error_callback);
- }
-
- bool RequestScan(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "RequestScan",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RequestScanAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "RequestScan",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool EnableTechnology(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "EnableTechnology",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void EnableTechnologyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "EnableTechnology",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool DisableTechnology(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "DisableTechnology",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void DisableTechnologyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "DisableTechnology",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool GetService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetService",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void GetServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetService",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool GetWifiService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetWifiService",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void GetWifiServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetWifiService",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool ConfigureService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ConfigureService",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void ConfigureServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ConfigureService",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool ConfigureServiceForProfile(
- const dbus::ObjectPath& in_1,
- const chromeos::VariantDictionary& in_2,
- dbus::ObjectPath* out_3,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ConfigureServiceForProfile",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_3);
- }
-
- void ConfigureServiceForProfileAsync(
- const dbus::ObjectPath& in_1,
- const chromeos::VariantDictionary& in_2,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ConfigureServiceForProfile",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool FindMatchingService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "FindMatchingService",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void FindMatchingServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "FindMatchingService",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool GetVPNService(
- const chromeos::VariantDictionary& in_1,
- dbus::ObjectPath* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetVPNService",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void GetVPNServiceAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void(const dbus::ObjectPath&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetVPNService",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool GetDebugLevel(
- int32_t* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetDebugLevel",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetDebugLevelAsync(
- const base::Callback<void(int32_t)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetDebugLevel",
- success_callback,
- error_callback);
- }
-
- bool SetDebugLevel(
- int32_t in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetDebugLevel",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetDebugLevelAsync(
- int32_t in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetDebugLevel",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool GetServiceOrder(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetServiceOrder",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetServiceOrderAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetServiceOrder",
- success_callback,
- error_callback);
- }
-
- bool SetServiceOrder(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetServiceOrder",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetServiceOrderAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetServiceOrder",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool GetDebugTags(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetDebugTags",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetDebugTagsAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetDebugTags",
- success_callback,
- error_callback);
- }
-
- bool SetDebugTags(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetDebugTags",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetDebugTagsAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetDebugTags",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool ListDebugTags(
- std::string* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ListDebugTags",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void ListDebugTagsAsync(
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ListDebugTags",
- success_callback,
- error_callback);
- }
-
- bool GetNetworksForGeolocation(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetNetworksForGeolocation",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetNetworksForGeolocationAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "GetNetworksForGeolocation",
- success_callback,
- error_callback);
- }
-
- bool VerifyDestination(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- bool* out_8,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "VerifyDestination",
- error,
- in_certificate,
- in_public_key,
- in_nonce,
- in_signed_data,
- in_destination_udn,
- in_hotspot_ssid,
- in_hotspot_bssid);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_8);
- }
-
- void VerifyDestinationAsync(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const base::Callback<void(bool)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "VerifyDestination",
- success_callback,
- error_callback,
- in_certificate,
- in_public_key,
- in_nonce,
- in_signed_data,
- in_destination_udn,
- in_hotspot_ssid,
- in_hotspot_bssid);
- }
-
- bool VerifyAndEncryptCredentials(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const dbus::ObjectPath& in_network,
- std::string* out_9,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "VerifyAndEncryptCredentials",
- error,
- in_certificate,
- in_public_key,
- in_nonce,
- in_signed_data,
- in_destination_udn,
- in_hotspot_ssid,
- in_hotspot_bssid,
- in_network);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_9);
- }
-
- void VerifyAndEncryptCredentialsAsync(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const dbus::ObjectPath& in_network,
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "VerifyAndEncryptCredentials",
- success_callback,
- error_callback,
- in_certificate,
- in_public_key,
- in_nonce,
- in_signed_data,
- in_destination_udn,
- in_hotspot_ssid,
- in_hotspot_bssid,
- in_network);
- }
-
- bool VerifyAndEncryptData(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const std::string& in_data,
- std::string* out_9,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "VerifyAndEncryptData",
- error,
- in_certificate,
- in_public_key,
- in_nonce,
- in_signed_data,
- in_destination_udn,
- in_hotspot_ssid,
- in_hotspot_bssid,
- in_data);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_9);
- }
-
- void VerifyAndEncryptDataAsync(
- const std::string& in_certificate,
- const std::string& in_public_key,
- const std::string& in_nonce,
- const std::string& in_signed_data,
- const std::string& in_destination_udn,
- const std::string& in_hotspot_ssid,
- const std::string& in_hotspot_bssid,
- const std::string& in_data,
- const base::Callback<void(const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "VerifyAndEncryptData",
- success_callback,
- error_callback,
- in_certificate,
- in_public_key,
- in_nonce,
- in_signed_data,
- in_destination_udn,
- in_hotspot_ssid,
- in_hotspot_bssid,
- in_data);
- }
-
- bool ConnectToBestServices(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ConnectToBestServices",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ConnectToBestServicesAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ConnectToBestServices",
- success_callback,
- error_callback);
- }
-
- bool CreateConnectivityReport(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "CreateConnectivityReport",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void CreateConnectivityReportAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "CreateConnectivityReport",
- success_callback,
- error_callback);
- }
-
- bool ClaimInterface(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ClaimInterface",
- error,
- in_claimer_name,
- in_interface_name);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ClaimInterfaceAsync(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ClaimInterface",
- success_callback,
- error_callback,
- in_claimer_name,
- in_interface_name);
- }
-
- bool ReleaseInterface(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ReleaseInterface",
- error,
- in_claimer_name,
- in_interface_name);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ReleaseInterfaceAsync(
- const std::string& in_claimer_name,
- const std::string& in_interface_name,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "ReleaseInterface",
- success_callback,
- error_callback,
- in_claimer_name,
- in_interface_name);
- }
-
- bool SetSchedScan(
- bool in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetSchedScan",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetSchedScanAsync(
- bool in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Manager",
- "SetSchedScan",
- success_callback,
- error_callback,
- in_1);
- }
-
- private:
- scoped_refptr<dbus::Bus> bus_;
- const std::string service_name_{"org.chromium.flimflam"};
- const dbus::ObjectPath object_path_{"/"};
- dbus::ObjectProxy* dbus_object_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(ManagerProxy);
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Abstract interface proxy for org::chromium::flimflam::Profile.
-class ProfileProxyInterface {
- public:
- virtual ~ProfileProxyInterface() = default;
-
- virtual bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetEntry(
- const std::string& in_1,
- chromeos::VariantDictionary* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetEntryAsync(
- const std::string& in_1,
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool DeleteEntry(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void DeleteEntryAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Interface proxy for org::chromium::flimflam::Profile.
-class ProfileProxy final : public ProfileProxyInterface {
- public:
- ProfileProxy(
- const scoped_refptr<dbus::Bus>& bus,
- const dbus::ObjectPath& object_path) :
- bus_{bus},
- object_path_{object_path},
- dbus_object_proxy_{
- bus_->GetObjectProxy(service_name_, object_path_)} {
- }
-
- ~ProfileProxy() override {
- bus_->RemoveObjectProxy(
- service_name_, object_path_, base::Bind(&base::DoNothing));
- }
-
- void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "PropertyChanged",
- signal_callback,
- on_connected_callback);
- }
-
- void ReleaseObjectProxy(const base::Closure& callback) {
- bus_->RemoveObjectProxy(service_name_, object_path_, callback);
- }
-
- const dbus::ObjectPath& GetObjectPath() const {
- return object_path_;
- }
-
- dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
- bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "GetProperties",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "GetProperties",
- success_callback,
- error_callback);
- }
-
- bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "SetProperty",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "SetProperty",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool GetEntry(
- const std::string& in_1,
- chromeos::VariantDictionary* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "GetEntry",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void GetEntryAsync(
- const std::string& in_1,
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "GetEntry",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool DeleteEntry(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "DeleteEntry",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void DeleteEntryAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Profile",
- "DeleteEntry",
- success_callback,
- error_callback,
- in_1);
- }
-
- private:
- scoped_refptr<dbus::Bus> bus_;
- const std::string service_name_{"org.chromium.flimflam"};
- dbus::ObjectPath object_path_;
- dbus::ObjectProxy* dbus_object_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(ProfileProxy);
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Abstract interface proxy for org::chromium::flimflam::Service.
-class ServiceProxyInterface {
- public:
- virtual ~ServiceProxyInterface() = default;
-
- virtual bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SetProperties(
- const chromeos::VariantDictionary& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetPropertiesAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ClearProperty(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ClearPropertyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ClearProperties(
- const std::vector<std::string>& in_1,
- std::vector<bool>* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ClearPropertiesAsync(
- const std::vector<std::string>& in_1,
- const base::Callback<void(const std::vector<bool>&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Connect(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ConnectAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Disconnect(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void DisconnectAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool Remove(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RemoveAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool ActivateCellularModem(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void ActivateCellularModemAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool CompleteCellularActivation(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void CompleteCellularActivationAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool GetLoadableProfileEntries(
- std::map<dbus::ObjectPath, std::string>* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void GetLoadableProfileEntriesAsync(
- const base::Callback<void(const std::map<dbus::ObjectPath, std::string>&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Interface proxy for org::chromium::flimflam::Service.
-class ServiceProxy final : public ServiceProxyInterface {
- public:
- ServiceProxy(
- const scoped_refptr<dbus::Bus>& bus,
- const dbus::ObjectPath& object_path) :
- bus_{bus},
- object_path_{object_path},
- dbus_object_proxy_{
- bus_->GetObjectProxy(service_name_, object_path_)} {
- }
-
- ~ServiceProxy() override {
- bus_->RemoveObjectProxy(
- service_name_, object_path_, base::Bind(&base::DoNothing));
- }
-
- void RegisterPropertyChangedSignalHandler(
- const base::Callback<void(const std::string&,
- const chromeos::Any&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "PropertyChanged",
- signal_callback,
- on_connected_callback);
- }
-
- void ReleaseObjectProxy(const base::Closure& callback) {
- bus_->RemoveObjectProxy(service_name_, object_path_, callback);
- }
-
- const dbus::ObjectPath& GetObjectPath() const {
- return object_path_;
- }
-
- dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
- bool GetProperties(
- chromeos::VariantDictionary* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "GetProperties",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetPropertiesAsync(
- const base::Callback<void(const chromeos::VariantDictionary&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "GetProperties",
- success_callback,
- error_callback);
- }
-
- bool SetProperty(
- const std::string& in_1,
- const chromeos::Any& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "SetProperty",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetPropertyAsync(
- const std::string& in_1,
- const chromeos::Any& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "SetProperty",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- bool SetProperties(
- const chromeos::VariantDictionary& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "SetProperties",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SetPropertiesAsync(
- const chromeos::VariantDictionary& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "SetProperties",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool ClearProperty(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "ClearProperty",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ClearPropertyAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "ClearProperty",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool ClearProperties(
- const std::vector<std::string>& in_1,
- std::vector<bool>* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "ClearProperties",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_2);
- }
-
- void ClearPropertiesAsync(
- const std::vector<std::string>& in_1,
- const base::Callback<void(const std::vector<bool>&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "ClearProperties",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool Connect(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "Connect",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ConnectAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "Connect",
- success_callback,
- error_callback);
- }
-
- bool Disconnect(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "Disconnect",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void DisconnectAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "Disconnect",
- success_callback,
- error_callback);
- }
-
- bool Remove(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "Remove",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void RemoveAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "Remove",
- success_callback,
- error_callback);
- }
-
- bool ActivateCellularModem(
- const std::string& in_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "ActivateCellularModem",
- error,
- in_1);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void ActivateCellularModemAsync(
- const std::string& in_1,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "ActivateCellularModem",
- success_callback,
- error_callback,
- in_1);
- }
-
- bool CompleteCellularActivation(
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "CompleteCellularActivation",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void CompleteCellularActivationAsync(
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "CompleteCellularActivation",
- success_callback,
- error_callback);
- }
-
- bool GetLoadableProfileEntries(
- std::map<dbus::ObjectPath, std::string>* out_1,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "GetLoadableProfileEntries",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1);
- }
-
- void GetLoadableProfileEntriesAsync(
- const base::Callback<void(const std::map<dbus::ObjectPath, std::string>&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Service",
- "GetLoadableProfileEntries",
- success_callback,
- error_callback);
- }
-
- private:
- scoped_refptr<dbus::Bus> bus_;
- const std::string service_name_{"org.chromium.flimflam"};
- dbus::ObjectPath object_path_;
- dbus::ObjectProxy* dbus_object_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(ServiceProxy);
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Abstract interface proxy for org::chromium::flimflam::Task.
-class TaskProxyInterface {
- public:
- virtual ~TaskProxyInterface() = default;
-
- virtual bool getsec(
- std::string* out_1,
- std::string* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void getsecAsync(
- const base::Callback<void(const std::string&, const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool notify(
- const std::string& in_1,
- const std::map<std::string, std::string>& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void notifyAsync(
- const std::string& in_1,
- const std::map<std::string, std::string>& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Interface proxy for org::chromium::flimflam::Task.
-class TaskProxy final : public TaskProxyInterface {
- public:
- TaskProxy(
- const scoped_refptr<dbus::Bus>& bus,
- const dbus::ObjectPath& object_path) :
- bus_{bus},
- object_path_{object_path},
- dbus_object_proxy_{
- bus_->GetObjectProxy(service_name_, object_path_)} {
- }
-
- ~TaskProxy() override {
- bus_->RemoveObjectProxy(
- service_name_, object_path_, base::Bind(&base::DoNothing));
- }
-
- void ReleaseObjectProxy(const base::Closure& callback) {
- bus_->RemoveObjectProxy(service_name_, object_path_, callback);
- }
-
- const dbus::ObjectPath& GetObjectPath() const {
- return object_path_;
- }
-
- dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
- bool getsec(
- std::string* out_1,
- std::string* out_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Task",
- "getsec",
- error);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_1, out_2);
- }
-
- void getsecAsync(
- const base::Callback<void(const std::string&, const std::string&)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Task",
- "getsec",
- success_callback,
- error_callback);
- }
-
- bool notify(
- const std::string& in_1,
- const std::map<std::string, std::string>& in_2,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Task",
- "notify",
- error,
- in_1,
- in_2);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void notifyAsync(
- const std::string& in_1,
- const std::map<std::string, std::string>& in_2,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.Task",
- "notify",
- success_callback,
- error_callback,
- in_1,
- in_2);
- }
-
- private:
- scoped_refptr<dbus::Bus> bus_;
- const std::string service_name_{"org.chromium.flimflam"};
- dbus::ObjectPath object_path_;
- dbus::ObjectProxy* dbus_object_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(TaskProxy);
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Abstract interface proxy for org::chromium::flimflam::ThirdPartyVpn.
-class ThirdPartyVpnProxyInterface {
- public:
- virtual ~ThirdPartyVpnProxyInterface() = default;
-
- virtual bool SetParameters(
- const std::map<std::string, std::string>& in_parameters,
- std::string* out_warning,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SetParametersAsync(
- const std::map<std::string, std::string>& in_parameters,
- const base::Callback<void(const std::string& /*warning*/)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool UpdateConnectionState(
- uint32_t in_connection_state,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void UpdateConnectionStateAsync(
- uint32_t in_connection_state,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual bool SendPacket(
- const std::vector<uint8_t>& in_ip_packet,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void SendPacketAsync(
- const std::vector<uint8_t>& in_ip_packet,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
- virtual void RegisterOnPacketReceivedSignalHandler(
- const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-
- virtual void RegisterOnPlatformMessageSignalHandler(
- const base::Callback<void(uint32_t)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0;
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Interface proxy for org::chromium::flimflam::ThirdPartyVpn.
-class ThirdPartyVpnProxy final : public ThirdPartyVpnProxyInterface {
- public:
- ThirdPartyVpnProxy(
- const scoped_refptr<dbus::Bus>& bus,
- const dbus::ObjectPath& object_path) :
- bus_{bus},
- object_path_{object_path},
- dbus_object_proxy_{
- bus_->GetObjectProxy(service_name_, object_path_)} {
- }
-
- ~ThirdPartyVpnProxy() override {
- bus_->RemoveObjectProxy(
- service_name_, object_path_, base::Bind(&base::DoNothing));
- }
-
- void RegisterOnPacketReceivedSignalHandler(
- const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "OnPacketReceived",
- signal_callback,
- on_connected_callback);
- }
-
- void RegisterOnPlatformMessageSignalHandler(
- const base::Callback<void(uint32_t)>& signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override {
- chromeos::dbus_utils::ConnectToSignal(
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "OnPlatformMessage",
- signal_callback,
- on_connected_callback);
- }
-
- void ReleaseObjectProxy(const base::Closure& callback) {
- bus_->RemoveObjectProxy(service_name_, object_path_, callback);
- }
-
- const dbus::ObjectPath& GetObjectPath() const {
- return object_path_;
- }
-
- dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
- bool SetParameters(
- const std::map<std::string, std::string>& in_parameters,
- std::string* out_warning,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "SetParameters",
- error,
- in_parameters);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error, out_warning);
- }
-
- void SetParametersAsync(
- const std::map<std::string, std::string>& in_parameters,
- const base::Callback<void(const std::string& /*warning*/)>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "SetParameters",
- success_callback,
- error_callback,
- in_parameters);
- }
-
- bool UpdateConnectionState(
- uint32_t in_connection_state,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "UpdateConnectionState",
- error,
- in_connection_state);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void UpdateConnectionStateAsync(
- uint32_t in_connection_state,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "UpdateConnectionState",
- success_callback,
- error_callback,
- in_connection_state);
- }
-
- bool SendPacket(
- const std::vector<uint8_t>& in_ip_packet,
- chromeos::ErrorPtr* error,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "SendPacket",
- error,
- in_ip_packet);
- return response && chromeos::dbus_utils::ExtractMethodCallResults(
- response.get(), error);
- }
-
- void SendPacketAsync(
- const std::vector<uint8_t>& in_ip_packet,
- const base::Callback<void()>& success_callback,
- const base::Callback<void(chromeos::Error*)>& error_callback,
- int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
- chromeos::dbus_utils::CallMethodWithTimeout(
- timeout_ms,
- dbus_object_proxy_,
- "org.chromium.flimflam.ThirdPartyVpn",
- "SendPacket",
- success_callback,
- error_callback,
- in_ip_packet);
- }
-
- private:
- scoped_refptr<dbus::Bus> bus_;
- const std::string service_name_{"org.chromium.flimflam"};
- dbus::ObjectPath object_path_;
- dbus::ObjectProxy* dbus_object_proxy_;
-
- DISALLOW_COPY_AND_ASSIGN(ThirdPartyVpnProxy);
-};
-
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-#endif // ____CHROMEOS_DBUS_BINDING___BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_SHILL_OUT_DEFAULT_GEN_INCLUDE_SHILL_DBUS_PROXIES_H
diff --git a/include/shill/dbus-proxy-mocks.h b/include/shill/dbus-proxy-mocks.h
deleted file mode 100644
index 0f2eb21..0000000
--- a/include/shill/dbus-proxy-mocks.h
+++ /dev/null
@@ -1,946 +0,0 @@
-// Automatic generation of D-Bus interface mock proxies for:
-// - org.chromium.flimflam.Device
-// - org.chromium.flimflam.IPConfig
-// - org.chromium.flimflam.Manager
-// - org.chromium.flimflam.Profile
-// - org.chromium.flimflam.Service
-// - org.chromium.flimflam.Task
-// - org.chromium.flimflam.ThirdPartyVpn
-#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_SHILL_OUT_DEFAULT_GEN_INCLUDE_SHILL_DBUS_PROXY_MOCKS_H
-#define ____CHROMEOS_DBUS_BINDING___BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_SHILL_OUT_DEFAULT_GEN_INCLUDE_SHILL_DBUS_PROXY_MOCKS_H
-#include <string>
-#include <vector>
-
-#include <base/callback_forward.h>
-#include <base/logging.h>
-#include <base/macros.h>
-#include <chromeos/any.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/variant_dictionary.h>
-#include <gmock/gmock.h>
-
-#include "shill/dbus-proxies.h"
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Mock object for DeviceProxyInterface.
-class DeviceProxyMock : public DeviceProxyInterface {
- public:
- DeviceProxyMock() = default;
-
- MOCK_METHOD3(AddWakeOnPacketConnection,
- bool(const std::string& /*in_ip_endpoint*/,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(AddWakeOnPacketConnectionAsync,
- void(const std::string& /*in_ip_endpoint*/,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RemoveWakeOnPacketConnection,
- bool(const std::string& /*in_ip_endpoint*/,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(RemoveWakeOnPacketConnectionAsync,
- void(const std::string& /*in_ip_endpoint*/,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RemoveAllWakeOnPacketConnections,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RemoveAllWakeOnPacketConnectionsAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetProperties,
- bool(chromeos::VariantDictionary*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetPropertiesAsync,
- void(const base::Callback<void(const chromeos::VariantDictionary&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetProperty,
- bool(const std::string&,
- const chromeos::Any&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(SetPropertyAsync,
- void(const std::string&,
- const chromeos::Any&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ClearProperty,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ClearPropertyAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Enable,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(EnableAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Disable,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(DisableAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(ProposeScan,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ProposeScanAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(AddIPConfig,
- bool(const std::string&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(AddIPConfigAsync,
- void(const std::string&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(Register,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(RegisterAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(RequirePin,
- bool(const std::string&,
- bool,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(RequirePinAsync,
- void(const std::string&,
- bool,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(EnterPin,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(EnterPinAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(UnblockPin,
- bool(const std::string&,
- const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(UnblockPinAsync,
- void(const std::string&,
- const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ChangePin,
- bool(const std::string&,
- const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(ChangePinAsync,
- void(const std::string&,
- const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(PerformTDLSOperation,
- bool(const std::string&,
- const std::string&,
- std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(PerformTDLSOperationAsync,
- void(const std::string&,
- const std::string&,
- const base::Callback<void(const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Reset,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ResetAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(ResetByteCounters,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ResetByteCountersAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(SetCarrier,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetCarrierAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RequestRoam,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(RequestRoamAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RegisterPropertyChangedSignalHandler,
- void(const base::Callback<void(const std::string&,
- const chromeos::Any&)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DeviceProxyMock);
-};
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Mock object for IPConfigProxyInterface.
-class IPConfigProxyMock : public IPConfigProxyInterface {
- public:
- IPConfigProxyMock() = default;
-
- MOCK_METHOD3(GetProperties,
- bool(chromeos::VariantDictionary*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetPropertiesAsync,
- void(const base::Callback<void(const chromeos::VariantDictionary&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetProperty,
- bool(const std::string&,
- const chromeos::Any&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(SetPropertyAsync,
- void(const std::string&,
- const chromeos::Any&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ClearProperty,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ClearPropertyAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Remove,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RemoveAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Refresh,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RefreshAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RegisterPropertyChangedSignalHandler,
- void(const base::Callback<void(const std::string&,
- const chromeos::Any&)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(IPConfigProxyMock);
-};
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Mock object for ManagerProxyInterface.
-class ManagerProxyMock : public ManagerProxyInterface {
- public:
- ManagerProxyMock() = default;
-
- MOCK_METHOD3(GetProperties,
- bool(chromeos::VariantDictionary*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetPropertiesAsync,
- void(const base::Callback<void(const chromeos::VariantDictionary&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetProperty,
- bool(const std::string&,
- const chromeos::Any&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(SetPropertyAsync,
- void(const std::string&,
- const chromeos::Any&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetState,
- bool(std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetStateAsync,
- void(const base::Callback<void(const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(CreateProfile,
- bool(const std::string&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(CreateProfileAsync,
- void(const std::string&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RemoveProfile,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(RemoveProfileAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(PushProfile,
- bool(const std::string&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(PushProfileAsync,
- void(const std::string&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(InsertUserProfile,
- bool(const std::string&,
- const std::string&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(InsertUserProfileAsync,
- void(const std::string&,
- const std::string&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(PopProfile,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(PopProfileAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(PopAnyProfile,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(PopAnyProfileAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(PopAllUserProfiles,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(PopAllUserProfilesAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RecheckPortal,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RecheckPortalAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RequestScan,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(RequestScanAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(EnableTechnology,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(EnableTechnologyAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(DisableTechnology,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(DisableTechnologyAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetService,
- bool(const chromeos::VariantDictionary&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetServiceAsync,
- void(const chromeos::VariantDictionary&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetWifiService,
- bool(const chromeos::VariantDictionary&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetWifiServiceAsync,
- void(const chromeos::VariantDictionary&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ConfigureService,
- bool(const chromeos::VariantDictionary&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ConfigureServiceAsync,
- void(const chromeos::VariantDictionary&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(ConfigureServiceForProfile,
- bool(const dbus::ObjectPath&,
- const chromeos::VariantDictionary&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(ConfigureServiceForProfileAsync,
- void(const dbus::ObjectPath&,
- const chromeos::VariantDictionary&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(FindMatchingService,
- bool(const chromeos::VariantDictionary&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(FindMatchingServiceAsync,
- void(const chromeos::VariantDictionary&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetVPNService,
- bool(const chromeos::VariantDictionary&,
- dbus::ObjectPath*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetVPNServiceAsync,
- void(const chromeos::VariantDictionary&,
- const base::Callback<void(const dbus::ObjectPath&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetDebugLevel,
- bool(int32_t*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetDebugLevelAsync,
- void(const base::Callback<void(int32_t)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(SetDebugLevel,
- bool(int32_t,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetDebugLevelAsync,
- void(int32_t,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetServiceOrder,
- bool(std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetServiceOrderAsync,
- void(const base::Callback<void(const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(SetServiceOrder,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetServiceOrderAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetDebugTags,
- bool(std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetDebugTagsAsync,
- void(const base::Callback<void(const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(SetDebugTags,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetDebugTagsAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ListDebugTags,
- bool(std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ListDebugTagsAsync,
- void(const base::Callback<void(const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetNetworksForGeolocation,
- bool(chromeos::VariantDictionary*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetNetworksForGeolocationAsync,
- void(const base::Callback<void(const chromeos::VariantDictionary&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD10(VerifyDestination,
- bool(const std::string& /*in_certificate*/,
- const std::string& /*in_public_key*/,
- const std::string& /*in_nonce*/,
- const std::string& /*in_signed_data*/,
- const std::string& /*in_destination_udn*/,
- const std::string& /*in_hotspot_ssid*/,
- const std::string& /*in_hotspot_bssid*/,
- bool*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD10(VerifyDestinationAsync,
- void(const std::string& /*in_certificate*/,
- const std::string& /*in_public_key*/,
- const std::string& /*in_nonce*/,
- const std::string& /*in_signed_data*/,
- const std::string& /*in_destination_udn*/,
- const std::string& /*in_hotspot_ssid*/,
- const std::string& /*in_hotspot_bssid*/,
- const base::Callback<void(bool)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- bool VerifyAndEncryptCredentials(const std::string& /*in_certificate*/,
- const std::string& /*in_public_key*/,
- const std::string& /*in_nonce*/,
- const std::string& /*in_signed_data*/,
- const std::string& /*in_destination_udn*/,
- const std::string& /*in_hotspot_ssid*/,
- const std::string& /*in_hotspot_bssid*/,
- const dbus::ObjectPath& /*in_network*/,
- std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/) override {
- LOG(WARNING) << "VerifyAndEncryptCredentials(): gmock can't handle methods with 11 arguments. You can override this method in a subclass if you need to.";
- return false;
- }
- void VerifyAndEncryptCredentialsAsync(const std::string& /*in_certificate*/,
- const std::string& /*in_public_key*/,
- const std::string& /*in_nonce*/,
- const std::string& /*in_signed_data*/,
- const std::string& /*in_destination_udn*/,
- const std::string& /*in_hotspot_ssid*/,
- const std::string& /*in_hotspot_bssid*/,
- const dbus::ObjectPath& /*in_network*/,
- const base::Callback<void(const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/) override {
- LOG(WARNING) << "VerifyAndEncryptCredentialsAsync(): gmock can't handle methods with 11 arguments. You can override this method in a subclass if you need to.";
- }
- bool VerifyAndEncryptData(const std::string& /*in_certificate*/,
- const std::string& /*in_public_key*/,
- const std::string& /*in_nonce*/,
- const std::string& /*in_signed_data*/,
- const std::string& /*in_destination_udn*/,
- const std::string& /*in_hotspot_ssid*/,
- const std::string& /*in_hotspot_bssid*/,
- const std::string& /*in_data*/,
- std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/) override {
- LOG(WARNING) << "VerifyAndEncryptData(): gmock can't handle methods with 11 arguments. You can override this method in a subclass if you need to.";
- return false;
- }
- void VerifyAndEncryptDataAsync(const std::string& /*in_certificate*/,
- const std::string& /*in_public_key*/,
- const std::string& /*in_nonce*/,
- const std::string& /*in_signed_data*/,
- const std::string& /*in_destination_udn*/,
- const std::string& /*in_hotspot_ssid*/,
- const std::string& /*in_hotspot_bssid*/,
- const std::string& /*in_data*/,
- const base::Callback<void(const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/) override {
- LOG(WARNING) << "VerifyAndEncryptDataAsync(): gmock can't handle methods with 11 arguments. You can override this method in a subclass if you need to.";
- }
- MOCK_METHOD2(ConnectToBestServices,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ConnectToBestServicesAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(CreateConnectivityReport,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(CreateConnectivityReportAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ClaimInterface,
- bool(const std::string& /*in_claimer_name*/,
- const std::string& /*in_interface_name*/,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(ClaimInterfaceAsync,
- void(const std::string& /*in_claimer_name*/,
- const std::string& /*in_interface_name*/,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ReleaseInterface,
- bool(const std::string& /*in_claimer_name*/,
- const std::string& /*in_interface_name*/,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(ReleaseInterfaceAsync,
- void(const std::string& /*in_claimer_name*/,
- const std::string& /*in_interface_name*/,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(SetSchedScan,
- bool(bool,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetSchedScanAsync,
- void(bool,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RegisterPropertyChangedSignalHandler,
- void(const base::Callback<void(const std::string&,
- const chromeos::Any&)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
- MOCK_METHOD2(RegisterStateChangedSignalHandler,
- void(const base::Callback<void(const std::string&)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ManagerProxyMock);
-};
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Mock object for ProfileProxyInterface.
-class ProfileProxyMock : public ProfileProxyInterface {
- public:
- ProfileProxyMock() = default;
-
- MOCK_METHOD3(GetProperties,
- bool(chromeos::VariantDictionary*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetPropertiesAsync,
- void(const base::Callback<void(const chromeos::VariantDictionary&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetProperty,
- bool(const std::string&,
- const chromeos::Any&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(SetPropertyAsync,
- void(const std::string&,
- const chromeos::Any&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetEntry,
- bool(const std::string&,
- chromeos::VariantDictionary*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(GetEntryAsync,
- void(const std::string&,
- const base::Callback<void(const chromeos::VariantDictionary&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(DeleteEntry,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(DeleteEntryAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RegisterPropertyChangedSignalHandler,
- void(const base::Callback<void(const std::string&,
- const chromeos::Any&)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ProfileProxyMock);
-};
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Mock object for ServiceProxyInterface.
-class ServiceProxyMock : public ServiceProxyInterface {
- public:
- ServiceProxyMock() = default;
-
- MOCK_METHOD3(GetProperties,
- bool(chromeos::VariantDictionary*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetPropertiesAsync,
- void(const base::Callback<void(const chromeos::VariantDictionary&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetProperty,
- bool(const std::string&,
- const chromeos::Any&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(SetPropertyAsync,
- void(const std::string&,
- const chromeos::Any&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(SetProperties,
- bool(const chromeos::VariantDictionary&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetPropertiesAsync,
- void(const chromeos::VariantDictionary&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ClearProperty,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ClearPropertyAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ClearProperties,
- bool(const std::vector<std::string>&,
- std::vector<bool>*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ClearPropertiesAsync,
- void(const std::vector<std::string>&,
- const base::Callback<void(const std::vector<bool>&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Connect,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ConnectAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Disconnect,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(DisconnectAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(Remove,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(RemoveAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(ActivateCellularModem,
- bool(const std::string&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(ActivateCellularModemAsync,
- void(const std::string&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(CompleteCellularActivation,
- bool(chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(CompleteCellularActivationAsync,
- void(const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetLoadableProfileEntries,
- bool(std::map<dbus::ObjectPath, std::string>*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(GetLoadableProfileEntriesAsync,
- void(const base::Callback<void(const std::map<dbus::ObjectPath, std::string>&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RegisterPropertyChangedSignalHandler,
- void(const base::Callback<void(const std::string&,
- const chromeos::Any&)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ServiceProxyMock);
-};
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Mock object for TaskProxyInterface.
-class TaskProxyMock : public TaskProxyInterface {
- public:
- TaskProxyMock() = default;
-
- MOCK_METHOD4(getsec,
- bool(std::string*,
- std::string*,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(getsecAsync,
- void(const base::Callback<void(const std::string&, const std::string&)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(notify,
- bool(const std::string&,
- const std::map<std::string, std::string>&,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD5(notifyAsync,
- void(const std::string&,
- const std::map<std::string, std::string>&,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TaskProxyMock);
-};
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-namespace org {
-namespace chromium {
-namespace flimflam {
-
-// Mock object for ThirdPartyVpnProxyInterface.
-class ThirdPartyVpnProxyMock : public ThirdPartyVpnProxyInterface {
- public:
- ThirdPartyVpnProxyMock() = default;
-
- MOCK_METHOD4(SetParameters,
- bool(const std::map<std::string, std::string>& /*in_parameters*/,
- std::string* /*out_warning*/,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SetParametersAsync,
- void(const std::map<std::string, std::string>& /*in_parameters*/,
- const base::Callback<void(const std::string& /*warning*/)>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(UpdateConnectionState,
- bool(uint32_t /*in_connection_state*/,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(UpdateConnectionStateAsync,
- void(uint32_t /*in_connection_state*/,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD3(SendPacket,
- bool(const std::vector<uint8_t>& /*in_ip_packet*/,
- chromeos::ErrorPtr* /*error*/,
- int /*timeout_ms*/));
- MOCK_METHOD4(SendPacketAsync,
- void(const std::vector<uint8_t>& /*in_ip_packet*/,
- const base::Callback<void()>& /*success_callback*/,
- const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
- int /*timeout_ms*/));
- MOCK_METHOD2(RegisterOnPacketReceivedSignalHandler,
- void(const base::Callback<void(const std::vector<uint8_t>&)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
- MOCK_METHOD2(RegisterOnPlatformMessageSignalHandler,
- void(const base::Callback<void(uint32_t)>& /*signal_callback*/,
- dbus::ObjectProxy::OnConnectedCallback /*on_connected_callback*/));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ThirdPartyVpnProxyMock);
-};
-} // namespace flimflam
-} // namespace chromium
-} // namespace org
-
-#endif // ____CHROMEOS_DBUS_BINDING___BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_SHILL_OUT_DEFAULT_GEN_INCLUDE_SHILL_DBUS_PROXY_MOCKS_H
diff --git a/install_plan.cc b/install_plan.cc
index ec2ee93..fa6dff7 100644
--- a/install_plan.cc
+++ b/install_plan.cc
@@ -16,7 +16,9 @@
#include "update_engine/install_plan.h"
+#include <base/format_macros.h>
#include <base/logging.h>
+#include <base/strings/stringprintf.h>
#include "update_engine/payload_constants.h"
#include "update_engine/utils.h"
@@ -32,10 +34,6 @@
const string& payload_hash,
uint64_t metadata_size,
const string& metadata_signature,
- const string& install_path,
- const string& kernel_install_path,
- const string& source_path,
- const string& kernel_source_path,
const string& public_key_rsa)
: is_resume(is_resume),
is_full_update(is_full_update),
@@ -44,12 +42,6 @@
payload_hash(payload_hash),
metadata_size(metadata_size),
metadata_signature(metadata_signature),
- install_path(install_path),
- kernel_install_path(kernel_install_path),
- source_path(source_path),
- kernel_source_path(kernel_source_path),
- kernel_size(0),
- rootfs_size(0),
hash_checks_mandatory(false),
powerwash_required(false),
public_key_rsa(public_key_rsa) {}
@@ -65,10 +57,7 @@
(metadata_signature == that.metadata_signature) &&
(source_slot == that.source_slot) &&
(target_slot == that.target_slot) &&
- (install_path == that.install_path) &&
- (kernel_install_path == that.kernel_install_path) &&
- (source_path == that.source_path) &&
- (kernel_source_path == that.kernel_source_path));
+ (partitions == that.partitions));
}
bool InstallPlan::operator!=(const InstallPlan& that) const {
@@ -76,6 +65,13 @@
}
void InstallPlan::Dump() const {
+ string partitions_str;
+ for (const auto& partition : partitions) {
+ partitions_str += base::StringPrintf(
+ ", part: %s (source_size: %" PRIu64 ", target_size %" PRIu64 ")",
+ partition.name.c_str(), partition.source_size, partition.target_size);
+ }
+
LOG(INFO) << "InstallPlan: "
<< (is_resume ? "resume" : "new_update")
<< ", payload type: " << (is_full_update ? "full" : "delta")
@@ -86,10 +82,7 @@
<< ", payload hash: " << payload_hash
<< ", metadata size: " << metadata_size
<< ", metadata signature: " << metadata_signature
- << ", install_path: " << install_path
- << ", kernel_install_path: " << kernel_install_path
- << ", source_path: " << source_path
- << ", kernel_source_path: " << kernel_source_path
+ << partitions_str
<< ", hash_checks_mandatory: " << utils::ToString(
hash_checks_mandatory)
<< ", powerwash_required: " << utils::ToString(
@@ -98,26 +91,34 @@
bool InstallPlan::LoadPartitionsFromSlots(SystemState* system_state) {
bool result = true;
- if (source_slot != BootControlInterface::kInvalidSlot) {
- result = system_state->boot_control()->GetPartitionDevice(
- kLegacyPartitionNameRoot, source_slot, &source_path) && result;
- result = system_state->boot_control()->GetPartitionDevice(
- kLegacyPartitionNameKernel, source_slot, &kernel_source_path) && result;
- } else {
- source_path.clear();
- kernel_source_path.clear();
- }
+ for (Partition& partition : partitions) {
+ if (source_slot != BootControlInterface::kInvalidSlot) {
+ result = system_state->boot_control()->GetPartitionDevice(
+ partition.name, source_slot, &partition.source_path) && result;
+ } else {
+ partition.source_path.clear();
+ }
- if (target_slot != BootControlInterface::kInvalidSlot) {
- result = system_state->boot_control()->GetPartitionDevice(
- kLegacyPartitionNameRoot, target_slot, &install_path) && result;
- result = system_state->boot_control()->GetPartitionDevice(
- kLegacyPartitionNameKernel, target_slot, &kernel_install_path) && result;
- } else {
- install_path.clear();
- kernel_install_path.clear();
+ if (target_slot != BootControlInterface::kInvalidSlot) {
+ result = system_state->boot_control()->GetPartitionDevice(
+ partition.name, target_slot, &partition.target_path) && result;
+ } else {
+ partition.target_path.clear();
+ }
}
return result;
}
+bool InstallPlan::Partition::operator==(
+ const InstallPlan::Partition& that) const {
+ return (name == that.name &&
+ source_path == that.source_path &&
+ source_size == that.source_size &&
+ source_hash == that.source_hash &&
+ target_path == that.target_path &&
+ target_size == that.target_size &&
+ target_hash == that.target_hash &&
+ run_postinstall == that.run_postinstall);
+}
+
} // namespace chromeos_update_engine
diff --git a/install_plan.h b/install_plan.h
index 6eb52fc..68aa1ae 100644
--- a/install_plan.h
+++ b/install_plan.h
@@ -39,10 +39,6 @@
const std::string& payload_hash,
uint64_t metadata_size,
const std::string& metadata_signature,
- const std::string& install_path,
- const std::string& kernel_install_path,
- const std::string& source_path,
- const std::string& kernel_source_path,
const std::string& public_key_rsa);
// Default constructor.
@@ -53,6 +49,9 @@
void Dump() const;
+ // Load the |source_path| and |target_path| of all |partitions| based on the
+ // |source_slot| and |target_slot| if available. Returns whether it succeeded
+ // to load all the partitions for the valid slots.
bool LoadPartitionsFromSlots(SystemState* system_state);
bool is_resume{false};
@@ -69,29 +68,35 @@
BootControlInterface::Slot source_slot{BootControlInterface::kInvalidSlot};
BootControlInterface::Slot target_slot{BootControlInterface::kInvalidSlot};
- // TODO(deymo): Deprecate these fields and use the slots instead.
- std::string install_path; // path to install device
- std::string kernel_install_path; // path to kernel install device
- std::string source_path; // path to source device
- std::string kernel_source_path; // path to source kernel device
-
- // The fields below are used for kernel and rootfs verification. The flow is:
+ // The vector below is used for partition verification. The flow is:
//
// 1. FilesystemVerifierAction computes and fills in the source partition
- // sizes and hashes.
+ // hash based on the guessed source size for delta major version 1 updates.
//
// 2. DownloadAction verifies the source partition sizes and hashes against
// the expected values transmitted in the update manifest. It fills in the
- // expected applied partition sizes and hashes based on the manifest.
+ // expected target partition sizes and hashes based on the manifest.
//
- // 3. FilesystemVerifierAction computes and verifies the applied and source
- // partition sizes and hashes against the expected values.
- uint64_t kernel_size{0};
- uint64_t rootfs_size{0};
- chromeos::Blob kernel_hash;
- chromeos::Blob rootfs_hash;
- chromeos::Blob source_kernel_hash;
- chromeos::Blob source_rootfs_hash;
+ // 3. FilesystemVerifierAction computes and verifies the applied partition
+ // sizes and hashes against the expected values in target_partition_hashes.
+ struct Partition {
+ bool operator==(const Partition& that) const;
+
+ // The name of the partition.
+ std::string name;
+
+ std::string source_path;
+ uint64_t source_size{0};
+ chromeos::Blob source_hash;
+
+ std::string target_path;
+ uint64_t target_size{0};
+ chromeos::Blob target_hash;
+
+ // Whether we should run the postinstall script from this partition.
+ bool run_postinstall{false};
+ };
+ std::vector<Partition> partitions;
// True if payload hash checks are mandatory based on the system state and
// the Omaha response.
diff --git a/mock_file_writer.h b/mock_file_writer.h
index 3270cbf..0d97e33 100644
--- a/mock_file_writer.h
+++ b/mock_file_writer.h
@@ -24,7 +24,6 @@
class MockFileWriter : public FileWriter {
public:
- MOCK_METHOD3(Open, int(const char* path, int flags, mode_t mode));
MOCK_METHOD2(Write, ssize_t(const void* bytes, size_t count));
MOCK_METHOD0(Close, int());
};
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index 1153628..9ad73d6 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -35,12 +35,10 @@
namespace chromeos_update_engine {
-const char OmahaResponseHandlerAction::kDeadlineFile[] =
- "/tmp/update-check-response-deadline";
-
OmahaResponseHandlerAction::OmahaResponseHandlerAction(
SystemState* system_state)
- : OmahaResponseHandlerAction(system_state, kDeadlineFile) {}
+ : OmahaResponseHandlerAction(system_state,
+ constants::kOmahaResponseDeadlineFile) {}
OmahaResponseHandlerAction::OmahaResponseHandlerAction(
SystemState* system_state, const string& deadline_file)
@@ -110,7 +108,6 @@
install_plan_.source_slot = system_state_->boot_control()->GetCurrentSlot();
install_plan_.target_slot = install_plan_.source_slot == 0 ? 1 : 0;
- TEST_AND_RETURN(install_plan_.LoadPartitionsFromSlots(system_state_));
if (params->to_more_stable_channel() && params->is_powerwash_allowed())
install_plan_.powerwash_required = true;
@@ -128,10 +125,12 @@
// file. Ideally, we would include this information in D-Bus's GetStatus
// method and UpdateStatus signal. A potential issue is that update_engine may
// be unresponsive during an update download.
- utils::WriteFile(deadline_file_.c_str(),
- response.deadline.data(),
- response.deadline.size());
- chmod(deadline_file_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ if (!deadline_file_.empty()) {
+ utils::WriteFile(deadline_file_.c_str(),
+ response.deadline.data(),
+ response.deadline.size());
+ chmod(deadline_file_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ }
completer.set_code(ErrorCode::kSuccess);
}
diff --git a/omaha_response_handler_action.h b/omaha_response_handler_action.h
index 5611375..3cdeb67 100644
--- a/omaha_response_handler_action.h
+++ b/omaha_response_handler_action.h
@@ -42,8 +42,6 @@
class OmahaResponseHandlerAction : public Action<OmahaResponseHandlerAction> {
public:
- static const char kDeadlineFile[];
-
explicit OmahaResponseHandlerAction(SystemState* system_state);
typedef ActionTraits<OmahaResponseHandlerAction>::InputObjectType
diff --git a/omaha_response_handler_action_unittest.cc b/omaha_response_handler_action_unittest.cc
index 65dbf0f..d103cbc 100644
--- a/omaha_response_handler_action_unittest.cc
+++ b/omaha_response_handler_action_unittest.cc
@@ -112,7 +112,7 @@
OmahaResponseHandlerAction response_handler_action(
&fake_system_state_,
(test_deadline_file.empty() ?
- OmahaResponseHandlerAction::kDeadlineFile : test_deadline_file));
+ constants::kOmahaResponseDeadlineFile : test_deadline_file));
BondActions(&feeder_action, &response_handler_action);
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&response_handler_action, &collector_action);
@@ -207,10 +207,7 @@
in.update_exists = false;
InstallPlan install_plan;
EXPECT_FALSE(DoTest(in, "", &install_plan));
- EXPECT_EQ("", install_plan.download_url);
- EXPECT_EQ("", install_plan.payload_hash);
- EXPECT_EQ("", install_plan.install_path);
- EXPECT_EQ("", install_plan.version);
+ EXPECT_TRUE(install_plan.partitions.empty());
}
TEST_F(OmahaResponseHandlerActionTest, HashChecksForHttpTest) {
diff --git a/payload_generator/generate_delta_main.cc b/payload_generator/generate_delta_main.cc
index e6e7c98..cdac82f 100644
--- a/payload_generator/generate_delta_main.cc
+++ b/payload_generator/generate_delta_main.cc
@@ -188,6 +188,9 @@
LOG(INFO) << "Done verifying signed payload.";
}
+// TODO(deymo): This function is likely broken for deltas minor version 2 or
+// newer. Move this function to a new file and make the delta_performer
+// integration tests use this instead.
void ApplyDelta(const string& in_file,
const string& old_kernel,
const string& old_rootfs,
@@ -202,24 +205,26 @@
<< "Failed to initialize preferences.";
// Get original checksums
LOG(INFO) << "Calculating original checksums";
- PartitionInfo kern_info, root_info;
ImageConfig old_image;
old_image.partitions.emplace_back(kLegacyPartitionNameRoot);
old_image.partitions.back().path = old_rootfs;
old_image.partitions.emplace_back(kLegacyPartitionNameKernel);
old_image.partitions.back().path = old_kernel;
CHECK(old_image.LoadImageSize());
- CHECK(diff_utils::InitializePartitionInfo(old_image.partitions[0],
- &root_info));
- CHECK(diff_utils::InitializePartitionInfo(old_image.partitions[1],
- &kern_info));
- install_plan.kernel_hash.assign(kern_info.hash().begin(),
- kern_info.hash().end());
- install_plan.rootfs_hash.assign(root_info.hash().begin(),
- root_info.hash().end());
+ for (const auto& old_part : old_image.partitions) {
+ PartitionInfo part_info;
+ CHECK(diff_utils::InitializePartitionInfo(old_part, &part_info));
+ InstallPlan::Partition part;
+ part.name = old_part.name;
+ part.source_hash.assign(part_info.hash().begin(),
+ part_info.hash().end());
+ part.source_path = old_part.path;
+ // Apply the delta in-place to the old_part.
+ part.target_path = old_part.path;
+ install_plan.partitions.push_back(part);
+ }
+
DeltaPerformer performer(&prefs, nullptr, &install_plan);
- CHECK_EQ(performer.Open(old_rootfs.c_str(), 0, 0), 0);
- CHECK(performer.OpenKernel(old_kernel.c_str()));
chromeos::Blob buf(1024 * 1024);
int fd = open(in_file.c_str(), O_RDONLY, 0);
CHECK_GE(fd, 0);
diff --git a/platform_constants.h b/platform_constants.h
index 0c832c9..189d134 100644
--- a/platform_constants.h
+++ b/platform_constants.h
@@ -38,6 +38,10 @@
// whole payload.
extern const char kUpdatePayloadPublicKeyPath[];
+// Path to the file used to notify chrome about the deadline of the last omaha
+// response. Empty if not supported.
+extern const char kOmahaResponseDeadlineFile[];
+
} // namespace constants
} // namespace chromeos_update_engine
diff --git a/platform_constants_android.cc b/platform_constants_android.cc
index be0329b..b6ee29f 100644
--- a/platform_constants_android.cc
+++ b/platform_constants_android.cc
@@ -27,6 +27,8 @@
const char kOmahaPlatformName[] = "Brillo";
const char kUpdatePayloadPublicKeyPath[] =
"/etc/update_engine/update-payload-key.pub.pem";
+// No deadline file API support on Android.
+const char kOmahaResponseDeadlineFile[] = "";
} // namespace constants
} // namespace chromeos_update_engine
diff --git a/platform_constants_chromeos.cc b/platform_constants_chromeos.cc
index 2a6ce12..d7aeca5 100644
--- a/platform_constants_chromeos.cc
+++ b/platform_constants_chromeos.cc
@@ -27,6 +27,8 @@
const char kOmahaPlatformName[] = "Chrome OS";
const char kUpdatePayloadPublicKeyPath[] =
"/usr/share/update_engine/update-payload-key.pub.pem";
+const char kOmahaResponseDeadlineFile[] =
+ "/tmp/update-check-response-deadline";
} // namespace constants
} // namespace chromeos_update_engine
diff --git a/postinstall_runner_action.cc b/postinstall_runner_action.cc
index c6879d8..8c871d0 100644
--- a/postinstall_runner_action.cc
+++ b/postinstall_runner_action.cc
@@ -21,6 +21,8 @@
#include <vector>
#include <base/bind.h>
+#include <base/files/file_path.h>
+#include <base/files/file_util.h>
#include "update_engine/action_processor.h"
#include "update_engine/subprocess.h"
@@ -44,39 +46,54 @@
void PostinstallRunnerAction::PerformAction() {
CHECK(HasInputObject());
install_plan_ = GetInputObject();
- const string install_device = install_plan_.install_path;
- ScopedActionCompleter completer(processor_, this);
-
- // Make mountpoint.
- TEST_AND_RETURN(
- utils::MakeTempDirectory("au_postint_mount.XXXXXX", &temp_rootfs_dir_));
- ScopedDirRemover temp_dir_remover(temp_rootfs_dir_);
-
- const string mountable_device =
- utils::MakePartitionNameForMount(install_device);
- if (mountable_device.empty()) {
- LOG(ERROR) << "Cannot make mountable device from " << install_device;
- return;
- }
-
- if (!utils::MountFilesystem(mountable_device, temp_rootfs_dir_, MS_RDONLY))
- return;
-
- LOG(INFO) << "Performing postinst with install device " << install_device
- << " and mountable device " << mountable_device;
-
- temp_dir_remover.set_should_remove(false);
- completer.set_should_complete(false);
if (install_plan_.powerwash_required) {
if (utils::CreatePowerwashMarkerFile(powerwash_marker_file_)) {
powerwash_marker_created_ = true;
} else {
- completer.set_code(ErrorCode::kPostinstallPowerwashError);
- return;
+ return CompletePostinstall(ErrorCode::kPostinstallPowerwashError);
}
}
+ PerformPartitionPostinstall();
+}
+
+void PostinstallRunnerAction::PerformPartitionPostinstall() {
+ // Skip all the partitions that don't have a post-install step.
+ while (current_partition_ < install_plan_.partitions.size() &&
+ !install_plan_.partitions[current_partition_].run_postinstall) {
+ VLOG(1) << "Skipping post-install on partition "
+ << install_plan_.partitions[current_partition_].name;
+ current_partition_++;
+ }
+ if (current_partition_ == install_plan_.partitions.size())
+ return CompletePostinstall(ErrorCode::kSuccess);
+
+ const InstallPlan::Partition& partition =
+ install_plan_.partitions[current_partition_];
+
+ const string mountable_device =
+ utils::MakePartitionNameForMount(partition.target_path);
+ if (mountable_device.empty()) {
+ LOG(ERROR) << "Cannot make mountable device from " << partition.target_path;
+ return CompletePostinstall(ErrorCode::kPostinstallRunnerError);
+ }
+
+ // Perform post-install for the current_partition_ partition. At this point we
+ // need to call CompletePartitionPostinstall to complete the operation and
+ // cleanup.
+ TEST_AND_RETURN(
+ utils::MakeTempDirectory("au_postint_mount.XXXXXX", &temp_rootfs_dir_));
+
+ if (!utils::MountFilesystem(mountable_device, temp_rootfs_dir_, MS_RDONLY)) {
+ return CompletePartitionPostinstall(
+ 1, "Error mounting the device " + mountable_device);
+ }
+
+ LOG(INFO) << "Performing postinst (" << kPostinstallScript
+ << ") installed on device " << partition.target_path
+ << " and mountable device " << mountable_device;
+
// Logs the file format of the postinstall script we are about to run. This
// will help debug when the postinstall script doesn't match the architecture
// of our build.
@@ -96,59 +113,70 @@
// If we're doing a rollback, just run our own postinstall.
command.push_back(kPostinstallScript);
}
- command.push_back(install_device);
- if (!Subprocess::Get().Exec(command,
- base::Bind(
- &PostinstallRunnerAction::CompletePostinstall,
- base::Unretained(this)))) {
- CompletePostinstall(1, "Postinstall didn't launch");
+ command.push_back(partition.target_path);
+ if (!Subprocess::Get().Exec(
+ command,
+ base::Bind(
+ &PostinstallRunnerAction::CompletePartitionPostinstall,
+ base::Unretained(this)))) {
+ CompletePartitionPostinstall(1, "Postinstall didn't launch");
}
}
-void PostinstallRunnerAction::CompletePostinstall(int return_code,
- const string& output) {
- ScopedActionCompleter completer(processor_, this);
- ScopedTempUnmounter temp_unmounter(temp_rootfs_dir_);
-
- bool success = true;
+void PostinstallRunnerAction::CompletePartitionPostinstall(
+ int return_code,
+ const string& output) {
+ utils::UnmountFilesystem(temp_rootfs_dir_);
+ if (!base::DeleteFile(base::FilePath(temp_rootfs_dir_), false)) {
+ PLOG(WARNING) << "Not removing mountpoint " << temp_rootfs_dir_;
+ }
+ temp_rootfs_dir_.clear();
if (return_code != 0) {
LOG(ERROR) << "Postinst command failed with code: " << return_code;
- success = false;
- }
-
- // We only attempt to mark the new slot as active if the /postinst script
- // succeeded.
- if (success && !system_state_->boot_control()->SetActiveBootSlot(
- install_plan_.target_slot)) {
- success = false;
- }
-
- if (!success) {
- LOG(ERROR) << "Postinstall action failed.";
-
- // Undo any changes done to trigger Powerwash using clobber-state.
- if (powerwash_marker_created_)
- utils::DeletePowerwashMarkerFile(powerwash_marker_file_);
+ ErrorCode error_code = ErrorCode::kPostinstallRunnerError;
if (return_code == 3) {
// This special return code means that we tried to update firmware,
// but couldn't because we booted from FW B, and we need to reboot
// to get back to FW A.
- completer.set_code(ErrorCode::kPostinstallBootedFromFirmwareB);
+ error_code = ErrorCode::kPostinstallBootedFromFirmwareB;
}
if (return_code == 4) {
// This special return code means that we tried to update firmware,
// but couldn't because we booted from FW B, and we need to reboot
// to get back to FW A.
- completer.set_code(ErrorCode::kPostinstallFirmwareRONotUpdatable);
+ error_code = ErrorCode::kPostinstallFirmwareRONotUpdatable;
}
+ return CompletePostinstall(error_code);
+ }
+ current_partition_++;
+ PerformPartitionPostinstall();
+}
+
+void PostinstallRunnerAction::CompletePostinstall(ErrorCode error_code) {
+ // We only attempt to mark the new slot as active if all the postinstall
+ // steps succeeded.
+ if (error_code == ErrorCode::kSuccess &&
+ !system_state_->boot_control()->SetActiveBootSlot(
+ install_plan_.target_slot)) {
+ error_code = ErrorCode::kPostinstallRunnerError;
+ }
+
+ ScopedActionCompleter completer(processor_, this);
+
+ if (error_code != ErrorCode::kSuccess) {
+ LOG(ERROR) << "Postinstall action failed.";
+
+ // Undo any changes done to trigger Powerwash using clobber-state.
+ if (powerwash_marker_created_)
+ utils::DeletePowerwashMarkerFile(powerwash_marker_file_);
return;
}
- LOG(INFO) << "Postinst command succeeded";
+ LOG(INFO) << "All post-install commands succeeded";
if (HasOutputPipe()) {
SetOutputObject(install_plan_);
}
diff --git a/postinstall_runner_action.h b/postinstall_runner_action.h
index c56218a..8b2f55d 100644
--- a/postinstall_runner_action.h
+++ b/postinstall_runner_action.h
@@ -51,19 +51,28 @@
: system_state_(system_state),
powerwash_marker_file_(powerwash_marker_file) {}
+ void PerformPartitionPostinstall();
+
// Subprocess::Exec callback.
- void CompletePostinstall(int return_code,
- const std::string& output);
+ void CompletePartitionPostinstall(int return_code,
+ const std::string& output);
+
+ //
+ void CompletePostinstall(ErrorCode error_code);
InstallPlan install_plan_;
std::string temp_rootfs_dir_;
+ // The partition being processed on the list of partitions specified in the
+ // InstallPlan.
+ size_t current_partition_{0};
+
// The main SystemState singleton.
SystemState* system_state_;
// True if Powerwash Marker was created before invoking post-install script.
// False otherwise. Used for cleaning up if post-install fails.
- bool powerwash_marker_created_ = false;
+ bool powerwash_marker_created_{false};
// Non-null value will cause post-install to override the default marker
// file name; used for testing.
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc
index a44d8d3..bf42749 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/postinstall_runner_action_unittest.cc
@@ -187,8 +187,12 @@
ActionProcessor processor;
ObjectFeederAction<InstallPlan> feeder_action;
+ InstallPlan::Partition part;
+ part.name = "part";
+ part.target_path = dev;
+ part.run_postinstall = true;
InstallPlan install_plan;
- install_plan.install_path = dev;
+ install_plan.partitions = {part};
install_plan.download_url = "http://devserver:8080/update";
install_plan.powerwash_required = powerwash_required;
feeder_action.set_obj(install_plan);
@@ -210,7 +214,6 @@
EXPECT_TRUE(delegate.code_set_);
EXPECT_EQ(should_succeed, delegate.code_ == ErrorCode::kSuccess);
- EXPECT_EQ(should_succeed, !collector_action.object().install_path.empty());
if (should_succeed)
EXPECT_TRUE(install_plan == collector_action.object());
diff --git a/update_attempter.cc b/update_attempter.cc
index 433d112..7824cd8 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -590,11 +590,8 @@
shared_ptr<OmahaResponseHandlerAction> response_handler_action(
new OmahaResponseHandlerAction(system_state_));
shared_ptr<FilesystemVerifierAction> src_filesystem_verifier_action(
- new FilesystemVerifierAction(system_state_,
- PartitionType::kSourceRootfs));
- shared_ptr<FilesystemVerifierAction> src_kernel_filesystem_verifier_action(
- new FilesystemVerifierAction(system_state_,
- PartitionType::kSourceKernel));
+ new FilesystemVerifierAction(system_state_->boot_control(),
+ VerifierMode::kComputeSourceHash));
shared_ptr<OmahaRequestAction> download_started_action(
new OmahaRequestAction(system_state_,
@@ -619,9 +616,8 @@
system_state_),
false));
shared_ptr<FilesystemVerifierAction> dst_filesystem_verifier_action(
- new FilesystemVerifierAction(system_state_, PartitionType::kRootfs));
- shared_ptr<FilesystemVerifierAction> dst_kernel_filesystem_verifier_action(
- new FilesystemVerifierAction(system_state_, PartitionType::kKernel));
+ new FilesystemVerifierAction(system_state_->boot_control(),
+ VerifierMode::kVerifyTargetHash));
shared_ptr<OmahaRequestAction> update_complete_action(
new OmahaRequestAction(system_state_,
new OmahaEvent(OmahaEvent::kTypeUpdateComplete),
@@ -637,15 +633,11 @@
actions_.push_back(shared_ptr<AbstractAction>(response_handler_action));
actions_.push_back(shared_ptr<AbstractAction>(
src_filesystem_verifier_action));
- actions_.push_back(shared_ptr<AbstractAction>(
- src_kernel_filesystem_verifier_action));
actions_.push_back(shared_ptr<AbstractAction>(download_started_action));
actions_.push_back(shared_ptr<AbstractAction>(download_action));
actions_.push_back(shared_ptr<AbstractAction>(download_finished_action));
actions_.push_back(shared_ptr<AbstractAction>(
dst_filesystem_verifier_action));
- actions_.push_back(shared_ptr<AbstractAction>(
- dst_kernel_filesystem_verifier_action));
// Bond them together. We have to use the leaf-types when calling
// BondActions().
@@ -654,15 +646,10 @@
BondActions(response_handler_action.get(),
src_filesystem_verifier_action.get());
BondActions(src_filesystem_verifier_action.get(),
- src_kernel_filesystem_verifier_action.get());
- BondActions(src_kernel_filesystem_verifier_action.get(),
download_action.get());
BondActions(download_action.get(),
dst_filesystem_verifier_action.get());
- BondActions(dst_filesystem_verifier_action.get(),
- dst_kernel_filesystem_verifier_action.get());
-
- BuildPostInstallActions(dst_kernel_filesystem_verifier_action.get());
+ BuildPostInstallActions(dst_filesystem_verifier_action.get());
actions_.push_back(shared_ptr<AbstractAction>(update_complete_action));
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 51e7920..1f506df 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -292,7 +292,7 @@
GetErrorCodeForAction(&omaha_response_handler_action,
ErrorCode::kError));
FilesystemVerifierAction filesystem_verifier_action(
- &fake_system_state_, PartitionType::kRootfs);
+ fake_system_state_.boot_control(), VerifierMode::kVerifyTargetHash);
EXPECT_EQ(ErrorCode::kFilesystemVerifierError,
GetErrorCodeForAction(&filesystem_verifier_action,
ErrorCode::kError));
@@ -383,12 +383,10 @@
OmahaRequestAction::StaticType(),
OmahaResponseHandlerAction::StaticType(),
FilesystemVerifierAction::StaticType(),
- FilesystemVerifierAction::StaticType(),
OmahaRequestAction::StaticType(),
DownloadAction::StaticType(),
OmahaRequestAction::StaticType(),
FilesystemVerifierAction::StaticType(),
- FilesystemVerifierAction::StaticType(),
PostinstallRunnerAction::StaticType(),
OmahaRequestAction::StaticType()
};
@@ -437,7 +435,7 @@
EXPECT_EQ(attempter_.response_handler_action_.get(),
attempter_.actions_[1].get());
DownloadAction* download_action =
- dynamic_cast<DownloadAction*>(attempter_.actions_[5].get());
+ dynamic_cast<DownloadAction*>(attempter_.actions_[4].get());
ASSERT_NE(nullptr, download_action);
EXPECT_EQ(&attempter_, download_action->delegate());
EXPECT_EQ(UpdateStatus::CHECKING_FOR_UPDATE, attempter_.status());
@@ -453,21 +451,12 @@
EXPECT_CALL(*device_policy, LoadPolicy()).WillRepeatedly(Return(true));
fake_system_state_.set_device_policy(device_policy);
- FakeBootControl* fake_boot_control = fake_system_state_.fake_boot_control();
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameKernel, 0, "/dev/sdz2");
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameRoot, 0, "/dev/sdz3");
-
if (valid_slot) {
BootControlInterface::Slot rollback_slot = 1;
LOG(INFO) << "Test Mark Bootable: "
<< BootControlInterface::SlotName(rollback_slot);
- fake_boot_control->SetSlotBootable(rollback_slot, true);
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameKernel, rollback_slot, "/dev/sdz4");
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameRoot, rollback_slot, "/dev/sdz5");
+ fake_system_state_.fake_boot_control()->SetSlotBootable(rollback_slot,
+ true);
}
bool is_rollback_allowed = false;
@@ -520,8 +509,7 @@
InstallPlanAction* install_plan_action =
dynamic_cast<InstallPlanAction*>(attempter_.actions_[0].get());
InstallPlan* install_plan = install_plan_action->install_plan();
- EXPECT_EQ(install_plan->install_path, string("/dev/sdz5"));
- EXPECT_EQ(install_plan->kernel_install_path, string("/dev/sdz4"));
+ EXPECT_EQ(0, install_plan->partitions.size());
EXPECT_EQ(install_plan->powerwash_required, true);
loop_.BreakLoop();
}
diff --git a/utils.h b/utils.h
index c1ee5a9..94dff9d 100644
--- a/utils.h
+++ b/utils.h
@@ -472,19 +472,6 @@
DISALLOW_COPY_AND_ASSIGN(ScopedDirRemover);
};
-// Utility class to unmount a filesystem mounted on a temporary directory and
-// delete the temporary directory when it goes out of scope.
-class ScopedTempUnmounter : public ScopedDirRemover {
- public:
- explicit ScopedTempUnmounter(const std::string& path) :
- ScopedDirRemover(path) {}
- ~ScopedTempUnmounter() {
- utils::UnmountFilesystem(path_);
- }
- private:
- DISALLOW_COPY_AND_ASSIGN(ScopedTempUnmounter);
-};
-
// A little object to call ActionComplete on the ActionProcessor when
// it's destructed.
class ScopedActionCompleter {