当前位置: 首页>>代码示例>>C++>>正文


C++ MobiCoreDevice类代码示例

本文整理汇总了C++中MobiCoreDevice的典型用法代码示例。如果您正苦于以下问题:C++ MobiCoreDevice类的具体用法?C++ MobiCoreDevice怎么用?C++ MobiCoreDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MobiCoreDevice类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processCloseDevice

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::processCloseDevice(
    Connection  *connection
) {
	do
	{
		// there is no payload to read

		// Device required
		MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);
		if (NULL == device)
		{
			LOG_E("processCloseDevice(): no device");
			writeResult(connection, MC_DRV_RSP_DEVICE_NOT_OPENED);
			break;
		}

		// No command data will be read
		// Unregister device object with connection
		device->close(connection);

		// there is no payload
		writeResult(connection, MC_DRV_RSP_OK);

	} while (false);
}
开发者ID:Hunter78rus,项目名称:tee-mobicore-driver,代码行数:26,代码来源:MobiCoreDriverDaemon.cpp

示例2: RECV_PAYLOAD_FROM_CLIENT

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::processOpenDevice(Connection *connection)
{
    MC_DRV_CMD_OPEN_DEVICE_struct cmdOpenDevice;
    RECV_PAYLOAD_FROM_CLIENT(connection, &cmdOpenDevice);

    // Check if device has been registered to the connection
    MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);
    if (NULL != device) {
        LOG_E("processOpenDevice(): device already set");
        writeResult(connection, MC_DRV_ERR_DEVICE_ALREADY_OPEN);
        return;
    }

    LOG_I(" Opening deviceId %d ", cmdOpenDevice.deviceId);

    // Get device for device ID
    device = getDevice(cmdOpenDevice.deviceId);

    // Check if a device for the given name has been found
    if (device == NULL) {
        LOG_E("invalid deviceId");
        writeResult(connection, MC_DRV_ERR_UNKNOWN_DEVICE);
        return;
    }

    // Register device object with connection
    device->open(connection);

    // Return result code to client lib (no payload)
    writeResult(connection, MC_DRV_OK);
}
开发者ID:Fevax,项目名称:android_hardware_samsung_slsi-cm_exynos8890,代码行数:32,代码来源:MobiCoreDriverDaemon.cpp

示例3: processGetMobiCoreVersion

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::processGetMobiCoreVersion(
    Connection  *connection
)
{
    // there is no payload to read

    // Device required
    MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);
    CHECK_DEVICE(device, connection);

    // Get <t-base version info from secure world.
    mcDrvRspGetMobiCoreVersion_t rspGetMobiCoreVersion;

    mcResult_t mcResult = device->getMobiCoreVersion(&rspGetMobiCoreVersion.payload);

    if (mcResult != MC_DRV_OK) {
        LOG_V("MC GET_MOBICORE_VERSION returned code %d", mcResult);
        writeResult(connection, mcResult);
        return;
    }

    rspGetMobiCoreVersion.header.responseId = MC_DRV_OK;
    connection->writeData(
        &rspGetMobiCoreVersion,
        sizeof(rspGetMobiCoreVersion));
}
开发者ID:Fevax,项目名称:android_hardware_samsung_slsi-cm_exynos8890,代码行数:27,代码来源:MobiCoreDriverDaemon.cpp

示例4: sizeof

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::processCloseSession(
    Connection  *connection
) {
	do
	{
		// Read entire command data
		mcDrvCmdCloseSessionPayload_t  cmdCloseSessionPayload;
		uint32_t rlen = connection->readData(
							&cmdCloseSessionPayload,
							sizeof(cmdCloseSessionPayload));
		if (rlen != sizeof(cmdCloseSessionPayload))
		{
			LOG_E("processCloseSession(): CloseSessionPayload length error: %d",rlen);
			writeResult(connection, MC_DRV_RSP_PAYLOAD_LENGTH_ERROR);
			break;
		}

		// Device required
		MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);
		if (NULL == device)
		{
			LOG_E("processCloseSession(): device is NULL");
			writeResult(connection, MC_DRV_RSP_DEVICE_NOT_OPENED);
			break;
		}

		device->closeSession(
					connection,
					cmdCloseSessionPayload.sessionId);

		// there is no payload
		writeResult(connection, MC_DRV_RSP_OK);

	} while (false);
}
开发者ID:Hunter78rus,项目名称:tee-mobicore-driver,代码行数:36,代码来源:MobiCoreDriverDaemon.cpp

示例5: sizeof

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::processNotify(Connection  *connection)
{
    // Read entire command data
    MC_DRV_CMD_NOTIFY_struct  cmd;
    //RECV_PAYLOAD_FROM_CLIENT(connection, &cmd);
    void *payload = (void *)((uintptr_t)&cmd + sizeof(mcDrvCommandHeader_t));
    uint32_t payload_len = sizeof(cmd) - sizeof(mcDrvCommandHeader_t);
    uint32_t rlen = connection->readData(payload, payload_len);
    if ((int) rlen < 0) {
        LOG_E("reading from Client failed");
        /* it is questionable, if writing to broken socket has any effect here. */
        // NOTE: notify fails silently
        //writeResult(connection, MC_DRV_RSP_SOCKET_ERROR);
        return;
    }
    if (rlen != payload_len) {
        LOG_E("wrong buffer length %i received from Client", rlen);
        // NOTE: notify fails silently
        //writeResult(connection, MC_DRV_RSP_PAYLOAD_LENGTH_ERROR);
        return;
    }

    // Device required
    MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);
    if (NULL == device) {
        LOG_V("%s: no device associated with connection", __FUNCTION__);
        // NOTE: notify fails silently
        // writeResult(connection,MC_DRV_RSP_DEVICE_NOT_OPENED);
        return;
    }

    device->notify(connection, cmd.sessionId);
    // NOTE: for notifications there is no response at all
}
开发者ID:Fevax,项目名称:android_hardware_samsung_slsi-cm_exynos8890,代码行数:35,代码来源:MobiCoreDriverDaemon.cpp

示例6: processGetMobiCoreVersion

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::processGetMobiCoreVersion(
    Connection  *connection
) {
	// Device required
	MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);
	if (NULL == device) {
		writeResult(connection, MC_DRV_RSP_DEVICE_NOT_OPENED);
		return;
	}

	// Get MobiCore version info from secure world.
	mcDrvRspGetMobiCoreVersion_t rspGetMobiCoreVersion;

	device->getMobiCoreVersion(
		&rspGetMobiCoreVersion.payload);

	uint32_t mcResult = rspGetMobiCoreVersion.payload.mcResult;
	if (MC_MCP_RET_OK != mcResult) {
		LOG_E("processGetMobiCoreVersion(): rspGetMobiCoreVersion mcResult %d", mcResult);
		writeResult(connection, MC_DRV_RSP_FAILED);
		return;
	}

	rspGetMobiCoreVersion.header.responseId = MC_DRV_RSP_OK;
	connection->writeData(
		&rspGetMobiCoreVersion,
		sizeof(rspGetMobiCoreVersion));
}
开发者ID:Hunter78rus,项目名称:tee-mobicore-driver,代码行数:29,代码来源:MobiCoreDriverDaemon.cpp

示例7: dropConnection

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::dropConnection(
    Connection *connection
) {
	// Check if a Device has already been registered with the connection
	MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);

	if (device != NULL) {
		LOG_I("dropConnection(): closing still open device.");
		// A connection has been found and has to be closed
		device->close(connection);
	}
}
开发者ID:Hunter78rus,项目名称:tee-mobicore-driver,代码行数:13,代码来源:MobiCoreDriverDaemon.cpp

示例8: processCloseDevice

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::processCloseDevice(
    Connection  *connection
)
{
    // there is no payload to read

    // Device required
    MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);
    CHECK_DEVICE(device, connection);

    // No command data will be read
    // Unregister device object with connection
    device->close(connection);

    // there is no payload
    writeResult(connection, MC_DRV_OK);
}
开发者ID:Fevax,项目名称:android_hardware_samsung_slsi-cm_exynos8890,代码行数:18,代码来源:MobiCoreDriverDaemon.cpp

示例9: dropConnection

//------------------------------------------------------------------------------
void MobiCoreDriverDaemon::dropConnection(
    Connection *connection
)
{
    // Check if a Device has already been registered with the connection
    MobiCoreDevice *device = (MobiCoreDevice *) (connection->connectionData);

    if (device != NULL) {
        // A connection has been found and has to be closed
        LOG_I("dropConnection(): closing still open device.");

        // Make sure nobody else writes the MCP, e.g. netlink/socket server, cleanup of TAs
        device->mutex_mcp.lock();
        device->close(connection);
        device->mutex_mcp.unlock();
    }
}
开发者ID:Fevax,项目名称:android_hardware_samsung_slsi-cm_exynos8890,代码行数:18,代码来源:MobiCoreDriverDaemon.cpp

示例10: getDevice

//------------------------------------------------------------------------------
mcResult_t MobiCoreDriverDaemon::processLoadCheck(mcSpid_t spid, void *blob, uint32_t size)
{

    // Device required
    MobiCoreDevice  *device = getDevice(MC_DEVICE_ID_DEFAULT);

    if (device == NULL) {
        LOG_E(" No device found");
        return MC_DRV_ERR_DAEMON_DEVICE_NOT_OPEN;
    }

    // Get service blob from registry
    regObject_t *regObj = mcRegistryMemGetServiceBlob(spid, blob, size);
    if (NULL == regObj) {
        LOG_E(" mcRegistryMemGetServiceBlob failed");
        return MC_DRV_ERR_TRUSTLET_NOT_FOUND;
    }
    if (regObj->len == 0) {
        free(regObj);
        LOG_E("mcRegistryMemGetServiceBlob returned registry object with length equal to zero");
        return MC_DRV_ERR_TRUSTLET_NOT_FOUND;
    }
    LOG_I(" Sharing Service loaded at %p with Secure World", (addr_t)(regObj->value));

    CWsm_ptr pWsm = device->registerWsmL2((addr_t)(regObj->value), regObj->len, 0);
    if (pWsm == NULL) {
        // Free memory occupied by Trustlet data
        free(regObj);
        LOG_E("allocating WSM for Trustlet failed");
        return MC_DRV_ERR_DAEMON_KMOD_ERROR;
    }
    // Initialize information data of open session command
    loadDataOpenSession_t loadDataOpenSession;
    loadDataOpenSession.baseAddr = pWsm->physAddr;
    loadDataOpenSession.offs = ((uintptr_t) regObj->value) & 0xFFF;
    loadDataOpenSession.len = regObj->len;
    loadDataOpenSession.tlHeader = (mclfHeader_ptr) (regObj->value + regObj->tlStartOffset);

    mcDrvRspOpenSession_t rspOpenSession;
    mcResult_t ret = device->checkLoad(
                         &loadDataOpenSession,
                         &rspOpenSession.payload);

    // Unregister physical memory from kernel module.
    LOG_I(" Service buffer was copied to Secure world and processed. Stop sharing of buffer.");

    // This will also destroy the WSM object.
    if (!device->unregisterWsmL2(pWsm)) {
        // Free memory occupied by Trustlet data
        free(regObj);
        LOG_E("deallocating WSM for Trustlet failed");
        return MC_DRV_ERR_DAEMON_KMOD_ERROR;
    }

    // Free memory occupied by Trustlet data
    free(regObj);

    if (ret != MC_DRV_OK) {
        LOG_E("TA could not be loaded.");
        return ret;
    } else {
        return MC_DRV_OK;
    }
}
开发者ID:Fevax,项目名称:android_hardware_samsung_slsi-cm_exynos8890,代码行数:65,代码来源:MobiCoreDriverDaemon.cpp


注:本文中的MobiCoreDevice类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。