New DBus methods to enable/disable P2P update sharing.

This patch adds two new methods to enable/disable sharing updates
over P2P in the local network. This allows a crosh command to set
and get this flag to enable or disable this feature.

BUG=chromium:260441
TEST=Manual test. See below.

Manual test procedure.
1. Enable P2P:
update_engine_client -p2p_update yes -show_p2p_update

[0829/141039:INFO:update_engine_client.cc(433)] Current update using P2P setting: ENABLED
[0829/141039:INFO:update_engine_client.cc(500)] Done.

2. Start the p2p server (this will be done by the p2p_manager
   as part of the update_engine procedure).

3. Run an update check
update_engine_client -check_for_update

The /var/log/update_engine.log shows the following line confirming
p2p is enabled.
[0829/141317:INFO:p2p_manager.cc(194)] Returning value 1 for whether p2p is enabled.

4. Disable p2p and verify the p2p server is not running.
update_engine_client -p2p_update no -show_p2p_update

[0829/141039:INFO:update_engine_client.cc(433)] Current update using P2P setting: ENABLED
[0829/141039:INFO:update_engine_client.cc(500)] Done.

5. Verify p2p server is not running (ps aux | grep p2p doesn't show
p2p-server)

Change-Id: I3215e2961be440c491f669d4c580bbf87f7fec25
Reviewed-on: https://chromium-review.googlesource.com/62505
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alejandro Deymo <deymo@chromium.org>
Tested-by: Alejandro Deymo <deymo@chromium.org>
diff --git a/dbus_service.h b/dbus_service.h
index 8349622..27210f6 100644
--- a/dbus_service.h
+++ b/dbus_service.h
@@ -91,6 +91,20 @@
                                            gchar** channel,
                                            GError **error);
 
+// Enables or disables the sharing and consuming updates over P2P feature
+// according to the |enabled| argument passed.
+gboolean update_engine_service_set_p2p_update_permission(
+    UpdateEngineService* self,
+    gboolean enabled,
+    GError **error);
+
+// Returns in |enabled| the current value for the P2P enabled setting. This
+// involves both sharing and consuming updates over P2P.
+gboolean update_engine_service_get_p2p_update_permission(
+    UpdateEngineService* self,
+    gboolean* enabled,
+    GError **error);
+
 // If there's no device policy installed, sets the update over cellular networks
 // permission to the |allowed| value. Otherwise, this method returns with an
 // error since this setting is overridden by the applied policy.