Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: src/untrusted/init/name_service.h

Issue 25147002: nacl_init Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/untrusted/init/nacl.scons ('k') | src/untrusted/init/name_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_INIT_NAME_SERVICE_H_
6 #define NATIVE_CLIENT_SRC_UNTRUSTED_INIT_NAME_SERVICE_H_
7
8 #include "native_client/src/untrusted/init/simple_service.h"
9
10 namespace nacl {
11
12 class NameService : public SimpleService {
13 public:
14 NameService();
15 ~NameService();
16
17 virtual bool CreateEntry(string name, int mode, int *out);
18
19 virtual bool Resolve(string name, int flags);
20
21 virtual bool DeleteName(string name, int *out);
22
23 virtual size_t Enumerate(string dest, size_t nbytes);
24 // template typename<Cont> List(Cont::insert_iterator<Cont> it);
25
26 private:
27 std::map<string, int> entries_;
28
29 DISALLOW_COPY_AND_ASSIGN(NameService);
30 };
31
32 // Basic name service related utilities.
33 class NameServiceClient : public SrpcClientConnection {
34 public:
35 NameServiceClient() {}
36
37 std::vector<std::string> List();
38 // TODO(bsy) consider instead implementing:
39 // template typename<Cont> List(Cont::insert_iterator<Cont> it);
40
41 int Resolve(std::string name);
42 };
43
44 class NameServiceFactory {
45 public:
46 // Init must be called before any other operation. May fail, which
47 // is typically a fatal error.
48 static bool Init();
49
50 static NameServiceFactory *NameServiceFactorySingleton();
51 NameServiceClient *NameService();
52 private:
53 NameServiceFactory();
54
55 static int name_service_cap;
56 static NameServiceFactory *singleton;
57 };
58
59 } // namespace nacl
60
61 #endif
OLDNEW
« no previous file with comments | « src/untrusted/init/nacl.scons ('k') | src/untrusted/init/name_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698