Example #1
0
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);
}
Example #2
0
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);
}