| 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:I:s", HelloWorld }, | 44 { "helloworld:I:s", HelloWorld }, |
| 45 { NULL, NULL }, | 45 { NULL, NULL }, |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 int main() { | 48 int main() { |
| 49 if (!NaClSrpcModuleInit()) { | 49 if (!NaClSrpcModuleInit()) { |
| 50 return 1; | 50 return 1; |
| 51 } | 51 } |
| 52 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { | 52 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { |
| 53 return 1; | 53 return 1; |
| 54 } | 54 } |
| 55 NaClSrpcModuleFini(); | 55 NaClSrpcModuleFini(); |
| 56 return 0; | 56 return 0; |
| 57 } | 57 } |
| OLD | NEW |