Intel

Developer Zone

Host Interface CPP

For developing your cross platform Intel® Host Interface Service to communicate with your host application.

For explanations of error and return codes, refer to https://github.com/intel/dynamic-application-loader-host-interface/blob/master/common/include/jhi.h

Enumerations

enum   _JHI_COMMUNICATION_TYPE { JHI_SOCKETS = 0, JHI_HECI = 1 }
  JHI Version info.
 
enum   _JHI_EVENT_DATA_TYPE { JHI_DATA_FROM_APPLET = 0, JHI_DATA_FROM_SERVICE = 1 }
  JHI Events.
 
enum   _JHI_PLATFROM_ID { ME = 0, VLV = 1, INVALID_PLATFORM_ID = 3 }
  this enum lists the platfom types that are supported by JHI
 
enum   _JHI_SESSION_STATE { JHI_SESSION_STATE_ACTIVE = 0, JHI_SESSION_STATE_NOT_EXISTS = 1 }
  Session info. JHI_SESSION_STATE_ACTIVE = 0: The session is active. JHI_SESSION_STATE_NOT_EXISTS = 1: The session does not exist.
 

Functions

JHI_EXPORT JHI_CloseSession (IN const JHI_HANDLE handle, IN JHI_SESSION_HANDLE *pSessionHandle)
  Function: JHI_CloseSession.
 
JHI_EXPORT JHI_CreateSession (IN const JHI_HANDLE handle, IN const char *AppId, IN UINT32 flags, IN DATA_BUFFER *initBuffer, OUT JHI_SESSION_HANDLE *pSessionHandle)
  Function: JHI_CreateSession.
 
JHI_EXPORT JHI_Deinit (IN JHI_HANDLE handle)
  Function: JHI_Deinit.
 
JHI_EXPORT JHI_GetAppletProperty (IN JHI_HANDLE handle, IN char *AppId, INOUT JVM_COMM_BUFFER *pComm)
  Function: JHI_GetAppletProperty.
 
JHI_EXPORT JHI_GetSessionInfo (IN const JHI_HANDLE handle, IN JHI_SESSION_HANDLE SessionHandle, OUT JHI_SESSION_INFO *SessionInfo)
  Function: JHI_GetSessionInfo.
 
JHI_EXPORT JHI_GetSessionsCount (IN const JHI_HANDLE handle, IN const char *AppId, OUT UINT32 *SessionsCount)
  Function: JHI_GetSessionsCount.
 
JHI_EXPORT JHI_GetVersionInfo (IN const JHI_HANDLE handle, OUT JHI_VERSION_INFO *pVersionInfo)
  Function: JHI_GetVersionInfo.
 
JHI_EXPORT JHI_Initialize (OUT JHI_HANDLE *ppHandle, IN PVOID context, IN UINT32 flags)
  Function Prototypes.
 
JHI_EXPORT JHI_Install2 (IN const JHI_HANDLE handle, IN const char *AppId, IN const FILECHAR *srcFile)
  Function: JHI_Install.
 
JHI_EXPORT JHI_RegisterEvents (IN const JHI_HANDLE handle, IN SessionHandle, IN JHI_EventFunc pEventFunction)
  Function: JHI_RegisterEvent.
 
JHI_EXPORT JHI_SendAndRecv2 (IN JHI_HANDLE handle, IN JHI_SESSION_HANDLE SessionHandle, IN INT32 nCommandId, INOUT JVM_COMM_BUFFER *pComm, OUT INT32 *responseCode)
  Function: JHI_SendAndRecv.
 
JHI_EXPORT JHI_Uninstall (IN JHI_HANDLE handle, IN char *AppId)
  Function: JHI_Uninstall.
 
JHI_EXPORT JHI_UnRegisterEvents (IN const JHI_HANDLE handle, IN JHI_SESSION_HANDLE SessionHandle)
  Function: JHI_UnRegisterEvent.
 

Detailed Description

Defines exported interfaces for JHI.DLL.

Macro Definition Documentation

 

#define JHI_APPID_NOT_EXIST   0x402

 

#define JHI_APPLET_FATAL   0x400
 

 

#define JHI_APPLET_NOT_INSTALLED   JHI_APPID_NOT_EXIST
 

 

#define JHI_APPLET_PROPERTY_NOT_SUPPORTED   0x1013
 

 

#define JHI_APPLET_TIMEOUT   0x401

The virtual machine will kill the applet in Intel DAL and return an error code. This error will be returned if the TA execution time exceeds the time allowed in the TA’s manifest. In this case, the TA execution will be terminated, and its session will be closed.

 

#define JHI_BUFFER_MAX   2097152

Buffer size limitation is 2MB. JHI will not accept a larger buffer.

Note that this size limitation does not mark the maximum buffer size that an applet can receive, applet max buffer size varies from one applet to another. This applies to all JHI API functions that use buffers (e.g., SendAndRecieve, CreateSession, GetAppletProperty).

 

#define JHI_COMMS_ERROR   0x300
 

 

#define JHI_DELETE_FROM_REPOSITORY_FAILURE   JHI_FILE_ERROR_DELETE
 

 

#define JHI_ERROR_LOGGING   0x500
 

 

#define JHI_ERROR_REGISTRY   0x501
 

 

#define JHI_ERROR_REPOSITORY_NOT_FOUND   0x1000
 

 

#define JHI_EVENTS_NOT_SUPPORTED   0x1012
 

 

#define JHI_EXPORT   __declspec(dllexport) JHI_RET

Define Linkage for the functions.

 

#define JHI_FILE_ERROR_AUTH   0x102

Attempted to load the file, but firmware returned a manifest failure check and rejected it

 

#define JHI_FILE_ERROR_COPY   0x103
 

 

#define JHI_FILE_ERROR_DELETE   0x104

Unable to remove file corresponding to the UUID in uninstall. Possibly permissions issue

 

#define JHI_FILE_ERROR_OPEN   0x106
 

 

#define JHI_FILE_IDENTICAL   0x108
 

 

#define JHI_FILE_INVALID   0x105

Invalid file - bad characters or larger than 64K.

 

#define JHI_FILE_MISSING_SRC   0x101

JHI 7.1 return codes - not used in 8.0 and above (backward compatibility only), JHI 8.0 return codes are listed below.

Source File not found in install/uninstall or unable to load file in SendAndRecv.

 

#define JHI_FILE_NOT_FOUND   JHI_FILE_MISSING_SRC

Could not find the specified dalp file

 

 

#define JHI_FILE_UUID_MISMATCH   0x107
 

 

#define JHI_ILLEGAL_VALUE   0x204
 

 

#define JHI_INSTALL_FAILED   0x1009
 

 

#define JHI_INSTALL_FAILURE_SESSIONS_EXISTS   0x1008
 

 

#define JHI_INSUFFICIENT_BUFFER   0x200
 

 

#define JHI_INTERNAL_ERROR   0x601
 

 

#define JHI_INVALID_APPLET_GUID   JHI_ILLEGAL_VALUE
 

 

#define JHI_INVALID_BUFFER_SIZE   0x1001
 

 

#define JHI_INVALID_COMM_BUFFER   0x1002
 

 

#define JHI_INVALID_COMMAND   0x202
 

 

#define JHI_INVALID_FILE_EXTENSION   0x1007
 

 

#define JHI_INVALID_HANDLE   0x201
 

 

#define JHI_INVALID_INIT_BUFFER   0x1006
 

 

#define JHI_INVALID_INSTALL_FILE   0x1003
 

 

#define JHI_INVALID_PACKAGE_FORMAT   0x1005
 

 

#define JHI_INVALID_PARAMS   0x203
 

 

#define JHI_INVALID_SESSION_HANDLE   0x100F
 

 

#define JHI_INVALID_SPOOLER   0x1015
 

 

#define JHI_JOM_ERROR_DOWNLOAD   0x405
 

 

#define JHI_JOM_ERROR_UNLOAD   0x406
 

 

#define JHI_JOM_FATAL   0x403
 

 

#define JHI_JOM_OVERFLOW   0x404
 

 

#define JHI_MAX_INSTALLED_APPLETS_REACHED   JHI_JOM_OVERFLOW
 

 

#define JHI_MAX_SESSIONS_REACHED   0x100C
 

 

#define JHI_MAX_SHARED_SESSION_REACHED   0x100E
 

 

#define JHI_NO_CONNECTION_TO_FIRMWARE   JHI_COMMS_ERROR
 

 

#define JHI_NO_FLAGS   0

No flags to be used.

 

#define JHI_READ_FROM_FILE_FAILED   0x1004
 

 

#define JHI_SERVICE_INVALID_GUID   0x302

Invalid COM GUID (from DLL)

 

#define JHI_SERVICE_UNAVAILABLE   0x301
 

 

#define JHI_SESSION_ALREADY_REGSITERED   0x1011
 

 

#define JHI_SESSION_NOT_REGISTERED   0x1010

Trying to unregister a session that is not registered for events.

 

#define JHI_SHARED_SESSION   1
 

 

#define JHI_SHARED_SESSION_NOT_SUPPORTED   0x100D
 

 

#define JHI_SPOOLER_NOT_FOUND   0x1014
 

 

#define JHI_SUCCESS   0x00
 

 

#define JHI_UNINSTALL_FAILURE_SESSIONS_EXISTS   0x100A
 

 

#define JHI_UNKNOWN_ERROR   0x600
 

 

#define JHI_VM_DLL_FILE_NOT_FOUND   0x1016
 

 

#define JHI_VM_DLL_VERIFY_FAILED   0x1017
 

 

#define MAJOR_APPLET_VER (   num)      ((UINT8) (num & 0x000000FFUL))

Extract Applet Major Version from a VM integer representation (num)

 

#define MINOR_APPLET_VER (   num)      ((UINT8) ((num & 0x0000FF00UL) >> 8))

Extract Applet Minor Version from a VM integer representation (num)

 

#define MK_APPLET_VER (   maj,
      min 
  )    
Value:
( (UINT32) \
(maj & 0x000000FFUL) | \
((min << 8) & 0x0000FF00UL) & \
(0x0000FFFFUL) )

Applet version macros.

While applet version is represented in a Major.Minor format (i.e., 1.0), the VM representation of an applet version (that can be obtained using JHI_GetAppletProperty) is an integer that combines both the major and minor versions. The following macros perform the transition between the two representations:

 

#define VERSION_BUFFER_SIZE   50
 

Typedef Documentation

 

typedef enum _JHI_COMMUNICATION_TYPE JHI_COMMUNICATION_TYPE

JHI Version info.

This enum lists the communication types that are used by JHI in order to communicate with the firmware

 

typedef enum _JHI_EVENT_DATA_TYPE JHI_EVENT_DATA_TYPE

JHI Events.

This enum lists the types of data received by the JHI event

 

typedef void(* JHI_EventFunc)(JHI_SESSION_HANDLE SessionHandle, JHI_EVENT_DATA EventData)

This is the format for a callback function that is used in order to receive session events.

 

typedef PVOID JHI_HANDLE

Common & External Interfaces.

 

typedef enum _JHI_PLATFROM_ID JHI_PLATFROM_ID

This enum lists the platfom types that are supported by JHI

 

typedef UINT32 JHI_RET
 

 

typedef PVOID JHI_SESSION_HANDLE
 

 

typedef enum _JHI_SESSION_STATE JHI_SESSION_STATE

Session info.

This enum lists the states of a session

Enumeration Type Documentation

 

enum _JHI_COMMUNICATION_TYPE

JHI Version info.

This enum lists the communication types that are used by JHI in order to communicate with the firmware

Enumerator
JHI_SOCKETS  
JHI_HECI

communication by sockets

 

enum _JHI_EVENT_DATA_TYPE

JHI Events.

This enum lists the types of data received by JHI events

Enumerator
JHI_DATA_FROM_APPLET  
JHI_DATA_FROM_SERVICE

the event raised by an applet session

 

enum _JHI_PLATFROM_ID

This enum lists the platfom types that are supported by JHI

Enumerator
ME  
VLV  
INVALID_PLATFORM_ID  

 

enum _JHI_SESSION_STATE

Session info.

this enum lists the states of a session

Enumerator
JHI_SESSION_STATE_ACTIVE

 
JHI_SESSION_STATE_NOT_EXISTS

the session is active

Function Documentation

 

JHI_EXPORT JHI_CloseSession ( IN const JHI_HANDLE handle,
    IN JHI_SESSION_HANDLE *  pSessionHandle
  )    

Function: JHI_CloseSession.

 

JHI_EXPORT JHI_CreateSession ( IN const JHI_HANDLE handle,
    IN const char *  AppId,
    IN UINT32 flags,
    IN DATA_BUFFER *  initBuffer,
    OUT JHI_SESSION_HANDLE *  pSessionHandle
  )    

Function: JHI_CreateSession.

 

JHI_EXPORT JHI_Deinit ( IN JHI_HANDLE handle)    

Function: JHI_Deinit.

 

JHI_EXPORT JHI_GetAppletProperty ( IN JHI_HANDLE handle,
    IN char *  AppId,
    INOUT JVM_COMM_BUFFER *  pComm
  )    

Function: JHI_GetAppletProperty.

		JVM_COMM_BUFFER appletProperty;		
	        wchar_t rxBuf[1000];
		char* ta_id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
		appletProperty.RxBuf->buffer = rxBuf;
		appletProperty.RxBuf->length = sizeof(rxBuf);
		wchar * txBuf = L"applet.name";
		appletProperty.TxBuf->buffer = txBuf;
		appletProperty.TxBuf->length = wcslen(txBuf);
		JHI_RET jhiRet = JHI_GetAppletProperty(jhi_handle, ta_id, &appletProperty);
	

 

JHI_EXPORT JHI_GetSessionInfo ( IN const JHI_HANDLE handle,
    IN JHI_SESSION_HANDLE SessionHandle,
    OUT JHI_SESSION_INFO *  SessionInfo
  )    

Function: JHI_GetSessionInfo.

 

JHI_EXPORT JHI_GetSessionsCount ( IN const JHI_HANDLE handle,
    IN const char *  AppId,
    OUT UINT32 SessionsCount
  )    

Function: JHI_GetSessionsCount.

 

JHI_EXPORT JHI_GetVersionInfo ( IN const JHI_HANDLE handle,
    OUT JHI_VERSION_INFO *  pVersionInfo
  )    

Function: JHI_GetVersionInfo.

 

JHI_EXPORT JHI_Initialize ( OUT JHI_HANDLE *  ppHandle,
    IN PVOID context,
    IN UINT32 flags
  )    

Function Prototypes.

Function: JHI_Initialize

 

JHI_EXPORT JHI_Install2 ( IN const JHI_HANDLE handle,
    IN const char *  AppId,
    IN const FILECHAR srcFile
  )    

Function: JHI_Install.

 

JHI_EXPORT JHI_RegisterEvents ( IN const JHI_HANDLE handle,
    IN JHI_SESSION_HANDLE SessionHandle,
    IN JHI_EventFunc pEventFunction
  )    

Function: JHI_RegisterEvent.

 

JHI_EXPORT JHI_SendAndRecv2 ( IN JHI_HANDLE handle,
    IN JHI_SESSION_HANDLE SessionHandle,
    IN INT32 nCommandId,
    INOUT JVM_COMM_BUFFER *  pComm,
    OUT INT32 responseCode
  )    

Function: JHI_SendAndRecv.

 

JHI_EXPORT JHI_Uninstall ( IN JHI_HANDLE handle,
    IN char *  AppId
  )    

Function: JHI_Uninstall.

 

JHI_EXPORT JHI_UnRegisterEvents ( IN const JHI_HANDLE handle,
    IN JHI_SESSION_HANDLE SessionHandle
  )    

Function: JHI_UnRegisterEvent.