static Bool RpcInSend(RpcIn *in, // IN int flags) // IN { Bool status; Bool useBackdoor = TRUE; ASSERT(in); ASSERT(in->mustSend); #if defined(VMTOOLS_USE_VSOCKET) if (in->conn != NULL) { useBackdoor = FALSE; status = RpcInConnSend(in->conn, in->last_result, in->last_resultLen, flags); } #endif if (useBackdoor) { ASSERT(in->channel); status = Message_Send(in->channel, (unsigned char *)in->last_result, in->last_resultLen); } if (status == FALSE) { Debug("RpcIn: couldn't send back the last result\n"); } free(in->last_result); in->last_result = NULL; in->last_resultLen = 0; in->mustSend = FALSE; return status; }
Bool RpcOut_send(RpcOut *out, // IN char const *request, // IN size_t reqLen, // IN char const **reply, // OUT size_t *repLen) // OUT { unsigned char *myReply; size_t myRepLen; Bool success; ASSERT(out); ASSERT(out->channel); if (out->channel == NULL) { *reply = "RpcOut: Channel is not active"; *repLen = strlen(*reply); return FALSE; } if (Message_Send(out->channel, (const unsigned char *)request, reqLen) == FALSE) { *reply = "RpcOut: Unable to send the RPCI command"; *repLen = strlen(*reply); return FALSE; } if (Message_Receive(out->channel, &myReply, &myRepLen) == FALSE) { *reply = "RpcOut: Unable to receive the result of the RPCI command"; *repLen = strlen(*reply); return FALSE; } if (myRepLen < 2 || ( (success = strncmp((const char *)myReply, "1 ", 2) == 0) == FALSE && strncmp((const char *)myReply, "0 ", 2))) { *reply = "RpcOut: Invalid format for the result of the RPCI command"; *repLen = strlen(*reply); return FALSE; } *reply = ((const char *)myReply) + 2; *repLen = myRepLen - 2; return success; }