OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Native Client Authors. All rights reserved. | 2 * Copyright 2008 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 /* | 7 /* |
8 * Simple test for simple rpc. | 8 * Simple test for simple rpc. |
9 */ | 9 */ |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 /* | 27 /* |
28 * Return a clever string. | 28 * Return a clever string. |
29 */ | 29 */ |
30 void HelloWorld(NaClSrpcRpc *rpc, | 30 void HelloWorld(NaClSrpcRpc *rpc, |
31 NaClSrpcArg **in_args, | 31 NaClSrpcArg **in_args, |
32 NaClSrpcArg **out_args, | 32 NaClSrpcArg **out_args, |
33 NaClSrpcClosure *done) { | 33 NaClSrpcClosure *done) { |
34 /* | 34 /* |
35 * Strdup must be used because the SRPC layer frees the string passed to it. | 35 * Strdup must be used because the SRPC layer frees the string passed to it. |
36 */ | 36 */ |
37 out_args[0]->u.sval.str = strdup("hello, world."); | 37 out_args[0]->arrays.str = strdup("hello, world."); |
38 rpc->result = NACL_SRPC_RESULT_OK; | 38 rpc->result = NACL_SRPC_RESULT_OK; |
39 done->Run(done); | 39 done->Run(done); |
40 } | 40 } |
41 | 41 |
42 const struct NaClSrpcHandlerDesc srpc_methods[] = { | 42 const struct NaClSrpcHandlerDesc srpc_methods[] = { |
43 { "fortytwo::i", FortyTwo }, | 43 { "fortytwo::i", FortyTwo }, |
44 { "helloworld::sssssssssssssssssssssssssssssssssssssssss" | 44 { "helloworld::sssssssssssssssssssssssssssssssssssssssss" |
45 "sssssssssssssssssssssssssssssssssssssssssssssssssssss" | 45 "sssssssssssssssssssssssssssssssssssssssssssssssssssss" |
46 "sssssssssssssssssssssssssssssssssssssssssssssssssssss" | 46 "sssssssssssssssssssssssssssssssssssssssssssssssssssss" |
47 "sssssssssssssssssssssssssssssssssssssssssssssssssssss", | 47 "sssssssssssssssssssssssssssssssssssssssssssssssssssss", |
48 HelloWorld }, | 48 HelloWorld }, |
49 { NULL, NULL }, | 49 { NULL, NULL }, |
50 }; | 50 }; |
51 | 51 |
52 int main() { | 52 int main() { |
53 if (!NaClSrpcModuleInit()) { | 53 if (!NaClSrpcModuleInit()) { |
54 return 1; | 54 return 1; |
55 } | 55 } |
56 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { | 56 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { |
57 return 1; | 57 return 1; |
58 } | 58 } |
59 NaClSrpcModuleFini(); | 59 NaClSrpcModuleFini(); |
60 return 0; | 60 return 0; |
61 } | 61 } |
OLD | NEW |