| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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> | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 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> | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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 |  | 
|  | 26 | namespace org { | 
|  | 27 | namespace chromium { | 
|  | 28 |  | 
|  | 29 | // Abstract interface proxy for org::chromium::debugd. | 
|  | 30 | class 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 41 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 42 | std::string* out_handle, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 43 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 53 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 54 | const base::Callback<void(const std::string& /*handle*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 55 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 61 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 68 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 76 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 85 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 91 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 98 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 105 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 112 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 118 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 119 | std::string* out_handle, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 120 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 126 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 127 | const base::Callback<void(const std::string& /*handle*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 128 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 134 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 141 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 142 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 143 |  | 
|  | 144 | // Returns the routing table. | 
|  | 145 | virtual bool GetRoutes( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 146 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 147 | std::vector<std::string>* out_result, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 148 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 149 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 150 |  | 
|  | 151 | // Returns the routing table. | 
|  | 152 | virtual void GetRoutesAsync( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 153 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 154 | const base::Callback<void(const std::vector<std::string>& /*result*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 155 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 162 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 169 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 177 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 185 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 192 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 199 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 206 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 213 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 224 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 233 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 246 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 257 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 268 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 279 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 287 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 296 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 304 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 313 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 319 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 326 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 334 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 342 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 348 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 354 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 360 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 366 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 374 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 382 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 388 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 394 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 400 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 406 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 413 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 420 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 428 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 436 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 443 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 450 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 457 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 464 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 472 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 480 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 486 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 493 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 500 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 507 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 513 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 520 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 537 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 538 | std::string* out_handle, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 539 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 556 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 557 | const base::Callback<void(const std::string& /*handle*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 558 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 564 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 571 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 577 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 584 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 589 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 595 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 601 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 608 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 613 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 619 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 627 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 636 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 644 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 653 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 661 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 670 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 683 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 697 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 707 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 717 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 718 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 719 |  | 
|  | 720 | // Allow uploading of device coredump files. | 
|  | 721 | virtual bool EnableDevCoredumpUpload( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 722 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 728 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 729 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 730 |  | 
|  | 731 | // Disallow uploading of device coredump files. | 
|  | 732 | virtual bool DisableDevCoredumpUpload( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 733 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 739 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 740 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 741 | }; | 
|  | 742 |  | 
|  | 743 | }  // namespace chromium | 
|  | 744 | }  // namespace org | 
|  | 745 |  | 
|  | 746 | namespace org { | 
|  | 747 | namespace chromium { | 
|  | 748 |  | 
|  | 749 | // Interface proxy for org::chromium::debugd. | 
|  | 750 | class 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 780 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 781 | std::string* out_handle, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 782 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 783 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 784 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 785 | timeout_ms, | 
|  | 786 | dbus_object_proxy_, | 
|  | 787 | "org.chromium.debugd", | 
|  | 788 | "PingStart", | 
|  | 789 | error, | 
|  | 790 | in_outfd, | 
|  | 791 | in_destination, | 
|  | 792 | in_options); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 793 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 804 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 805 | const base::Callback<void(const std::string& /*handle*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 806 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 807 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 808 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 823 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 824 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 825 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 826 | timeout_ms, | 
|  | 827 | dbus_object_proxy_, | 
|  | 828 | "org.chromium.debugd", | 
|  | 829 | "PingStop", | 
|  | 830 | error, | 
|  | 831 | in_handle); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 832 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 840 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 841 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 842 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 857 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 858 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 859 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 860 | timeout_ms, | 
|  | 861 | dbus_object_proxy_, | 
|  | 862 | "org.chromium.debugd", | 
|  | 863 | "SystraceStart", | 
|  | 864 | error, | 
|  | 865 | in_categories); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 866 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 876 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 877 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 878 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 891 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 892 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 893 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 894 | timeout_ms, | 
|  | 895 | dbus_object_proxy_, | 
|  | 896 | "org.chromium.debugd", | 
|  | 897 | "SystraceStop", | 
|  | 898 | error, | 
|  | 899 | in_outfd); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 900 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 908 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 909 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 910 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 924 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 925 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 926 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 927 | timeout_ms, | 
|  | 928 | dbus_object_proxy_, | 
|  | 929 | "org.chromium.debugd", | 
|  | 930 | "SystraceStatus", | 
|  | 931 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 932 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 940 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 941 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 942 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 954 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 955 | std::string* out_handle, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 956 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 957 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 958 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 959 | timeout_ms, | 
|  | 960 | dbus_object_proxy_, | 
|  | 961 | "org.chromium.debugd", | 
|  | 962 | "TracePathStart", | 
|  | 963 | error, | 
|  | 964 | in_outfd, | 
|  | 965 | in_destination, | 
|  | 966 | in_options); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 967 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 968 | response.get(), error, out_handle); | 
|  | 969 | } | 
|  | 970 |  | 
|  | 971 | void TracePathStartAsync( | 
|  | 972 | const dbus::FileDescriptor& in_outfd, | 
|  | 973 | const std::string& in_destination, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 974 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 975 | const base::Callback<void(const std::string& /*handle*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 976 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 977 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 978 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 993 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 994 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 995 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 996 | timeout_ms, | 
|  | 997 | dbus_object_proxy_, | 
|  | 998 | "org.chromium.debugd", | 
|  | 999 | "TracePathStop", | 
|  | 1000 | error, | 
|  | 1001 | in_handle); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1002 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1010 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1011 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1012 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1024 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1025 | std::vector<std::string>* out_result, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1026 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1027 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1028 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1029 | timeout_ms, | 
|  | 1030 | dbus_object_proxy_, | 
|  | 1031 | "org.chromium.debugd", | 
|  | 1032 | "GetRoutes", | 
|  | 1033 | error, | 
|  | 1034 | in_options); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1035 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1036 | response.get(), error, out_result); | 
|  | 1037 | } | 
|  | 1038 |  | 
|  | 1039 | // Returns the routing table. | 
|  | 1040 | void GetRoutesAsync( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1041 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1042 | const base::Callback<void(const std::vector<std::string>& /*result*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1043 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1044 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1045 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1059 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1060 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1061 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1062 | timeout_ms, | 
|  | 1063 | dbus_object_proxy_, | 
|  | 1064 | "org.chromium.debugd", | 
|  | 1065 | "GetModemStatus", | 
|  | 1066 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1067 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1075 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1076 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1077 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1091 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1092 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1093 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1094 | timeout_ms, | 
|  | 1095 | dbus_object_proxy_, | 
|  | 1096 | "org.chromium.debugd", | 
|  | 1097 | "RunModemCommand", | 
|  | 1098 | error, | 
|  | 1099 | in_command); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1100 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1109 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1110 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1111 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1125 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1126 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1127 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1128 | timeout_ms, | 
|  | 1129 | dbus_object_proxy_, | 
|  | 1130 | "org.chromium.debugd", | 
|  | 1131 | "GetNetworkStatus", | 
|  | 1132 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1133 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1141 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1142 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1143 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1156 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1157 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1158 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1159 | timeout_ms, | 
|  | 1160 | dbus_object_proxy_, | 
|  | 1161 | "org.chromium.debugd", | 
|  | 1162 | "GetWiMaxStatus", | 
|  | 1163 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1164 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1172 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1173 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1174 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1191 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1192 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1193 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1194 | timeout_ms, | 
|  | 1195 | dbus_object_proxy_, | 
|  | 1196 | "org.chromium.debugd", | 
|  | 1197 | "GetPerfOutput", | 
|  | 1198 | error, | 
|  | 1199 | in_duration_sec, | 
|  | 1200 | in_perf_args); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1201 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1211 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1212 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1213 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1234 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1235 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1236 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1237 | timeout_ms, | 
|  | 1238 | dbus_object_proxy_, | 
|  | 1239 | "org.chromium.debugd", | 
|  | 1240 | "GetRandomPerfOutput", | 
|  | 1241 | error, | 
|  | 1242 | in_duration_sec); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1243 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1255 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1256 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1257 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1275 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1276 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1277 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1278 | timeout_ms, | 
|  | 1279 | dbus_object_proxy_, | 
|  | 1280 | "org.chromium.debugd", | 
|  | 1281 | "GetRichPerfData", | 
|  | 1282 | error, | 
|  | 1283 | in_duration_sec); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1284 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1296 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1297 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1298 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1313 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1314 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1315 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1316 | timeout_ms, | 
|  | 1317 | dbus_object_proxy_, | 
|  | 1318 | "org.chromium.debugd", | 
|  | 1319 | "GetDebugLogs", | 
|  | 1320 | error, | 
|  | 1321 | in_outfd); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1322 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1332 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1333 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1334 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1349 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1350 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1351 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1352 | timeout_ms, | 
|  | 1353 | dbus_object_proxy_, | 
|  | 1354 | "org.chromium.debugd", | 
|  | 1355 | "DumpDebugLogs", | 
|  | 1356 | error, | 
|  | 1357 | in_is_compressed, | 
|  | 1358 | in_outfd); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1359 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1369 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1370 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1371 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1385 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1386 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1387 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1388 | timeout_ms, | 
|  | 1389 | dbus_object_proxy_, | 
|  | 1390 | "org.chromium.debugd", | 
|  | 1391 | "SetDebugMode", | 
|  | 1392 | error, | 
|  | 1393 | in_subsystem); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1394 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1402 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1403 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1404 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1419 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1420 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1421 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1422 | timeout_ms, | 
|  | 1423 | dbus_object_proxy_, | 
|  | 1424 | "org.chromium.debugd", | 
|  | 1425 | "GetLog", | 
|  | 1426 | error, | 
|  | 1427 | in_log); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1428 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1437 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1438 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1439 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1452 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1453 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1454 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1455 | timeout_ms, | 
|  | 1456 | dbus_object_proxy_, | 
|  | 1457 | "org.chromium.debugd", | 
|  | 1458 | "GetAllLogs", | 
|  | 1459 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1460 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1467 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1468 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1469 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1481 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1482 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1483 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1484 | timeout_ms, | 
|  | 1485 | dbus_object_proxy_, | 
|  | 1486 | "org.chromium.debugd", | 
|  | 1487 | "GetFeedbackLogs", | 
|  | 1488 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1489 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1496 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1497 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1498 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1512 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1513 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1514 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1515 | timeout_ms, | 
|  | 1516 | dbus_object_proxy_, | 
|  | 1517 | "org.chromium.debugd", | 
|  | 1518 | "GetUserLogFiles", | 
|  | 1519 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1520 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1529 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1530 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1531 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1543 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1544 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1545 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1546 | timeout_ms, | 
|  | 1547 | dbus_object_proxy_, | 
|  | 1548 | "org.chromium.debugd", | 
|  | 1549 | "GetExample", | 
|  | 1550 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1551 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1558 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1559 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1560 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1572 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1573 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1574 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1575 | timeout_ms, | 
|  | 1576 | dbus_object_proxy_, | 
|  | 1577 | "org.chromium.debugd", | 
|  | 1578 | "GetInterfaces", | 
|  | 1579 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1580 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1587 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1588 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1589 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1602 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1603 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1604 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1605 | timeout_ms, | 
|  | 1606 | dbus_object_proxy_, | 
|  | 1607 | "org.chromium.debugd", | 
|  | 1608 | "TestICMP", | 
|  | 1609 | error, | 
|  | 1610 | in_host); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1611 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1619 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1620 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1621 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1636 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1637 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1638 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1639 | timeout_ms, | 
|  | 1640 | dbus_object_proxy_, | 
|  | 1641 | "org.chromium.debugd", | 
|  | 1642 | "TestICMPWithOptions", | 
|  | 1643 | error, | 
|  | 1644 | in_host, | 
|  | 1645 | in_options); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1646 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1655 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1656 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1657 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1672 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1673 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1674 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1675 | timeout_ms, | 
|  | 1676 | dbus_object_proxy_, | 
|  | 1677 | "org.chromium.debugd", | 
|  | 1678 | "BatteryFirmware", | 
|  | 1679 | error, | 
|  | 1680 | in_option); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1681 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1689 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1690 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1691 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1705 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1706 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1707 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1708 | timeout_ms, | 
|  | 1709 | dbus_object_proxy_, | 
|  | 1710 | "org.chromium.debugd", | 
|  | 1711 | "Smartctl", | 
|  | 1712 | error, | 
|  | 1713 | in_option); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1714 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1722 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1723 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1724 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1739 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1740 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1741 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1742 | timeout_ms, | 
|  | 1743 | dbus_object_proxy_, | 
|  | 1744 | "org.chromium.debugd", | 
|  | 1745 | "MemtesterStart", | 
|  | 1746 | error, | 
|  | 1747 | in_outfd, | 
|  | 1748 | in_memory); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1749 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1758 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1759 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1760 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1774 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1775 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1776 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1777 | timeout_ms, | 
|  | 1778 | dbus_object_proxy_, | 
|  | 1779 | "org.chromium.debugd", | 
|  | 1780 | "MemtesterStop", | 
|  | 1781 | error, | 
|  | 1782 | in_handle); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1783 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1791 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1792 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1793 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1807 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1808 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1809 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1810 | timeout_ms, | 
|  | 1811 | dbus_object_proxy_, | 
|  | 1812 | "org.chromium.debugd", | 
|  | 1813 | "BadblocksStart", | 
|  | 1814 | error, | 
|  | 1815 | in_outfd); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1816 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1824 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1825 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1826 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1839 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1840 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1841 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1842 | timeout_ms, | 
|  | 1843 | dbus_object_proxy_, | 
|  | 1844 | "org.chromium.debugd", | 
|  | 1845 | "BadblocksStop", | 
|  | 1846 | error, | 
|  | 1847 | in_handle); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1848 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1856 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1857 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1858 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1882 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1883 | std::string* out_handle, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1884 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1885 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1886 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1887 | timeout_ms, | 
|  | 1888 | dbus_object_proxy_, | 
|  | 1889 | "org.chromium.debugd", | 
|  | 1890 | "PacketCaptureStart", | 
|  | 1891 | error, | 
|  | 1892 | in_statfd, | 
|  | 1893 | in_outfd, | 
|  | 1894 | in_options); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1895 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1913 | const brillo::VariantDictionary& in_options, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1914 | const base::Callback<void(const std::string& /*handle*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1915 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1916 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1917 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1932 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1933 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1934 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1935 | timeout_ms, | 
|  | 1936 | dbus_object_proxy_, | 
|  | 1937 | "org.chromium.debugd", | 
|  | 1938 | "PacketCaptureStop", | 
|  | 1939 | error, | 
|  | 1940 | in_handle); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1941 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1949 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1950 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1951 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1964 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1965 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1966 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1967 | timeout_ms, | 
|  | 1968 | dbus_object_proxy_, | 
|  | 1969 | "org.chromium.debugd", | 
|  | 1970 | "LogKernelTaskStates", | 
|  | 1971 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1972 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1980 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1981 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1982 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1993 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1994 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1995 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1996 | timeout_ms, | 
|  | 1997 | dbus_object_proxy_, | 
|  | 1998 | "org.chromium.debugd", | 
|  | 1999 | "UploadCrashes", | 
|  | 2000 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2001 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2008 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2009 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2010 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2022 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2023 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2024 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2025 | timeout_ms, | 
|  | 2026 | dbus_object_proxy_, | 
|  | 2027 | "org.chromium.debugd", | 
|  | 2028 | "RemoveRootfsVerification", | 
|  | 2029 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2030 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2038 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2039 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2040 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2051 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2052 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2053 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2054 | timeout_ms, | 
|  | 2055 | dbus_object_proxy_, | 
|  | 2056 | "org.chromium.debugd", | 
|  | 2057 | "EnableBootFromUsb", | 
|  | 2058 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2059 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2066 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2067 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2068 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2082 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2083 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2084 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2085 | timeout_ms, | 
|  | 2086 | dbus_object_proxy_, | 
|  | 2087 | "org.chromium.debugd", | 
|  | 2088 | "ConfigureSshServer", | 
|  | 2089 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2090 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2100 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2101 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2102 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2116 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2117 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2118 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2119 | timeout_ms, | 
|  | 2120 | dbus_object_proxy_, | 
|  | 2121 | "org.chromium.debugd", | 
|  | 2122 | "SetUserPassword", | 
|  | 2123 | error, | 
|  | 2124 | in_username, | 
|  | 2125 | in_password); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2126 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2136 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2137 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2138 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2154 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2155 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2156 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2157 | timeout_ms, | 
|  | 2158 | dbus_object_proxy_, | 
|  | 2159 | "org.chromium.debugd", | 
|  | 2160 | "EnableChromeRemoteDebugging", | 
|  | 2161 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2162 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2172 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2173 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2174 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2193 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2194 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2195 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2196 | timeout_ms, | 
|  | 2197 | dbus_object_proxy_, | 
|  | 2198 | "org.chromium.debugd", | 
|  | 2199 | "EnableChromeDevFeatures", | 
|  | 2200 | error, | 
|  | 2201 | in_root_password); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2202 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2217 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2218 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2219 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2236 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2237 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2238 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2239 | timeout_ms, | 
|  | 2240 | dbus_object_proxy_, | 
|  | 2241 | "org.chromium.debugd", | 
|  | 2242 | "QueryDevFeatures", | 
|  | 2243 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2244 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2255 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2256 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2257 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2268 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2269 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2270 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2271 | timeout_ms, | 
|  | 2272 | dbus_object_proxy_, | 
|  | 2273 | "org.chromium.debugd", | 
|  | 2274 | "EnableDevCoredumpUpload", | 
|  | 2275 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2276 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2277 | response.get(), error); | 
|  | 2278 | } | 
|  | 2279 |  | 
|  | 2280 | // Allow uploading of device coredump files. | 
|  | 2281 | void EnableDevCoredumpUploadAsync( | 
|  | 2282 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2283 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2284 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2285 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2296 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2297 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2298 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2299 | timeout_ms, | 
|  | 2300 | dbus_object_proxy_, | 
|  | 2301 | "org.chromium.debugd", | 
|  | 2302 | "DisableDevCoredumpUpload", | 
|  | 2303 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2304 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2305 | response.get(), error); | 
|  | 2306 | } | 
|  | 2307 |  | 
|  | 2308 | // Disallow uploading of device coredump files. | 
|  | 2309 | void DisableDevCoredumpUploadAsync( | 
|  | 2310 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2311 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 2312 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 2313 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 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 |