1// Automatic generation of D-Bus interfaces:
2//  - org.chromium.debugd
3#ifndef ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_DEBUGD_CLIENT_OUT_DEFAULT_GEN_INCLUDE_DEBUGD_DBUS_PROXIES_H
4#define ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_DEBUGD_CLIENT_OUT_DEFAULT_GEN_INCLUDE_DEBUGD_DBUS_PROXIES_H
5#include <memory>
6#include <string>
7#include <vector>
8
9#include <base/bind.h>
10#include <base/callback.h>
11#include <base/logging.h>
12#include <base/macros.h>
13#include <base/memory/ref_counted.h>
14#include <brillo/any.h>
15#include <brillo/dbus/dbus_method_invoker.h>
16#include <brillo/dbus/dbus_property.h>
17#include <brillo/dbus/dbus_signal_handler.h>
18#include <brillo/errors/error.h>
19#include <brillo/variant_dictionary.h>
20#include <dbus/bus.h>
21#include <dbus/message.h>
22#include <dbus/object_manager.h>
23#include <dbus/object_path.h>
24#include <dbus/object_proxy.h>
25
26namespace org {
27namespace chromium {
28
29// Abstract interface proxy for org::chromium::debugd.
30class debugdProxyInterface {
31 public:
32  virtual ~debugdProxyInterface() = default;
33
34  // Starts pinging the specified hostname with the specified options, with
35  // output directed to the given output file descriptor. The returned opaque
36  // string functions as a handle for this particular ping. Multiple pings
37  // can be running at once.
38  virtual bool PingStart(
39      const dbus::FileDescriptor& in_outfd,
40      const std::string& in_destination,
41      const brillo::VariantDictionary& in_options,
42      std::string* out_handle,
43      brillo::ErrorPtr* error,
44      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
45
46  // Starts pinging the specified hostname with the specified options, with
47  // output directed to the given output file descriptor. The returned opaque
48  // string functions as a handle for this particular ping. Multiple pings
49  // can be running at once.
50  virtual void PingStartAsync(
51      const dbus::FileDescriptor& in_outfd,
52      const std::string& in_destination,
53      const brillo::VariantDictionary& in_options,
54      const base::Callback<void(const std::string& /*handle*/)>& success_callback,
55      const base::Callback<void(brillo::Error*)>& error_callback,
56      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
57
58  // Stops a running ping.
59  virtual bool PingStop(
60      const std::string& in_handle,
61      brillo::ErrorPtr* error,
62      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
63
64  // Stops a running ping.
65  virtual void PingStopAsync(
66      const std::string& in_handle,
67      const base::Callback<void()>& success_callback,
68      const base::Callback<void(brillo::Error*)>& error_callback,
69      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
70
71  // Start system/kernel tracing.  If tracing is already enabled it is
72  // stopped first and any collected events are discarded.  The kernel
73  // must have been configured to support tracing.
74  virtual bool SystraceStart(
75      const std::string& in_categories,
76      brillo::ErrorPtr* error,
77      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
78
79  // Start system/kernel tracing.  If tracing is already enabled it is
80  // stopped first and any collected events are discarded.  The kernel
81  // must have been configured to support tracing.
82  virtual void SystraceStartAsync(
83      const std::string& in_categories,
84      const base::Callback<void()>& success_callback,
85      const base::Callback<void(brillo::Error*)>& error_callback,
86      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
87
88  // Stop system/kernel tracing and write the collected event data.
89  virtual bool SystraceStop(
90      const dbus::FileDescriptor& in_outfd,
91      brillo::ErrorPtr* error,
92      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
93
94  // Stop system/kernel tracing and write the collected event data.
95  virtual void SystraceStopAsync(
96      const dbus::FileDescriptor& in_outfd,
97      const base::Callback<void()>& success_callback,
98      const base::Callback<void(brillo::Error*)>& error_callback,
99      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
100
101  // Return current status for system/kernel tracing including whether it
102  // is enabled, the tracing clock, and the set of events enabled.
103  virtual bool SystraceStatus(
104      std::string* out_status,
105      brillo::ErrorPtr* error,
106      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
107
108  // Return current status for system/kernel tracing including whether it
109  // is enabled, the tracing clock, and the set of events enabled.
110  virtual void SystraceStatusAsync(
111      const base::Callback<void(const std::string& /*status*/)>& success_callback,
112      const base::Callback<void(brillo::Error*)>& error_callback,
113      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
114
115  virtual bool TracePathStart(
116      const dbus::FileDescriptor& in_outfd,
117      const std::string& in_destination,
118      const brillo::VariantDictionary& in_options,
119      std::string* out_handle,
120      brillo::ErrorPtr* error,
121      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
122
123  virtual void TracePathStartAsync(
124      const dbus::FileDescriptor& in_outfd,
125      const std::string& in_destination,
126      const brillo::VariantDictionary& in_options,
127      const base::Callback<void(const std::string& /*handle*/)>& success_callback,
128      const base::Callback<void(brillo::Error*)>& error_callback,
129      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
130
131  // Stops a running tracepath.
132  virtual bool TracePathStop(
133      const std::string& in_handle,
134      brillo::ErrorPtr* error,
135      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
136
137  // Stops a running tracepath.
138  virtual void TracePathStopAsync(
139      const std::string& in_handle,
140      const base::Callback<void()>& success_callback,
141      const base::Callback<void(brillo::Error*)>& error_callback,
142      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
143
144  // Returns the routing table.
145  virtual bool GetRoutes(
146      const brillo::VariantDictionary& in_options,
147      std::vector<std::string>* out_result,
148      brillo::ErrorPtr* error,
149      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
150
151  // Returns the routing table.
152  virtual void GetRoutesAsync(
153      const brillo::VariantDictionary& in_options,
154      const base::Callback<void(const std::vector<std::string>& /*result*/)>& success_callback,
155      const base::Callback<void(brillo::Error*)>& error_callback,
156      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
157
158  // Returns modem information as a JSON string. See the design document for
159  // a rationale.
160  virtual bool GetModemStatus(
161      std::string* out_status,
162      brillo::ErrorPtr* error,
163      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
164
165  // Returns modem information as a JSON string. See the design document for
166  // a rationale.
167  virtual void GetModemStatusAsync(
168      const base::Callback<void(const std::string& /*status*/)>& success_callback,
169      const base::Callback<void(brillo::Error*)>& error_callback,
170      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
171
172  // Runs the specified command through the modem serial interface and
173  // returns the output.
174  virtual bool RunModemCommand(
175      const std::string& in_command,
176      std::string* out_status,
177      brillo::ErrorPtr* error,
178      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
179
180  // Runs the specified command through the modem serial interface and
181  // returns the output.
182  virtual void RunModemCommandAsync(
183      const std::string& in_command,
184      const base::Callback<void(const std::string& /*status*/)>& success_callback,
185      const base::Callback<void(brillo::Error*)>& error_callback,
186      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
187
188  // Returns network information as a JSON string. See the design document
189  // for a rationale.
190  virtual bool GetNetworkStatus(
191      std::string* out_status,
192      brillo::ErrorPtr* error,
193      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
194
195  // Returns network information as a JSON string. See the design document
196  // for a rationale.
197  virtual void GetNetworkStatusAsync(
198      const base::Callback<void(const std::string& /*status*/)>& success_callback,
199      const base::Callback<void(brillo::Error*)>& error_callback,
200      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
201
202  // Returns WiMAX information as a JSON string. See the design document for
203  // a rationale.
204  virtual bool GetWiMaxStatus(
205      std::string* out_status,
206      brillo::ErrorPtr* error,
207      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
208
209  // Returns WiMAX information as a JSON string. See the design document for
210  // a rationale.
211  virtual void GetWiMaxStatusAsync(
212      const base::Callback<void(const std::string& /*status*/)>& success_callback,
213      const base::Callback<void(brillo::Error*)>& error_callback,
214      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
215
216  // Runs system-wide perf profiling. The profile parameters are selected by
217  // perf_args.
218  virtual bool GetPerfOutput(
219      uint32_t in_duration_sec,
220      const std::vector<std::string>& in_perf_args,
221      int32_t* out_status,
222      std::vector<uint8_t>* out_perf_data,
223      std::vector<uint8_t>* out_perf_stat,
224      brillo::ErrorPtr* error,
225      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
226
227  // Runs system-wide perf profiling. The profile parameters are selected by
228  // perf_args.
229  virtual void GetPerfOutputAsync(
230      uint32_t in_duration_sec,
231      const std::vector<std::string>& in_perf_args,
232      const base::Callback<void(int32_t /*status*/, const std::vector<uint8_t>& /*perf_data*/, const std::vector<uint8_t>& /*perf_stat*/)>& success_callback,
233      const base::Callback<void(brillo::Error*)>& error_callback,
234      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
235
236  // Runs system-wide perf profiling. It can can profile events other than
237  // cycles (example: iTLB-misses), and can collect branch profiles. It can
238  // also return raw counter values. The exact profile or counters to be
239  // collected is chosen at random and depends on what CPU is used by the
240  // system (certain CPUs do not support certain profiling modes).
241  virtual bool GetRandomPerfOutput(
242      uint32_t in_duration_sec,
243      int32_t* out_status,
244      std::vector<uint8_t>* out_perf_data,
245      std::vector<uint8_t>* out_perf_stat,
246      brillo::ErrorPtr* error,
247      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
248
249  // Runs system-wide perf profiling. It can can profile events other than
250  // cycles (example: iTLB-misses), and can collect branch profiles. It can
251  // also return raw counter values. The exact profile or counters to be
252  // collected is chosen at random and depends on what CPU is used by the
253  // system (certain CPUs do not support certain profiling modes).
254  virtual void GetRandomPerfOutputAsync(
255      uint32_t in_duration_sec,
256      const base::Callback<void(int32_t /*status*/, const std::vector<uint8_t>& /*perf_data*/, const std::vector<uint8_t>& /*perf_stat*/)>& success_callback,
257      const base::Callback<void(brillo::Error*)>& error_callback,
258      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
259
260  // Returns perf event data. Does systemwide profiling. It can profile
261  // events other than cycles (example: iTLB-misses), and can collect branch
262  // profiles. The exact profile to be collected is chosen at random
263  // and depends on what CPU is used by the system (certain CPUs do not
264  // support certain profiling modes).
265  virtual bool GetRichPerfData(
266      uint32_t in_duration_sec,
267      std::vector<uint8_t>* out_status,
268      brillo::ErrorPtr* error,
269      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
270
271  // Returns perf event data. Does systemwide profiling. It can profile
272  // events other than cycles (example: iTLB-misses), and can collect branch
273  // profiles. The exact profile to be collected is chosen at random
274  // and depends on what CPU is used by the system (certain CPUs do not
275  // support certain profiling modes).
276  virtual void GetRichPerfDataAsync(
277      uint32_t in_duration_sec,
278      const base::Callback<void(const std::vector<uint8_t>& /*status*/)>& success_callback,
279      const base::Callback<void(brillo::Error*)>& error_callback,
280      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
281
282  // DEPRECATED: Use DumpDebugLogs instead.
283  // Packages up system logs into a .tar.gz and returns it over the supplied
284  // file descriptor.
285  virtual bool GetDebugLogs(
286      const dbus::FileDescriptor& in_outfd,
287      brillo::ErrorPtr* error,
288      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
289
290  // DEPRECATED: Use DumpDebugLogs instead.
291  // Packages up system logs into a .tar.gz and returns it over the supplied
292  // file descriptor.
293  virtual void GetDebugLogsAsync(
294      const dbus::FileDescriptor& in_outfd,
295      const base::Callback<void()>& success_callback,
296      const base::Callback<void(brillo::Error*)>& error_callback,
297      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
298
299  // Packages up system logs into a .tar(.gz) and returns it over the
300  // supplied file descriptor.
301  virtual bool DumpDebugLogs(
302      bool in_is_compressed,
303      const dbus::FileDescriptor& in_outfd,
304      brillo::ErrorPtr* error,
305      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
306
307  // Packages up system logs into a .tar(.gz) and returns it over the
308  // supplied file descriptor.
309  virtual void DumpDebugLogsAsync(
310      bool in_is_compressed,
311      const dbus::FileDescriptor& in_outfd,
312      const base::Callback<void()>& success_callback,
313      const base::Callback<void(brillo::Error*)>& error_callback,
314      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
315
316  // Enables or disables debug mode for a specified subsystem.
317  virtual bool SetDebugMode(
318      const std::string& in_subsystem,
319      brillo::ErrorPtr* error,
320      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
321
322  // Enables or disables debug mode for a specified subsystem.
323  virtual void SetDebugModeAsync(
324      const std::string& in_subsystem,
325      const base::Callback<void()>& success_callback,
326      const base::Callback<void(brillo::Error*)>& error_callback,
327      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
328
329  // Fetches the contents of a single system log, identified by name. See
330  // /src/log_tool.cc for a list of valid names.
331  virtual bool GetLog(
332      const std::string& in_log,
333      std::string* out_contents,
334      brillo::ErrorPtr* error,
335      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
336
337  // Fetches the contents of a single system log, identified by name. See
338  // /src/log_tool.cc for a list of valid names.
339  virtual void GetLogAsync(
340      const std::string& in_log,
341      const base::Callback<void(const std::string& /*contents*/)>& success_callback,
342      const base::Callback<void(brillo::Error*)>& error_callback,
343      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
344
345  // Returns all the system logs.
346  virtual bool GetAllLogs(
347      std::map<std::string, std::string>* out_logs,
348      brillo::ErrorPtr* error,
349      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
350
351  // Returns all the system logs.
352  virtual void GetAllLogsAsync(
353      const base::Callback<void(const std::map<std::string, std::string>& /*logs*/)>& success_callback,
354      const base::Callback<void(brillo::Error*)>& error_callback,
355      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
356
357  // Returns system logs for feedback reports.
358  virtual bool GetFeedbackLogs(
359      std::map<std::string, std::string>* out_logs,
360      brillo::ErrorPtr* error,
361      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
362
363  // Returns system logs for feedback reports.
364  virtual void GetFeedbackLogsAsync(
365      const base::Callback<void(const std::map<std::string, std::string>& /*logs*/)>& success_callback,
366      const base::Callback<void(brillo::Error*)>& error_callback,
367      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
368
369  // Returns list of User log file names that Chrome itself must collect.
370  // These logfiles are relative to the user's profile path and must be
371  // collected separately for each user.
372  virtual bool GetUserLogFiles(
373      std::map<std::string, std::string>* out_user_log_files,
374      brillo::ErrorPtr* error,
375      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
376
377  // Returns list of User log file names that Chrome itself must collect.
378  // These logfiles are relative to the user's profile path and must be
379  // collected separately for each user.
380  virtual void GetUserLogFilesAsync(
381      const base::Callback<void(const std::map<std::string, std::string>& /*user_log_files*/)>& success_callback,
382      const base::Callback<void(brillo::Error*)>& error_callback,
383      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
384
385  // Example method. See /doc/hacking.md.
386  virtual bool GetExample(
387      std::string* out_result,
388      brillo::ErrorPtr* error,
389      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
390
391  // Example method. See /doc/hacking.md.
392  virtual void GetExampleAsync(
393      const base::Callback<void(const std::string& /*result*/)>& success_callback,
394      const base::Callback<void(brillo::Error*)>& error_callback,
395      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
396
397  // Returns information about network interfaces as a JSON string.
398  virtual bool GetInterfaces(
399      std::string* out_result,
400      brillo::ErrorPtr* error,
401      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
402
403  // Returns information about network interfaces as a JSON string.
404  virtual void GetInterfacesAsync(
405      const base::Callback<void(const std::string& /*result*/)>& success_callback,
406      const base::Callback<void(brillo::Error*)>& error_callback,
407      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
408
409  // Tests ICMP connectivity to a specified host.
410  virtual bool TestICMP(
411      const std::string& in_host,
412      std::string* out_result,
413      brillo::ErrorPtr* error,
414      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
415
416  // Tests ICMP connectivity to a specified host.
417  virtual void TestICMPAsync(
418      const std::string& in_host,
419      const base::Callback<void(const std::string& /*result*/)>& success_callback,
420      const base::Callback<void(brillo::Error*)>& error_callback,
421      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
422
423  // Tests ICMP connectivity to a specified host (with options).
424  virtual bool TestICMPWithOptions(
425      const std::string& in_host,
426      const std::map<std::string, std::string>& in_options,
427      std::string* out_result,
428      brillo::ErrorPtr* error,
429      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
430
431  // Tests ICMP connectivity to a specified host (with options).
432  virtual void TestICMPWithOptionsAsync(
433      const std::string& in_host,
434      const std::map<std::string, std::string>& in_options,
435      const base::Callback<void(const std::string& /*result*/)>& success_callback,
436      const base::Callback<void(brillo::Error*)>& error_callback,
437      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
438
439  // Runs BatteryFirmware utility.
440  virtual bool BatteryFirmware(
441      const std::string& in_option,
442      std::string* out_result,
443      brillo::ErrorPtr* error,
444      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
445
446  // Runs BatteryFirmware utility.
447  virtual void BatteryFirmwareAsync(
448      const std::string& in_option,
449      const base::Callback<void(const std::string& /*result*/)>& success_callback,
450      const base::Callback<void(brillo::Error*)>& error_callback,
451      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
452
453  // Runs Smartctl utility.
454  virtual bool Smartctl(
455      const std::string& in_option,
456      std::string* out_result,
457      brillo::ErrorPtr* error,
458      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
459
460  // Runs Smartctl utility.
461  virtual void SmartctlAsync(
462      const std::string& in_option,
463      const base::Callback<void(const std::string& /*result*/)>& success_callback,
464      const base::Callback<void(brillo::Error*)>& error_callback,
465      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
466
467  // Starts running memtester.
468  virtual bool MemtesterStart(
469      const dbus::FileDescriptor& in_outfd,
470      uint32_t in_memory,
471      std::string* out_status,
472      brillo::ErrorPtr* error,
473      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
474
475  // Starts running memtester.
476  virtual void MemtesterStartAsync(
477      const dbus::FileDescriptor& in_outfd,
478      uint32_t in_memory,
479      const base::Callback<void(const std::string& /*status*/)>& success_callback,
480      const base::Callback<void(brillo::Error*)>& error_callback,
481      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
482
483  // Stops running memtester.
484  virtual bool MemtesterStop(
485      const std::string& in_handle,
486      brillo::ErrorPtr* error,
487      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
488
489  // Stops running memtester.
490  virtual void MemtesterStopAsync(
491      const std::string& in_handle,
492      const base::Callback<void()>& success_callback,
493      const base::Callback<void(brillo::Error*)>& error_callback,
494      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
495
496  // Starts running badblocks test.
497  virtual bool BadblocksStart(
498      const dbus::FileDescriptor& in_outfd,
499      std::string* out_status,
500      brillo::ErrorPtr* error,
501      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
502
503  // Starts running badblocks test.
504  virtual void BadblocksStartAsync(
505      const dbus::FileDescriptor& in_outfd,
506      const base::Callback<void(const std::string& /*status*/)>& success_callback,
507      const base::Callback<void(brillo::Error*)>& error_callback,
508      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
509
510  // Stops running badblocks.
511  virtual bool BadblocksStop(
512      const std::string& in_handle,
513      brillo::ErrorPtr* error,
514      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
515
516  // Stops running badblocks.
517  virtual void BadblocksStopAsync(
518      const std::string& in_handle,
519      const base::Callback<void()>& success_callback,
520      const base::Callback<void(brillo::Error*)>& error_callback,
521      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
522
523  // Starts a packet capture with the specified options, with diagnostic
524  // status directed to the "statfd" file descriptor and packet capture
525  // data sent to the "outfd" file descriptor.  The returned opaque string
526  // functions as a handle for this particular packet capture.  Multiple
527  // captures can be running at once.  Captures can be initiated on
528  // Ethernet-like devices or WiFi devices in "client mode" (showing only
529  // Ethernet frames) by specifying the "device" parameter (see below).
530  // By specifying a channel, the script will find or create a "monitor
531  // mode" interface if one is available and produce an "over the air"
532  // packet capture.  The name of the output packet capture file is sent
533  // to the output file descriptor.
534  virtual bool PacketCaptureStart(
535      const dbus::FileDescriptor& in_statfd,
536      const dbus::FileDescriptor& in_outfd,
537      const brillo::VariantDictionary& in_options,
538      std::string* out_handle,
539      brillo::ErrorPtr* error,
540      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
541
542  // Starts a packet capture with the specified options, with diagnostic
543  // status directed to the "statfd" file descriptor and packet capture
544  // data sent to the "outfd" file descriptor.  The returned opaque string
545  // functions as a handle for this particular packet capture.  Multiple
546  // captures can be running at once.  Captures can be initiated on
547  // Ethernet-like devices or WiFi devices in "client mode" (showing only
548  // Ethernet frames) by specifying the "device" parameter (see below).
549  // By specifying a channel, the script will find or create a "monitor
550  // mode" interface if one is available and produce an "over the air"
551  // packet capture.  The name of the output packet capture file is sent
552  // to the output file descriptor.
553  virtual void PacketCaptureStartAsync(
554      const dbus::FileDescriptor& in_statfd,
555      const dbus::FileDescriptor& in_outfd,
556      const brillo::VariantDictionary& in_options,
557      const base::Callback<void(const std::string& /*handle*/)>& success_callback,
558      const base::Callback<void(brillo::Error*)>& error_callback,
559      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
560
561  // Stops a running packet capture.
562  virtual bool PacketCaptureStop(
563      const std::string& in_handle,
564      brillo::ErrorPtr* error,
565      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
566
567  // Stops a running packet capture.
568  virtual void PacketCaptureStopAsync(
569      const std::string& in_handle,
570      const base::Callback<void()>& success_callback,
571      const base::Callback<void(brillo::Error*)>& error_callback,
572      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
573
574  // Triggers show-task-states(T) SysRq.
575  // See https://www.kernel.org/doc/Documentation/sysrq.txt.
576  virtual bool LogKernelTaskStates(
577      brillo::ErrorPtr* error,
578      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
579
580  // Triggers show-task-states(T) SysRq.
581  // See https://www.kernel.org/doc/Documentation/sysrq.txt.
582  virtual void LogKernelTaskStatesAsync(
583      const base::Callback<void()>& success_callback,
584      const base::Callback<void(brillo::Error*)>& error_callback,
585      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
586
587  // Triggers uploading of system crashes (the crash_sender program).
588  virtual bool UploadCrashes(
589      brillo::ErrorPtr* error,
590      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
591
592  // Triggers uploading of system crashes (the crash_sender program).
593  virtual void UploadCrashesAsync(
594      const base::Callback<void()>& success_callback,
595      const base::Callback<void(brillo::Error*)>& error_callback,
596      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
597
598  // Removes rootfs verification. Requires a system reboot before it will
599  // take effect. Restricted to pre-owner dev mode.
600  virtual bool RemoveRootfsVerification(
601      brillo::ErrorPtr* error,
602      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
603
604  // Removes rootfs verification. Requires a system reboot before it will
605  // take effect. Restricted to pre-owner dev mode.
606  virtual void RemoveRootfsVerificationAsync(
607      const base::Callback<void()>& success_callback,
608      const base::Callback<void(brillo::Error*)>& error_callback,
609      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
610
611  // Enables OS booting from a USB image. Restricted to pre-owner dev mode.
612  virtual bool EnableBootFromUsb(
613      brillo::ErrorPtr* error,
614      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
615
616  // Enables OS booting from a USB image. Restricted to pre-owner dev mode.
617  virtual void EnableBootFromUsbAsync(
618      const base::Callback<void()>& success_callback,
619      const base::Callback<void(brillo::Error*)>& error_callback,
620      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
621
622  // Sets up sshd to provide an SSH server immediately and on future reboots.
623  // Also installs the test SSH keys to allow access by cros tools. Requires
624  // that rootfs verification has been removed. Restricted to pre-owner dev
625  // mode.
626  virtual bool ConfigureSshServer(
627      brillo::ErrorPtr* error,
628      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
629
630  // Sets up sshd to provide an SSH server immediately and on future reboots.
631  // Also installs the test SSH keys to allow access by cros tools. Requires
632  // that rootfs verification has been removed. Restricted to pre-owner dev
633  // mode.
634  virtual void ConfigureSshServerAsync(
635      const base::Callback<void()>& success_callback,
636      const base::Callback<void(brillo::Error*)>& error_callback,
637      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
638
639  // Sets both the system and dev mode password for the indicated account.
640  // Restricted to pre-owner dev mode.
641  virtual bool SetUserPassword(
642      const std::string& in_username,
643      const std::string& in_password,
644      brillo::ErrorPtr* error,
645      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
646
647  // Sets both the system and dev mode password for the indicated account.
648  // Restricted to pre-owner dev mode.
649  virtual void SetUserPasswordAsync(
650      const std::string& in_username,
651      const std::string& in_password,
652      const base::Callback<void()>& success_callback,
653      const base::Callback<void(brillo::Error*)>& error_callback,
654      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
655
656  // Sets up Chrome for remote debugging. It will take effect after a reboot
657  // and using port 9222.
658  // Requires that rootfs verification has been removed. Restricted to
659  // pre-owner dev mode.
660  virtual bool EnableChromeRemoteDebugging(
661      brillo::ErrorPtr* error,
662      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
663
664  // Sets up Chrome for remote debugging. It will take effect after a reboot
665  // and using port 9222.
666  // Requires that rootfs verification has been removed. Restricted to
667  // pre-owner dev mode.
668  virtual void EnableChromeRemoteDebuggingAsync(
669      const base::Callback<void()>& success_callback,
670      const base::Callback<void(brillo::Error*)>& error_callback,
671      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
672
673  // Convenience function to enable a predefined set of tools from the Chrome
674  // UI. Equivalent to calling these functions in order:
675  //   1. EnableBootFromUsb()
676  //   2. ConfigureSshServer()
677  //   3. SetUserPassword("root", root_password)
678  // Requires that rootfs verification has been removed. If any sub-function
679  // fails, this function will exit with an error without attempting any
680  // further configuration or rollback. Restricted to pre-owner dev mode.
681  virtual bool EnableChromeDevFeatures(
682      const std::string& in_root_password,
683      brillo::ErrorPtr* error,
684      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
685
686  // Convenience function to enable a predefined set of tools from the Chrome
687  // UI. Equivalent to calling these functions in order:
688  //   1. EnableBootFromUsb()
689  //   2. ConfigureSshServer()
690  //   3. SetUserPassword("root", root_password)
691  // Requires that rootfs verification has been removed. If any sub-function
692  // fails, this function will exit with an error without attempting any
693  // further configuration or rollback. Restricted to pre-owner dev mode.
694  virtual void EnableChromeDevFeaturesAsync(
695      const std::string& in_root_password,
696      const base::Callback<void()>& success_callback,
697      const base::Callback<void(brillo::Error*)>& error_callback,
698      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
699
700  // Queries which dev features have been enabled. Each dev feature will be
701  // indicated by a bit flag in the return value. Flags are defined in the
702  // DevFeatureFlag enumeration. If the dev tools are unavailable (system is
703  // not in dev mode/pre-login state), the DEV_FEATURES_DISABLED flag will be
704  // set and the rest of the bits will always be set to 0.
705  virtual bool QueryDevFeatures(
706      int32_t* out_features,
707      brillo::ErrorPtr* error,
708      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
709
710  // Queries which dev features have been enabled. Each dev feature will be
711  // indicated by a bit flag in the return value. Flags are defined in the
712  // DevFeatureFlag enumeration. If the dev tools are unavailable (system is
713  // not in dev mode/pre-login state), the DEV_FEATURES_DISABLED flag will be
714  // set and the rest of the bits will always be set to 0.
715  virtual void QueryDevFeaturesAsync(
716      const base::Callback<void(int32_t /*features*/)>& success_callback,
717      const base::Callback<void(brillo::Error*)>& error_callback,
718      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
719
720  // Allow uploading of device coredump files.
721  virtual bool EnableDevCoredumpUpload(
722      brillo::ErrorPtr* error,
723      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
724
725  // Allow uploading of device coredump files.
726  virtual void EnableDevCoredumpUploadAsync(
727      const base::Callback<void()>& success_callback,
728      const base::Callback<void(brillo::Error*)>& error_callback,
729      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
730
731  // Disallow uploading of device coredump files.
732  virtual bool DisableDevCoredumpUpload(
733      brillo::ErrorPtr* error,
734      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
735
736  // Disallow uploading of device coredump files.
737  virtual void DisableDevCoredumpUploadAsync(
738      const base::Callback<void()>& success_callback,
739      const base::Callback<void(brillo::Error*)>& error_callback,
740      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
741};
742
743}  // namespace chromium
744}  // namespace org
745
746namespace org {
747namespace chromium {
748
749// Interface proxy for org::chromium::debugd.
750class debugdProxy final : public debugdProxyInterface {
751 public:
752  debugdProxy(const scoped_refptr<dbus::Bus>& bus) :
753      bus_{bus},
754      dbus_object_proxy_{
755          bus_->GetObjectProxy(service_name_, object_path_)} {
756  }
757
758  ~debugdProxy() override {
759    bus_->RemoveObjectProxy(
760        service_name_, object_path_, base::Bind(&base::DoNothing));
761  }
762
763  void ReleaseObjectProxy(const base::Closure& callback) {
764    bus_->RemoveObjectProxy(service_name_, object_path_, callback);
765  }
766
767  const dbus::ObjectPath& GetObjectPath() const {
768    return object_path_;
769  }
770
771  dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
772
773  // Starts pinging the specified hostname with the specified options, with
774  // output directed to the given output file descriptor. The returned opaque
775  // string functions as a handle for this particular ping. Multiple pings
776  // can be running at once.
777  bool PingStart(
778      const dbus::FileDescriptor& in_outfd,
779      const std::string& in_destination,
780      const brillo::VariantDictionary& in_options,
781      std::string* out_handle,
782      brillo::ErrorPtr* error,
783      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
784    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
785        timeout_ms,
786        dbus_object_proxy_,
787        "org.chromium.debugd",
788        "PingStart",
789        error,
790        in_outfd,
791        in_destination,
792        in_options);
793    return response && brillo::dbus_utils::ExtractMethodCallResults(
794        response.get(), error, out_handle);
795  }
796
797  // Starts pinging the specified hostname with the specified options, with
798  // output directed to the given output file descriptor. The returned opaque
799  // string functions as a handle for this particular ping. Multiple pings
800  // can be running at once.
801  void PingStartAsync(
802      const dbus::FileDescriptor& in_outfd,
803      const std::string& in_destination,
804      const brillo::VariantDictionary& in_options,
805      const base::Callback<void(const std::string& /*handle*/)>& success_callback,
806      const base::Callback<void(brillo::Error*)>& error_callback,
807      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
808    brillo::dbus_utils::CallMethodWithTimeout(
809        timeout_ms,
810        dbus_object_proxy_,
811        "org.chromium.debugd",
812        "PingStart",
813        success_callback,
814        error_callback,
815        in_outfd,
816        in_destination,
817        in_options);
818  }
819
820  // Stops a running ping.
821  bool PingStop(
822      const std::string& in_handle,
823      brillo::ErrorPtr* error,
824      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
825    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
826        timeout_ms,
827        dbus_object_proxy_,
828        "org.chromium.debugd",
829        "PingStop",
830        error,
831        in_handle);
832    return response && brillo::dbus_utils::ExtractMethodCallResults(
833        response.get(), error);
834  }
835
836  // Stops a running ping.
837  void PingStopAsync(
838      const std::string& in_handle,
839      const base::Callback<void()>& success_callback,
840      const base::Callback<void(brillo::Error*)>& error_callback,
841      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
842    brillo::dbus_utils::CallMethodWithTimeout(
843        timeout_ms,
844        dbus_object_proxy_,
845        "org.chromium.debugd",
846        "PingStop",
847        success_callback,
848        error_callback,
849        in_handle);
850  }
851
852  // Start system/kernel tracing.  If tracing is already enabled it is
853  // stopped first and any collected events are discarded.  The kernel
854  // must have been configured to support tracing.
855  bool SystraceStart(
856      const std::string& in_categories,
857      brillo::ErrorPtr* error,
858      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
859    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
860        timeout_ms,
861        dbus_object_proxy_,
862        "org.chromium.debugd",
863        "SystraceStart",
864        error,
865        in_categories);
866    return response && brillo::dbus_utils::ExtractMethodCallResults(
867        response.get(), error);
868  }
869
870  // Start system/kernel tracing.  If tracing is already enabled it is
871  // stopped first and any collected events are discarded.  The kernel
872  // must have been configured to support tracing.
873  void SystraceStartAsync(
874      const std::string& in_categories,
875      const base::Callback<void()>& success_callback,
876      const base::Callback<void(brillo::Error*)>& error_callback,
877      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
878    brillo::dbus_utils::CallMethodWithTimeout(
879        timeout_ms,
880        dbus_object_proxy_,
881        "org.chromium.debugd",
882        "SystraceStart",
883        success_callback,
884        error_callback,
885        in_categories);
886  }
887
888  // Stop system/kernel tracing and write the collected event data.
889  bool SystraceStop(
890      const dbus::FileDescriptor& in_outfd,
891      brillo::ErrorPtr* error,
892      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
893    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
894        timeout_ms,
895        dbus_object_proxy_,
896        "org.chromium.debugd",
897        "SystraceStop",
898        error,
899        in_outfd);
900    return response && brillo::dbus_utils::ExtractMethodCallResults(
901        response.get(), error);
902  }
903
904  // Stop system/kernel tracing and write the collected event data.
905  void SystraceStopAsync(
906      const dbus::FileDescriptor& in_outfd,
907      const base::Callback<void()>& success_callback,
908      const base::Callback<void(brillo::Error*)>& error_callback,
909      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
910    brillo::dbus_utils::CallMethodWithTimeout(
911        timeout_ms,
912        dbus_object_proxy_,
913        "org.chromium.debugd",
914        "SystraceStop",
915        success_callback,
916        error_callback,
917        in_outfd);
918  }
919
920  // Return current status for system/kernel tracing including whether it
921  // is enabled, the tracing clock, and the set of events enabled.
922  bool SystraceStatus(
923      std::string* out_status,
924      brillo::ErrorPtr* error,
925      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
926    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
927        timeout_ms,
928        dbus_object_proxy_,
929        "org.chromium.debugd",
930        "SystraceStatus",
931        error);
932    return response && brillo::dbus_utils::ExtractMethodCallResults(
933        response.get(), error, out_status);
934  }
935
936  // Return current status for system/kernel tracing including whether it
937  // is enabled, the tracing clock, and the set of events enabled.
938  void SystraceStatusAsync(
939      const base::Callback<void(const std::string& /*status*/)>& success_callback,
940      const base::Callback<void(brillo::Error*)>& error_callback,
941      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
942    brillo::dbus_utils::CallMethodWithTimeout(
943        timeout_ms,
944        dbus_object_proxy_,
945        "org.chromium.debugd",
946        "SystraceStatus",
947        success_callback,
948        error_callback);
949  }
950
951  bool TracePathStart(
952      const dbus::FileDescriptor& in_outfd,
953      const std::string& in_destination,
954      const brillo::VariantDictionary& in_options,
955      std::string* out_handle,
956      brillo::ErrorPtr* error,
957      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
958    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
959        timeout_ms,
960        dbus_object_proxy_,
961        "org.chromium.debugd",
962        "TracePathStart",
963        error,
964        in_outfd,
965        in_destination,
966        in_options);
967    return response && brillo::dbus_utils::ExtractMethodCallResults(
968        response.get(), error, out_handle);
969  }
970
971  void TracePathStartAsync(
972      const dbus::FileDescriptor& in_outfd,
973      const std::string& in_destination,
974      const brillo::VariantDictionary& in_options,
975      const base::Callback<void(const std::string& /*handle*/)>& success_callback,
976      const base::Callback<void(brillo::Error*)>& error_callback,
977      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
978    brillo::dbus_utils::CallMethodWithTimeout(
979        timeout_ms,
980        dbus_object_proxy_,
981        "org.chromium.debugd",
982        "TracePathStart",
983        success_callback,
984        error_callback,
985        in_outfd,
986        in_destination,
987        in_options);
988  }
989
990  // Stops a running tracepath.
991  bool TracePathStop(
992      const std::string& in_handle,
993      brillo::ErrorPtr* error,
994      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
995    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
996        timeout_ms,
997        dbus_object_proxy_,
998        "org.chromium.debugd",
999        "TracePathStop",
1000        error,
1001        in_handle);
1002    return response && brillo::dbus_utils::ExtractMethodCallResults(
1003        response.get(), error);
1004  }
1005
1006  // Stops a running tracepath.
1007  void TracePathStopAsync(
1008      const std::string& in_handle,
1009      const base::Callback<void()>& success_callback,
1010      const base::Callback<void(brillo::Error*)>& error_callback,
1011      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1012    brillo::dbus_utils::CallMethodWithTimeout(
1013        timeout_ms,
1014        dbus_object_proxy_,
1015        "org.chromium.debugd",
1016        "TracePathStop",
1017        success_callback,
1018        error_callback,
1019        in_handle);
1020  }
1021
1022  // Returns the routing table.
1023  bool GetRoutes(
1024      const brillo::VariantDictionary& in_options,
1025      std::vector<std::string>* out_result,
1026      brillo::ErrorPtr* error,
1027      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1028    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1029        timeout_ms,
1030        dbus_object_proxy_,
1031        "org.chromium.debugd",
1032        "GetRoutes",
1033        error,
1034        in_options);
1035    return response && brillo::dbus_utils::ExtractMethodCallResults(
1036        response.get(), error, out_result);
1037  }
1038
1039  // Returns the routing table.
1040  void GetRoutesAsync(
1041      const brillo::VariantDictionary& in_options,
1042      const base::Callback<void(const std::vector<std::string>& /*result*/)>& success_callback,
1043      const base::Callback<void(brillo::Error*)>& error_callback,
1044      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1045    brillo::dbus_utils::CallMethodWithTimeout(
1046        timeout_ms,
1047        dbus_object_proxy_,
1048        "org.chromium.debugd",
1049        "GetRoutes",
1050        success_callback,
1051        error_callback,
1052        in_options);
1053  }
1054
1055  // Returns modem information as a JSON string. See the design document for
1056  // a rationale.
1057  bool GetModemStatus(
1058      std::string* out_status,
1059      brillo::ErrorPtr* error,
1060      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1061    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1062        timeout_ms,
1063        dbus_object_proxy_,
1064        "org.chromium.debugd",
1065        "GetModemStatus",
1066        error);
1067    return response && brillo::dbus_utils::ExtractMethodCallResults(
1068        response.get(), error, out_status);
1069  }
1070
1071  // Returns modem information as a JSON string. See the design document for
1072  // a rationale.
1073  void GetModemStatusAsync(
1074      const base::Callback<void(const std::string& /*status*/)>& success_callback,
1075      const base::Callback<void(brillo::Error*)>& error_callback,
1076      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1077    brillo::dbus_utils::CallMethodWithTimeout(
1078        timeout_ms,
1079        dbus_object_proxy_,
1080        "org.chromium.debugd",
1081        "GetModemStatus",
1082        success_callback,
1083        error_callback);
1084  }
1085
1086  // Runs the specified command through the modem serial interface and
1087  // returns the output.
1088  bool RunModemCommand(
1089      const std::string& in_command,
1090      std::string* out_status,
1091      brillo::ErrorPtr* error,
1092      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1093    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1094        timeout_ms,
1095        dbus_object_proxy_,
1096        "org.chromium.debugd",
1097        "RunModemCommand",
1098        error,
1099        in_command);
1100    return response && brillo::dbus_utils::ExtractMethodCallResults(
1101        response.get(), error, out_status);
1102  }
1103
1104  // Runs the specified command through the modem serial interface and
1105  // returns the output.
1106  void RunModemCommandAsync(
1107      const std::string& in_command,
1108      const base::Callback<void(const std::string& /*status*/)>& success_callback,
1109      const base::Callback<void(brillo::Error*)>& error_callback,
1110      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1111    brillo::dbus_utils::CallMethodWithTimeout(
1112        timeout_ms,
1113        dbus_object_proxy_,
1114        "org.chromium.debugd",
1115        "RunModemCommand",
1116        success_callback,
1117        error_callback,
1118        in_command);
1119  }
1120
1121  // Returns network information as a JSON string. See the design document
1122  // for a rationale.
1123  bool GetNetworkStatus(
1124      std::string* out_status,
1125      brillo::ErrorPtr* error,
1126      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1127    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1128        timeout_ms,
1129        dbus_object_proxy_,
1130        "org.chromium.debugd",
1131        "GetNetworkStatus",
1132        error);
1133    return response && brillo::dbus_utils::ExtractMethodCallResults(
1134        response.get(), error, out_status);
1135  }
1136
1137  // Returns network information as a JSON string. See the design document
1138  // for a rationale.
1139  void GetNetworkStatusAsync(
1140      const base::Callback<void(const std::string& /*status*/)>& success_callback,
1141      const base::Callback<void(brillo::Error*)>& error_callback,
1142      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1143    brillo::dbus_utils::CallMethodWithTimeout(
1144        timeout_ms,
1145        dbus_object_proxy_,
1146        "org.chromium.debugd",
1147        "GetNetworkStatus",
1148        success_callback,
1149        error_callback);
1150  }
1151
1152  // Returns WiMAX information as a JSON string. See the design document for
1153  // a rationale.
1154  bool GetWiMaxStatus(
1155      std::string* out_status,
1156      brillo::ErrorPtr* error,
1157      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1158    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1159        timeout_ms,
1160        dbus_object_proxy_,
1161        "org.chromium.debugd",
1162        "GetWiMaxStatus",
1163        error);
1164    return response && brillo::dbus_utils::ExtractMethodCallResults(
1165        response.get(), error, out_status);
1166  }
1167
1168  // Returns WiMAX information as a JSON string. See the design document for
1169  // a rationale.
1170  void GetWiMaxStatusAsync(
1171      const base::Callback<void(const std::string& /*status*/)>& success_callback,
1172      const base::Callback<void(brillo::Error*)>& error_callback,
1173      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1174    brillo::dbus_utils::CallMethodWithTimeout(
1175        timeout_ms,
1176        dbus_object_proxy_,
1177        "org.chromium.debugd",
1178        "GetWiMaxStatus",
1179        success_callback,
1180        error_callback);
1181  }
1182
1183  // Runs system-wide perf profiling. The profile parameters are selected by
1184  // perf_args.
1185  bool GetPerfOutput(
1186      uint32_t in_duration_sec,
1187      const std::vector<std::string>& in_perf_args,
1188      int32_t* out_status,
1189      std::vector<uint8_t>* out_perf_data,
1190      std::vector<uint8_t>* out_perf_stat,
1191      brillo::ErrorPtr* error,
1192      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1193    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1194        timeout_ms,
1195        dbus_object_proxy_,
1196        "org.chromium.debugd",
1197        "GetPerfOutput",
1198        error,
1199        in_duration_sec,
1200        in_perf_args);
1201    return response && brillo::dbus_utils::ExtractMethodCallResults(
1202        response.get(), error, out_status, out_perf_data, out_perf_stat);
1203  }
1204
1205  // Runs system-wide perf profiling. The profile parameters are selected by
1206  // perf_args.
1207  void GetPerfOutputAsync(
1208      uint32_t in_duration_sec,
1209      const std::vector<std::string>& in_perf_args,
1210      const base::Callback<void(int32_t /*status*/, const std::vector<uint8_t>& /*perf_data*/, const std::vector<uint8_t>& /*perf_stat*/)>& success_callback,
1211      const base::Callback<void(brillo::Error*)>& error_callback,
1212      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1213    brillo::dbus_utils::CallMethodWithTimeout(
1214        timeout_ms,
1215        dbus_object_proxy_,
1216        "org.chromium.debugd",
1217        "GetPerfOutput",
1218        success_callback,
1219        error_callback,
1220        in_duration_sec,
1221        in_perf_args);
1222  }
1223
1224  // Runs system-wide perf profiling. It can can profile events other than
1225  // cycles (example: iTLB-misses), and can collect branch profiles. It can
1226  // also return raw counter values. The exact profile or counters to be
1227  // collected is chosen at random and depends on what CPU is used by the
1228  // system (certain CPUs do not support certain profiling modes).
1229  bool GetRandomPerfOutput(
1230      uint32_t in_duration_sec,
1231      int32_t* out_status,
1232      std::vector<uint8_t>* out_perf_data,
1233      std::vector<uint8_t>* out_perf_stat,
1234      brillo::ErrorPtr* error,
1235      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1236    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1237        timeout_ms,
1238        dbus_object_proxy_,
1239        "org.chromium.debugd",
1240        "GetRandomPerfOutput",
1241        error,
1242        in_duration_sec);
1243    return response && brillo::dbus_utils::ExtractMethodCallResults(
1244        response.get(), error, out_status, out_perf_data, out_perf_stat);
1245  }
1246
1247  // Runs system-wide perf profiling. It can can profile events other than
1248  // cycles (example: iTLB-misses), and can collect branch profiles. It can
1249  // also return raw counter values. The exact profile or counters to be
1250  // collected is chosen at random and depends on what CPU is used by the
1251  // system (certain CPUs do not support certain profiling modes).
1252  void GetRandomPerfOutputAsync(
1253      uint32_t in_duration_sec,
1254      const base::Callback<void(int32_t /*status*/, const std::vector<uint8_t>& /*perf_data*/, const std::vector<uint8_t>& /*perf_stat*/)>& success_callback,
1255      const base::Callback<void(brillo::Error*)>& error_callback,
1256      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1257    brillo::dbus_utils::CallMethodWithTimeout(
1258        timeout_ms,
1259        dbus_object_proxy_,
1260        "org.chromium.debugd",
1261        "GetRandomPerfOutput",
1262        success_callback,
1263        error_callback,
1264        in_duration_sec);
1265  }
1266
1267  // Returns perf event data. Does systemwide profiling. It can profile
1268  // events other than cycles (example: iTLB-misses), and can collect branch
1269  // profiles. The exact profile to be collected is chosen at random
1270  // and depends on what CPU is used by the system (certain CPUs do not
1271  // support certain profiling modes).
1272  bool GetRichPerfData(
1273      uint32_t in_duration_sec,
1274      std::vector<uint8_t>* out_status,
1275      brillo::ErrorPtr* error,
1276      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1277    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1278        timeout_ms,
1279        dbus_object_proxy_,
1280        "org.chromium.debugd",
1281        "GetRichPerfData",
1282        error,
1283        in_duration_sec);
1284    return response && brillo::dbus_utils::ExtractMethodCallResults(
1285        response.get(), error, out_status);
1286  }
1287
1288  // Returns perf event data. Does systemwide profiling. It can profile
1289  // events other than cycles (example: iTLB-misses), and can collect branch
1290  // profiles. The exact profile to be collected is chosen at random
1291  // and depends on what CPU is used by the system (certain CPUs do not
1292  // support certain profiling modes).
1293  void GetRichPerfDataAsync(
1294      uint32_t in_duration_sec,
1295      const base::Callback<void(const std::vector<uint8_t>& /*status*/)>& success_callback,
1296      const base::Callback<void(brillo::Error*)>& error_callback,
1297      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1298    brillo::dbus_utils::CallMethodWithTimeout(
1299        timeout_ms,
1300        dbus_object_proxy_,
1301        "org.chromium.debugd",
1302        "GetRichPerfData",
1303        success_callback,
1304        error_callback,
1305        in_duration_sec);
1306  }
1307
1308  // DEPRECATED: Use DumpDebugLogs instead.
1309  // Packages up system logs into a .tar.gz and returns it over the supplied
1310  // file descriptor.
1311  bool GetDebugLogs(
1312      const dbus::FileDescriptor& in_outfd,
1313      brillo::ErrorPtr* error,
1314      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1315    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1316        timeout_ms,
1317        dbus_object_proxy_,
1318        "org.chromium.debugd",
1319        "GetDebugLogs",
1320        error,
1321        in_outfd);
1322    return response && brillo::dbus_utils::ExtractMethodCallResults(
1323        response.get(), error);
1324  }
1325
1326  // DEPRECATED: Use DumpDebugLogs instead.
1327  // Packages up system logs into a .tar.gz and returns it over the supplied
1328  // file descriptor.
1329  void GetDebugLogsAsync(
1330      const dbus::FileDescriptor& in_outfd,
1331      const base::Callback<void()>& success_callback,
1332      const base::Callback<void(brillo::Error*)>& error_callback,
1333      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1334    brillo::dbus_utils::CallMethodWithTimeout(
1335        timeout_ms,
1336        dbus_object_proxy_,
1337        "org.chromium.debugd",
1338        "GetDebugLogs",
1339        success_callback,
1340        error_callback,
1341        in_outfd);
1342  }
1343
1344  // Packages up system logs into a .tar(.gz) and returns it over the
1345  // supplied file descriptor.
1346  bool DumpDebugLogs(
1347      bool in_is_compressed,
1348      const dbus::FileDescriptor& in_outfd,
1349      brillo::ErrorPtr* error,
1350      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1351    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1352        timeout_ms,
1353        dbus_object_proxy_,
1354        "org.chromium.debugd",
1355        "DumpDebugLogs",
1356        error,
1357        in_is_compressed,
1358        in_outfd);
1359    return response && brillo::dbus_utils::ExtractMethodCallResults(
1360        response.get(), error);
1361  }
1362
1363  // Packages up system logs into a .tar(.gz) and returns it over the
1364  // supplied file descriptor.
1365  void DumpDebugLogsAsync(
1366      bool in_is_compressed,
1367      const dbus::FileDescriptor& in_outfd,
1368      const base::Callback<void()>& success_callback,
1369      const base::Callback<void(brillo::Error*)>& error_callback,
1370      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1371    brillo::dbus_utils::CallMethodWithTimeout(
1372        timeout_ms,
1373        dbus_object_proxy_,
1374        "org.chromium.debugd",
1375        "DumpDebugLogs",
1376        success_callback,
1377        error_callback,
1378        in_is_compressed,
1379        in_outfd);
1380  }
1381
1382  // Enables or disables debug mode for a specified subsystem.
1383  bool SetDebugMode(
1384      const std::string& in_subsystem,
1385      brillo::ErrorPtr* error,
1386      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1387    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1388        timeout_ms,
1389        dbus_object_proxy_,
1390        "org.chromium.debugd",
1391        "SetDebugMode",
1392        error,
1393        in_subsystem);
1394    return response && brillo::dbus_utils::ExtractMethodCallResults(
1395        response.get(), error);
1396  }
1397
1398  // Enables or disables debug mode for a specified subsystem.
1399  void SetDebugModeAsync(
1400      const std::string& in_subsystem,
1401      const base::Callback<void()>& success_callback,
1402      const base::Callback<void(brillo::Error*)>& error_callback,
1403      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1404    brillo::dbus_utils::CallMethodWithTimeout(
1405        timeout_ms,
1406        dbus_object_proxy_,
1407        "org.chromium.debugd",
1408        "SetDebugMode",
1409        success_callback,
1410        error_callback,
1411        in_subsystem);
1412  }
1413
1414  // Fetches the contents of a single system log, identified by name. See
1415  // /src/log_tool.cc for a list of valid names.
1416  bool GetLog(
1417      const std::string& in_log,
1418      std::string* out_contents,
1419      brillo::ErrorPtr* error,
1420      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1421    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1422        timeout_ms,
1423        dbus_object_proxy_,
1424        "org.chromium.debugd",
1425        "GetLog",
1426        error,
1427        in_log);
1428    return response && brillo::dbus_utils::ExtractMethodCallResults(
1429        response.get(), error, out_contents);
1430  }
1431
1432  // Fetches the contents of a single system log, identified by name. See
1433  // /src/log_tool.cc for a list of valid names.
1434  void GetLogAsync(
1435      const std::string& in_log,
1436      const base::Callback<void(const std::string& /*contents*/)>& success_callback,
1437      const base::Callback<void(brillo::Error*)>& error_callback,
1438      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1439    brillo::dbus_utils::CallMethodWithTimeout(
1440        timeout_ms,
1441        dbus_object_proxy_,
1442        "org.chromium.debugd",
1443        "GetLog",
1444        success_callback,
1445        error_callback,
1446        in_log);
1447  }
1448
1449  // Returns all the system logs.
1450  bool GetAllLogs(
1451      std::map<std::string, std::string>* out_logs,
1452      brillo::ErrorPtr* error,
1453      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1454    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1455        timeout_ms,
1456        dbus_object_proxy_,
1457        "org.chromium.debugd",
1458        "GetAllLogs",
1459        error);
1460    return response && brillo::dbus_utils::ExtractMethodCallResults(
1461        response.get(), error, out_logs);
1462  }
1463
1464  // Returns all the system logs.
1465  void GetAllLogsAsync(
1466      const base::Callback<void(const std::map<std::string, std::string>& /*logs*/)>& success_callback,
1467      const base::Callback<void(brillo::Error*)>& error_callback,
1468      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1469    brillo::dbus_utils::CallMethodWithTimeout(
1470        timeout_ms,
1471        dbus_object_proxy_,
1472        "org.chromium.debugd",
1473        "GetAllLogs",
1474        success_callback,
1475        error_callback);
1476  }
1477
1478  // Returns system logs for feedback reports.
1479  bool GetFeedbackLogs(
1480      std::map<std::string, std::string>* out_logs,
1481      brillo::ErrorPtr* error,
1482      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1483    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1484        timeout_ms,
1485        dbus_object_proxy_,
1486        "org.chromium.debugd",
1487        "GetFeedbackLogs",
1488        error);
1489    return response && brillo::dbus_utils::ExtractMethodCallResults(
1490        response.get(), error, out_logs);
1491  }
1492
1493  // Returns system logs for feedback reports.
1494  void GetFeedbackLogsAsync(
1495      const base::Callback<void(const std::map<std::string, std::string>& /*logs*/)>& success_callback,
1496      const base::Callback<void(brillo::Error*)>& error_callback,
1497      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1498    brillo::dbus_utils::CallMethodWithTimeout(
1499        timeout_ms,
1500        dbus_object_proxy_,
1501        "org.chromium.debugd",
1502        "GetFeedbackLogs",
1503        success_callback,
1504        error_callback);
1505  }
1506
1507  // Returns list of User log file names that Chrome itself must collect.
1508  // These logfiles are relative to the user's profile path and must be
1509  // collected separately for each user.
1510  bool GetUserLogFiles(
1511      std::map<std::string, std::string>* out_user_log_files,
1512      brillo::ErrorPtr* error,
1513      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1514    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1515        timeout_ms,
1516        dbus_object_proxy_,
1517        "org.chromium.debugd",
1518        "GetUserLogFiles",
1519        error);
1520    return response && brillo::dbus_utils::ExtractMethodCallResults(
1521        response.get(), error, out_user_log_files);
1522  }
1523
1524  // Returns list of User log file names that Chrome itself must collect.
1525  // These logfiles are relative to the user's profile path and must be
1526  // collected separately for each user.
1527  void GetUserLogFilesAsync(
1528      const base::Callback<void(const std::map<std::string, std::string>& /*user_log_files*/)>& success_callback,
1529      const base::Callback<void(brillo::Error*)>& error_callback,
1530      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1531    brillo::dbus_utils::CallMethodWithTimeout(
1532        timeout_ms,
1533        dbus_object_proxy_,
1534        "org.chromium.debugd",
1535        "GetUserLogFiles",
1536        success_callback,
1537        error_callback);
1538  }
1539
1540  // Example method. See /doc/hacking.md.
1541  bool GetExample(
1542      std::string* out_result,
1543      brillo::ErrorPtr* error,
1544      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1545    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1546        timeout_ms,
1547        dbus_object_proxy_,
1548        "org.chromium.debugd",
1549        "GetExample",
1550        error);
1551    return response && brillo::dbus_utils::ExtractMethodCallResults(
1552        response.get(), error, out_result);
1553  }
1554
1555  // Example method. See /doc/hacking.md.
1556  void GetExampleAsync(
1557      const base::Callback<void(const std::string& /*result*/)>& success_callback,
1558      const base::Callback<void(brillo::Error*)>& error_callback,
1559      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1560    brillo::dbus_utils::CallMethodWithTimeout(
1561        timeout_ms,
1562        dbus_object_proxy_,
1563        "org.chromium.debugd",
1564        "GetExample",
1565        success_callback,
1566        error_callback);
1567  }
1568
1569  // Returns information about network interfaces as a JSON string.
1570  bool GetInterfaces(
1571      std::string* out_result,
1572      brillo::ErrorPtr* error,
1573      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1574    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1575        timeout_ms,
1576        dbus_object_proxy_,
1577        "org.chromium.debugd",
1578        "GetInterfaces",
1579        error);
1580    return response && brillo::dbus_utils::ExtractMethodCallResults(
1581        response.get(), error, out_result);
1582  }
1583
1584  // Returns information about network interfaces as a JSON string.
1585  void GetInterfacesAsync(
1586      const base::Callback<void(const std::string& /*result*/)>& success_callback,
1587      const base::Callback<void(brillo::Error*)>& error_callback,
1588      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1589    brillo::dbus_utils::CallMethodWithTimeout(
1590        timeout_ms,
1591        dbus_object_proxy_,
1592        "org.chromium.debugd",
1593        "GetInterfaces",
1594        success_callback,
1595        error_callback);
1596  }
1597
1598  // Tests ICMP connectivity to a specified host.
1599  bool TestICMP(
1600      const std::string& in_host,
1601      std::string* out_result,
1602      brillo::ErrorPtr* error,
1603      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1604    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1605        timeout_ms,
1606        dbus_object_proxy_,
1607        "org.chromium.debugd",
1608        "TestICMP",
1609        error,
1610        in_host);
1611    return response && brillo::dbus_utils::ExtractMethodCallResults(
1612        response.get(), error, out_result);
1613  }
1614
1615  // Tests ICMP connectivity to a specified host.
1616  void TestICMPAsync(
1617      const std::string& in_host,
1618      const base::Callback<void(const std::string& /*result*/)>& success_callback,
1619      const base::Callback<void(brillo::Error*)>& error_callback,
1620      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1621    brillo::dbus_utils::CallMethodWithTimeout(
1622        timeout_ms,
1623        dbus_object_proxy_,
1624        "org.chromium.debugd",
1625        "TestICMP",
1626        success_callback,
1627        error_callback,
1628        in_host);
1629  }
1630
1631  // Tests ICMP connectivity to a specified host (with options).
1632  bool TestICMPWithOptions(
1633      const std::string& in_host,
1634      const std::map<std::string, std::string>& in_options,
1635      std::string* out_result,
1636      brillo::ErrorPtr* error,
1637      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1638    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1639        timeout_ms,
1640        dbus_object_proxy_,
1641        "org.chromium.debugd",
1642        "TestICMPWithOptions",
1643        error,
1644        in_host,
1645        in_options);
1646    return response && brillo::dbus_utils::ExtractMethodCallResults(
1647        response.get(), error, out_result);
1648  }
1649
1650  // Tests ICMP connectivity to a specified host (with options).
1651  void TestICMPWithOptionsAsync(
1652      const std::string& in_host,
1653      const std::map<std::string, std::string>& in_options,
1654      const base::Callback<void(const std::string& /*result*/)>& success_callback,
1655      const base::Callback<void(brillo::Error*)>& error_callback,
1656      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1657    brillo::dbus_utils::CallMethodWithTimeout(
1658        timeout_ms,
1659        dbus_object_proxy_,
1660        "org.chromium.debugd",
1661        "TestICMPWithOptions",
1662        success_callback,
1663        error_callback,
1664        in_host,
1665        in_options);
1666  }
1667
1668  // Runs BatteryFirmware utility.
1669  bool BatteryFirmware(
1670      const std::string& in_option,
1671      std::string* out_result,
1672      brillo::ErrorPtr* error,
1673      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1674    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1675        timeout_ms,
1676        dbus_object_proxy_,
1677        "org.chromium.debugd",
1678        "BatteryFirmware",
1679        error,
1680        in_option);
1681    return response && brillo::dbus_utils::ExtractMethodCallResults(
1682        response.get(), error, out_result);
1683  }
1684
1685  // Runs BatteryFirmware utility.
1686  void BatteryFirmwareAsync(
1687      const std::string& in_option,
1688      const base::Callback<void(const std::string& /*result*/)>& success_callback,
1689      const base::Callback<void(brillo::Error*)>& error_callback,
1690      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1691    brillo::dbus_utils::CallMethodWithTimeout(
1692        timeout_ms,
1693        dbus_object_proxy_,
1694        "org.chromium.debugd",
1695        "BatteryFirmware",
1696        success_callback,
1697        error_callback,
1698        in_option);
1699  }
1700
1701  // Runs Smartctl utility.
1702  bool Smartctl(
1703      const std::string& in_option,
1704      std::string* out_result,
1705      brillo::ErrorPtr* error,
1706      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1707    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1708        timeout_ms,
1709        dbus_object_proxy_,
1710        "org.chromium.debugd",
1711        "Smartctl",
1712        error,
1713        in_option);
1714    return response && brillo::dbus_utils::ExtractMethodCallResults(
1715        response.get(), error, out_result);
1716  }
1717
1718  // Runs Smartctl utility.
1719  void SmartctlAsync(
1720      const std::string& in_option,
1721      const base::Callback<void(const std::string& /*result*/)>& success_callback,
1722      const base::Callback<void(brillo::Error*)>& error_callback,
1723      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1724    brillo::dbus_utils::CallMethodWithTimeout(
1725        timeout_ms,
1726        dbus_object_proxy_,
1727        "org.chromium.debugd",
1728        "Smartctl",
1729        success_callback,
1730        error_callback,
1731        in_option);
1732  }
1733
1734  // Starts running memtester.
1735  bool MemtesterStart(
1736      const dbus::FileDescriptor& in_outfd,
1737      uint32_t in_memory,
1738      std::string* out_status,
1739      brillo::ErrorPtr* error,
1740      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1741    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1742        timeout_ms,
1743        dbus_object_proxy_,
1744        "org.chromium.debugd",
1745        "MemtesterStart",
1746        error,
1747        in_outfd,
1748        in_memory);
1749    return response && brillo::dbus_utils::ExtractMethodCallResults(
1750        response.get(), error, out_status);
1751  }
1752
1753  // Starts running memtester.
1754  void MemtesterStartAsync(
1755      const dbus::FileDescriptor& in_outfd,
1756      uint32_t in_memory,
1757      const base::Callback<void(const std::string& /*status*/)>& success_callback,
1758      const base::Callback<void(brillo::Error*)>& error_callback,
1759      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1760    brillo::dbus_utils::CallMethodWithTimeout(
1761        timeout_ms,
1762        dbus_object_proxy_,
1763        "org.chromium.debugd",
1764        "MemtesterStart",
1765        success_callback,
1766        error_callback,
1767        in_outfd,
1768        in_memory);
1769  }
1770
1771  // Stops running memtester.
1772  bool MemtesterStop(
1773      const std::string& in_handle,
1774      brillo::ErrorPtr* error,
1775      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1776    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1777        timeout_ms,
1778        dbus_object_proxy_,
1779        "org.chromium.debugd",
1780        "MemtesterStop",
1781        error,
1782        in_handle);
1783    return response && brillo::dbus_utils::ExtractMethodCallResults(
1784        response.get(), error);
1785  }
1786
1787  // Stops running memtester.
1788  void MemtesterStopAsync(
1789      const std::string& in_handle,
1790      const base::Callback<void()>& success_callback,
1791      const base::Callback<void(brillo::Error*)>& error_callback,
1792      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1793    brillo::dbus_utils::CallMethodWithTimeout(
1794        timeout_ms,
1795        dbus_object_proxy_,
1796        "org.chromium.debugd",
1797        "MemtesterStop",
1798        success_callback,
1799        error_callback,
1800        in_handle);
1801  }
1802
1803  // Starts running badblocks test.
1804  bool BadblocksStart(
1805      const dbus::FileDescriptor& in_outfd,
1806      std::string* out_status,
1807      brillo::ErrorPtr* error,
1808      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1809    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1810        timeout_ms,
1811        dbus_object_proxy_,
1812        "org.chromium.debugd",
1813        "BadblocksStart",
1814        error,
1815        in_outfd);
1816    return response && brillo::dbus_utils::ExtractMethodCallResults(
1817        response.get(), error, out_status);
1818  }
1819
1820  // Starts running badblocks test.
1821  void BadblocksStartAsync(
1822      const dbus::FileDescriptor& in_outfd,
1823      const base::Callback<void(const std::string& /*status*/)>& success_callback,
1824      const base::Callback<void(brillo::Error*)>& error_callback,
1825      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1826    brillo::dbus_utils::CallMethodWithTimeout(
1827        timeout_ms,
1828        dbus_object_proxy_,
1829        "org.chromium.debugd",
1830        "BadblocksStart",
1831        success_callback,
1832        error_callback,
1833        in_outfd);
1834  }
1835
1836  // Stops running badblocks.
1837  bool BadblocksStop(
1838      const std::string& in_handle,
1839      brillo::ErrorPtr* error,
1840      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1841    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1842        timeout_ms,
1843        dbus_object_proxy_,
1844        "org.chromium.debugd",
1845        "BadblocksStop",
1846        error,
1847        in_handle);
1848    return response && brillo::dbus_utils::ExtractMethodCallResults(
1849        response.get(), error);
1850  }
1851
1852  // Stops running badblocks.
1853  void BadblocksStopAsync(
1854      const std::string& in_handle,
1855      const base::Callback<void()>& success_callback,
1856      const base::Callback<void(brillo::Error*)>& error_callback,
1857      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1858    brillo::dbus_utils::CallMethodWithTimeout(
1859        timeout_ms,
1860        dbus_object_proxy_,
1861        "org.chromium.debugd",
1862        "BadblocksStop",
1863        success_callback,
1864        error_callback,
1865        in_handle);
1866  }
1867
1868  // Starts a packet capture with the specified options, with diagnostic
1869  // status directed to the "statfd" file descriptor and packet capture
1870  // data sent to the "outfd" file descriptor.  The returned opaque string
1871  // functions as a handle for this particular packet capture.  Multiple
1872  // captures can be running at once.  Captures can be initiated on
1873  // Ethernet-like devices or WiFi devices in "client mode" (showing only
1874  // Ethernet frames) by specifying the "device" parameter (see below).
1875  // By specifying a channel, the script will find or create a "monitor
1876  // mode" interface if one is available and produce an "over the air"
1877  // packet capture.  The name of the output packet capture file is sent
1878  // to the output file descriptor.
1879  bool PacketCaptureStart(
1880      const dbus::FileDescriptor& in_statfd,
1881      const dbus::FileDescriptor& in_outfd,
1882      const brillo::VariantDictionary& in_options,
1883      std::string* out_handle,
1884      brillo::ErrorPtr* error,
1885      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1886    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1887        timeout_ms,
1888        dbus_object_proxy_,
1889        "org.chromium.debugd",
1890        "PacketCaptureStart",
1891        error,
1892        in_statfd,
1893        in_outfd,
1894        in_options);
1895    return response && brillo::dbus_utils::ExtractMethodCallResults(
1896        response.get(), error, out_handle);
1897  }
1898
1899  // Starts a packet capture with the specified options, with diagnostic
1900  // status directed to the "statfd" file descriptor and packet capture
1901  // data sent to the "outfd" file descriptor.  The returned opaque string
1902  // functions as a handle for this particular packet capture.  Multiple
1903  // captures can be running at once.  Captures can be initiated on
1904  // Ethernet-like devices or WiFi devices in "client mode" (showing only
1905  // Ethernet frames) by specifying the "device" parameter (see below).
1906  // By specifying a channel, the script will find or create a "monitor
1907  // mode" interface if one is available and produce an "over the air"
1908  // packet capture.  The name of the output packet capture file is sent
1909  // to the output file descriptor.
1910  void PacketCaptureStartAsync(
1911      const dbus::FileDescriptor& in_statfd,
1912      const dbus::FileDescriptor& in_outfd,
1913      const brillo::VariantDictionary& in_options,
1914      const base::Callback<void(const std::string& /*handle*/)>& success_callback,
1915      const base::Callback<void(brillo::Error*)>& error_callback,
1916      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1917    brillo::dbus_utils::CallMethodWithTimeout(
1918        timeout_ms,
1919        dbus_object_proxy_,
1920        "org.chromium.debugd",
1921        "PacketCaptureStart",
1922        success_callback,
1923        error_callback,
1924        in_statfd,
1925        in_outfd,
1926        in_options);
1927  }
1928
1929  // Stops a running packet capture.
1930  bool PacketCaptureStop(
1931      const std::string& in_handle,
1932      brillo::ErrorPtr* error,
1933      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1934    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1935        timeout_ms,
1936        dbus_object_proxy_,
1937        "org.chromium.debugd",
1938        "PacketCaptureStop",
1939        error,
1940        in_handle);
1941    return response && brillo::dbus_utils::ExtractMethodCallResults(
1942        response.get(), error);
1943  }
1944
1945  // Stops a running packet capture.
1946  void PacketCaptureStopAsync(
1947      const std::string& in_handle,
1948      const base::Callback<void()>& success_callback,
1949      const base::Callback<void(brillo::Error*)>& error_callback,
1950      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1951    brillo::dbus_utils::CallMethodWithTimeout(
1952        timeout_ms,
1953        dbus_object_proxy_,
1954        "org.chromium.debugd",
1955        "PacketCaptureStop",
1956        success_callback,
1957        error_callback,
1958        in_handle);
1959  }
1960
1961  // Triggers show-task-states(T) SysRq.
1962  // See https://www.kernel.org/doc/Documentation/sysrq.txt.
1963  bool LogKernelTaskStates(
1964      brillo::ErrorPtr* error,
1965      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1966    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1967        timeout_ms,
1968        dbus_object_proxy_,
1969        "org.chromium.debugd",
1970        "LogKernelTaskStates",
1971        error);
1972    return response && brillo::dbus_utils::ExtractMethodCallResults(
1973        response.get(), error);
1974  }
1975
1976  // Triggers show-task-states(T) SysRq.
1977  // See https://www.kernel.org/doc/Documentation/sysrq.txt.
1978  void LogKernelTaskStatesAsync(
1979      const base::Callback<void()>& success_callback,
1980      const base::Callback<void(brillo::Error*)>& error_callback,
1981      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1982    brillo::dbus_utils::CallMethodWithTimeout(
1983        timeout_ms,
1984        dbus_object_proxy_,
1985        "org.chromium.debugd",
1986        "LogKernelTaskStates",
1987        success_callback,
1988        error_callback);
1989  }
1990
1991  // Triggers uploading of system crashes (the crash_sender program).
1992  bool UploadCrashes(
1993      brillo::ErrorPtr* error,
1994      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
1995    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
1996        timeout_ms,
1997        dbus_object_proxy_,
1998        "org.chromium.debugd",
1999        "UploadCrashes",
2000        error);
2001    return response && brillo::dbus_utils::ExtractMethodCallResults(
2002        response.get(), error);
2003  }
2004
2005  // Triggers uploading of system crashes (the crash_sender program).
2006  void UploadCrashesAsync(
2007      const base::Callback<void()>& success_callback,
2008      const base::Callback<void(brillo::Error*)>& error_callback,
2009      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2010    brillo::dbus_utils::CallMethodWithTimeout(
2011        timeout_ms,
2012        dbus_object_proxy_,
2013        "org.chromium.debugd",
2014        "UploadCrashes",
2015        success_callback,
2016        error_callback);
2017  }
2018
2019  // Removes rootfs verification. Requires a system reboot before it will
2020  // take effect. Restricted to pre-owner dev mode.
2021  bool RemoveRootfsVerification(
2022      brillo::ErrorPtr* error,
2023      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2024    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2025        timeout_ms,
2026        dbus_object_proxy_,
2027        "org.chromium.debugd",
2028        "RemoveRootfsVerification",
2029        error);
2030    return response && brillo::dbus_utils::ExtractMethodCallResults(
2031        response.get(), error);
2032  }
2033
2034  // Removes rootfs verification. Requires a system reboot before it will
2035  // take effect. Restricted to pre-owner dev mode.
2036  void RemoveRootfsVerificationAsync(
2037      const base::Callback<void()>& success_callback,
2038      const base::Callback<void(brillo::Error*)>& error_callback,
2039      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2040    brillo::dbus_utils::CallMethodWithTimeout(
2041        timeout_ms,
2042        dbus_object_proxy_,
2043        "org.chromium.debugd",
2044        "RemoveRootfsVerification",
2045        success_callback,
2046        error_callback);
2047  }
2048
2049  // Enables OS booting from a USB image. Restricted to pre-owner dev mode.
2050  bool EnableBootFromUsb(
2051      brillo::ErrorPtr* error,
2052      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2053    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2054        timeout_ms,
2055        dbus_object_proxy_,
2056        "org.chromium.debugd",
2057        "EnableBootFromUsb",
2058        error);
2059    return response && brillo::dbus_utils::ExtractMethodCallResults(
2060        response.get(), error);
2061  }
2062
2063  // Enables OS booting from a USB image. Restricted to pre-owner dev mode.
2064  void EnableBootFromUsbAsync(
2065      const base::Callback<void()>& success_callback,
2066      const base::Callback<void(brillo::Error*)>& error_callback,
2067      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2068    brillo::dbus_utils::CallMethodWithTimeout(
2069        timeout_ms,
2070        dbus_object_proxy_,
2071        "org.chromium.debugd",
2072        "EnableBootFromUsb",
2073        success_callback,
2074        error_callback);
2075  }
2076
2077  // Sets up sshd to provide an SSH server immediately and on future reboots.
2078  // Also installs the test SSH keys to allow access by cros tools. Requires
2079  // that rootfs verification has been removed. Restricted to pre-owner dev
2080  // mode.
2081  bool ConfigureSshServer(
2082      brillo::ErrorPtr* error,
2083      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2084    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2085        timeout_ms,
2086        dbus_object_proxy_,
2087        "org.chromium.debugd",
2088        "ConfigureSshServer",
2089        error);
2090    return response && brillo::dbus_utils::ExtractMethodCallResults(
2091        response.get(), error);
2092  }
2093
2094  // Sets up sshd to provide an SSH server immediately and on future reboots.
2095  // Also installs the test SSH keys to allow access by cros tools. Requires
2096  // that rootfs verification has been removed. Restricted to pre-owner dev
2097  // mode.
2098  void ConfigureSshServerAsync(
2099      const base::Callback<void()>& success_callback,
2100      const base::Callback<void(brillo::Error*)>& error_callback,
2101      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2102    brillo::dbus_utils::CallMethodWithTimeout(
2103        timeout_ms,
2104        dbus_object_proxy_,
2105        "org.chromium.debugd",
2106        "ConfigureSshServer",
2107        success_callback,
2108        error_callback);
2109  }
2110
2111  // Sets both the system and dev mode password for the indicated account.
2112  // Restricted to pre-owner dev mode.
2113  bool SetUserPassword(
2114      const std::string& in_username,
2115      const std::string& in_password,
2116      brillo::ErrorPtr* error,
2117      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2118    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2119        timeout_ms,
2120        dbus_object_proxy_,
2121        "org.chromium.debugd",
2122        "SetUserPassword",
2123        error,
2124        in_username,
2125        in_password);
2126    return response && brillo::dbus_utils::ExtractMethodCallResults(
2127        response.get(), error);
2128  }
2129
2130  // Sets both the system and dev mode password for the indicated account.
2131  // Restricted to pre-owner dev mode.
2132  void SetUserPasswordAsync(
2133      const std::string& in_username,
2134      const std::string& in_password,
2135      const base::Callback<void()>& success_callback,
2136      const base::Callback<void(brillo::Error*)>& error_callback,
2137      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2138    brillo::dbus_utils::CallMethodWithTimeout(
2139        timeout_ms,
2140        dbus_object_proxy_,
2141        "org.chromium.debugd",
2142        "SetUserPassword",
2143        success_callback,
2144        error_callback,
2145        in_username,
2146        in_password);
2147  }
2148
2149  // Sets up Chrome for remote debugging. It will take effect after a reboot
2150  // and using port 9222.
2151  // Requires that rootfs verification has been removed. Restricted to
2152  // pre-owner dev mode.
2153  bool EnableChromeRemoteDebugging(
2154      brillo::ErrorPtr* error,
2155      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2156    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2157        timeout_ms,
2158        dbus_object_proxy_,
2159        "org.chromium.debugd",
2160        "EnableChromeRemoteDebugging",
2161        error);
2162    return response && brillo::dbus_utils::ExtractMethodCallResults(
2163        response.get(), error);
2164  }
2165
2166  // Sets up Chrome for remote debugging. It will take effect after a reboot
2167  // and using port 9222.
2168  // Requires that rootfs verification has been removed. Restricted to
2169  // pre-owner dev mode.
2170  void EnableChromeRemoteDebuggingAsync(
2171      const base::Callback<void()>& success_callback,
2172      const base::Callback<void(brillo::Error*)>& error_callback,
2173      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2174    brillo::dbus_utils::CallMethodWithTimeout(
2175        timeout_ms,
2176        dbus_object_proxy_,
2177        "org.chromium.debugd",
2178        "EnableChromeRemoteDebugging",
2179        success_callback,
2180        error_callback);
2181  }
2182
2183  // Convenience function to enable a predefined set of tools from the Chrome
2184  // UI. Equivalent to calling these functions in order:
2185  //   1. EnableBootFromUsb()
2186  //   2. ConfigureSshServer()
2187  //   3. SetUserPassword("root", root_password)
2188  // Requires that rootfs verification has been removed. If any sub-function
2189  // fails, this function will exit with an error without attempting any
2190  // further configuration or rollback. Restricted to pre-owner dev mode.
2191  bool EnableChromeDevFeatures(
2192      const std::string& in_root_password,
2193      brillo::ErrorPtr* error,
2194      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2195    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2196        timeout_ms,
2197        dbus_object_proxy_,
2198        "org.chromium.debugd",
2199        "EnableChromeDevFeatures",
2200        error,
2201        in_root_password);
2202    return response && brillo::dbus_utils::ExtractMethodCallResults(
2203        response.get(), error);
2204  }
2205
2206  // Convenience function to enable a predefined set of tools from the Chrome
2207  // UI. Equivalent to calling these functions in order:
2208  //   1. EnableBootFromUsb()
2209  //   2. ConfigureSshServer()
2210  //   3. SetUserPassword("root", root_password)
2211  // Requires that rootfs verification has been removed. If any sub-function
2212  // fails, this function will exit with an error without attempting any
2213  // further configuration or rollback. Restricted to pre-owner dev mode.
2214  void EnableChromeDevFeaturesAsync(
2215      const std::string& in_root_password,
2216      const base::Callback<void()>& success_callback,
2217      const base::Callback<void(brillo::Error*)>& error_callback,
2218      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2219    brillo::dbus_utils::CallMethodWithTimeout(
2220        timeout_ms,
2221        dbus_object_proxy_,
2222        "org.chromium.debugd",
2223        "EnableChromeDevFeatures",
2224        success_callback,
2225        error_callback,
2226        in_root_password);
2227  }
2228
2229  // Queries which dev features have been enabled. Each dev feature will be
2230  // indicated by a bit flag in the return value. Flags are defined in the
2231  // DevFeatureFlag enumeration. If the dev tools are unavailable (system is
2232  // not in dev mode/pre-login state), the DEV_FEATURES_DISABLED flag will be
2233  // set and the rest of the bits will always be set to 0.
2234  bool QueryDevFeatures(
2235      int32_t* out_features,
2236      brillo::ErrorPtr* error,
2237      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2238    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2239        timeout_ms,
2240        dbus_object_proxy_,
2241        "org.chromium.debugd",
2242        "QueryDevFeatures",
2243        error);
2244    return response && brillo::dbus_utils::ExtractMethodCallResults(
2245        response.get(), error, out_features);
2246  }
2247
2248  // Queries which dev features have been enabled. Each dev feature will be
2249  // indicated by a bit flag in the return value. Flags are defined in the
2250  // DevFeatureFlag enumeration. If the dev tools are unavailable (system is
2251  // not in dev mode/pre-login state), the DEV_FEATURES_DISABLED flag will be
2252  // set and the rest of the bits will always be set to 0.
2253  void QueryDevFeaturesAsync(
2254      const base::Callback<void(int32_t /*features*/)>& success_callback,
2255      const base::Callback<void(brillo::Error*)>& error_callback,
2256      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2257    brillo::dbus_utils::CallMethodWithTimeout(
2258        timeout_ms,
2259        dbus_object_proxy_,
2260        "org.chromium.debugd",
2261        "QueryDevFeatures",
2262        success_callback,
2263        error_callback);
2264  }
2265
2266  // Allow uploading of device coredump files.
2267  bool EnableDevCoredumpUpload(
2268      brillo::ErrorPtr* error,
2269      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2270    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2271        timeout_ms,
2272        dbus_object_proxy_,
2273        "org.chromium.debugd",
2274        "EnableDevCoredumpUpload",
2275        error);
2276    return response && brillo::dbus_utils::ExtractMethodCallResults(
2277        response.get(), error);
2278  }
2279
2280  // Allow uploading of device coredump files.
2281  void EnableDevCoredumpUploadAsync(
2282      const base::Callback<void()>& success_callback,
2283      const base::Callback<void(brillo::Error*)>& error_callback,
2284      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2285    brillo::dbus_utils::CallMethodWithTimeout(
2286        timeout_ms,
2287        dbus_object_proxy_,
2288        "org.chromium.debugd",
2289        "EnableDevCoredumpUpload",
2290        success_callback,
2291        error_callback);
2292  }
2293
2294  // Disallow uploading of device coredump files.
2295  bool DisableDevCoredumpUpload(
2296      brillo::ErrorPtr* error,
2297      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2298    auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout(
2299        timeout_ms,
2300        dbus_object_proxy_,
2301        "org.chromium.debugd",
2302        "DisableDevCoredumpUpload",
2303        error);
2304    return response && brillo::dbus_utils::ExtractMethodCallResults(
2305        response.get(), error);
2306  }
2307
2308  // Disallow uploading of device coredump files.
2309  void DisableDevCoredumpUploadAsync(
2310      const base::Callback<void()>& success_callback,
2311      const base::Callback<void(brillo::Error*)>& error_callback,
2312      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
2313    brillo::dbus_utils::CallMethodWithTimeout(
2314        timeout_ms,
2315        dbus_object_proxy_,
2316        "org.chromium.debugd",
2317        "DisableDevCoredumpUpload",
2318        success_callback,
2319        error_callback);
2320  }
2321
2322 private:
2323  scoped_refptr<dbus::Bus> bus_;
2324  const std::string service_name_{"org.chromium.debugd"};
2325  const dbus::ObjectPath object_path_{"/org/chromium/debugd"};
2326  dbus::ObjectProxy* dbus_object_proxy_;
2327
2328  DISALLOW_COPY_AND_ASSIGN(debugdProxy);
2329};
2330
2331}  // namespace chromium
2332}  // namespace org
2333
2334#endif  // ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_VAR_CACHE_PORTAGE_CHROMEOS_BASE_DEBUGD_CLIENT_OUT_DEFAULT_GEN_INCLUDE_DEBUGD_DBUS_PROXIES_H
2335