blob: 65d0cefcd74d004b7c269e5d190e4ab138aa159a [file] [log] [blame]
Elly Jonesa44d22d2012-01-05 18:05:56 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Elly Jonese7cb5b32011-12-01 14:18:32 -05002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Ben Chana0011d82014-05-13 00:19:29 -07005#ifndef PROCESS_WITH_ID_H_
6#define PROCESS_WITH_ID_H_
7
8#include <string>
Elly Jonese7cb5b32011-12-01 14:18:32 -05009
Elly Fong-Jonesd9a16cd2012-11-12 16:09:49 -050010#include "sandboxed_process.h"
Elly Jonese7cb5b32011-12-01 14:18:32 -050011
12namespace 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-Jonesd9a16cd2012-11-12 16:09:49 -050018class ProcessWithId : public SandboxedProcess {
Elly Jonese7cb5b32011-12-01 14:18:32 -050019 public:
20 ProcessWithId();
Elly Fong-Jonesd9a16cd2012-11-12 16:09:49 -050021 virtual bool Init();
Ben Chana0011d82014-05-13 00:19:29 -070022 const std::string& id() const { return id_; }
23
Elly Jonese7cb5b32011-12-01 14:18:32 -050024 private:
Ben Chana0011d82014-05-13 00:19:29 -070025 bool GenerateId();
Elly Jonese7cb5b32011-12-01 14:18:32 -050026 std::string id_;
27};
28
Ben Chana0011d82014-05-13 00:19:29 -070029} // namespace debugd
Elly Jonese7cb5b32011-12-01 14:18:32 -050030
Ben Chana0011d82014-05-13 00:19:29 -070031#endif // PROCESS_WITH_ID_H_