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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/untrusted/init/nacl.scons ('k') | src/untrusted/init/name_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/untrusted/init/name_service.h
diff --git a/src/untrusted/init/name_service.h b/src/untrusted/init/name_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..a859812ce6560256e28d326bc9931eb97e765274
--- /dev/null
+++ b/src/untrusted/init/name_service.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 The Native Client Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NATIVE_CLIENT_SRC_UNTRUSTED_INIT_NAME_SERVICE_H_
+#define NATIVE_CLIENT_SRC_UNTRUSTED_INIT_NAME_SERVICE_H_
+
+#include "native_client/src/untrusted/init/simple_service.h"
+
+namespace nacl {
+
+class NameService : public SimpleService {
+ public:
+ NameService();
+ ~NameService();
+
+ virtual bool CreateEntry(string name, int mode, int *out);
+
+ virtual bool Resolve(string name, int flags);
+
+ virtual bool DeleteName(string name, int *out);
+
+ virtual size_t Enumerate(string dest, size_t nbytes);
+ // template typename<Cont> List(Cont::insert_iterator<Cont> it);
+
+ private:
+ std::map<string, int> entries_;
+
+ DISALLOW_COPY_AND_ASSIGN(NameService);
+};
+
+// Basic name service related utilities.
+class NameServiceClient : public SrpcClientConnection {
+ public:
+ NameServiceClient() {}
+
+ std::vector<std::string> List();
+ // TODO(bsy) consider instead implementing:
+ // template typename<Cont> List(Cont::insert_iterator<Cont> it);
+
+ int Resolve(std::string name);
+};
+
+class NameServiceFactory {
+ public:
+ // Init must be called before any other operation. May fail, which
+ // is typically a fatal error.
+ static bool Init();
+
+ static NameServiceFactory *NameServiceFactorySingleton();
+ NameServiceClient *NameService();
+ private:
+ NameServiceFactory();
+
+ static int name_service_cap;
+ static NameServiceFactory *singleton;
+};
+
+} // namespace nacl
+
+#endif
« 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