OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 | 11 |
12 #include <nacl/nacl_srpc.h> | 12 #include <nacl/nacl_srpc.h> |
13 #include <sys/nacl_syscalls.h> | 13 #include <sys/nacl_syscalls.h> |
14 | 14 |
15 | 15 |
16 void TestMethod(NaClSrpcRpc *rpc, | 16 void TestMethod(NaClSrpcRpc *rpc, |
17 NaClSrpcArg **in_args, | 17 NaClSrpcArg **in_args, |
18 NaClSrpcArg **out_args, | 18 NaClSrpcArg **out_args, |
19 NaClSrpcClosure *done) { | 19 NaClSrpcClosure *done) { |
20 out_args[0]->u.sval.str = strdup("Deferred SRPC connection worked."); | 20 out_args[0]->arrays.str = strdup("Deferred SRPC connection worked."); |
21 rpc->result = NACL_SRPC_RESULT_OK; | 21 rpc->result = NACL_SRPC_RESULT_OK; |
22 done->Run(done); | 22 done->Run(done); |
23 } | 23 } |
24 | 24 |
25 const struct NaClSrpcHandlerDesc srpc_methods[] = { | 25 const struct NaClSrpcHandlerDesc srpc_methods[] = { |
26 { "test_method::s", TestMethod }, | 26 { "test_method::s", TestMethod }, |
27 { NULL, NULL }, | 27 { NULL, NULL }, |
28 }; | 28 }; |
29 | 29 |
30 int main() { | 30 int main() { |
(...skipping 15 matching lines...) Expand all Loading... |
46 rc = close(fd); | 46 rc = close(fd); |
47 assert(rc == 0); | 47 assert(rc == 0); |
48 | 48 |
49 /* But the third connection was just right! We accept it. */ | 49 /* But the third connection was just right! We accept it. */ |
50 fd = imc_accept(3); | 50 fd = imc_accept(3); |
51 assert(fd >= 0); | 51 assert(fd >= 0); |
52 NaClSrpcServerLoop(fd, srpc_methods, NULL); | 52 NaClSrpcServerLoop(fd, srpc_methods, NULL); |
53 | 53 |
54 return 0; | 54 return 0; |
55 } | 55 } |
OLD | NEW |