| 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 /* | 8 /* |
| 9 * NativeClient client side of a test for passing socket addresses. The | 9 * NativeClient client side of a test for passing socket addresses. The |
| 10 * client side steps are: | 10 * client side steps are: |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } else { | 120 } else { |
| 121 strncpy(map_addr, test_string, strlen(test_string)); | 121 strncpy(map_addr, test_string, strlen(test_string)); |
| 122 } | 122 } |
| 123 } else { | 123 } else { |
| 124 printf("SharedMemoryClient: imc_mem_obj_create failed %d\n", desc); | 124 printf("SharedMemoryClient: imc_mem_obj_create failed %d\n", desc); |
| 125 ++errors_seen; | 125 ++errors_seen; |
| 126 } | 126 } |
| 127 /* Return the imc descriptor, the string we wrote, and the error count. */ | 127 /* Return the imc descriptor, the string we wrote, and the error count. */ |
| 128 out_args[0]->u.hval = desc; | 128 out_args[0]->u.hval = desc; |
| 129 /* NOTE: string return values from SRPC need to be heap allocated. */ | 129 /* NOTE: string return values from SRPC need to be heap allocated. */ |
| 130 out_args[1]->u.sval.str = strdup(test_string); | 130 out_args[1]->arrays.str = strdup(test_string); |
| 131 out_args[2]->u.ival = errors_seen; | 131 out_args[2]->u.ival = errors_seen; |
| 132 rpc->result = NACL_SRPC_RESULT_OK; | 132 rpc->result = NACL_SRPC_RESULT_OK; |
| 133 done->Run(done); | 133 done->Run(done); |
| 134 } | 134 } |
| 135 | 135 |
| 136 const struct NaClSrpcHandlerDesc srpc_methods[] = { | 136 const struct NaClSrpcHandlerDesc srpc_methods[] = { |
| 137 { "sock_addr_client:h:i", SockAddrClient }, | 137 { "sock_addr_client:h:i", SockAddrClient }, |
| 138 { "shared_memory_client:i:hsi", SharedMemoryClient }, | 138 { "shared_memory_client:i:hsi", SharedMemoryClient }, |
| 139 { NULL, NULL }, | 139 { NULL, NULL }, |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 int main() { | 142 int main() { |
| 143 printf("================== CLIENT ================\n"); | 143 printf("================== CLIENT ================\n"); |
| 144 if (!NaClSrpcModuleInit()) { | 144 if (!NaClSrpcModuleInit()) { |
| 145 return 1; | 145 return 1; |
| 146 } | 146 } |
| 147 printf("================== CLIENT INIT ================\n"); | 147 printf("================== CLIENT INIT ================\n"); |
| 148 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { | 148 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { |
| 149 printf("================== CLIENT ACCEPT FAILED ================\n"); | 149 printf("================== CLIENT ACCEPT FAILED ================\n"); |
| 150 return 1; | 150 return 1; |
| 151 } | 151 } |
| 152 printf("================== CLIENT ACCEPT DONE ================\n"); | 152 printf("================== CLIENT ACCEPT DONE ================\n"); |
| 153 NaClSrpcModuleFini(); | 153 NaClSrpcModuleFini(); |
| 154 return 0; | 154 return 0; |
| 155 } | 155 } |
| OLD | NEW |