bool_t rpc_build_lookup(const RPC_XdrInfo_t *tbl, UInt16 table_size, UInt16 clientIndex) { bool_t bRetVal = TRUE; if (tableBase == NULL) { tableBase = (UInt32 **)capi2_malloc(256 * sizeof(UInt32)); if (tableBase) { int i; for (i = 0; i < 256; i++) tableBase[i] = 0; } } if (tableBase) { int i; for (i = 0; i < (int)(table_size); i++) { unsigned short id = (unsigned short)tbl[i].msgType; unsigned short id1 = ((unsigned short)((id & (unsigned short)0xff00) >> 8)); unsigned short id2 = id & ((unsigned short)0x00ff); UInt32 *tableBase2 = NULL; if (tableBase[id1] == 0) { int j; tableBase[id1] = (UInt32 *)capi2_malloc(256 * sizeof(UInt32)); tableBase2 = tableBase[id1]; if (tableBase2) { for (j = 0; j < 256; j++) tableBase2[j] = 0xFFFF; } } tableBase2 = tableBase[id1]; if (tableBase2 == 0) { bRetVal = FALSE; } else { UInt32 val = 0; // if(tableBase2[id2] != 0xFFFF) // _DBG_(RPC_TRACE("xdr_build_lookup duplicate entry = 0x%x, 0x%x, 0x%x\r\n", id, id1, id2)); val = (UInt32)((UInt32) ((clientIndex << 16) & 0xFFFF0000) | (UInt32)(((UInt16)i) & 0xFFFF)); tableBase2[id2] = val; //_DBG_(RPC_TRACE("rpc_build_lookup = 0x%x, 0x%x, 0x%x\r\n", id, id1, id2)); } } } else {
static Boolean rpc_build_lookup_msgs(UInt16 *tbl, UInt32 table_size, UInt32 mask) { Boolean bRetVal = TRUE; if (tableBase == NULL) { tableBase = (UInt32 **) capi2_malloc(256 * sizeof(UInt32)); if (tableBase) { int i; for (i = 0; i < 256; i++) tableBase[i] = 0; } } if (tableBase) { int i; for (i = 0; i < (int)(table_size); i++) { unsigned short id = (unsigned short)tbl[i]; unsigned short id1 = ((unsigned short)((id & (unsigned short)0xff00) >> 8)); unsigned short id2 = id & ((unsigned short)0x00ff); UInt32 *tableBase2 = NULL; if (tableBase[id1] == 0) { int j; tableBase[id1] = (UInt32 *) capi2_malloc(256 * sizeof(UInt32)); tableBase2 = tableBase[id1]; if (tableBase2) { for (j = 0; j < 256; j++) tableBase2[j] = 0xFFFF; } } tableBase2 = tableBase[id1]; if (tableBase2 == 0) { bRetVal = FALSE; } else { if (tableBase2[id2] == 0xFFFF) tableBase2[id2] = 0; tableBase2[id2] |= mask; /*_DBG_(RPC_TRACE("rpc_build_lookup = 0x%x, 0x%x, 0x%x\r\n", id, id1, id2));*/ } } } else {
void RPC_HandleEvent(void *eventHandle) { UInt8 clientId = 0; ResultDataBuffer_t *dataBuf; Result_t res = RESULT_OK; PACKET_BufHandle_t bufHandle = (PACKET_BufHandle_t) eventHandle; dataBuf = capi2_malloc(sizeof(ResultDataBuffer_t)); if (dataBuf) { dataBuf->refCount = 1; res = RPC_DeserializeMsg(RPC_PACKET_GetBufferData(bufHandle), RPC_PACKET_GetBufferLength(bufHandle), dataBuf); if (res == RESULT_OK) { Boolean isUnsolicited; UInt8 clientIndex = GetClientIndex(dataBuf, &isUnsolicited); clientId = RPC_SYS_GetClientID(clientIndex); RPC_USER_LOCK(gRpcLock); RPC_DispatchMsg(dataBuf); RPC_USER_UNLOCK(gRpcLock); } else { capi2_free(dataBuf); } } RPC_PACKET_FreeBufferEx(bufHandle, clientId); }
void RPC_HandleEvent(void* eventHandle) { ResultDataBuffer_t* dataBuf; Result_t res = RESULT_OK; PACKET_BufHandle_t bufHandle = (PACKET_BufHandle_t)eventHandle; dataBuf = capi2_malloc(sizeof(ResultDataBuffer_t)); if(dataBuf) { dataBuf->refCount = 1; res = RPC_DeserializeMsg(RPC_PACKET_GetBufferData(bufHandle), RPC_PACKET_GetBufferLength(bufHandle),dataBuf); if(res == RESULT_OK) { RPC_DispatchMsg(dataBuf); } } RPC_PACKET_FreeBuffer(bufHandle); }