| 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 /* |
| 29 * |mu| protects the thread count access. |
| 30 */ |
| 31 uint32_t thread_count; |
| 32 }; |
| 33 |
| 34 int NaClSecureServiceCtor( |
| 35 struct NaClSecureService *self, |
| 36 struct NaClSrpcHandlerDesc const *srpc_handlers, |
| 37 struct NaClApp *nap, |
| 38 struct NaClDesc *service_port, |
| 39 struct NaClDesc *sock_addr); |
| 40 |
| 41 void NaClSecureServiceDtor(struct NaClRefCount *vself); |
| 42 |
| 43 extern struct NaClSimpleServiceVtbl const kNaClSecureServiceVtbl; |
| 44 |
| 45 struct NaClSecureRevClientConnHandler; /* fwd */ |
| 46 |
| 47 struct NaClSecureReverseClient { |
| 48 struct NaClSimpleRevClient base; |
| 49 struct NaClApp *nap; |
| 50 |
| 51 struct NaClMutex mu; |
| 52 /* |
| 53 * |mu| protects the service entries hanging off of |queue_head|. |
| 54 */ |
| 55 struct NaClSecureRevClientConnHandler *queue_head; |
| 56 struct NaClSecureRevClientConnHandler **queue_insert; |
| 57 }; |
| 58 |
| 59 struct NaClSecureReverseClientVtbl { |
| 60 struct NaClSimpleRevClientVtbl vbase; |
| 61 |
| 62 int (*InsertHandler)( |
| 63 struct NaClSecureReverseClient *self, |
| 64 void (*handler)( |
| 65 void *handler_state, |
| 66 struct NaClThreadInterface *thread_id, |
| 67 struct NaClDesc *new_conn), |
| 68 void *state); |
| 69 |
| 70 struct NaClSecureRevClientConnHandler *(*RemoveHandler)( |
| 71 struct NaClSecureReverseClient *self); |
| 72 }; |
| 73 |
| 74 int NaClSecureReverseClientCtor( |
| 75 struct NaClSecureReverseClient *self, |
| 76 void (*client_callback)( |
| 77 void *, struct NaClThreadInterface *, struct NaClDesc *), |
| 78 void *state, |
| 79 struct NaClApp *nap); |
| 80 |
| 81 void NaClSecureReverseClientDtor(struct NaClRefCount *vself); |
| 82 |
| 83 int NaClSecureReverseClientInsertHandler( |
| 84 struct NaClSecureReverseClient *self, |
| 85 void (*handler)( |
| 86 void *handler_state, |
| 87 struct NaClThreadInterface *thread_if, |
| 88 struct NaClDesc *new_conn), |
| 89 void *state) NACL_WUR; |
| 90 |
| 91 struct NaClSecureRevClientConnHandler *NaClSecureReverseClientRemoveHandler( |
| 92 struct NaClSecureReverseClient *self); |
| 93 |
| 94 extern struct NaClSecureReverseClientVtbl const kNaClSecureReverseClientVtbl; |
| 95 |
| 96 EXTERN_C_END |
| 97 |
| 98 #endif /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_SECURE_SERVICE_H_ */ |
| OLD | NEW |