Added the AMT sample app from the IntelAMTSDK. It pulls in all cpp and
[monitor.git] / cmdamt / Include / IMRSDK.h
diff --git a/cmdamt/Include/IMRSDK.h b/cmdamt/Include/IMRSDK.h
new file mode 100644 (file)
index 0000000..0fe9cea
--- /dev/null
@@ -0,0 +1,260 @@
+// Copyright (C) Intel Corporation, 2003 - 2006.\r
+\r
+#ifndef _IMR_SDK_H_\r
+#define _IMR_SDK_H_\r
+\r
+#define EXPORTED_FUNC\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif // __cplusplus\r
+\r
+#ifndef BOOL\r
+       typedef int            BOOL;\r
+       #define TRUE                    1\r
+       #define FALSE                   0\r
+#endif\r
+\r
+#define MAX_IP_LEN                     128\r
+#define MAX_NAME_LEN           128\r
+#define MAX_COMP_NAME          128\r
+#define MAX_PSWD_LEN           128\r
+#define KEY_LEN                                20\r
+#define GUID_LEN                       16\r
+\r
+// SOL spec defines text length as maximum 255\r
+#define MAX_SOL_MESSAGE                0xFF\r
+\r
+#define INVALID_CLIENT_ID (unsigned long)-1\r
+typedef unsigned long ClientID;\r
+\r
+#define INVALID_SESSION_ID (unsigned long)-1\r
+typedef unsigned long SessionID;\r
+\r
+\r
+typedef enum {\r
+       IMR_RES_OK, \r
+       IMR_RES_ERROR, \r
+       IMR_RES_INVALID_PARAMETER,\r
+       IMR_RES_NOT_INITIALIZED,\r
+       IMR_RES_ALREADY_INITIALIZED,\r
+       IMR_RES_MEMALLOC_FAILED,\r
+       IMR_RES_UNSUPPORTED,\r
+       IMR_RES_CLIENT_NOT_FOUND,\r
+       IMR_RES_DUPLICATE_CLIENT,\r
+       IMR_RES_CLIENT_NOT_ACTIVE,\r
+       IMR_RES_CLIENT_ACTIVE,\r
+       IMR_RES_SESSION_ALREADY_OPEN,\r
+       IMR_RES_SESSION_CLOSED,\r
+       IMR_RES_SOCKET_ERROR,\r
+       IMR_RES_UNKNOWN_PROTOCOL,\r
+       IMR_RES_PROTOCOL_ALREADY_REGISTERED,\r
+       IMR_RES_PENDING,\r
+       IMR_RES_UNEXPECTED_PACKET,\r
+       IMR_RES_TIMEOUT,\r
+       IMR_RES_CORRUPT_PACKET,\r
+       IMR_RES_OS_ERROR,\r
+       IMR_RES_IDER_VERSION_NOT_SUPPORTED,\r
+       IMR_RES_IDER_COMMAND_RUNNING,\r
+       IMR_RES_STORAGE_FAILURE,\r
+       IMR_RES_UNKNOWN,\r
+       IMR_RES_AUTH_FAILED,\r
+       IMR_RES_CLIENT_TYPE_UNKNOWN,\r
+       IMR_RES_CLIENT_BUSY,\r
+       IMR_RES_CLIENT_UNSUPPORTED,\r
+       IMR_RES_CLIENT_ERROR,\r
+       IMR_RES_NOT_ENOUGH_SPACE,\r
+       IMR_RES_SESSION_LOOPBACK,\r
+       IMR_RES_TLS_CONNECTION_FAILED,\r
+\r
+       IMR_RES_COUNT,   // must be last entry\r
+} IMRResult;\r
+\r
+typedef struct {\r
+       unsigned short major;\r
+       unsigned short minor;\r
+} IMRVersion;\r
+\r
+typedef enum {CLI_TCP = 1, CLI_TLS = 2, CLI_UNKNOWN } ClientType;\r
+\r
+\r
+typedef char GUIDType[GUID_LEN];\r
+\r
+typedef struct {\r
+       ClientType      type;\r
+       char            ip[MAX_IP_LEN];\r
+       GUIDType        guid;\r
+} ClientInfo;\r
+\r
+\r
+//IN Parameter for IDER/SOL session \r
+\r
+typedef struct {\r
+       char user_name[MAX_NAME_LEN]; // user name - nul terminated string \r
+       char user_pswd[MAX_PSWD_LEN]; // user password - nul terminated string \r
+} TCPSessionParams;\r
+\r
+//IN Parameter for SOL session \r
+typedef struct {\r
+       unsigned short  tx_over_timeout;\r
+       unsigned short  tx_buf_timeout;\r
+       unsigned short  hb_interval;\r
+       unsigned short  fifo_rx_flush_timeout;\r
+       unsigned short  rx_timeout;\r
+} SOLTout; \r
+\r
+//IN Parameter for IDER session \r
+typedef struct {\r
+       unsigned short  rx_timeout;     //client host RX timeout as defined in the IDER spec.\r
+       unsigned short  tx_timeout; //client host TX timeout as defined in the IDER spec.\r
+       unsigned short  hb_timeout; //client FW HB interval  as defined in the IDER spec.\r
+} IDERTout; \r
+\r
+//OUT parameter for querying supported IDER client features\r
+typedef struct {\r
+       BOOL ider_dev_pri; //TRUE if client FW supports enable/disable of primary IDE devices\r
+       BOOL ider_dev_sec; //TRUE if client FW supports enable/disable of secondary IDE devices\r
+       BOOL reserved[30];\r
+}FeaturesSupported;\r
+\r
+typedef enum {IDER_ENABLE, IDER_DISABLE, IDER_NOP } SetOperation;\r
+//Timing options for the IDE device enabling/disabling:\r
+//ONRESET - Client should perform command at the next FW RESET.\r
+//GRACEFULLY - Client should perform command if there is no other host command in progress.\r
+//IMMEDIATELY - Client should perform command immediately.\r
+typedef enum {IDER_SET_ONRESET, IDER_SET_GRACEFULLY, IDER_SET_IMMEDIATELY,  } SetOption;\r
+\r
+typedef enum { IDER_DISABLED, IDER_ENABLED  } DeviceState;\r
+\r
+//Client returns REJECTED if there is a Host Command in progress\r
+//and the Disable/Enable command can't be performed at this time\r
+typedef enum { IDER_REJECTED, IDER_DONE } SetResult;\r
+\r
+//IN parameter for querying client IDE devices state\r
+typedef struct  {\r
+       DeviceState     pri_default;    //Default primary devices state at the Client FW\r
+       DeviceState     pri_current;    //Current primary devices state at the Client FW\r
+       DeviceState     sec_default;    //Default secondary devices state at the Client FW\r
+       DeviceState     sec_current;    //Default secondary devices state at the Client FW\r
+} IDERDeviceState;\r
+\r
+//IN paramter for changing client IDE devices state\r
+typedef struct {\r
+       SetOperation    pri_op;         //Pimary device operation (enable or disable)\r
+       SetOption               pri_timing; //Pimary device operation timing \r
+       SetOperation    sec_op;         //Not supported by the SDK yet \r
+       SetOption               sec_timing; //Not supported by the SDK yet\r
+} IDERDeviceCmd;\r
+\r
+//OUT parameter - IDERDeviceCmd execution result returned by the client\r
+typedef struct {\r
+       SetResult       pri_res;\r
+       SetResult       sec_res;\r
+} IDERDeviceResult;\r
+\r
+typedef struct {\r
+               BOOL                            error_state;    //TRUE if session is in ERROR state\r
+               BOOL                            data_transfer;  //TRUE if there is a read/write command in progress\r
+               unsigned short          num_reopen;             //number of session re-opens due to error recovery\r
+               unsigned long           num_error;              //number of ErrorOccured messages received\r
+               unsigned long           num_reset;              //number of ResetOccured messages received\r
+               unsigned long           last_cmd_length;//last data transfer (read/write) length in bytes\r
+               unsigned long           data_sent;              //bytes of data sent to the client\r
+               unsigned long           data_received;  //bytes of data received from the client\r
+               unsigned long           packets_sent;   //mesages sent during the session \r
+               unsigned long           packets_received;//messages received during the session\r
+} IDERStatistics;\r
+\r
+typedef enum {SEC_LEVEL_NONE, SEC_LEVEL_AUTH, SEC_LEVEL_ENCR, SEC_LEVEL_AUTH_ENCR } SecLevel;\r
+\r
+typedef enum { SOL_LOOPBACK_NONE = 0, SOL_LOOPBACK_RS232C = 1 } SOLLoopbackMode;\r
+\r
+\r
+//General:\r
+EXPORTED_FUNC IMRResult IMR_Init(IMRVersion *version, char *ini_file);\r
+EXPORTED_FUNC IMRResult IMR_Close();\r
+EXPORTED_FUNC IMRResult IMR_GetErrorStringLen(IMRResult, int * str_len);\r
+EXPORTED_FUNC IMRResult IMR_GetErrorString(IMRResult, char *str);\r
+EXPORTED_FUNC IMRResult IMR_SetCertificateInfo(const char *root_cert, const char *private_cert, const char *cert_pass);\r
+\r
+//Client List:\r
+EXPORTED_FUNC IMRResult IMR_AddClient( ClientType new_client_type, char *client_ip, GUIDType client_guid, ClientID *new_client_id);\r
+EXPORTED_FUNC IMRResult IMR_RemoveClient(ClientID client_id);\r
+EXPORTED_FUNC IMRResult IMR_RemoveAllClients();\r
+EXPORTED_FUNC IMRResult IMR_GetAllClients(ClientID *client_list, int *client_list_size);\r
+\r
+EXPORTED_FUNC IMRResult IMR_GetClientInfo(ClientID client_id, ClientInfo * );\r
+\r
+\r
+\r
+//SOL:\r
+EXPORTED_FUNC IMRResult IMR_SOLOpenTCPSession(ClientID  client_id, TCPSessionParams * params,\r
+                                                       SOLTout* touts , SOLLoopbackMode *loopback);\r
+EXPORTED_FUNC IMRResult IMR_SOLCloseSession(ClientID  client_id);\r
+EXPORTED_FUNC IMRResult IMR_SOLSendText(ClientID  client_id, unsigned char *data, int data_len);\r
+EXPORTED_FUNC IMRResult IMR_SOLReceiveText(ClientID  client_id, unsigned char *data, int *data_len);\r
+\r
+//IDER:\r
+\r
+//\r
+//client_id - unique client ID, as returned by the IMR_AddClient\r
+//params       - pointer to the IDER over TCP/TLS session paramters structure\r
+//touts                - pointer to the IDER over TCP/TLS session timeouts structure\r
+//drive0       - floppy drive name for the IDER over TCP/TLS session. should be null terminated.\r
+//drive1    - CD drive name for the IDER over TCP/TLS session. should be null terminated.\r
+//returns   - IMR_RES_OK on success, error otherwise.\r
+//\r
+//Use this function to establish a new IDER session with the client. \r
+//Function will create a new connection and exchange messages needed in order\r
+//to open IDER session. It will return only when the session is established, or \r
+//error occured. After the session opening client will initiate data transfers.\r
+EXPORTED_FUNC IMRResult IMR_IDEROpenTCPSession(ClientID  client_id, TCPSessionParams * params,\r
+                                                               IDERTout* touts ,\r
+                                                               char *drive0, char *drive1);\r
+//\r
+//client_id - unique client ID, as returned by the IMR_AddClient\r
+//returns   - IMR_RES_OK on success, error otherwise.\r
+//\r
+//Use this function to close an active IDER session. After the function returns\r
+//no other operations can be done succesfully on the session. Closing a session during \r
+//write data operation can cause data corruption. \r
+EXPORTED_FUNC IMRResult IMR_IDERCloseSession(ClientID  client_id);\r
+//\r
+//client_id - unique client ID, as returned by the IMR_AddClient\r
+//supported - pointer to the FeaturesSupported structure filled by the SDK\r
+//returns   - IMR_RES_OK on success, error otherwise.\r
+//Use this function to query the Client about the special features it supports.\r
+//Currently the only special feature defined is an ability to disable/enable host IDE devices.\r
+EXPORTED_FUNC IMRResult IMR_IDERClientFeatureSupported(ClientID  client_id, FeaturesSupported *supported);\r
+//\r
+//client_id - unique client ID, as returned by the IMR_AddClient\r
+//state                - pointer to the IDERDeviceState structure filled by the SDK\r
+//returns   - IMR_RES_OK on success, error otherwise.\r
+//Use this function to query host IDE device(s) state. \r
+EXPORTED_FUNC IMRResult IMR_IDERGetDeviceState(ClientID  client_id, IDERDeviceState *state);\r
+//\r
+//client_id - unique client ID, as returned by the IMR_AddClient\r
+//cmd          - pointer to the IDERDeviceCmd structure that shoudl contain disable/enable command and options\r
+//result       - pointer to the IDERDeviceResult structure filled by the SDK\r
+//returns   - IMR_RES_OK on success, error otherwise.\r
+//Use this function to control host IDE device(s) state. Devices can be disabled/enabled through\r
+//this API. \r
+EXPORTED_FUNC IMRResult IMR_IDERSetDeviceState(ClientID  client_id, IDERDeviceCmd *cmd, IDERDeviceResult *result);\r
+//\r
+//client_id - unique client ID, as returned by the IMR_AddClient\r
+//stat         - pointer to the IDERStatistics filled by the SDK\r
+//returns   - IMR_RES_OK on success, error otherwise.\r
+//\r
+//Use this functon in order to poll active IDER session.\r
+//If the IDER session for the corresponding client was closed due to timeout/protocol error\r
+//function will fill the stat structure with the latest data, but will return IMR_RES_SESSION_CLOSED.\r
+EXPORTED_FUNC IMRResult IMR_IDERGetSessionStatistics(ClientID  client_id, IDERStatistics * stat );\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif // __cplusplus\r
+\r
+#endif //_IMR_SDK_H_\r
+\r