OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_INIT_KERNEL_SERVICE_H_ |
| 6 #define NATIVE_CLIENT_SRC_UNTRUSTED_INIT_KERNEL_SERVICE_H_ |
| 7 |
| 8 namespace nacl { |
| 9 |
| 10 class SimpleServiceConnection; |
| 11 |
| 12 class SimpleService { |
| 13 public: |
| 14 SimpleService(); |
| 15 |
| 16 ~SimpleService(); |
| 17 |
| 18 int AcceptAndSpawnHandler(); |
| 19 |
| 20 void RpcHandler(SimpleServiceConnection *conn); |
| 21 |
| 22 protected: |
| 23 SimpleServiceConnection *ConnectionFactoryWithInstanceData( |
| 24 int d, void *instance_data) |
| 25 SimpleServiceConnection *ConnectionFactory(int d); |
| 26 |
| 27 private: |
| 28 SimpleServiceConnection *AcceptConnection(); |
| 29 |
| 30 struct NaClDesc *bound_and_cap_[2]; |
| 31 |
| 32 NaClThreadIfFactoryFunction thread_factory_fn; |
| 33 void *thread_factory_data; |
| 34 |
| 35 // Acceptor thread |
| 36 scoped_ptr<Thread> acceptor_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(SimpleService); |
| 39 }; |
| 40 |
| 41 class SimpleServiceConnection { |
| 42 public: |
| 43 SimpleServiceConnection(SimpleService *server, |
| 44 int connection, |
| 45 void *instance_data); |
| 46 |
| 47 ~SimpleServiceConnection(); |
| 48 |
| 49 int ServerLoop(); |
| 50 |
| 51 private: |
| 52 NaClSimpleService *server_; |
| 53 int connected_socket_; |
| 54 |
| 55 void *instance_data_; |
| 56 |
| 57 //NaClThreadInterface *thread; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(SimpleServiceConnection); |
| 60 }; |
| 61 |
| 62 } // namespace nacl |
| 63 |
| 64 #endif |
OLD | NEW |