Build for Android.
Add Android.mk files to build webservd and libwebserv, patch
the source to not use libminijail when __BRILLO__ is
defined, and update copyright information.
Also add pre-generated D-Bus bindings into a gen/ directory
to use until code generation is working.
Bug: 22828211
Change-Id: Ib6d06789c1a5a27b8ee4f85d5723b46973c1ddaa
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..4061825
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,50 @@
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+webservd_root := $(my-dir)
+
+# Definitions applying to all targets. $(eval) this last.
+define webservd_common
+ LOCAL_CPP_EXTENSION := .cc
+ LOCAL_RTTI_FLAG := -frtti
+ LOCAL_CFLAGS += \
+ -D__BRILLO__ \
+ -Wno-missing-field-initializers \
+ -Wno-unused-parameter \
+
+ # libchromeos's secure_blob.h calls "using Blob::vector" to expose its base
+ # class's constructors. This causes a "conflicts with version inherited from
+ # 'std::__1::vector<unsigned char>'" error when building with GCC.
+ LOCAL_CLANG := true
+
+ # TODO: Remove "gen" directory once D-Bus code generation is working.
+ LOCAL_C_INCLUDES += \
+ $(webservd_root) \
+ $(webservd_root)/gen \
+ external/gtest/include \
+
+ LOCAL_SHARED_LIBRARIES += \
+ libchrome \
+ libchrome-dbus \
+ libchromeos \
+ libchromeos-dbus \
+ libchromeos-http \
+ libdbus \
+ libmicrohttpd \
+
+endef
+
+include $(call all-subdir-makefiles)
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..a849a94
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,190 @@
+
+ Copyright (c) 2014-2015, The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/README b/README
index ee0de04..5eaa374 100644
--- a/README
+++ b/README
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
This directory contains a web server (webservd) and a client interface library
(libwebserv).
diff --git a/gen/firewalld/dbus-proxies.h b/gen/firewalld/dbus-proxies.h
new file mode 100644
index 0000000..2735892
--- /dev/null
+++ b/gen/firewalld/dbus-proxies.h
@@ -0,0 +1,501 @@
+// Automatic generation of D-Bus interfaces:
+// - org.chromium.Firewalld
+#ifndef ____CHROMEOS_DBUS_BINDING____________________BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_PERMISSION_BROKER_OUT_DEFAULT_GEN_INCLUDE_FIREWALLD_DBUS_PROXIES_H
+#define ____CHROMEOS_DBUS_BINDING____________________BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_PERMISSION_BROKER_OUT_DEFAULT_GEN_INCLUDE_FIREWALLD_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 Firewalld {
+class ObjectManagerProxy;
+} // namespace Firewalld
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+
+// Abstract interface proxy for org::chromium::Firewalld.
+class FirewalldProxyInterface {
+ public:
+ virtual ~FirewalldProxyInterface() = default;
+
+ virtual bool PunchTcpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual void PunchTcpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual bool PunchUdpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual void PunchUdpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual bool PlugTcpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual void PlugTcpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual bool PlugUdpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual void PlugUdpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual bool RequestVpnSetup(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ bool* out_success,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual void RequestVpnSetupAsync(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual bool RemoveVpnSetup(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ bool* out_success,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual void RemoveVpnSetupAsync(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+};
+
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+
+// Interface proxy for org::chromium::Firewalld.
+class FirewalldProxy final : public FirewalldProxyInterface {
+ public:
+ class PropertySet : public dbus::PropertySet {
+ public:
+ PropertySet(dbus::ObjectProxy* object_proxy,
+ const PropertyChangedCallback& callback)
+ : dbus::PropertySet{object_proxy,
+ "org.chromium.Firewalld",
+ callback} {
+ }
+
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PropertySet);
+ };
+
+ FirewalldProxy(const scoped_refptr<dbus::Bus>& bus) :
+ bus_{bus},
+ dbus_object_proxy_{
+ bus_->GetObjectProxy(service_name_, object_path_)} {
+ }
+
+ ~FirewalldProxy() override {
+ }
+
+ 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 PunchTcpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ 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.Firewalld",
+ "PunchTcpHole",
+ error,
+ in_port,
+ in_interface);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_success);
+ }
+
+ void PunchTcpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& 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.Firewalld",
+ "PunchTcpHole",
+ success_callback,
+ error_callback,
+ in_port,
+ in_interface);
+ }
+
+ bool PunchUdpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ 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.Firewalld",
+ "PunchUdpHole",
+ error,
+ in_port,
+ in_interface);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_success);
+ }
+
+ void PunchUdpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& 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.Firewalld",
+ "PunchUdpHole",
+ success_callback,
+ error_callback,
+ in_port,
+ in_interface);
+ }
+
+ bool PlugTcpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ 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.Firewalld",
+ "PlugTcpHole",
+ error,
+ in_port,
+ in_interface);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_success);
+ }
+
+ void PlugTcpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& 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.Firewalld",
+ "PlugTcpHole",
+ success_callback,
+ error_callback,
+ in_port,
+ in_interface);
+ }
+
+ bool PlugUdpHole(
+ uint16_t in_port,
+ const std::string& in_interface,
+ bool* out_success,
+ 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.Firewalld",
+ "PlugUdpHole",
+ error,
+ in_port,
+ in_interface);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_success);
+ }
+
+ void PlugUdpHoleAsync(
+ uint16_t in_port,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& 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.Firewalld",
+ "PlugUdpHole",
+ success_callback,
+ error_callback,
+ in_port,
+ in_interface);
+ }
+
+ bool RequestVpnSetup(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ bool* out_success,
+ 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.Firewalld",
+ "RequestVpnSetup",
+ error,
+ in_usernames,
+ in_interface);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_success);
+ }
+
+ void RequestVpnSetupAsync(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& 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.Firewalld",
+ "RequestVpnSetup",
+ success_callback,
+ error_callback,
+ in_usernames,
+ in_interface);
+ }
+
+ bool RemoveVpnSetup(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ bool* out_success,
+ 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.Firewalld",
+ "RemoveVpnSetup",
+ error,
+ in_usernames,
+ in_interface);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_success);
+ }
+
+ void RemoveVpnSetupAsync(
+ const std::vector<std::string>& in_usernames,
+ const std::string& in_interface,
+ const base::Callback<void(bool /*success*/)>& 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.Firewalld",
+ "RemoveVpnSetup",
+ success_callback,
+ error_callback,
+ in_usernames,
+ in_interface);
+ }
+
+ private:
+ scoped_refptr<dbus::Bus> bus_;
+ const std::string service_name_{"org.chromium.Firewalld"};
+ const dbus::ObjectPath object_path_{"/org/chromium/Firewalld/Firewall"};
+ dbus::ObjectProxy* dbus_object_proxy_;
+
+ DISALLOW_COPY_AND_ASSIGN(FirewalldProxy);
+};
+
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace Firewalld {
+
+class ObjectManagerProxy : public dbus::ObjectManager::Interface {
+ public:
+ ObjectManagerProxy(const scoped_refptr<dbus::Bus>& bus)
+ : bus_{bus},
+ dbus_object_manager_{bus->GetObjectManager(
+ "org.chromium.Firewalld",
+ dbus::ObjectPath{"/org/chromium/Firewalld"})} {
+ dbus_object_manager_->RegisterInterface("org.chromium.Firewalld", this);
+ }
+
+ ~ObjectManagerProxy() override {
+ dbus_object_manager_->UnregisterInterface("org.chromium.Firewalld");
+ }
+
+ dbus::ObjectManager* GetObjectManagerProxy() const {
+ return dbus_object_manager_;
+ }
+
+ org::chromium::FirewalldProxy* GetFirewalldProxy() {
+ if (firewalld_instances_.empty())
+ return nullptr;
+ return firewalld_instances_.begin()->second.get();
+ }
+ std::vector<org::chromium::FirewalldProxy*> GetFirewalldInstances() const {
+ std::vector<org::chromium::FirewalldProxy*> values;
+ values.reserve(firewalld_instances_.size());
+ for (const auto& pair : firewalld_instances_)
+ values.push_back(pair.second.get());
+ return values;
+ }
+ void SetFirewalldAddedCallback(
+ const base::Callback<void(org::chromium::FirewalldProxy*)>& callback) {
+ on_firewalld_added_ = callback;
+ }
+ void SetFirewalldRemovedCallback(
+ const base::Callback<void(const dbus::ObjectPath&)>& callback) {
+ on_firewalld_removed_ = callback;
+ }
+
+ private:
+ void OnPropertyChanged(const dbus::ObjectPath& object_path,
+ const std::string& interface_name,
+ const std::string& property_name) {
+ }
+
+ void ObjectAdded(
+ const dbus::ObjectPath& object_path,
+ const std::string& interface_name) override {
+ if (interface_name == "org.chromium.Firewalld") {
+ std::unique_ptr<org::chromium::FirewalldProxy> firewalld_proxy{
+ new org::chromium::FirewalldProxy{bus_}
+ };
+ auto p = firewalld_instances_.emplace(object_path, std::move(firewalld_proxy));
+ if (!on_firewalld_added_.is_null())
+ on_firewalld_added_.Run(p.first->second.get());
+ return;
+ }
+ }
+
+ void ObjectRemoved(
+ const dbus::ObjectPath& object_path,
+ const std::string& interface_name) override {
+ if (interface_name == "org.chromium.Firewalld") {
+ auto p = firewalld_instances_.find(object_path);
+ if (p != firewalld_instances_.end()) {
+ if (!on_firewalld_removed_.is_null())
+ on_firewalld_removed_.Run(object_path);
+ firewalld_instances_.erase(p);
+ }
+ return;
+ }
+ }
+
+ dbus::PropertySet* CreateProperties(
+ dbus::ObjectProxy* object_proxy,
+ const dbus::ObjectPath& object_path,
+ const std::string& interface_name) override {
+ if (interface_name == "org.chromium.Firewalld") {
+ return new org::chromium::FirewalldProxy::PropertySet{
+ object_proxy,
+ base::Bind(&ObjectManagerProxy::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(),
+ object_path,
+ interface_name)
+ };
+ }
+ LOG(FATAL) << "Creating properties for unsupported interface "
+ << interface_name;
+ return nullptr;
+ }
+
+ scoped_refptr<dbus::Bus> bus_;
+ dbus::ObjectManager* dbus_object_manager_;
+ std::map<dbus::ObjectPath,
+ std::unique_ptr<org::chromium::FirewalldProxy>> firewalld_instances_;
+ base::Callback<void(org::chromium::FirewalldProxy*)> on_firewalld_added_;
+ base::Callback<void(const dbus::ObjectPath&)> on_firewalld_removed_;
+ base::WeakPtrFactory<ObjectManagerProxy> weak_ptr_factory_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(ObjectManagerProxy);
+};
+
+} // namespace Firewalld
+} // namespace chromium
+} // namespace org
+
+#endif // ____CHROMEOS_DBUS_BINDING____________________BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_PERMISSION_BROKER_OUT_DEFAULT_GEN_INCLUDE_FIREWALLD_DBUS_PROXIES_H
diff --git a/gen/libwebserv/dbus-mocks.h b/gen/libwebserv/dbus-mocks.h
new file mode 100644
index 0000000..b6b34fa
--- /dev/null
+++ b/gen/libwebserv/dbus-mocks.h
@@ -0,0 +1,52 @@
+// Automatic generation of D-Bus interface mock proxies for:
+// - org.chromium.WebServer.RequestHandler
+#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_MOCKS_H
+#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_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 "dbus-proxies.h"
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Mock object for RequestHandlerProxyInterface.
+class RequestHandlerProxyMock : public RequestHandlerProxyInterface {
+ public:
+ RequestHandlerProxyMock() = default;
+
+ MOCK_METHOD7(ProcessRequest,
+ bool(const std::tuple<std::string, std::string, std::string, std::string, std::string>& /*in_request_info*/,
+ const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
+ const std::vector<std::tuple<bool, std::string, std::string>>& /*in_params*/,
+ const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& /*in_files*/,
+ const std::vector<uint8_t>& /*in_body*/,
+ chromeos::ErrorPtr* /*error*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD8(ProcessRequestAsync,
+ void(const std::tuple<std::string, std::string, std::string, std::string, std::string>& /*in_request_info*/,
+ const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
+ const std::vector<std::tuple<bool, std::string, std::string>>& /*in_params*/,
+ const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& /*in_files*/,
+ const std::vector<uint8_t>& /*in_body*/,
+ const base::Callback<void()>& /*success_callback*/,
+ const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
+ int /*timeout_ms*/));
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RequestHandlerProxyMock);
+};
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+#endif // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_MOCKS_H
diff --git a/gen/libwebserv/dbus-proxies.h b/gen/libwebserv/dbus-proxies.h
new file mode 100644
index 0000000..bda3a69
--- /dev/null
+++ b/gen/libwebserv/dbus-proxies.h
@@ -0,0 +1,279 @@
+// Automatic generation of D-Bus interfaces:
+// - org.chromium.WebServer.RequestHandler
+#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_PROXIES_H
+#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_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 WebServer {
+
+// Abstract interface proxy for org::chromium::WebServer::RequestHandler.
+class RequestHandlerProxyInterface {
+ public:
+ virtual ~RequestHandlerProxyInterface() = default;
+
+ // Sends a new HTTP request to the handler.
+ // Parameters:
+ // - request_info - request metadata. Due to limitation of base::Callback
+ // on the number of parameters, we have to collapse a couple
+ // of distinct parameters into a larger struct, containing:
+ // - (s) protocol_handler_id - ID of the protocol handler.
+ // - (s) request_handler_id - ID of the registered request
+ // handler.
+ // - (s) request_id - unique ID of this request within the
+ // protocol handler.
+ // - (s) url - The request URL (e.g. "/path/object").
+ // - (s) method - Request method (e.g. "GET", "POST", ...).
+ // - headers - Request headers (key-value pairs)
+ // - params - an array of request parameters which could be either
+ // URL params (specified after "?" in the request URL), or
+ // form fields in a POST request. Elements have the following
+ // structure:
+ // - (b) true = form field, false = URL param
+ // - (s) field_name
+ // - (s) field_value
+ // - files - Information about uploaded files.
+ // The data is an array of FileInfo structures containing the
+ // following fields:
+ // - (i) file_id
+ // - (s) field_name
+ // - (s) file_name
+ // - (s) content_type
+ // - (s) transfer_encoding
+ // The actual contents of the file is obtained by calling
+ // GetFileData() on the request object
+ // - body - Raw unparsed request data. Could be empty for POST requests
+ // that have form data/uploaded files already parsed into
+ // form_fields/files parameters.
+ virtual bool ProcessRequest(
+ const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
+ const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
+ const std::vector<uint8_t>& in_body,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Sends a new HTTP request to the handler.
+ // Parameters:
+ // - request_info - request metadata. Due to limitation of base::Callback
+ // on the number of parameters, we have to collapse a couple
+ // of distinct parameters into a larger struct, containing:
+ // - (s) protocol_handler_id - ID of the protocol handler.
+ // - (s) request_handler_id - ID of the registered request
+ // handler.
+ // - (s) request_id - unique ID of this request within the
+ // protocol handler.
+ // - (s) url - The request URL (e.g. "/path/object").
+ // - (s) method - Request method (e.g. "GET", "POST", ...).
+ // - headers - Request headers (key-value pairs)
+ // - params - an array of request parameters which could be either
+ // URL params (specified after "?" in the request URL), or
+ // form fields in a POST request. Elements have the following
+ // structure:
+ // - (b) true = form field, false = URL param
+ // - (s) field_name
+ // - (s) field_value
+ // - files - Information about uploaded files.
+ // The data is an array of FileInfo structures containing the
+ // following fields:
+ // - (i) file_id
+ // - (s) field_name
+ // - (s) file_name
+ // - (s) content_type
+ // - (s) transfer_encoding
+ // The actual contents of the file is obtained by calling
+ // GetFileData() on the request object
+ // - body - Raw unparsed request data. Could be empty for POST requests
+ // that have form data/uploaded files already parsed into
+ // form_fields/files parameters.
+ virtual void ProcessRequestAsync(
+ const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
+ const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
+ const std::vector<uint8_t>& in_body,
+ const base::Callback<void()>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Interface proxy for org::chromium::WebServer::RequestHandler.
+class RequestHandlerProxy final : public RequestHandlerProxyInterface {
+ public:
+ RequestHandlerProxy(
+ const scoped_refptr<dbus::Bus>& bus,
+ const std::string& service_name) :
+ bus_{bus},
+ service_name_{service_name},
+ dbus_object_proxy_{
+ bus_->GetObjectProxy(service_name_, object_path_)} {
+ }
+
+ ~RequestHandlerProxy() override {
+ }
+
+ 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_; }
+
+ // Sends a new HTTP request to the handler.
+ // Parameters:
+ // - request_info - request metadata. Due to limitation of base::Callback
+ // on the number of parameters, we have to collapse a couple
+ // of distinct parameters into a larger struct, containing:
+ // - (s) protocol_handler_id - ID of the protocol handler.
+ // - (s) request_handler_id - ID of the registered request
+ // handler.
+ // - (s) request_id - unique ID of this request within the
+ // protocol handler.
+ // - (s) url - The request URL (e.g. "/path/object").
+ // - (s) method - Request method (e.g. "GET", "POST", ...).
+ // - headers - Request headers (key-value pairs)
+ // - params - an array of request parameters which could be either
+ // URL params (specified after "?" in the request URL), or
+ // form fields in a POST request. Elements have the following
+ // structure:
+ // - (b) true = form field, false = URL param
+ // - (s) field_name
+ // - (s) field_value
+ // - files - Information about uploaded files.
+ // The data is an array of FileInfo structures containing the
+ // following fields:
+ // - (i) file_id
+ // - (s) field_name
+ // - (s) file_name
+ // - (s) content_type
+ // - (s) transfer_encoding
+ // The actual contents of the file is obtained by calling
+ // GetFileData() on the request object
+ // - body - Raw unparsed request data. Could be empty for POST requests
+ // that have form data/uploaded files already parsed into
+ // form_fields/files parameters.
+ bool ProcessRequest(
+ const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
+ const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
+ const std::vector<uint8_t>& in_body,
+ 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.WebServer.RequestHandler",
+ "ProcessRequest",
+ error,
+ in_request_info,
+ in_headers,
+ in_params,
+ in_files,
+ in_body);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error);
+ }
+
+ // Sends a new HTTP request to the handler.
+ // Parameters:
+ // - request_info - request metadata. Due to limitation of base::Callback
+ // on the number of parameters, we have to collapse a couple
+ // of distinct parameters into a larger struct, containing:
+ // - (s) protocol_handler_id - ID of the protocol handler.
+ // - (s) request_handler_id - ID of the registered request
+ // handler.
+ // - (s) request_id - unique ID of this request within the
+ // protocol handler.
+ // - (s) url - The request URL (e.g. "/path/object").
+ // - (s) method - Request method (e.g. "GET", "POST", ...).
+ // - headers - Request headers (key-value pairs)
+ // - params - an array of request parameters which could be either
+ // URL params (specified after "?" in the request URL), or
+ // form fields in a POST request. Elements have the following
+ // structure:
+ // - (b) true = form field, false = URL param
+ // - (s) field_name
+ // - (s) field_value
+ // - files - Information about uploaded files.
+ // The data is an array of FileInfo structures containing the
+ // following fields:
+ // - (i) file_id
+ // - (s) field_name
+ // - (s) file_name
+ // - (s) content_type
+ // - (s) transfer_encoding
+ // The actual contents of the file is obtained by calling
+ // GetFileData() on the request object
+ // - body - Raw unparsed request data. Could be empty for POST requests
+ // that have form data/uploaded files already parsed into
+ // form_fields/files parameters.
+ void ProcessRequestAsync(
+ const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
+ const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
+ const std::vector<uint8_t>& in_body,
+ 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.WebServer.RequestHandler",
+ "ProcessRequest",
+ success_callback,
+ error_callback,
+ in_request_info,
+ in_headers,
+ in_params,
+ in_files,
+ in_body);
+ }
+
+ private:
+ scoped_refptr<dbus::Bus> bus_;
+ std::string service_name_;
+ const dbus::ObjectPath object_path_{"/org/chromium/WebServer/RequestHandler"};
+ dbus::ObjectProxy* dbus_object_proxy_;
+
+ DISALLOW_COPY_AND_ASSIGN(RequestHandlerProxy);
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+#endif // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_PROXIES_H
diff --git a/gen/libwebserv/org.chromium.WebServer.RequestHandler.h b/gen/libwebserv/org.chromium.WebServer.RequestHandler.h
new file mode 100644
index 0000000..51faa52
--- /dev/null
+++ b/gen/libwebserv/org.chromium.WebServer.RequestHandler.h
@@ -0,0 +1,96 @@
+// Automatic generation of D-Bus interfaces:
+// - org.chromium.WebServer.RequestHandler
+#ifndef ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_ORG_CHROMIUM_WEBSERVER_REQUESTHANDLER_H
+#define ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_ORG_CHROMIUM_WEBSERVER_REQUESTHANDLER_H
+#include <memory>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include <base/macros.h>
+#include <dbus/object_path.h>
+#include <chromeos/any.h>
+#include <chromeos/dbus/dbus_object.h>
+#include <chromeos/dbus/exported_object_manager.h>
+#include <chromeos/variant_dictionary.h>
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Interface definition for org::chromium::WebServer::RequestHandler.
+class RequestHandlerInterface {
+ public:
+ virtual ~RequestHandlerInterface() = default;
+
+ // Sends a new HTTP request to the handler.
+ // Parameters:
+ // - request_info - request metadata. Due to limitation of base::Callback
+ // on the number of parameters, we have to collapse a couple
+ // of distinct parameters into a larger struct, containing:
+ // - (s) protocol_handler_id - ID of the protocol handler.
+ // - (s) request_handler_id - ID of the registered request
+ // handler.
+ // - (s) request_id - unique ID of this request within the
+ // protocol handler.
+ // - (s) url - The request URL (e.g. "/path/object").
+ // - (s) method - Request method (e.g. "GET", "POST", ...).
+ // - headers - Request headers (key-value pairs)
+ // - params - an array of request parameters which could be either
+ // URL params (specified after "?" in the request URL), or
+ // form fields in a POST request. Elements have the following
+ // structure:
+ // - (b) true = form field, false = URL param
+ // - (s) field_name
+ // - (s) field_value
+ // - files - Information about uploaded files.
+ // The data is an array of FileInfo structures containing the
+ // following fields:
+ // - (i) file_id
+ // - (s) field_name
+ // - (s) file_name
+ // - (s) content_type
+ // - (s) transfer_encoding
+ // The actual contents of the file is obtained by calling
+ // GetFileData() on the request object
+ // - body - Raw unparsed request data. Could be empty for POST requests
+ // that have form data/uploaded files already parsed into
+ // form_fields/files parameters.
+ virtual bool ProcessRequest(
+ chromeos::ErrorPtr* error,
+ const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
+ const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
+ const std::vector<uint8_t>& in_body) = 0;
+};
+
+// Interface adaptor for org::chromium::WebServer::RequestHandler.
+class RequestHandlerAdaptor {
+ public:
+ RequestHandlerAdaptor(RequestHandlerInterface* interface) : interface_(interface) {}
+
+ void RegisterWithDBusObject(chromeos::dbus_utils::DBusObject* object) {
+ chromeos::dbus_utils::DBusInterface* itf =
+ object->AddOrGetInterface("org.chromium.WebServer.RequestHandler");
+
+ itf->AddSimpleMethodHandlerWithError(
+ "ProcessRequest",
+ base::Unretained(interface_),
+ &RequestHandlerInterface::ProcessRequest);
+ }
+
+ static dbus::ObjectPath GetObjectPath() {
+ return dbus::ObjectPath{"/org/chromium/WebServer/RequestHandler"};
+ }
+
+ private:
+ RequestHandlerInterface* interface_; // Owned by container of this adapter.
+
+ DISALLOW_COPY_AND_ASSIGN(RequestHandlerAdaptor);
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+#endif // ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_ORG_CHROMIUM_WEBSERVER_REQUESTHANDLER_H
diff --git a/gen/webservd/dbus-mocks.h b/gen/webservd/dbus-mocks.h
new file mode 100644
index 0000000..9073663
--- /dev/null
+++ b/gen/webservd/dbus-mocks.h
@@ -0,0 +1,116 @@
+// Automatic generation of D-Bus interface mock proxies for:
+// - org.chromium.WebServer.ProtocolHandler
+// - org.chromium.WebServer.Server
+#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_MOCKS_H
+#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_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 "dbus-proxies.h"
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Mock object for ProtocolHandlerProxyInterface.
+class ProtocolHandlerProxyMock : public ProtocolHandlerProxyInterface {
+ public:
+ ProtocolHandlerProxyMock() = default;
+
+ MOCK_METHOD6(AddRequestHandler,
+ bool(const std::string& /*in_url*/,
+ const std::string& /*in_method*/,
+ const std::string& /*in_service_name*/,
+ std::string* /*out_request_handler_id*/,
+ chromeos::ErrorPtr* /*error*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD6(AddRequestHandlerAsync,
+ void(const std::string& /*in_url*/,
+ const std::string& /*in_method*/,
+ const std::string& /*in_service_name*/,
+ const base::Callback<void(const std::string& /*request_handler_id*/)>& /*success_callback*/,
+ const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD3(RemoveRequestHandler,
+ bool(const std::string& /*in_request_handler_id*/,
+ chromeos::ErrorPtr* /*error*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD4(RemoveRequestHandlerAsync,
+ void(const std::string& /*in_request_handler_id*/,
+ const base::Callback<void()>& /*success_callback*/,
+ const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD5(GetRequestFileData,
+ bool(const std::string& /*in_request_id*/,
+ int32_t /*in_file_id*/,
+ std::vector<uint8_t>* /*out_contents*/,
+ chromeos::ErrorPtr* /*error*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD5(GetRequestFileDataAsync,
+ void(const std::string& /*in_request_id*/,
+ int32_t /*in_file_id*/,
+ const base::Callback<void(const std::vector<uint8_t>& /*contents*/)>& /*success_callback*/,
+ const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD6(CompleteRequest,
+ bool(const std::string& /*in_request_id*/,
+ int32_t /*in_status_code*/,
+ const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
+ const std::vector<uint8_t>& /*in_data*/,
+ chromeos::ErrorPtr* /*error*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD7(CompleteRequestAsync,
+ void(const std::string& /*in_request_id*/,
+ int32_t /*in_status_code*/,
+ const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
+ const std::vector<uint8_t>& /*in_data*/,
+ const base::Callback<void()>& /*success_callback*/,
+ const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
+ int /*timeout_ms*/));
+ MOCK_CONST_METHOD0(id, const std::string&());
+ MOCK_CONST_METHOD0(name, const std::string&());
+ MOCK_CONST_METHOD0(port, uint16_t());
+ MOCK_CONST_METHOD0(protocol, const std::string&());
+ MOCK_CONST_METHOD0(certificate_fingerprint, const std::vector<uint8_t>&());
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerProxyMock);
+};
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Mock object for ServerProxyInterface.
+class ServerProxyMock : public ServerProxyInterface {
+ public:
+ ServerProxyMock() = default;
+
+ MOCK_METHOD3(Ping,
+ bool(std::string* /*out_message*/,
+ chromeos::ErrorPtr* /*error*/,
+ int /*timeout_ms*/));
+ MOCK_METHOD3(PingAsync,
+ void(const base::Callback<void(const std::string& /*message*/)>& /*success_callback*/,
+ const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
+ int /*timeout_ms*/));
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ServerProxyMock);
+};
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+#endif // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_MOCKS_H
diff --git a/gen/webservd/dbus-proxies.h b/gen/webservd/dbus-proxies.h
new file mode 100644
index 0000000..b129107
--- /dev/null
+++ b/gen/webservd/dbus-proxies.h
@@ -0,0 +1,680 @@
+// Automatic generation of D-Bus interfaces:
+// - org.chromium.WebServer.ProtocolHandler
+// - org.chromium.WebServer.Server
+#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_PROXIES_H
+#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_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 WebServer {
+class ObjectManagerProxy;
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Abstract interface proxy for org::chromium::WebServer::ProtocolHandler.
+class ProtocolHandlerProxyInterface {
+ public:
+ virtual ~ProtocolHandlerProxyInterface() = default;
+
+ // Adds a handler for the given |url|, and optionally request |method|.
+ // On success returns a handler ID.
+ virtual bool AddRequestHandler(
+ const std::string& in_url,
+ const std::string& in_method,
+ const std::string& in_service_name,
+ std::string* out_request_handler_id,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Adds a handler for the given |url|, and optionally request |method|.
+ // On success returns a handler ID.
+ virtual void AddRequestHandlerAsync(
+ const std::string& in_url,
+ const std::string& in_method,
+ const std::string& in_service_name,
+ const base::Callback<void(const std::string& /*request_handler_id*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Removes a previously registered request handler.
+ // The |handler_id| is the ID returned from AddHanlder() method.
+ virtual bool RemoveRequestHandler(
+ const std::string& in_request_handler_id,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Removes a previously registered request handler.
+ // The |handler_id| is the ID returned from AddHanlder() method.
+ virtual void RemoveRequestHandlerAsync(
+ const std::string& in_request_handler_id,
+ const base::Callback<void()>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Returns the contents of the given uploaded file. The |file_id| parameter
+ // must correspond to the file_id member of FileInfo structure returned
+ // by |Files| property for the given |request_id|.
+ virtual bool GetRequestFileData(
+ const std::string& in_request_id,
+ int32_t in_file_id,
+ std::vector<uint8_t>* out_contents,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Returns the contents of the given uploaded file. The |file_id| parameter
+ // must correspond to the file_id member of FileInfo structure returned
+ // by |Files| property for the given |request_id|.
+ virtual void GetRequestFileDataAsync(
+ const std::string& in_request_id,
+ int32_t in_file_id,
+ const base::Callback<void(const std::vector<uint8_t>& /*contents*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Fulfills the request with specified |request_id| and provides response.
+ virtual bool CompleteRequest(
+ const std::string& in_request_id,
+ int32_t in_status_code,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<uint8_t>& in_data,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ // Fulfills the request with specified |request_id| and provides response.
+ virtual void CompleteRequestAsync(
+ const std::string& in_request_id,
+ int32_t in_status_code,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<uint8_t>& in_data,
+ const base::Callback<void()>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ static const char* IdName() { return "Id"; }
+ virtual const std::string& id() const = 0;
+ static const char* NameName() { return "Name"; }
+ virtual const std::string& name() const = 0;
+ static const char* PortName() { return "Port"; }
+ virtual uint16_t port() const = 0;
+ static const char* ProtocolName() { return "Protocol"; }
+ virtual const std::string& protocol() const = 0;
+ static const char* CertificateFingerprintName() { return "CertificateFingerprint"; }
+ virtual const std::vector<uint8_t>& certificate_fingerprint() const = 0;
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Interface proxy for org::chromium::WebServer::ProtocolHandler.
+class ProtocolHandlerProxy final : public ProtocolHandlerProxyInterface {
+ public:
+ class PropertySet : public dbus::PropertySet {
+ public:
+ PropertySet(dbus::ObjectProxy* object_proxy,
+ const PropertyChangedCallback& callback)
+ : dbus::PropertySet{object_proxy,
+ "org.chromium.WebServer.ProtocolHandler",
+ callback} {
+ RegisterProperty(IdName(), &id);
+ RegisterProperty(NameName(), &name);
+ RegisterProperty(PortName(), &port);
+ RegisterProperty(ProtocolName(), &protocol);
+ RegisterProperty(CertificateFingerprintName(), &certificate_fingerprint);
+ }
+
+ chromeos::dbus_utils::Property<std::string> id;
+ chromeos::dbus_utils::Property<std::string> name;
+ chromeos::dbus_utils::Property<uint16_t> port;
+ chromeos::dbus_utils::Property<std::string> protocol;
+ chromeos::dbus_utils::Property<std::vector<uint8_t>> certificate_fingerprint;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PropertySet);
+ };
+
+ ProtocolHandlerProxy(
+ const scoped_refptr<dbus::Bus>& bus,
+ const dbus::ObjectPath& object_path,
+ PropertySet* property_set) :
+ bus_{bus},
+ object_path_{object_path},
+ property_set_{property_set},
+ dbus_object_proxy_{
+ bus_->GetObjectProxy(service_name_, object_path_)} {
+ }
+
+ ~ProtocolHandlerProxy() override {
+ }
+
+ 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_; }
+
+ void SetPropertyChangedCallback(
+ const base::Callback<void(ProtocolHandlerProxy*, const std::string&)>& callback) {
+ on_property_changed_ = callback;
+ }
+
+ const PropertySet* GetProperties() const { return property_set_; }
+ PropertySet* GetProperties() { return property_set_; }
+
+ // Adds a handler for the given |url|, and optionally request |method|.
+ // On success returns a handler ID.
+ bool AddRequestHandler(
+ const std::string& in_url,
+ const std::string& in_method,
+ const std::string& in_service_name,
+ std::string* out_request_handler_id,
+ 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.WebServer.ProtocolHandler",
+ "AddRequestHandler",
+ error,
+ in_url,
+ in_method,
+ in_service_name);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_request_handler_id);
+ }
+
+ // Adds a handler for the given |url|, and optionally request |method|.
+ // On success returns a handler ID.
+ void AddRequestHandlerAsync(
+ const std::string& in_url,
+ const std::string& in_method,
+ const std::string& in_service_name,
+ const base::Callback<void(const std::string& /*request_handler_id*/)>& 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.WebServer.ProtocolHandler",
+ "AddRequestHandler",
+ success_callback,
+ error_callback,
+ in_url,
+ in_method,
+ in_service_name);
+ }
+
+ // Removes a previously registered request handler.
+ // The |handler_id| is the ID returned from AddHanlder() method.
+ bool RemoveRequestHandler(
+ const std::string& in_request_handler_id,
+ 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.WebServer.ProtocolHandler",
+ "RemoveRequestHandler",
+ error,
+ in_request_handler_id);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error);
+ }
+
+ // Removes a previously registered request handler.
+ // The |handler_id| is the ID returned from AddHanlder() method.
+ void RemoveRequestHandlerAsync(
+ const std::string& in_request_handler_id,
+ 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.WebServer.ProtocolHandler",
+ "RemoveRequestHandler",
+ success_callback,
+ error_callback,
+ in_request_handler_id);
+ }
+
+ // Returns the contents of the given uploaded file. The |file_id| parameter
+ // must correspond to the file_id member of FileInfo structure returned
+ // by |Files| property for the given |request_id|.
+ bool GetRequestFileData(
+ const std::string& in_request_id,
+ int32_t in_file_id,
+ std::vector<uint8_t>* out_contents,
+ 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.WebServer.ProtocolHandler",
+ "GetRequestFileData",
+ error,
+ in_request_id,
+ in_file_id);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_contents);
+ }
+
+ // Returns the contents of the given uploaded file. The |file_id| parameter
+ // must correspond to the file_id member of FileInfo structure returned
+ // by |Files| property for the given |request_id|.
+ void GetRequestFileDataAsync(
+ const std::string& in_request_id,
+ int32_t in_file_id,
+ const base::Callback<void(const std::vector<uint8_t>& /*contents*/)>& 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.WebServer.ProtocolHandler",
+ "GetRequestFileData",
+ success_callback,
+ error_callback,
+ in_request_id,
+ in_file_id);
+ }
+
+ // Fulfills the request with specified |request_id| and provides response.
+ bool CompleteRequest(
+ const std::string& in_request_id,
+ int32_t in_status_code,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<uint8_t>& in_data,
+ 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.WebServer.ProtocolHandler",
+ "CompleteRequest",
+ error,
+ in_request_id,
+ in_status_code,
+ in_headers,
+ in_data);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error);
+ }
+
+ // Fulfills the request with specified |request_id| and provides response.
+ void CompleteRequestAsync(
+ const std::string& in_request_id,
+ int32_t in_status_code,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<uint8_t>& in_data,
+ 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.WebServer.ProtocolHandler",
+ "CompleteRequest",
+ success_callback,
+ error_callback,
+ in_request_id,
+ in_status_code,
+ in_headers,
+ in_data);
+ }
+
+ const std::string& id() const override {
+ return property_set_->id.value();
+ }
+
+ const std::string& name() const override {
+ return property_set_->name.value();
+ }
+
+ uint16_t port() const override {
+ return property_set_->port.value();
+ }
+
+ const std::string& protocol() const override {
+ return property_set_->protocol.value();
+ }
+
+ const std::vector<uint8_t>& certificate_fingerprint() const override {
+ return property_set_->certificate_fingerprint.value();
+ }
+
+ private:
+ void OnPropertyChanged(const std::string& property_name) {
+ if (!on_property_changed_.is_null())
+ on_property_changed_.Run(this, property_name);
+ }
+
+ scoped_refptr<dbus::Bus> bus_;
+ const std::string service_name_{"org.chromium.WebServer"};
+ dbus::ObjectPath object_path_;
+ PropertySet* property_set_;
+ base::Callback<void(ProtocolHandlerProxy*, const std::string&)> on_property_changed_;
+ dbus::ObjectProxy* dbus_object_proxy_;
+
+ friend class org::chromium::WebServer::ObjectManagerProxy;
+ DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerProxy);
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Abstract interface proxy for org::chromium::WebServer::Server.
+class ServerProxyInterface {
+ public:
+ virtual ~ServerProxyInterface() = default;
+
+ virtual bool Ping(
+ std::string* out_message,
+ chromeos::ErrorPtr* error,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+
+ virtual void PingAsync(
+ const base::Callback<void(const std::string& /*message*/)>& success_callback,
+ const base::Callback<void(chromeos::Error*)>& error_callback,
+ int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Interface proxy for org::chromium::WebServer::Server.
+class ServerProxy final : public ServerProxyInterface {
+ public:
+ class PropertySet : public dbus::PropertySet {
+ public:
+ PropertySet(dbus::ObjectProxy* object_proxy,
+ const PropertyChangedCallback& callback)
+ : dbus::PropertySet{object_proxy,
+ "org.chromium.WebServer.Server",
+ callback} {
+ }
+
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PropertySet);
+ };
+
+ ServerProxy(const scoped_refptr<dbus::Bus>& bus) :
+ bus_{bus},
+ dbus_object_proxy_{
+ bus_->GetObjectProxy(service_name_, object_path_)} {
+ }
+
+ ~ServerProxy() override {
+ }
+
+ 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 Ping(
+ std::string* out_message,
+ 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.WebServer.Server",
+ "Ping",
+ error);
+ return response && chromeos::dbus_utils::ExtractMethodCallResults(
+ response.get(), error, out_message);
+ }
+
+ void PingAsync(
+ const base::Callback<void(const std::string& /*message*/)>& 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.WebServer.Server",
+ "Ping",
+ success_callback,
+ error_callback);
+ }
+
+ private:
+ scoped_refptr<dbus::Bus> bus_;
+ const std::string service_name_{"org.chromium.WebServer"};
+ const dbus::ObjectPath object_path_{"/org/chromium/WebServer/Server"};
+ dbus::ObjectProxy* dbus_object_proxy_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServerProxy);
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+class ObjectManagerProxy : public dbus::ObjectManager::Interface {
+ public:
+ ObjectManagerProxy(const scoped_refptr<dbus::Bus>& bus)
+ : bus_{bus},
+ dbus_object_manager_{bus->GetObjectManager(
+ "org.chromium.WebServer",
+ dbus::ObjectPath{"/org/chromium/WebServer"})} {
+ dbus_object_manager_->RegisterInterface("org.chromium.WebServer.ProtocolHandler", this);
+ dbus_object_manager_->RegisterInterface("org.chromium.WebServer.Server", this);
+ }
+
+ ~ObjectManagerProxy() override {
+ dbus_object_manager_->UnregisterInterface("org.chromium.WebServer.ProtocolHandler");
+ dbus_object_manager_->UnregisterInterface("org.chromium.WebServer.Server");
+ }
+
+ dbus::ObjectManager* GetObjectManagerProxy() const {
+ return dbus_object_manager_;
+ }
+
+ org::chromium::WebServer::ProtocolHandlerProxy* GetProtocolHandlerProxy(
+ const dbus::ObjectPath& object_path) {
+ auto p = protocol_handler_instances_.find(object_path);
+ if (p != protocol_handler_instances_.end())
+ return p->second.get();
+ return nullptr;
+ }
+ std::vector<org::chromium::WebServer::ProtocolHandlerProxy*> GetProtocolHandlerInstances() const {
+ std::vector<org::chromium::WebServer::ProtocolHandlerProxy*> values;
+ values.reserve(protocol_handler_instances_.size());
+ for (const auto& pair : protocol_handler_instances_)
+ values.push_back(pair.second.get());
+ return values;
+ }
+ void SetProtocolHandlerAddedCallback(
+ const base::Callback<void(org::chromium::WebServer::ProtocolHandlerProxy*)>& callback) {
+ on_protocol_handler_added_ = callback;
+ }
+ void SetProtocolHandlerRemovedCallback(
+ const base::Callback<void(const dbus::ObjectPath&)>& callback) {
+ on_protocol_handler_removed_ = callback;
+ }
+
+ org::chromium::WebServer::ServerProxy* GetServerProxy() {
+ if (server_instances_.empty())
+ return nullptr;
+ return server_instances_.begin()->second.get();
+ }
+ std::vector<org::chromium::WebServer::ServerProxy*> GetServerInstances() const {
+ std::vector<org::chromium::WebServer::ServerProxy*> values;
+ values.reserve(server_instances_.size());
+ for (const auto& pair : server_instances_)
+ values.push_back(pair.second.get());
+ return values;
+ }
+ void SetServerAddedCallback(
+ const base::Callback<void(org::chromium::WebServer::ServerProxy*)>& callback) {
+ on_server_added_ = callback;
+ }
+ void SetServerRemovedCallback(
+ const base::Callback<void(const dbus::ObjectPath&)>& callback) {
+ on_server_removed_ = callback;
+ }
+
+ private:
+ void OnPropertyChanged(const dbus::ObjectPath& object_path,
+ const std::string& interface_name,
+ const std::string& property_name) {
+ if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
+ auto p = protocol_handler_instances_.find(object_path);
+ if (p == protocol_handler_instances_.end())
+ return;
+ p->second->OnPropertyChanged(property_name);
+ return;
+ }
+ }
+
+ void ObjectAdded(
+ const dbus::ObjectPath& object_path,
+ const std::string& interface_name) override {
+ if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
+ auto property_set =
+ static_cast<org::chromium::WebServer::ProtocolHandlerProxy::PropertySet*>(
+ dbus_object_manager_->GetProperties(object_path, interface_name));
+ std::unique_ptr<org::chromium::WebServer::ProtocolHandlerProxy> protocol_handler_proxy{
+ new org::chromium::WebServer::ProtocolHandlerProxy{bus_, object_path, property_set}
+ };
+ auto p = protocol_handler_instances_.emplace(object_path, std::move(protocol_handler_proxy));
+ if (!on_protocol_handler_added_.is_null())
+ on_protocol_handler_added_.Run(p.first->second.get());
+ return;
+ }
+ if (interface_name == "org.chromium.WebServer.Server") {
+ std::unique_ptr<org::chromium::WebServer::ServerProxy> server_proxy{
+ new org::chromium::WebServer::ServerProxy{bus_}
+ };
+ auto p = server_instances_.emplace(object_path, std::move(server_proxy));
+ if (!on_server_added_.is_null())
+ on_server_added_.Run(p.first->second.get());
+ return;
+ }
+ }
+
+ void ObjectRemoved(
+ const dbus::ObjectPath& object_path,
+ const std::string& interface_name) override {
+ if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
+ auto p = protocol_handler_instances_.find(object_path);
+ if (p != protocol_handler_instances_.end()) {
+ if (!on_protocol_handler_removed_.is_null())
+ on_protocol_handler_removed_.Run(object_path);
+ protocol_handler_instances_.erase(p);
+ }
+ return;
+ }
+ if (interface_name == "org.chromium.WebServer.Server") {
+ auto p = server_instances_.find(object_path);
+ if (p != server_instances_.end()) {
+ if (!on_server_removed_.is_null())
+ on_server_removed_.Run(object_path);
+ server_instances_.erase(p);
+ }
+ return;
+ }
+ }
+
+ dbus::PropertySet* CreateProperties(
+ dbus::ObjectProxy* object_proxy,
+ const dbus::ObjectPath& object_path,
+ const std::string& interface_name) override {
+ if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
+ return new org::chromium::WebServer::ProtocolHandlerProxy::PropertySet{
+ object_proxy,
+ base::Bind(&ObjectManagerProxy::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(),
+ object_path,
+ interface_name)
+ };
+ }
+ if (interface_name == "org.chromium.WebServer.Server") {
+ return new org::chromium::WebServer::ServerProxy::PropertySet{
+ object_proxy,
+ base::Bind(&ObjectManagerProxy::OnPropertyChanged,
+ weak_ptr_factory_.GetWeakPtr(),
+ object_path,
+ interface_name)
+ };
+ }
+ LOG(FATAL) << "Creating properties for unsupported interface "
+ << interface_name;
+ return nullptr;
+ }
+
+ scoped_refptr<dbus::Bus> bus_;
+ dbus::ObjectManager* dbus_object_manager_;
+ std::map<dbus::ObjectPath,
+ std::unique_ptr<org::chromium::WebServer::ProtocolHandlerProxy>> protocol_handler_instances_;
+ base::Callback<void(org::chromium::WebServer::ProtocolHandlerProxy*)> on_protocol_handler_added_;
+ base::Callback<void(const dbus::ObjectPath&)> on_protocol_handler_removed_;
+ std::map<dbus::ObjectPath,
+ std::unique_ptr<org::chromium::WebServer::ServerProxy>> server_instances_;
+ base::Callback<void(org::chromium::WebServer::ServerProxy*)> on_server_added_;
+ base::Callback<void(const dbus::ObjectPath&)> on_server_removed_;
+ base::WeakPtrFactory<ObjectManagerProxy> weak_ptr_factory_{this};
+
+ DISALLOW_COPY_AND_ASSIGN(ObjectManagerProxy);
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+
+#endif // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_PROXIES_H
diff --git a/gen/webservd/org.chromium.WebServer.ProtocolHandler.h b/gen/webservd/org.chromium.WebServer.ProtocolHandler.h
new file mode 100644
index 0000000..fd185a9
--- /dev/null
+++ b/gen/webservd/org.chromium.WebServer.ProtocolHandler.h
@@ -0,0 +1,150 @@
+// Automatic generation of D-Bus interfaces:
+// - org.chromium.WebServer.ProtocolHandler
+#ifndef ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_PROTOCOLHANDLER_H
+#define ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_PROTOCOLHANDLER_H
+#include <memory>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include <base/macros.h>
+#include <dbus/object_path.h>
+#include <chromeos/any.h>
+#include <chromeos/dbus/dbus_object.h>
+#include <chromeos/dbus/exported_object_manager.h>
+#include <chromeos/variant_dictionary.h>
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Interface definition for org::chromium::WebServer::ProtocolHandler.
+class ProtocolHandlerInterface {
+ public:
+ virtual ~ProtocolHandlerInterface() = default;
+
+ // Adds a handler for the given |url|, and optionally request |method|.
+ // On success returns a handler ID.
+ virtual std::string AddRequestHandler(
+ const std::string& in_url,
+ const std::string& in_method,
+ const std::string& in_service_name) = 0;
+ // Removes a previously registered request handler.
+ // The |handler_id| is the ID returned from AddHanlder() method.
+ virtual bool RemoveRequestHandler(
+ chromeos::ErrorPtr* error,
+ const std::string& in_request_handler_id) = 0;
+ // Returns the contents of the given uploaded file. The |file_id| parameter
+ // must correspond to the file_id member of FileInfo structure returned
+ // by |Files| property for the given |request_id|.
+ virtual bool GetRequestFileData(
+ chromeos::ErrorPtr* error,
+ const std::string& in_request_id,
+ int32_t in_file_id,
+ std::vector<uint8_t>* out_contents) = 0;
+ // Fulfills the request with specified |request_id| and provides response.
+ virtual bool CompleteRequest(
+ chromeos::ErrorPtr* error,
+ const std::string& in_request_id,
+ int32_t in_status_code,
+ const std::vector<std::tuple<std::string, std::string>>& in_headers,
+ const std::vector<uint8_t>& in_data) = 0;
+};
+
+// Interface adaptor for org::chromium::WebServer::ProtocolHandler.
+class ProtocolHandlerAdaptor {
+ public:
+ ProtocolHandlerAdaptor(ProtocolHandlerInterface* interface) : interface_(interface) {}
+
+ void RegisterWithDBusObject(chromeos::dbus_utils::DBusObject* object) {
+ chromeos::dbus_utils::DBusInterface* itf =
+ object->AddOrGetInterface("org.chromium.WebServer.ProtocolHandler");
+
+ itf->AddSimpleMethodHandler(
+ "AddRequestHandler",
+ base::Unretained(interface_),
+ &ProtocolHandlerInterface::AddRequestHandler);
+ itf->AddSimpleMethodHandlerWithError(
+ "RemoveRequestHandler",
+ base::Unretained(interface_),
+ &ProtocolHandlerInterface::RemoveRequestHandler);
+ itf->AddSimpleMethodHandlerWithError(
+ "GetRequestFileData",
+ base::Unretained(interface_),
+ &ProtocolHandlerInterface::GetRequestFileData);
+ itf->AddSimpleMethodHandlerWithError(
+ "CompleteRequest",
+ base::Unretained(interface_),
+ &ProtocolHandlerInterface::CompleteRequest);
+
+ itf->AddProperty(IdName(), &id_);
+ itf->AddProperty(NameName(), &name_);
+ itf->AddProperty(PortName(), &port_);
+ itf->AddProperty(ProtocolName(), &protocol_);
+ itf->AddProperty(CertificateFingerprintName(), &certificate_fingerprint_);
+ }
+
+ // Returns a unique ID of this instance.
+ static const char* IdName() { return "Id"; }
+ std::string GetId() const {
+ return id_.GetValue().Get<std::string>();
+ }
+ void SetId(const std::string& id) {
+ id_.SetValue(id);
+ }
+
+ // Returns the name of the handler. Multiple related protocol handler
+ // could share the same name so that clients don't have to register
+ // request handlers for each of them separately.
+ static const char* NameName() { return "Name"; }
+ std::string GetName() const {
+ return name_.GetValue().Get<std::string>();
+ }
+ void SetName(const std::string& name) {
+ name_.SetValue(name);
+ }
+
+ // Returns the port number this instance is serving requests on.
+ static const char* PortName() { return "Port"; }
+ uint16_t GetPort() const {
+ return port_.GetValue().Get<uint16_t>();
+ }
+ void SetPort(uint16_t port) {
+ port_.SetValue(port);
+ }
+
+ // Returns the protocol name of this instance ("http" or "https").
+ static const char* ProtocolName() { return "Protocol"; }
+ std::string GetProtocol() const {
+ return protocol_.GetValue().Get<std::string>();
+ }
+ void SetProtocol(const std::string& protocol) {
+ protocol_.SetValue(protocol);
+ }
+
+ // Returns the TLS certificate fingerprint used for HTTPS instance or
+ // empty array if this is an unsecured HTTP instance.
+ static const char* CertificateFingerprintName() { return "CertificateFingerprint"; }
+ std::vector<uint8_t> GetCertificateFingerprint() const {
+ return certificate_fingerprint_.GetValue().Get<std::vector<uint8_t>>();
+ }
+ void SetCertificateFingerprint(const std::vector<uint8_t>& certificate_fingerprint) {
+ certificate_fingerprint_.SetValue(certificate_fingerprint);
+ }
+
+ private:
+ chromeos::dbus_utils::ExportedProperty<std::string> id_;
+ chromeos::dbus_utils::ExportedProperty<std::string> name_;
+ chromeos::dbus_utils::ExportedProperty<uint16_t> port_;
+ chromeos::dbus_utils::ExportedProperty<std::string> protocol_;
+ chromeos::dbus_utils::ExportedProperty<std::vector<uint8_t>> certificate_fingerprint_;
+
+ ProtocolHandlerInterface* interface_; // Owned by container of this adapter.
+
+ DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerAdaptor);
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+#endif // ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_PROTOCOLHANDLER_H
diff --git a/gen/webservd/org.chromium.WebServer.Server.h b/gen/webservd/org.chromium.WebServer.Server.h
new file mode 100644
index 0000000..1b844c8
--- /dev/null
+++ b/gen/webservd/org.chromium.WebServer.Server.h
@@ -0,0 +1,57 @@
+// Automatic generation of D-Bus interfaces:
+// - org.chromium.WebServer.Server
+#ifndef ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_SERVER_H
+#define ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_SERVER_H
+#include <memory>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include <base/macros.h>
+#include <dbus/object_path.h>
+#include <chromeos/any.h>
+#include <chromeos/dbus/dbus_object.h>
+#include <chromeos/dbus/exported_object_manager.h>
+#include <chromeos/variant_dictionary.h>
+
+namespace org {
+namespace chromium {
+namespace WebServer {
+
+// Interface definition for org::chromium::WebServer::Server.
+class ServerInterface {
+ public:
+ virtual ~ServerInterface() = default;
+
+ virtual std::string Ping() = 0;
+};
+
+// Interface adaptor for org::chromium::WebServer::Server.
+class ServerAdaptor {
+ public:
+ ServerAdaptor(ServerInterface* interface) : interface_(interface) {}
+
+ void RegisterWithDBusObject(chromeos::dbus_utils::DBusObject* object) {
+ chromeos::dbus_utils::DBusInterface* itf =
+ object->AddOrGetInterface("org.chromium.WebServer.Server");
+
+ itf->AddSimpleMethodHandler(
+ "Ping",
+ base::Unretained(interface_),
+ &ServerInterface::Ping);
+ }
+
+ static dbus::ObjectPath GetObjectPath() {
+ return dbus::ObjectPath{"/org/chromium/WebServer/Server"};
+ }
+
+ private:
+ ServerInterface* interface_; // Owned by container of this adapter.
+
+ DISALLOW_COPY_AND_ASSIGN(ServerAdaptor);
+};
+
+} // namespace WebServer
+} // namespace chromium
+} // namespace org
+#endif // ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_SERVER_H
diff --git a/libwebserv/Android.mk b/libwebserv/Android.mk
new file mode 100644
index 0000000..396015f
--- /dev/null
+++ b/libwebserv/Android.mk
@@ -0,0 +1,35 @@
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(my-dir)
+
+# libwebserv shared library
+# ========================================================
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libwebserv
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+# TODO: Add dbus_bindings/org.chromium.WebServer.RequestHandler.dbus.xml once
+# code generation is working.
+LOCAL_SRC_FILES := \
+ protocol_handler.cc \
+ request.cc \
+ request_handler_callback.cc \
+ response.cc \
+ server.cc \
+
+$(eval $(webservd_common))
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libwebserv/_empty.cc b/libwebserv/_empty.cc
index def2420..31ef18a 100644
--- a/libwebserv/_empty.cc
+++ b/libwebserv/_empty.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
// This file is left empty deliberately to work around some dependency
// generation in GYP. In GYP for custom actions to run properly, the 'sources'
diff --git a/libwebserv/export.h b/libwebserv/export.h
index f2c5394..ff68423 100644
--- a/libwebserv/export.h
+++ b/libwebserv/export.h
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_LIBWEBSERV_EXPORT_H_
#define WEBSERVER_LIBWEBSERV_EXPORT_H_
diff --git a/libwebserv/libwebserv_testrunner.cc b/libwebserv/libwebserv_testrunner.cc
index 4e89dbb..46268e5 100644
--- a/libwebserv/libwebserv_testrunner.cc
+++ b/libwebserv/libwebserv_testrunner.cc
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include <base/at_exit.h>
#include <gtest/gtest.h>
diff --git a/libwebserv/preinstall.sh b/libwebserv/preinstall.sh
index 51ee83b..7600707 100755
--- a/libwebserv/preinstall.sh
+++ b/libwebserv/preinstall.sh
@@ -1,7 +1,18 @@
#!/bin/bash
-# Copyright 2014 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.
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
set -e
diff --git a/libwebserv/protocol_handler.cc b/libwebserv/protocol_handler.cc
index 53514be..7897c76 100644
--- a/libwebserv/protocol_handler.cc
+++ b/libwebserv/protocol_handler.cc
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "libwebserv/protocol_handler.h"
diff --git a/libwebserv/protocol_handler.h b/libwebserv/protocol_handler.h
index f6543cc..648f0ff 100644
--- a/libwebserv/protocol_handler.h
+++ b/libwebserv/protocol_handler.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_LIBWEBSERV_PROTOCOL_HANDLER_H_
#define WEBSERVER_LIBWEBSERV_PROTOCOL_HANDLER_H_
diff --git a/libwebserv/request.cc b/libwebserv/request.cc
index b51aa94..cb0fa1b 100644
--- a/libwebserv/request.cc
+++ b/libwebserv/request.cc
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include <libwebserv/request.h>
diff --git a/libwebserv/request.h b/libwebserv/request.h
index 894546b..4ffbb7c 100644
--- a/libwebserv/request.h
+++ b/libwebserv/request.h
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_LIBWEBSERV_REQUEST_H_
#define WEBSERVER_LIBWEBSERV_REQUEST_H_
diff --git a/libwebserv/request_handler_callback.cc b/libwebserv/request_handler_callback.cc
index 4989a8e..7606ecc 100644
--- a/libwebserv/request_handler_callback.cc
+++ b/libwebserv/request_handler_callback.cc
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include <libwebserv/request_handler_callback.h>
diff --git a/libwebserv/request_handler_callback.h b/libwebserv/request_handler_callback.h
index 6b191bc..ab1ad6a 100644
--- a/libwebserv/request_handler_callback.h
+++ b/libwebserv/request_handler_callback.h
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_CALLBACK_H_
#define WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_CALLBACK_H_
diff --git a/libwebserv/request_handler_interface.h b/libwebserv/request_handler_interface.h
index a373680..c9ce115 100644
--- a/libwebserv/request_handler_interface.h
+++ b/libwebserv/request_handler_interface.h
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_
#define WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_
diff --git a/libwebserv/response.cc b/libwebserv/response.cc
index 57b4cd7..8fc49f7 100644
--- a/libwebserv/response.cc
+++ b/libwebserv/response.cc
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include <libwebserv/response.h>
diff --git a/libwebserv/response.h b/libwebserv/response.h
index 616264d..f3f2adf 100644
--- a/libwebserv/response.h
+++ b/libwebserv/response.h
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_LIBWEBSERV_RESPONSE_H_
#define WEBSERVER_LIBWEBSERV_RESPONSE_H_
diff --git a/libwebserv/server.cc b/libwebserv/server.cc
index 408852e..113be20 100644
--- a/libwebserv/server.cc
+++ b/libwebserv/server.cc
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include <libwebserv/server.h>
diff --git a/libwebserv/server.h b/libwebserv/server.h
index bb45204..70e5dcd 100644
--- a/libwebserv/server.h
+++ b/libwebserv/server.h
@@ -1,6 +1,16 @@
-// Copyright 2014 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_LIBWEBSERV_SERVER_H_
#define WEBSERVER_LIBWEBSERV_SERVER_H_
diff --git a/webservd/Android.mk b/webservd/Android.mk
new file mode 100644
index 0000000..85eb73c
--- /dev/null
+++ b/webservd/Android.mk
@@ -0,0 +1,66 @@
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(my-dir)
+
+# TODO: Refactor to build and run unit tests.
+
+# webservd executable
+# ========================================================
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := webservd
+LOCAL_REQUIRED_MODULES := init.webservd.rc
+# TODO: Add firewalld-client once code generation is working.
+LOCAL_SHARED_LIBRARIES := \
+ libcrypto \
+ libwebserv \
+
+# TODO: Add the following once code generation is working:
+# dbus_bindings/dbus-service-config.json
+# dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus.xml
+# dbus_bindings/org.chromium.WebServer.Server.dbus.xml
+LOCAL_SRC_FILES := \
+ config.cc \
+ dbus_protocol_handler.cc \
+ dbus_request_handler.cc \
+ error_codes.cc \
+ firewalld_firewall.cc \
+ log_manager.cc \
+ main.cc \
+ protocol_handler.cc \
+ request.cc \
+ server.cc \
+ utils.cc \
+
+$(eval $(webservd_common))
+include $(BUILD_EXECUTABLE)
+
+# init.webservd.rc script
+# ========================================================
+
+ifdef INITRC_TEMPLATE
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := init.webservd.rc
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_INITRCD)
+
+include $(BUILD_SYSTEM)/base_rules.mk
+.PHONY: $(LOCAL_BUILT_MODULE)
+$(LOCAL_BUILT_MODULE): $(INITRC_TEMPLATE)
+ $(call generate-initrc-file,webservd,,inet)
+endif
diff --git a/webservd/config.cc b/webservd/config.cc
index 562ce05..d3644bc 100644
--- a/webservd/config.cc
+++ b/webservd/config.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/config.h"
diff --git a/webservd/config.h b/webservd/config.h
index 3ff65bd..f8c86c1 100644
--- a/webservd/config.h
+++ b/webservd/config.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_CONFIG_H_
#define WEBSERVER_WEBSERVD_CONFIG_H_
diff --git a/webservd/config_unittest.cc b/webservd/config_unittest.cc
index dc7f4e0..d5589f4 100644
--- a/webservd/config_unittest.cc
+++ b/webservd/config_unittest.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/config.h"
diff --git a/webservd/dbus_protocol_handler.cc b/webservd/dbus_protocol_handler.cc
index 3d11a87..a2d0d86 100644
--- a/webservd/dbus_protocol_handler.cc
+++ b/webservd/dbus_protocol_handler.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/dbus_protocol_handler.h"
diff --git a/webservd/dbus_protocol_handler.h b/webservd/dbus_protocol_handler.h
index 74238b1..bcec227 100644
--- a/webservd/dbus_protocol_handler.h
+++ b/webservd/dbus_protocol_handler.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_DBUS_PROTOCOL_HANDLER_H_
#define WEBSERVER_WEBSERVD_DBUS_PROTOCOL_HANDLER_H_
diff --git a/webservd/dbus_request_handler.cc b/webservd/dbus_request_handler.cc
index 4e1d033..303d191 100644
--- a/webservd/dbus_request_handler.cc
+++ b/webservd/dbus_request_handler.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/dbus_request_handler.h"
diff --git a/webservd/dbus_request_handler.h b/webservd/dbus_request_handler.h
index 168f402..3171f8a 100644
--- a/webservd/dbus_request_handler.h
+++ b/webservd/dbus_request_handler.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_DBUS_REQUEST_HANDLER_H_
#define WEBSERVER_WEBSERVD_DBUS_REQUEST_HANDLER_H_
diff --git a/webservd/error_codes.cc b/webservd/error_codes.cc
index 30803e2..9a9dbde 100644
--- a/webservd/error_codes.cc
+++ b/webservd/error_codes.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/error_codes.h"
diff --git a/webservd/error_codes.h b/webservd/error_codes.h
index ad694f1..3a479c2 100644
--- a/webservd/error_codes.h
+++ b/webservd/error_codes.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_ERROR_CODES_H_
#define WEBSERVER_WEBSERVD_ERROR_CODES_H_
diff --git a/webservd/etc/init/webservd.conf b/webservd/etc/init/webservd.conf
index 9eca9b6..ef05d03 100644
--- a/webservd/etc/init/webservd.conf
+++ b/webservd/etc/init/webservd.conf
@@ -1,6 +1,16 @@
-# 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.
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
description "Brillo WebServer Daemon"
author "chromium-os-dev@chromium.org"
diff --git a/webservd/firewall_interface.h b/webservd/firewall_interface.h
index 0d93b59..bd333e2 100644
--- a/webservd/firewall_interface.h
+++ b/webservd/firewall_interface.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_FIREWALL_INTERFACE_H_
#define WEBSERVER_WEBSERVD_FIREWALL_INTERFACE_H_
diff --git a/webservd/firewalld_firewall.cc b/webservd/firewalld_firewall.cc
index 9022382..3691d4a 100644
--- a/webservd/firewalld_firewall.cc
+++ b/webservd/firewalld_firewall.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/firewalld_firewall.h"
diff --git a/webservd/firewalld_firewall.h b/webservd/firewalld_firewall.h
index e18b232..903beb5 100644
--- a/webservd/firewalld_firewall.h
+++ b/webservd/firewalld_firewall.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_FIREWALLD_FIREWALL_H_
#define WEBSERVER_WEBSERVD_FIREWALLD_FIREWALL_H_
diff --git a/webservd/log_manager.cc b/webservd/log_manager.cc
index bd049dd..13409b7 100644
--- a/webservd/log_manager.cc
+++ b/webservd/log_manager.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/log_manager.h"
diff --git a/webservd/log_manager.h b/webservd/log_manager.h
index 729fcd7..a6bc866 100644
--- a/webservd/log_manager.h
+++ b/webservd/log_manager.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_LOG_MANAGER_H_
#define WEBSERVER_WEBSERVD_LOG_MANAGER_H_
diff --git a/webservd/log_manager_unittest.cc b/webservd/log_manager_unittest.cc
index b007831..f88c532 100644
--- a/webservd/log_manager_unittest.cc
+++ b/webservd/log_manager_unittest.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/log_manager.h"
diff --git a/webservd/main.cc b/webservd/main.cc
index 727c400..fbe4faf 100644
--- a/webservd/main.cc
+++ b/webservd/main.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include <string>
#include <sysexits.h>
@@ -11,7 +21,9 @@
#include <chromeos/dbus/exported_object_manager.h>
#include <chromeos/daemons/dbus_daemon.h>
#include <chromeos/flag_helper.h>
+#if !defined(__BRILLO__)
#include <chromeos/minijail/minijail.h>
+#endif // !defined(__BRILLO__)
#include <chromeos/syslog_logging.h>
#include "webservd/config.h"
@@ -25,7 +37,7 @@
#else
#include "webservd/permission_broker_firewall.h"
using FirewallImpl = webservd::PermissionBrokerFirewall;
-#endif // __BRILLO__
+#endif // defined(__BRILLO__)
using chromeos::dbus_utils::AsyncEventSequencer;
@@ -113,6 +125,8 @@
config.use_debug = FLAGS_debug;
Daemon daemon{std::move(config)};
+ // TODO: Re-enable this for Brillo once minijail works with libcap-ng.
+#if !defined(__BRILLO__)
// Drop privileges and use 'webservd' user. We need to do this after Daemon
// object is constructed since it creates an instance of base::AtExitManager
// which is required for chromeos::Minijail::GetInstance() to work.
@@ -124,5 +138,7 @@
minijail_instance->UseCapabilities(jail, CAP_TO_MASK(CAP_NET_BIND_SERVICE));
minijail_enter(jail);
minijail_instance->Destroy(jail);
+#endif // !defined(__BRILLO__)
+
return daemon.Run();
}
diff --git a/webservd/permission_broker_firewall.cc b/webservd/permission_broker_firewall.cc
index a507d14..14570d4 100644
--- a/webservd/permission_broker_firewall.cc
+++ b/webservd/permission_broker_firewall.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/permission_broker_firewall.h"
diff --git a/webservd/permission_broker_firewall.h b/webservd/permission_broker_firewall.h
index 9b4fcc7..41343c2 100644
--- a/webservd/permission_broker_firewall.h
+++ b/webservd/permission_broker_firewall.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_PERMISSION_BROKER_FIREWALL_H_
#define WEBSERVER_WEBSERVD_PERMISSION_BROKER_FIREWALL_H_
diff --git a/webservd/protocol_handler.cc b/webservd/protocol_handler.cc
index a620b13..9e96d45 100644
--- a/webservd/protocol_handler.cc
+++ b/webservd/protocol_handler.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/protocol_handler.h"
diff --git a/webservd/protocol_handler.h b/webservd/protocol_handler.h
index d9aeffc..9802807 100644
--- a/webservd/protocol_handler.h
+++ b/webservd/protocol_handler.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_PROTOCOL_HANDLER_H_
#define WEBSERVER_WEBSERVD_PROTOCOL_HANDLER_H_
diff --git a/webservd/request.cc b/webservd/request.cc
index 011d043..14b5793 100644
--- a/webservd/request.cc
+++ b/webservd/request.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/request.h"
diff --git a/webservd/request.h b/webservd/request.h
index 78877c7..179c3e6 100644
--- a/webservd/request.h
+++ b/webservd/request.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_REQUEST_H_
#define WEBSERVER_WEBSERVD_REQUEST_H_
diff --git a/webservd/request_handler_interface.h b/webservd/request_handler_interface.h
index 1cde9c4..fb3a25c 100644
--- a/webservd/request_handler_interface.h
+++ b/webservd/request_handler_interface.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_REQUEST_HANDLER_INTERFACE_H_
#define WEBSERVER_WEBSERVD_REQUEST_HANDLER_INTERFACE_H_
diff --git a/webservd/server.cc b/webservd/server.cc
index 9757848..2f0a9a8 100644
--- a/webservd/server.cc
+++ b/webservd/server.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/server.h"
diff --git a/webservd/server.h b/webservd/server.h
index 693e135..418ec71 100644
--- a/webservd/server.h
+++ b/webservd/server.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_SERVER_H_
#define WEBSERVER_WEBSERVD_SERVER_H_
diff --git a/webservd/server_interface.h b/webservd/server_interface.h
index 8703dd7..afcb0bf 100644
--- a/webservd/server_interface.h
+++ b/webservd/server_interface.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_SERVER_INTERFACE_H_
#define WEBSERVER_WEBSERVD_SERVER_INTERFACE_H_
diff --git a/webservd/utils.cc b/webservd/utils.cc
index c78e51f..bb7f4a8 100644
--- a/webservd/utils.cc
+++ b/webservd/utils.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "webservd/utils.h"
diff --git a/webservd/utils.h b/webservd/utils.h
index 4b39675..b8904a0 100644
--- a/webservd/utils.h
+++ b/webservd/utils.h
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#ifndef WEBSERVER_WEBSERVD_UTILS_H_
#define WEBSERVER_WEBSERVD_UTILS_H_
diff --git a/webservd/webservd_testrunner.cc b/webservd/webservd_testrunner.cc
index fd37f03..46268e5 100644
--- a/webservd/webservd_testrunner.cc
+++ b/webservd/webservd_testrunner.cc
@@ -1,6 +1,16 @@
-// 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.
+// Copyright 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include <base/at_exit.h>
#include <gtest/gtest.h>