static rw_status_t rwlogd_create_client_endpoint(rwlogd_instance_ptr_t instance) { // Create endpoint rwmsg_clichan_t *log_cli_chan; RWLOGD__INITCLIENT(&instance->rwlogd_cli); log_cli_chan = rwmsg_clichan_create(instance->rwtasklet_info->rwmsg_endpoint); rwmsg_clichan_add_service(log_cli_chan, &instance->rwlogd_cli.base); RW_ASSERT(instance->rwlogd_cli.base.rw_context); if (!instance->rwlogd_cli.base.rw_context) { return RW_STATUS_FAILURE; } RWLOGD_PEER_API__INITCLIENT(&instance->rwlogd_peer_msg_client); rwmsg_clichan_add_service(log_cli_chan, &instance->rwlogd_peer_msg_client.base); RW_ASSERT(instance->rwlogd_peer_msg_client.base.rw_context); if (!instance->rwlogd_peer_msg_client.base.rw_context) { return RW_STATUS_FAILURE; } instance->cc = log_cli_chan; return RW_STATUS_SUCCESS; }
rw_status_t rwtasklet_register_uagent_client(rwuagent_client_info_ptr_t rwuagent_info) { rw_status_t status; rwtasklet_info_ptr_t rwtasklet_info = rwuagent_info->rwtasklet_info; RW_CF_TYPE_VALIDATE(rwuagent_info, rwuagent_client_info_ptr_t); // Instantiate a Test service client and bind this to the client channel RW_UAGENT__INITCLIENT(&rwuagent_info->rwuacli); RW_ASSERT(rwtasklet_info->rwmsg_endpoint); // Create a client channel pointing at the Test service's path // Instantiate a Test service client and connect this to the client channel rwuagent_info->dest = rwmsg_destination_create(rwtasklet_info->rwmsg_endpoint, RWMSG_ADDRTYPE_UNICAST, RWUAGENT_PATH); RW_ASSERT(rwuagent_info->dest); // Create a client channel that rwcli uses to recieve messages rwuagent_info->cc = rwmsg_clichan_create(rwtasklet_info->rwmsg_endpoint); RW_ASSERT(rwuagent_info->cc); // Bind a single service for uagent rwmsg_clichan_add_service(rwuagent_info->cc, &rwuagent_info->rwuacli.base); // Bind this srvchan to rwsched's taskletized cfrunloop // This will result in events executing in the cfrunloop context // rwsched_CFRunLoopRef runloop = rwsched_tasklet_CFRunLoopGetCurrent(tenv.rwsched); status = rwmsg_clichan_bind_rwsched_cfrunloop(rwuagent_info->cc, rwtasklet_info->rwsched_tasklet_info); RW_ASSERT(status == RW_STATUS_SUCCESS); return status; }