Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can be | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_SECURE_SERVICE_H_ | |
| 8 #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_SECURE_SERVICE_H_ | |
| 9 | |
| 10 #include "native_client/src/include/nacl_base.h" | |
| 11 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | |
| 12 #include "native_client/src/trusted/simple_service/nacl_simple_service.h" | |
| 13 #include "native_client/src/trusted/simple_service/nacl_simple_rservice.h" | |
| 14 | |
| 15 EXTERN_C_BEGIN | |
| 16 | |
| 17 struct NaClApp; | |
| 18 | |
| 19 /* | |
| 20 * Secure channel. | |
| 21 */ | |
| 22 | |
| 23 struct NaClSecureService { | |
| 24 struct NaClSimpleService base NACL_IS_REFCOUNT_SUBCLASS; | |
| 25 struct NaClApp *nap; | |
| 26 | |
| 27 struct NaClMutex mu; | |
| 28 struct NaClCondVar cv; | |
|
bsy
2012/09/26 03:35:33
remove cv
Petr Hosek
2012/09/26 04:22:21
Removed.
| |
| 29 /* | |
| 30 * |mu| protects the thread count access. | |
| 31 */ | |
| 32 uint32_t thread_count; | |
| 33 }; | |
| 34 | |
| 35 int NaClSecureServiceCtor( | |
| 36 struct NaClSecureService *self, | |
| 37 struct NaClSrpcHandlerDesc const *srpc_handlers, | |
| 38 struct NaClApp *nap, | |
| 39 struct NaClDesc *service_port, | |
| 40 struct NaClDesc *sock_addr); | |
| 41 | |
| 42 void NaClSecureServiceDtor(struct NaClRefCount *vself); | |
| 43 | |
| 44 struct NaClSecureServiceVtbl { | |
| 45 struct NaClSimpleServiceVtbl vbase; | |
| 46 | |
| 47 void (*WaitForServiceThreadsToExit)( | |
|
bsy
2012/09/26 03:35:33
remove this method
Petr Hosek
2012/09/26 04:22:21
Removed.
| |
| 48 struct NaClSecureService *self); | |
| 49 | |
| 50 void (*ThreadCountIncr)( | |
|
bsy
2012/09/26 03:35:33
not clear if these two really need to be virtual f
Petr Hosek
2012/09/26 04:22:21
Turned into non-virtual, dropped NaClSecureService
| |
| 51 struct NaClSecureService *self); | |
| 52 | |
| 53 void (*ThreadCountDecr)( | |
| 54 struct NaClSecureService *self); | |
| 55 }; | |
| 56 | |
| 57 extern struct NaClSecureServiceVtbl const kNaClSecureServiceVtbl; | |
| 58 | |
| 59 struct NaClSecureRevClientConnHandler; /* fwd */ | |
| 60 | |
| 61 struct NaClSecureReverseClient { | |
| 62 struct NaClSimpleRevClient base; | |
| 63 struct NaClApp *nap; | |
| 64 | |
| 65 struct NaClMutex mu; | |
| 66 /* | |
| 67 * |mu| protects the service entries hanging off of |queue_head|. | |
| 68 */ | |
| 69 struct NaClSecureRevClientConnHandler *queue_head; | |
| 70 struct NaClSecureRevClientConnHandler **queue_insert; | |
| 71 }; | |
| 72 | |
| 73 struct NaClSecureReverseClientVtbl { | |
| 74 struct NaClSimpleRevClientVtbl vbase; | |
| 75 | |
| 76 int (*InsertHandler)( | |
| 77 struct NaClSecureReverseClient *self, | |
| 78 void (*handler)( | |
| 79 void *handler_state, | |
| 80 struct NaClThreadInterface *thread_id, | |
| 81 struct NaClDesc *new_conn), | |
| 82 void *state); | |
| 83 | |
| 84 struct NaClSecureRevClientConnHandler *(*RemoveHandler)( | |
| 85 struct NaClSecureReverseClient *self); | |
| 86 }; | |
| 87 | |
| 88 int NaClSecureReverseClientCtor( | |
| 89 struct NaClSecureReverseClient *self, | |
| 90 void (*client_callback)( | |
| 91 void *, struct NaClThreadInterface *, struct NaClDesc *), | |
| 92 void *state, | |
| 93 struct NaClApp *nap); | |
| 94 | |
| 95 void NaClSecureReverseClientDtor(struct NaClRefCount *vself); | |
| 96 | |
| 97 int NaClSecureReverseClientInsertHandler( | |
| 98 struct NaClSecureReverseClient *self, | |
| 99 void (*handler)( | |
| 100 void *handler_state, | |
| 101 struct NaClThreadInterface *thread_if, | |
| 102 struct NaClDesc *new_conn), | |
| 103 void *state) NACL_WUR; | |
| 104 | |
| 105 struct NaClSecureRevClientConnHandler *NaClSecureReverseClientRemoveHandler( | |
| 106 struct NaClSecureReverseClient *self); | |
| 107 | |
| 108 extern struct NaClSecureReverseClientVtbl const kNaClSecureReverseClientVtbl; | |
| 109 | |
| 110 EXTERN_C_END | |
| 111 | |
| 112 #endif /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_SECURE_SERVICE_H_ */ | |
| OLD | NEW |