Elly Jones | a44d22d | 2012-01-05 18:05:56 -0500 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Elly Jones | e7cb5b3 | 2011-12-01 14:18:32 -0500 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame^] | 5 | #ifndef PROCESS_WITH_ID_H_ |
| 6 | #define PROCESS_WITH_ID_H_ |
| 7 | |
| 8 | #include <string> |
Elly Jones | e7cb5b3 | 2011-12-01 14:18:32 -0500 | [diff] [blame] | 9 | |
Elly Fong-Jones | d9a16cd | 2012-11-12 16:09:49 -0500 | [diff] [blame] | 10 | #include "sandboxed_process.h" |
Elly Jones | e7cb5b3 | 2011-12-01 14:18:32 -0500 | [diff] [blame] | 11 | |
| 12 | namespace debugd { |
| 13 | |
| 14 | // @brief Represents a process with an immutable ID. |
| 15 | // |
| 16 | // The ID is random, unguessable, and may be given to other processes. It is a |
| 17 | // null-terminated ASCII string. |
Elly Fong-Jones | d9a16cd | 2012-11-12 16:09:49 -0500 | [diff] [blame] | 18 | class ProcessWithId : public SandboxedProcess { |
Elly Jones | e7cb5b3 | 2011-12-01 14:18:32 -0500 | [diff] [blame] | 19 | public: |
| 20 | ProcessWithId(); |
Elly Fong-Jones | d9a16cd | 2012-11-12 16:09:49 -0500 | [diff] [blame] | 21 | virtual bool Init(); |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame^] | 22 | const std::string& id() const { return id_; } |
| 23 | |
Elly Jones | e7cb5b3 | 2011-12-01 14:18:32 -0500 | [diff] [blame] | 24 | private: |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame^] | 25 | bool GenerateId(); |
Elly Jones | e7cb5b3 | 2011-12-01 14:18:32 -0500 | [diff] [blame] | 26 | std::string id_; |
| 27 | }; |
| 28 | |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame^] | 29 | } // namespace debugd |
Elly Jones | e7cb5b3 | 2011-12-01 14:18:32 -0500 | [diff] [blame] | 30 | |
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame^] | 31 | #endif // PROCESS_WITH_ID_H_ |