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