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

Unified Diff: src/trusted/service_runtime/nacl_command_service.c

Issue 10914138: Split secure command channel and untrusted application channel (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 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
Index: src/trusted/service_runtime/nacl_command_service.c
diff --git a/src/trusted/service_runtime/nacl_command_service.c b/src/trusted/service_runtime/nacl_command_service.c
new file mode 100644
index 0000000000000000000000000000000000000000..bd27a1416ddbe15cbea5eeba8ceaf99f11d918a6
--- /dev/null
+++ b/src/trusted/service_runtime/nacl_command_service.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012 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.
+ */
+
+#include "native_client/src/trusted/service_runtime/nacl_secure_service.h"
+
+#include "native_client/src/shared/platform/nacl_exit.h"
+#include "native_client/src/shared/platform/nacl_log.h"
+#include "native_client/src/shared/platform/nacl_sync.h"
+#include "native_client/src/shared/platform/nacl_sync_checked.h"
+#include "native_client/src/shared/srpc/nacl_srpc.h"
+
+#include "native_client/src/trusted/fault_injection/fault_injection.h"
+#include "native_client/src/trusted/simple_service/nacl_simple_service.h"
+#include "native_client/src/trusted/service_runtime/sel_ldr.h"
+
+
+int NaClCommandServiceCtor(struct NaClCommandService *self,
+ struct NaClSrpcHandlerDesc const *srpc_handlers,
+ struct NaClApp *nap) {
+ NaClLog(4,
+ "Entered NaClCommandServiceCtor: self 0x%"NACL_PRIxPTR"\n",
+ (uintptr_t) self);
+ if (NACL_FI_ERROR_COND(
+ "NaClCommandServiceCtor__NaClSimpleService",
+ !NaClSimpleServiceCtor(
+ &self->base,
+ srpc_handlers,
+ NaClThreadInterfaceThreadFactory,
+ (void *) NULL))) {
+ goto failure_simple_ctor;
+ }
+ self->nap = nap;
+
+ NACL_VTBL(NaClRefCount, self) =
+ (struct NaClRefCountVtbl *) &kNaClCommandServiceVtbl;
+ return 1;
+ failure_simple_ctor:
+ return 0;
+}
+
+void NaClCommandServiceDtor(struct NaClRefCount *vself) {
+ struct NaClCommandService *self = (struct NaClCommandService *) vself;
+
+ NACL_VTBL(NaClRefCount, self) = (struct NaClRefCountVtbl const *)
+ &kNaClSimpleServiceVtbl;
+ (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
+}
+
+int NaClCommandServiceConnectionFactory(
+ struct NaClSimpleService *vself,
+ struct NaClDesc *conn,
+ struct NaClSimpleServiceConnection **out) {
+ struct NaClCommandService *self =
+ (struct NaClCommandService *) vself;
+
+ /* our instance_data is not connection specific */
+ return NaClSimpleServiceConnectionFactoryWithInstanceData(
+ vself, conn, (void *) self->nap, out);
+}
+
+struct NaClSimpleServiceVtbl const kNaClCommandServiceVtbl = {
+ {
+ NaClCommandServiceDtor,
+ },
+ NaClCommandServiceConnectionFactory,
+ NaClSimpleServiceAcceptConnection,
+ NaClSimpleServiceAcceptAndSpawnHandler,
+ NaClSimpleServiceRpcHandler,
+};

Powered by Google App Engine
This is Rietveld 408576698