OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_LOGIN_H_ | 5 #ifndef CHROMEOS_LOGIN_H_ |
6 #define CHROMEOS_LOGIN_H_ | 6 #define CHROMEOS_LOGIN_H_ |
7 | 7 |
| 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include <base/basictypes.h> | 11 #include <base/basictypes.h> |
11 | 12 |
12 namespace chromeos { // NOLINT | 13 namespace chromeos { // NOLINT |
13 | 14 |
14 // TODO(cmasone): change references to "login" (LoginLibrary, etc) to "session" | 15 // TODO(cmasone): change references to "login" (LoginLibrary, etc) to "session" |
15 // or similar. The API implemented here doesn't really deal with logging in | 16 // or similar. The API implemented here doesn't really deal with logging in |
16 // so much as state relating to user and the user sessions. | 17 // so much as state relating to user and the user sessions. |
17 | 18 |
18 enum OwnershipEvent { | 19 enum OwnershipEvent { |
19 SetKeySuccess = 0, | 20 SetKeySuccess = 0, |
20 SetKeyFailure = 1, | 21 SetKeyFailure = 1, |
21 WhitelistOpSuccess = 2, | 22 WhitelistOpSuccess = 2, |
22 WhitelistOpFailure = 3, | 23 WhitelistOpFailure = 3, |
23 SettingsOpSuccess = 4, | 24 PropertyOpSuccess = 4, |
24 SettingsOpFailure = 5, | 25 PropertyOpFailure = 5, |
25 }; | 26 }; |
26 | 27 |
27 static const char kOwnerKeyFile[] = "/var/lib/whitelist/owner.key"; | 28 static const char kOwnerKeyFile[] = "/var/lib/whitelist/owner.key"; |
28 | 29 |
29 class OpaqueSessionConnection; | 30 class OpaqueSessionConnection; |
30 typedef OpaqueSessionConnection* SessionConnection; | 31 typedef OpaqueSessionConnection* SessionConnection; |
31 typedef void(*SessionMonitor)(void*, const OwnershipEvent&); | 32 typedef void(*SessionMonitor)(void*, const OwnershipEvent&); |
32 | 33 |
33 extern SessionConnection (*MonitorSession)(SessionMonitor monitor, void*); | 34 extern SessionConnection (*MonitorSession)(SessionMonitor monitor, void*); |
34 extern void (*DisconnectSession)(SessionConnection connection); | 35 extern void (*DisconnectSession)(SessionConnection connection); |
35 | 36 |
| 37 extern bool (*CheckWhitelist)(const char* email, |
| 38 std::vector<uint8>* OUT_signature); |
36 extern bool (*EmitLoginPromptReady)(); | 39 extern bool (*EmitLoginPromptReady)(); |
| 40 extern bool (*RestartJob)(int pid, const char* command_line); |
| 41 extern bool (*RetrieveProperty)(const char* name, |
| 42 std::string* OUT_value, |
| 43 std::vector<uint8>* OUT_signature); |
37 extern bool (*SetOwnerKey)(const std::vector<uint8>& public_key_der); | 44 extern bool (*SetOwnerKey)(const std::vector<uint8>& public_key_der); |
38 extern bool (*StartSession)(const char* user_email, | 45 extern bool (*StartSession)(const char* user_email, |
39 const char* unique_id /* unused */); | 46 const char* unique_id /* unused */); |
40 extern bool (*StopSession)(const char* unique_id /* unused */); | 47 extern bool (*StopSession)(const char* unique_id /* unused */); |
41 extern bool (*RestartJob)(int pid, const char* command_line); | 48 extern bool (*StoreProperty)(const char* name, |
| 49 const char* value, |
| 50 const std::vector<uint8>& signature); |
| 51 extern bool (*Unwhitelist)(const char* email, |
| 52 const std::vector<uint8>& signature); |
| 53 extern bool (*Whitelist)(const char* email, |
| 54 const std::vector<uint8>& signature); |
42 | 55 |
43 } // namespace chromeos | 56 } // namespace chromeos |
44 | 57 |
45 #endif // CHROMEOS_LOGIN_H_ | 58 #endif // CHROMEOS_LOGIN_H_ |
OLD | NEW |