Browse Source

resolve merge

lusa 5 years ago
parent
commit
d952dd002b
61 changed files with 2760 additions and 2605 deletions
  1. 63 0
      app/bmc/Api.c
  2. 3 0
      app/bmc/Api.h
  3. BIN
      app/bmc/bmc_app
  4. BIN
      app/bmc/bmc_app.gdb
  5. 0 306
      app/bmc/libipmi_struct.h
  6. 0 1
      app/bmc/msghndlr/App/App.c
  7. 0 1
      app/bmc/msghndlr/App/AppDevice/AppDevice.c
  8. 1 10
      app/bmc/msghndlr/Storage/SELRecord.h
  9. 1 0
      app/bmc/readme.txt
  10. 78 4
      app/common_include/com_IPMIDefs.h
  11. 234 0
      app/common_include/com_IPMI_AppDevice+.h
  12. 68 0
      app/common_include/com_IPMI_IPMB.h
  13. 0 1
      app/common_include/com_IPMI_LANConfig.h
  14. 2 7
      app/common_include/com_IPMI_SDRRecord.h
  15. 11 0
      app/common_include/com_IPMI_SEL.h
  16. 1 1
      app/goahead-5.1.0/build/linux-arm-static/.makeflags
  17. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/goahead
  18. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test
  19. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test.gdb
  20. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/goahead.gdb
  21. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/gopass
  22. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/gopass.gdb
  23. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/libgo.a
  24. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/libgoahead-mbedtls.a
  25. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/libmbedtls.a
  26. 9 1
      app/goahead-5.1.0/build/linux-arm-static/inc/goahead.h
  27. 234 15
      app/goahead-5.1.0/projects/goahead-linux-static.mk
  28. 2 2
      app/goahead-5.1.0/src/goahead.c
  29. 9 1
      app/goahead-5.1.0/src/goahead.h
  30. 34 546
      app/goahead-5.1.0/src/libipmi/inc/libipmi.h
  31. 11 12
      app/goahead-5.1.0/src/libipmi/inc/libipmi_AppDevice.h
  32. 10 11
      app/goahead-5.1.0/src/libipmi/inc/libipmi_ChassisDevice.h
  33. 20 21
      app/goahead-5.1.0/src/libipmi/inc/libipmi_PEF.h
  34. 28 31
      app/goahead-5.1.0/src/libipmi/inc/libipmi_StorDevice.h
  35. 0 474
      app/goahead-5.1.0/src/libipmi/inc/libipmi_XportDevice.h
  36. 5 6
      app/goahead-5.1.0/src/libipmi/inc/libipmi_fru.h
  37. 21 30
      app/goahead-5.1.0/src/libipmi/inc/libipmi_rmcp.h
  38. 22 22
      app/goahead-5.1.0/src/libipmi/inc/libipmi_sdr.h
  39. 37 38
      app/goahead-5.1.0/src/libipmi/inc/libipmi_sensor.h
  40. 3 2
      app/goahead-5.1.0/src/libipmi/inc/libipmi_storlead_OEM.h
  41. 52 96
      app/goahead-5.1.0/src/libipmi/inc/libipmi_struct.h
  42. 0 11
      app/goahead-5.1.0/src/libipmi/inc/libipmi_usermgmt.h
  43. 0 20
      app/goahead-5.1.0/src/libipmi/inc/libipmi_version.h
  44. 10 10
      app/goahead-5.1.0/src/libipmi/inc/libsensor.h
  45. 37 0
      app/goahead-5.1.0/src/libipmi/inc/sensor_helpers.h
  46. 0 150
      app/goahead-5.1.0/src/libipmi/inc/std_macros.h
  47. 7 8
      app/goahead-5.1.0/src/libipmi/src/libipmi_Chassis.c
  48. 8 10
      app/goahead-5.1.0/src/libipmi/src/libipmi_PEF.c
  49. 0 3
      app/goahead-5.1.0/src/libipmi/src/libipmi_StorDevice.c
  50. 0 81
      app/goahead-5.1.0/src/libipmi/src/libipmi_device_api.c
  51. 21 36
      app/goahead-5.1.0/src/libipmi/src/libipmi_fru.c
  52. 47 61
      app/goahead-5.1.0/src/libipmi/src/libipmi_sdr.c
  53. 405 418
      app/goahead-5.1.0/src/libipmi/src/libipmi_sensor.c
  54. 1 2
      app/goahead-5.1.0/src/libipmi/src/libipmi_session.c
  55. 102 124
      app/goahead-5.1.0/src/libipmi/src/libipmi_storlead_OEM.c
  56. 8 8
      app/goahead-5.1.0/src/libipmi/src/libipmi_uds_session.c
  57. 2 2
      app/goahead-5.1.0/src/libipmi/src/libipmi_usermgmt.c
  58. 1064 0
      app/goahead-5.1.0/src/libipmi/src/sensor_helpers.c
  59. 74 7
      app/goahead-5.1.0/src/web_interface/src/dashboard.c
  60. 15 15
      app/goahead-5.1.0/test/test.c
  61. BIN
      gd32450i-eval.uImage

+ 63 - 0
app/bmc/Api.c

@@ -2,6 +2,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <sys/ioctl.h>
 
 #include "main.h"
 #include "Api.h"
@@ -405,4 +411,61 @@ int PDK_DiagInterruptChassis(void)
 int PDK_FanControl(void)
 {
 	;
+}
+
+//设置IP地址
+/*
+ * 函数名称 : int setip(char *ip)
+ * 函数功能 : 设置系统IP地址
+ * 参    数 : 
+ *char *ip :设置的IP地址,以点分十进制的字符串方式表示,如“192.168.0.5” 
+ * 返 回 值 : 0 : 成功 ;  -1 :  失败 
+ */
+int setip(char *ip)
+{
+    struct ifreq temp;
+    struct sockaddr_in *addr;
+    int fd = 0;
+    int ret = -1;
+    strcpy(temp.ifr_name, "eth0");
+    if((fd=socket(AF_INET, SOCK_STREAM, 0))<0)
+    {
+      return -1;
+    }
+    addr = (struct sockaddr_in *)&(temp.ifr_addr);
+    addr->sin_family = AF_INET;
+    addr->sin_addr.s_addr = inet_addr(ip);
+    ret = ioctl(fd, SIOCSIFADDR, &temp);
+    close(fd);
+    if(ret < 0)
+       return -1;
+    return 0;
+}
+
+//获取IP地址
+/*
+ * 函数名称 : char * getip(char *ip_buf)
+ * 函数功能 : 获取系統IP地址
+ * 参    数 : 
+ *char *ip_buf :用来存放IP地址的内存空间
+ * 返 回 值 : ip_buf : 存放IP地址的内存地址
+ */
+char* getip(char *ip_buf)
+{
+    struct ifreq temp;
+    struct sockaddr_in *myaddr;
+    int fd = 0;
+    int ret = -1;
+    strcpy(temp.ifr_name, "eth0");
+    if((fd=socket(AF_INET, SOCK_STREAM, 0))<0)
+    {
+        return NULL;
+    }
+    ret = ioctl(fd, SIOCGIFADDR, &temp);
+    close(fd);
+    if(ret < 0)
+        return NULL;
+    myaddr = (struct sockaddr_in *)&(temp.ifr_addr);
+    strcpy(ip_buf, inet_ntoa(myaddr->sin_addr));
+    return ip_buf;
 }

+ 3 - 0
app/bmc/Api.h

@@ -26,4 +26,7 @@ extern int PDK_ResetChassis(void);
 extern int PDK_DiagInterruptChassis(void);
 extern int PDK_FanControl(void);
 
+char* getip(char *ip_buf);
+int setip(char *ip);
+
 #endif /* __API_H__ */

BIN
app/bmc/bmc_app


BIN
app/bmc/bmc_app.gdb


+ 0 - 306
app/bmc/libipmi_struct.h

@@ -1,306 +0,0 @@
-/**
- * @file   libipmi_struct.h
- * @author Rajasekhar (rajasekharj@amiindia.co.in)
- * @date   02-Sep-2004
- *
- * @brief  Contains data structures	required for establishing a session
- *
- */
-
-#ifndef __LIBIPMI_STRUCT_H__
-#define __LIBIPMI_STRUCT_H__
-
-#include "com_BmcType.h"
-
-#pragma pack(1)
-
-#define	MAX_REQUEST_SIZE		1024
-#define	MAX_RESPONSE_SIZE		1024
-
-#define IP4_VERSION     4
-#define IP6_VERSION     6
-#define IP4_ADDR_LEN    4
-#define IP6_ADDR_LEN   16
-
-///**
-// @def LAN_CHANNEL_T
-// @brief holds data required for network medium
-//*/
-//typedef struct LAN_CHANNEL_T_tag {
-//	char			szIPAddress[46];
-//	uint16			wPort;
-//	SOCKET			hSocket;
-//	uint8_t			byIsConnected;
-//	uint8_t			bProtocol;
-//    uint8_t                   bFamily;
-//}  LAN_CHANNEL_T;
-
-///**
-// @def UDS_CHANNEL_T
-// @brief holds data required for network medium
-//*/
-//typedef struct UDS_CHANNEL_T_tag {
-//	uint16			hSocketPath;
-//	SOCKET			hSocket;
-//	uint8_t			byIsConnected;
-//}  UDS_CHANNEL_T;
-///**
-// @def SERIAL_CHANNEL_T
-// @brief holds data required for Serial medium
-//*/
-//typedef struct SERIAL_CHANNEL_T_tag {
-//	char			szdevice[32];
-//}  SERIAL_CHANNEL_T;
-
-/* Authentication Types */
-#define	AUTHTYPE_NONE									0x00
-#define	AUTHTYPE_MD2									0x01
-#define	AUTHTYPE_MD5									0x02
-#define	AUTHTYPE_RESERVED								0x03
-#define	AUTHTYPE_STRAIGHT_PASSWORD						0x04
-#define	AUTHTYPE_OEM_PROPRIETARY						0x05
-#define	AUTHTYPE_RMCP_PLUS_FORMAT						0x06
-
-/* Privilege levels */
-#define PRIV_LEVEL_NO_ACCESS                            0x0F
-#define PRIV_LEVEL_PROPRIETARY							0x05
-#define PRIV_LEVEL_ADMIN								0x04
-#define PRIV_LEVEL_OPERATOR								0x03
-#define PRIV_LEVEL_USER									0x02
-#define PRIV_LEVEL_CALLBACK								0x01
-#define PRIV_LEVEL_RESERVED								0x00
-
-
-/* Authentication Algorithms */
-#define AUTH_ALG_RAKP_NONE								0x00
-#define AUTH_ALG_RAKP_HMAC_SHA1							0x01
-#define AUTH_ALG_RAKP_HMAC_MD5							0x02
-
-/* Integrity Algorithms */
-#define INTEGRITY_ALG_NONE								0x00
-#define INTEGRITY_ALG_HMAC_SHA1_96						0x01
-#define INTEGRITY_ALG_HMAC_SHA1_128						0x02
-#define INTEGRITY_ALG_MD5_128							0x03
-
-/* Confidentiality Algorithms */
-#define CONFIDENTIALITY_ALG_NONE						0x00
-#define CONFIDENTIALITY_ALG_AES_CBC_128					0x01
-#define CONFIDENTIALITY_ALG_XRC4_128					0x02
-#define CONFIDENTIALITY_ALG_XRC4_40						0x03
-
-/* Payload Types */
-#define PAYLOAD_TYPE_IPMI								0
-#define PAYLOAD_TYPE_SOL								1
-#define PAYLOAD_TYPE_RSSP_OPEN_SES_REQ					0x10
-#define PAYLOAD_TYPE_RSSP_OPEN_SES_RES					0x11
-#define PAYLOAD_TYPE_RAKP_MSG_1							0x12
-#define PAYLOAD_TYPE_RAKP_MSG_2							0x13
-#define PAYLOAD_TYPE_RAKP_MSG_3							0x14
-#define PAYLOAD_TYPE_RAKP_MSG_4							0x15
-
-#define	MAX_KEY1_SIZE									20
-#define	MAX_KEY2_SIZE									20
-#define	MAX_GUID_SIZE									16
-//#define	MAX_USER_NAME_LEN								(16+1) //1 for stroing the null character
-//#define	MAX_USER_PWD_LEN								(20+1) //1 for storing the null character
-#define MAX_RAND_NO_LEN									16
-
-
-/* (0x6 << 2) == 0x18 */
-#define DEFAULT_NET_FN_LUN					0x18
-#define NETFNLUN_IPMI_APP					0x18
-#define NETFNLUN_IPMI_SENSOR					0x10
-#define NETFNLUN_IPMI_STORAGE					0x28
-#define NETFNLUN_IPMI_CHASSIS                                   0x00
-
-///**
-// @def IPMI20_NETWORK_SESSION_T
-// @brief holds data required for maintaining session with network medium
-//*/
-//typedef struct IPMI20_NETWORK_SESSION_tag
-//{
-//	LAN_CHANNEL_T	hLANInfo;
-//	char			szUserName [MAX_USER_NAME_LEN];
-//	char			szPwd [MAX_USER_PWD_LEN];
-//	uint32_t			dwSessionID;
-//	uint8_t			byIPMBSeqNum;
-//	uint32_t			dwSessionSeqNum;
-//	uint8_t			byAuthType;
-//	uint8_t			byChannelNum;
-//	uint8_t			byPerMsgAuthentication;
-//	uint8_t			byRole;
-//	uint8_t			byAuthAlgthm;
-//	uint8_t			byIntegrityAlgthm;
-//	uint8_t			byEncryptAlgthm;
-//	uint8_t			byPreSession;
-//	uint8_t			byResAddr;
-//	uint8_t			byReqAddr;
-//	uint8_t			byGUID [MAX_GUID_SIZE];
-//	uint8_t			byIsEncryptionReq;
-//	uint8_t			byKey1 [MAX_KEY1_SIZE];
-//	uint8_t			byKey2 [MAX_KEY2_SIZE];
-//	uint8_t			byMsgTag;
-//	uint32_t			dwRemConSessID;
-//	uint8_t			byRemConRandomNo [16];
-//	uint8_t			byMgdSysRandomNo [16];
-//	uint8_t			byDefTimeout;
-//}  IPMI20_NETWORK_SESSION_T;
-
-
-///**
-// @def IPMI20_SERIAL_SESSION_T
-// @brief holds data required for maintaining session with serial medium
-//*/
-//typedef struct IPMI20_SERIAL_SESSION_T_tag {
-//	SERIAL_CHANNEL_T	hSerialInfo;
-//	char			szUserName [MAX_USER_NAME_LEN];
-//	char			szPwd [MAX_USER_PWD_LEN];
-//	HANDLE			hSerialPort;
-//	uint8_t			byMaxRetries;
-//	uint32_t			dwSessionID;
-//	uint8_t			byAuthType;
-//	uint32_t			dwInboundSeqNum;
-//	uint32_t			dwOutboundSeqNum;
-//	uint8_t			byIPMBSeqNum;
-//	uint8_t			byPrivLevel;
-//	uint8_t			byResAddr;
-//	uint8_t			byReqAddr;
-//	uint8_t			byDefTimeout;
-//}  IPMI20_SERIAL_SESSION_T;
-
-///**
-// @def IPMI20_UDS_SESSION_T
-// @brief holds data required for maintaining session with unix domain socket medium
-//*/
-//typedef struct IPMI20_UDS_SESSION_T_tag {
-//  UDS_CHANNEL_T hUDSInfo;
-//  char szUserName[MAX_USER_NAME_LEN];
-//  char szPwd[MAX_USER_PWD_LEN];
-//  char szUName[MAX_USER_NAME_LEN];
-//  char abyIPAddr[IP6_ADDR_LEN];
-//  uint32_t dwSessionID;
-//  uint8_t byPreSession;
-//  uint8_t byAuthType;
-//  uint8_t byRole;
-//  uint8_t byChannelNum;
-//  uint8_t byDefTimeout;
-//  uint8_t byMaxRetries;
-//} IPMI20_UDS_SESSION_T;
-
-///**
-// @def IPMI20_KCS_SESSION_T
-// @brief holds data required for maintaining session with KCS medium
-//*/
-//typedef struct IPMI20_KCS_SESSION_T_tag {
-//	HANDLE			hKCSDevice;
-//	uint8_t			byResAddr;
-//}  IPMI20_KCS_SESSION_T;
-
-///**
-// @def IPMI20_IPMB_SESSION_T
-// @brief holds data required for maintaining session with IPMB medium
-//*/
-//typedef struct IPMI20_IPMB_SESSION_T_tag {
-//	HANDLE			hIPMBDevice;
-//	uint8_t			bySlaveAddr;
-//}  IPMI20_IPMB_SESSION_T;
-
-///**
-// @def LIBIPMI_SERIAL_SETTINGS_T
-// @brief holds settings for a session
-//*/
-//typedef struct {
-///* settings state */
-//	uint8_t		bySettings;
-//#define	SETTINGS_NOTSET			0x00
-//#define	SETTINGS_DEFAULT		0x01
-//#define	SETTINGS_USER			0x02
-
-///* BaudRate */
-//	uint32_t		dwBaudRate;
-
-///* Parity */
-//	uint8_t		byParity;
-//#define			EVEN_PARITY					0x00
-//#define			ODD_PARITY					0x01
-//#define			NO_PARITY					0x02
-//#define			MARK_PARITY					0x03
-//#define			SPACE_PARITY				0x04
-
-///* Stop Bits */
-//	uint8_t		byStopBit;
-//#define			STOPBIT_ONE					0x00
-//#define			STOPBIT_ONE5				0x01
-//#define			STOPBIT_TWO					0x02
-
-//	uint8_t		byByteSize;
-
-///* Byte Size */
-//}  LIBIPMI_SERIAL_SETTINGS_T;
-
-//#define DEFAULT_BAUD_RATE					115200
-//#define DEFAULT_PARITY						NO_PARITY
-//#define	DEFAULT_STOPBITS					STOPBIT_ONE
-//#define DEFAULT_BYTESIZE					8
-
-///**
-// @def IPMI20_USB_SESSION_T
-// @brief holds data required for maintaining session with USB medium
-//*/
-//typedef struct IPMI20_USB_SESSION_T_tag {
-//	union {
-//		HANDLE			hUSBDevice;
-//		int				hUSBDesc;
-//	};
-//	uint8_t			byResAddr;
-//}  IPMI20_USB_SESSION_T;
-
-
-///**
-// @def IPMI20_SESSION_T
-// @brief holds info for maintaining a session
-//*/
-//typedef struct IPMI20_SESSION_T_tag {
-///* Medium type (Network, Serial, KCS, IPMB, USB) */
-//	uint8_t	byMediumType;
-
-//#define NETWORK_MEDIUM_TCP      0x01
-//#define NETWORK_MEDIUM_UDP      0x04
-
-//#define	NETWORK_MEDIUM	        NETWORK_MEDIUM_TCP
-//#define	SERIAL_MEDIUM	        0x02
-//#define KCS_MEDIUM		        0x03
-//#define IPMB_MEDIUM		        0x05
-//#define USB_MEDIUM		        0x06
-//#define	UDS_MEDIUM	          0x07
-
-///* tells whether session has started or not. */
-//	uint8_t	bySessionStarted;
-//#define SESSION_NOT_STARTED 0x00
-//#define SESSION_STARTED	0x01
-
-///* if this value is > 0, session reestablishment will be tried for byMaxRetries times. */
-//	uint8_t	byMaxRetries;
-///* LAN Eth Index for hold Eth number if multi NIc supported */
-//	uint8_t         EthIndex;
-
-//	IPMI20_NETWORK_SESSION_T	*hNetworkSession;
-//	IPMI20_SERIAL_SESSION_T		*hSerialSession;
-//	IPMI20_KCS_SESSION_T		*hKCSSession;
-//	IPMI20_IPMB_SESSION_T		*hIPMBSession;
-//	IPMI20_USB_SESSION_T		*hUSBSession;
-//	IPMI20_UDS_SESSION_T		*hUDSSession;
-
-//	LIBIPMI_SERIAL_SETTINGS_T	Settings;
-
-//}  IPMI20_SESSION_T;
-
-//typedef enum
-//{
-//    AUTH_FLAG = 1,
-//    AUTH_BYPASS_FLAG,
-//}USER_Auth;
-
-#pragma pack()
-
-#endif /* __LIBIPMI_STRUCT_H__ */

+ 0 - 1
app/bmc/msghndlr/App/App.c

@@ -26,7 +26,6 @@
 #include "com_IPMI_IPM.h"
 //#include "com_IPMI_Firewall.h"
 #include "com_IPMI_App+.h"
-#include "libipmi_struct.h"
 #include "Support.h"
 #include "com_IPMI_AppDevice.h"
 

+ 0 - 1
app/bmc/msghndlr/App/AppDevice/AppDevice.c

@@ -31,7 +31,6 @@
 #include "AppDevice.h"
 #include "RMCP.h"
 #include "Session.h"
-#include "libipmi_struct.h"
 #include "PMConfig.h"
 #include "main.h"
 #include <string.h>

+ 1 - 10
app/bmc/msghndlr/Storage/SELRecord.h

@@ -61,16 +61,7 @@
 
 #pragma pack( 1 )
 
-/**
- * @struct SELRec_T
- * @brief SEL Record
-**/
-typedef struct
-{
-    uint8_t               Valid;
-    uint8_t               Len;
-    SELEventRecord_T    EvtRecord;
-}   SELRec_T;
+
 
 
 /**

+ 1 - 0
app/bmc/readme.txt

@@ -5,3 +5,4 @@
 	- sensor_sdr.c			Add new SDR
 	- main.h				SENSOR_NUMBERS = ?
 
+2. Web Access IPMC through SendMessage and GetMessage command

+ 78 - 4
app/common_include/com_IPMIDefs.h

@@ -32,6 +32,10 @@
 #ifndef uint32_t
   #define uint32_t unsigned long
 #endif
+// #ifndef bool
+// 	#define bool uint8_t
+// #endif
+
 
 #ifndef TRUE
     #define TRUE 1
@@ -50,6 +54,9 @@
 #define DEFAULT_TIMEOUT			10
 #define MAX_USER_NUM			(10)
 #define MAX_SEL_RECORD			(100)
+#define MAX_ID_STR_LEN  		16
+#define MAX_FRU_SDR_STR_SIZE 	40
+#define MAX_SENSOR_INFO_SIZE	(1024*2)
 
 #define AUTH_FILE_PATH		"/etc/goahead/auth.txt"
 
@@ -88,7 +95,6 @@
 #define MAC_ADDR_LEN            6
 #define IP_ADDR_LEN             4
 #define MAX_AUTH_PARAM_SIZE     296
-#define IP6_ADDR_LEN            16
 
 #define LAN_IFC_Q   "/var/LAN_IFC_Q"
 #define LAN_RES_Q   "/var/LAN_RES_Q"
@@ -140,6 +146,75 @@
 #define BRIDGING_REQUEST        PARAM_BRIDGE
 
 
+#define	MAX_REQUEST_SIZE		1024
+#define	MAX_RESPONSE_SIZE		1024
+
+#define IP4_VERSION     4
+#define IP6_VERSION     6
+#define IP4_ADDR_LEN    4
+#define IP6_ADDR_LEN   16
+
+
+/* Authentication Types */
+#define	AUTHTYPE_NONE									0x00
+#define	AUTHTYPE_MD2									0x01
+#define	AUTHTYPE_MD5									0x02
+#define	AUTHTYPE_RESERVED								0x03
+#define	AUTHTYPE_STRAIGHT_PASSWORD						0x04
+#define	AUTHTYPE_OEM_PROPRIETARY						0x05
+#define	AUTHTYPE_RMCP_PLUS_FORMAT						0x06
+
+/* Privilege levels */
+#define PRIV_LEVEL_NO_ACCESS                            0x0F
+#define PRIV_LEVEL_PROPRIETARY							0x05
+#define PRIV_LEVEL_ADMIN								0x04
+#define PRIV_LEVEL_OPERATOR								0x03
+#define PRIV_LEVEL_USER									0x02
+#define PRIV_LEVEL_CALLBACK								0x01
+#define PRIV_LEVEL_RESERVED								0x00
+
+
+/* Authentication Algorithms */
+#define AUTH_ALG_RAKP_NONE								0x00
+#define AUTH_ALG_RAKP_HMAC_SHA1							0x01
+#define AUTH_ALG_RAKP_HMAC_MD5							0x02
+
+/* Integrity Algorithms */
+#define INTEGRITY_ALG_NONE								0x00
+#define INTEGRITY_ALG_HMAC_SHA1_96						0x01
+#define INTEGRITY_ALG_HMAC_SHA1_128						0x02
+#define INTEGRITY_ALG_MD5_128							0x03
+
+/* Confidentiality Algorithms */
+#define CONFIDENTIALITY_ALG_NONE						0x00
+#define CONFIDENTIALITY_ALG_AES_CBC_128					0x01
+#define CONFIDENTIALITY_ALG_XRC4_128					0x02
+#define CONFIDENTIALITY_ALG_XRC4_40						0x03
+
+/* Payload Types */
+#define PAYLOAD_TYPE_IPMI								0
+#define PAYLOAD_TYPE_SOL								1
+#define PAYLOAD_TYPE_RSSP_OPEN_SES_REQ					0x10
+#define PAYLOAD_TYPE_RSSP_OPEN_SES_RES					0x11
+#define PAYLOAD_TYPE_RAKP_MSG_1							0x12
+#define PAYLOAD_TYPE_RAKP_MSG_2							0x13
+#define PAYLOAD_TYPE_RAKP_MSG_3							0x14
+#define PAYLOAD_TYPE_RAKP_MSG_4							0x15
+
+#define	MAX_KEY1_SIZE									20
+#define	MAX_KEY2_SIZE									20
+#define	MAX_GUID_SIZE									16
+//#define	MAX_USER_NAME_LEN								(16+1) //1 for stroing the null character
+//#define	MAX_USER_PWD_LEN								(20+1) //1 for storing the null character
+#define MAX_RAND_NO_LEN									16
+
+
+/* (0x6 << 2) == 0x18 */
+#define DEFAULT_NET_FN_LUN					0x18
+#define NETFNLUN_IPMI_APP					0x18
+#define NETFNLUN_IPMI_SENSOR					0x10
+#define NETFNLUN_IPMI_STORAGE					0x28
+#define NETFNLUN_IPMI_CHASSIS                   0x00
 
 
 
@@ -204,9 +279,8 @@
 #define NETFN_GROUP_EXTN                  0x2C
 #define IPMI_GROUP_EXTN_CODE_DCMI         0xDC
 
-#define IP6_ADDR_LEN                      16
-#define MAX_USERNAME_LEN        16
-#define MAX_PASSWORD_LEN        100
+#define MAX_USERNAME_LEN        (16+1)
+#define MAX_PASSWORD_LEN        (20+1)
 
 /**** Command Completion Codes ****/
 #define CC_NORMAL                                       0x00

+ 234 - 0
app/common_include/com_IPMI_AppDevice+.h

@@ -0,0 +1,234 @@
+/****************************************************************
+ ****************************************************************
+ **                                                            **
+ **    (C)Copyright 2005-2006, American Megatrends Inc.        **
+ **                                                            **
+ **            All Rights Reserved.                            **
+ **                                                            **
+ **        6145-F, Northbelt Parkway, Norcross,                **
+ **                                                            **
+ **        Georgia - 30071, USA. Phone-(770)-246-8600.         **
+ **                                                            **
+ ****************************************************************
+ ****************************************************************
+ ****************************************************************
+ *
+ * IPMI_App.h
+ * AppDevice Commands Handler
+ *
+ * Author: Govind Kothandapani <govindk@ami.com>
+ *       : Rama Bisa <ramab@ami.com>
+ *       : Basavaraj Astekar <basavaraja@ami.com>
+ *       : Bakka Ravinder Reddy <bakkar@ami.com>
+ *
+ *****************************************************************/
+#ifndef IPMI_APPDEV_PLUS_H
+#define IPMI_APPDEV_PLUS_H
+
+#include "stdint.h"
+
+#pragma pack( 1 )
+
+/*** Macro Definitions ***/
+#define MAX_PLD_ENABLES     4
+
+/* ActivatePayloadReq_T */
+typedef struct
+{
+    uint8_t   PayldType;
+    uint8_t   PayldInst;
+    uint8_t   AuxData [4];
+
+}    ActivatePayloadReq_T;
+
+/* ActivatePayloadRes_T */
+typedef struct
+{
+
+    uint8_t   CompletionCode;
+    uint8_t   AuxData [4];
+    uint16_t  InboundPayldSize;
+    uint16_t  OutboundPayldSize;
+    uint16_t  UDPPort;
+    uint16_t  VLANNo;
+
+}    ActivatePayloadRes_T;
+
+/* DeactivatePayloadReq_T */
+typedef struct
+{
+    uint8_t   PayldType;
+    uint8_t   PayldInst;
+    uint8_t   AuxData [4];
+
+}    DeactivatePayloadReq_T;
+
+/* GetPayldActStatRes_T */
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint8_t   InstCap;
+    uint16_t  ActivatedInst;
+
+}    GetPayldActStatRes_T;
+
+/* GetPayldInstInfoReq_T */
+typedef struct 
+{
+    uint8_t   PayldType;
+    uint8_t   PayldInst;
+
+}    GetPayldInstInfoReq_T;
+
+/* GetPayldInstInfoRes_T */
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint32_t  SessionID;
+    uint8_t   SpecificInfo [8];
+
+}    GetPayldInstInfoRes_T;
+
+/* SetUsrPayldAccReq_T */
+typedef struct
+{
+    uint8_t   ChannelNum;
+    uint8_t   UserId;
+    uint8_t   PayloadEnables [MAX_PLD_ENABLES];
+
+}    SetUsrPayldAccReq_T;
+
+/* SetUsrPayldAccRes_T */
+typedef struct
+{
+    uint8_t CompletionCode;
+
+}    SetUsrPayldAccRes_T;
+
+
+/* GetUsrPayldAccReq_T */
+typedef struct
+{
+    uint8_t   ChannelNum;
+    uint8_t   UserId;
+
+}    GetUsrPayldAccReq_T;
+
+/* GetUsrPayldAccRes_T */
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint8_t   PayloadEnables [MAX_PLD_ENABLES];
+
+}    GetUsrPayldAccRes_T;
+
+
+/* GetChPayldSupRes_T */
+typedef struct
+{
+
+    uint8_t   CompletionCode;
+    uint8_t   StdPldtype1;
+    uint8_t   StdPldtype2;
+    uint8_t   SessStpPldtype1;
+    uint8_t   SessStpPldtype2;
+    uint8_t   OemPldtype1;
+    uint8_t   OemPldtype2;
+    uint16_t  Rsvd;
+
+}    GetChPayldSupRes_T;
+
+/* GetChPayldVerReq_T */
+typedef struct
+{
+    uint8_t   ChannelNum;
+    uint8_t   PayloadNum;
+
+}    GetChPayldVerReq_T;
+
+/* GetChPayldVerRes_T */
+typedef struct
+{
+
+    uint8_t   CompletionCode;
+    uint8_t   FormatVer;
+
+}    GetChPayldVerRes_T;
+
+/* GetChOemPayldInfoReq_T */
+typedef struct
+{
+    uint8_t   ChannelNum;
+    uint8_t   PayloadNum;
+    uint8_t   OemIANA [3];
+    uint8_t   OemPyldId [2];
+
+}    GetChOemPayldInfoReq_T;
+
+/* GetChOemPayldInfoRes_T */
+typedef struct
+{
+
+    uint8_t   CompletionCode;
+    uint8_t   PayloadNum;
+    uint8_t   OemIANA [3];
+    uint8_t   OemPyldId [2];
+    uint8_t   FormatVer;
+
+}    GetChOemPayldInfoRes_T;
+
+/* SusResPayldEncryptReq_T */
+typedef struct
+{
+    uint8_t   PayldType;
+    uint8_t   PayldInst;
+    uint8_t   Operation;
+
+}    SusResPayldEncryptReq_T;
+
+/* SetChSecurityKeysReq_T */
+typedef struct
+{
+    uint8_t   ChannelNum;
+    uint8_t   Operation;
+    uint8_t   KeyID;
+
+}    SetChSecurityKeysReq_T;
+
+/* SetChSecurityKeysRes_T */
+typedef struct
+{
+
+    uint8_t   CompletionCode;
+    uint8_t   LockStatus;
+
+}    SetChSecurityKeysRes_T;
+
+/* GetSysIfcCapsRes_T */
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint8_t   Rsrvd;
+
+}    GetSysIfcCapsRes_T;
+
+/* GetChCipherSuitesReq_T */
+typedef struct
+{
+    uint8_t   ChannelNum;
+    uint8_t   PayloadType;
+    uint8_t   ListIndex;
+
+}    GetChCipherSuitesReq_T;
+
+/* GetChCipherSuitesRes_T */
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint8_t   ChannelNum;
+
+}    GetChCipherSuitesRes_T;
+
+#pragma pack( )
+
+#endif /* IPMI_APPDEV_PLUS_H */

+ 68 - 0
app/common_include/com_IPMI_IPMB.h

@@ -0,0 +1,68 @@
+/****************************************************************
+ ****************************************************************
+ **                                                            **
+ **    (C)Copyright 2005-2006, American Megatrends Inc.        **
+ **                                                            **
+ **            All Rights Reserved.                            **
+ **                                                            **
+ **        6145-F, Northbelt Parkway, Norcross,                **
+ **                                                            **
+ **        Georgia - 30071, USA. Phone-(770)-246-8600.         **
+ **                                                            **
+ ****************************************************************
+ ****************************************************************
+ ****************************************************************
+ *
+ * IPMI_IPMB.H
+ * IPMB IPMI related structures
+ *
+ * Author: Rama Bisa <ramab@ami.com>
+ *
+ *
+ *****************************************************************/
+#ifndef IPMI_IPMB_H
+#define IPMI_IPMB_H
+#include <stdint.h>
+#include <com_IPMIDefs.h>
+#pragma pack( 1 )
+
+/**
+ * @struct IPMIEvtMsgHdr_T
+ * @brief IPMI Event Message Header. 
+**/
+typedef struct
+{
+    IPMIMsgHdr_T    IPMIMsgHdr;
+    uint8_t   EvMRev;
+    uint8_t   SensorType;
+    uint8_t   SensorNum;
+    uint8_t   Ev_Type_Dir;
+    uint8_t   EventData1;
+    uint8_t   EventData2;
+    uint8_t   EventData3;
+    uint8_t   ChkSum;
+}    IPMIEvtMsgHdr_T;
+
+
+/**
+ * @struct EvtRecord_T
+ * @brief Event Record structure.
+**/
+typedef struct 
+{
+    uint8_t	GeneratorID;
+    uint8_t	EvMRev;			/**< Event Message format version. */
+    uint8_t	SensorType;		/**< Sensor Type Code. */
+    uint8_t	SensorNum;		/**< Number of sensor that generated the event.	*/
+    uint8_t	Ev_Type_Dir;	/**< [7]   - 0b = Assertion event	
+    						 		   - 1b = Deassertion event.
+    						     [6:0] - Event Type Code.   */
+    uint8_t	EventData1;		/**< Event Data Field Contents.	*/
+    uint8_t	EventData2;		/**< Event Data Field Contents.	*/
+    uint8_t	EventData3;		/**< Event Data Field Contents.	*/
+
+}    EvtRecord_T;
+
+#pragma pack( )
+
+#endif /* IPMI_IPMB_H */

+ 0 - 1
app/common_include/com_IPMI_LANConfig.h

@@ -27,7 +27,6 @@
 
 /*** External Definitions ***/
 #define IP_ADDR_LEN             4
-#define IP6_ADDR_LEN             16
 #define MAC_ADDR_LEN            6
 #define MAX_COMM_STRING_SIZE    18
 #define MAX_NUM_CIPHER_SUITE_PRIV_LEVELS    10

+ 2 - 7
app/common_include/com_IPMI_SDRRecord.h

@@ -23,6 +23,8 @@
 #ifndef IPMI_SDR_RECORD_H
 #define IPMI_SDR_RECORD_H
 
+#include "com_IPMIDefs.h"
+
 #ifndef uint8_t
   #define uint8_t unsigned char
 #endif
@@ -61,13 +63,6 @@
 #define OEM_SDRFRU_REC                  0xD0
 #define OEM_SDRNM_REC                   0xC0
 
-
-/**
- * @brief Maximum Length of the ID String
-**/
-#define MAX_ID_STR_LEN  16
-#define MAX_FRU_SDR_STR_SIZE 40
-
 /**
  * @struct SDRRecHdr_T
  * @brief SDR Record Header

+ 11 - 0
app/common_include/com_IPMI_SEL.h

@@ -64,6 +64,17 @@ typedef struct
 
 }   SELEventRecord_T;
 
+/**
+ * @struct SELRec_T
+ * @brief SEL Record
+**/
+typedef struct
+{
+    uint8_t               Valid;
+    uint8_t               Len;
+    SELEventRecord_T    EvtRecord;
+}   SELRec_T;
+
 /**
  * @struct SELOEM1Record_T
  * @brief SEL OEM1 Record

+ 1 - 1
app/goahead-5.1.0/build/linux-arm-static/.makeflags

@@ -1 +1 @@
-s --no-print-directory
+ --no-print-directory -s

BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgo.a


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgoahead-mbedtls.a


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libmbedtls.a


+ 9 - 1
app/goahead-5.1.0/build/linux-arm-static/inc/goahead.h

@@ -3990,13 +3990,21 @@ PUBLIC void websRemoveSessionVar(Webs *wp, cchar *name);
 PUBLIC int websSetSessionVar(Webs *wp, cchar *name, cchar *value);
 
 
-//add by lusa
+////////////////////////////////////add by lusa///////////////////////////
 PUBLIC void personInfoAction(Webs *wp);
 
 PUBLIC void getDeviceInfo(Webs *wp);
 
 
 PUBLIC void getDeviceInfoBak(Webs *wp);
+
+
+PUBLIC void actionTest(Webs *wp);
+
+PUBLIC void buy(Webs *wp);
+
+
+////////////////////////////////end/////////////////
 /************************************ Legacy **********************************/
 /*
     Legacy mappings for pre GoAhead 3.X applications

+ 234 - 15
app/goahead-5.1.0/projects/goahead-linux-static.mk

@@ -141,8 +141,6 @@ clean:
 	rm -f "$(BUILD)/bin/libgoahead-mbedtls.a"
 	rm -f "$(BUILD)/bin/libmbedtls.a"
 
-<<<<<<< HEAD
-=======
 	rm -f "$(BUILD)/bin/libipmi_session.o"
 	rm -f "$(BUILD)/bin/libipmi_uds_session.o"
 	rm -f "$(BUILD)/bin/libipmi_IPM.o"
@@ -154,7 +152,6 @@ clean:
 	rm -f "$(BUILD)/bin/remote_control.o"
 	rm -f "$(BUILD)/bin/sel.o"
 	rm -f "$(BUILD)/bin/server_health.o"
->>>>>>> 62e2f54f0c6a6c4a634828a115139a52376334ba
 clobber: clean
 	rm -fr ./$(BUILD)
 
@@ -239,10 +236,38 @@ DEPS_USER_H2 += src/libipmi/inc/libipmi.h
 DEPS_USER_H2 += src/libipmi/inc/libipmi_errorcodes.h
 DEPS_USER_H2 += src/libipmi/inc/libipmi_struct.h
 DEPS_USER_H2 += src/libipmi/inc/libipmi_IPM.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_AppDevice.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_ChassisDevice.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_fru.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_PEF.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_rmcp.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_sdr.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_sensor.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_StorDevice.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_storlead_OEM.h
+DEPS_USER_H2 += src/libipmi/inc/libipmi_usermgmt.h
+DEPS_USER_H2 += src/libipmi/inc/libsensor.h
+DEPS_USER_H2 += src/libipmi/inc/sensor_helpers.h
 DEPS_USER_H2 += ../common_include/com_IPMI_AppDevice.h
+DEPS_USER_H2 += ../common_include/com_IPMI_AppDevice+.h
 DEPS_USER_H2 += ../common_include/com_IPMIDefs.h
 DEPS_USER_H2 += ../common_include/com_IPMI_IPM.h
 DEPS_USER_H2 += ../common_include/com_IPMI_App.h
+DEPS_USER_H2 += ../common_include/com_IPMI_Chassis.h
+DEPS_USER_H2 += ../common_include/com_IPMI_ChassisDevice.h
+DEPS_USER_H2 += ../common_include/com_IPMI_FRU.h
+DEPS_USER_H2 += ../common_include/com_IPMI_SDRRecord.h
+DEPS_USER_H2 += ../common_include/com_IPMI_SDR.h
+DEPS_USER_H2 += ../common_include/com_IPMI_SensorEvent.h
+DEPS_USER_H2 += ../common_include/com_IPMI_Sensor.h
+DEPS_USER_H2 += ../common_include/com_IPMI_SEL.h
+DEPS_USER_H2 += ../common_include/com_IPMI_IPMB.h
+DEPS_USER_H2 += ../common_include/com_IPMI_Storage.h
+DEPS_USER_H2 += ../common_include/com_IPMI_LANConfig.h
+DEPS_USER_H2 += ../common_include/com_IPMI_PEF.h
+DEPS_USER_H2 += ../common_include/com_IPMI_RMCP.h
+DEPS_USER_H2 += ../common_include/com_BmcType.h
+
 
 $(BUILD)/inc/libipmi_session.h: $(DEPS_USER_H2)
 	@echo '      [Copy] $(BUILD)/inc/libipmi_session.h'
@@ -264,11 +289,63 @@ $(BUILD)/inc/libipmi_IPM.h: $(DEPS_USER_H2)
 	@echo '      [Copy] $(BUILD)/inc/libipmi_IPM.h'
 	mkdir -p "$(BUILD)/inc"
 	cp src/libipmi/inc/libipmi_IPM.h $(BUILD)/inc/libipmi_IPM.h
+$(BUILD)/inc/libipmi_AppDevice.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_AppDevice.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_AppDevice.h $(BUILD)/inc/libipmi_AppDevice.h
+$(BUILD)/inc/libipmi_ChassisDevice.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_ChassisDevice.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_ChassisDevice.h $(BUILD)/inc/libipmi_ChassisDevice.h
+$(BUILD)/inc/libipmi_fru.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_fru.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_fru.h $(BUILD)/inc/libipmi_fru.h
+$(BUILD)/inc/libipmi_PEF.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_PEF.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_PEF.h $(BUILD)/inc/libipmi_PEF.h
+$(BUILD)/inc/libipmi_rmcp.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_rmcp.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_rmcp.h $(BUILD)/inc/libipmi_rmcp.h
+$(BUILD)/inc/libipmi_sdr.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_sdr.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_sdr.h $(BUILD)/inc/libipmi_sdr.h
+$(BUILD)/inc/libipmi_sensor.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_sensor.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_sensor.h $(BUILD)/inc/libipmi_sensor.h
+$(BUILD)/inc/libipmi_StorDevice.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_StorDevice.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_StorDevice.h $(BUILD)/inc/libipmi_StorDevice.h
+$(BUILD)/inc/libipmi_storlead_OEM.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_storlead_OEM.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_storlead_OEM.h $(BUILD)/inc/libipmi_storlead_OEM.h
+$(BUILD)/inc/libipmi_usermgmt.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libipmi_usermgmt.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libipmi_usermgmt.h $(BUILD)/inc/libipmi_usermgmt.h
+$(BUILD)/inc/libsensor.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/libsensor.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/libsensor.h $(BUILD)/inc/libsensor.h
+$(BUILD)/inc/sensor_helpers.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/sensor_helpers.h'
+	mkdir -p "$(BUILD)/inc"
+	cp src/libipmi/inc/sensor_helpers.h $(BUILD)/inc/sensor_helpers.h
 
 $(BUILD)/inc/com_IPMI_AppDevice.h: $(DEPS_USER_H2)
 	@echo '      [Copy] $(BUILD)/inc/com_IPMI_AppDevice.h'
 	mkdir -p "$(BUILD)/inc"
 	cp ../common_include/com_IPMI_AppDevice.h $(BUILD)/inc/com_IPMI_AppDevice.h
+$(BUILD)/inc/com_IPMI_AppDevice+.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_AppDevice+.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_AppDevice+.h $(BUILD)/inc/com_IPMI_AppDevice+.h
 $(BUILD)/inc/com_IPMIDefs.h: $(DEPS_USER_H2)
 	@echo '      [Copy] $(BUILD)/inc/com_IPMIDefs.h'
 	mkdir -p "$(BUILD)/inc"
@@ -281,8 +358,62 @@ $(BUILD)/inc/com_IPMI_App.h: $(DEPS_USER_H2)
 	@echo '      [Copy] $(BUILD)/inc/com_IPMI_App.h'
 	mkdir -p "$(BUILD)/inc"
 	cp ../common_include/com_IPMI_App.h $(BUILD)/inc/com_IPMI_App.h
-
-
+$(BUILD)/inc/com_IPMI_Chassis.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_Chassis.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_Chassis.h $(BUILD)/inc/com_IPMI_Chassis.h
+$(BUILD)/inc/com_IPMI_ChassisDevice.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_ChassisDevice.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_ChassisDevice.h $(BUILD)/inc/com_IPMI_ChassisDevice.h
+$(BUILD)/inc/com_IPMI_FRU.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_FRU.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_FRU.h $(BUILD)/inc/com_IPMI_FRU.h
+$(BUILD)/inc/com_IPMI_SDRRecord.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_SDRRecord.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_SDRRecord.h $(BUILD)/inc/com_IPMI_SDRRecord.h
+$(BUILD)/inc/com_IPMI_SDR.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_SDR.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_SDR.h $(BUILD)/inc/com_IPMI_SDR.h
+$(BUILD)/inc/com_IPMI_SensorEvent.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_SensorEvent.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_SensorEvent.h $(BUILD)/inc/com_IPMI_SensorEvent.h
+$(BUILD)/inc/com_IPMI_Sensor.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_Sensor.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_Sensor.h $(BUILD)/inc/com_IPMI_Sensor.h
+$(BUILD)/inc/com_IPMI_SEL.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_SEL.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_SEL.h $(BUILD)/inc/com_IPMI_SEL.h
+$(BUILD)/inc/com_IPMI_IPMB.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_IPMB.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_IPMB.h $(BUILD)/inc/com_IPMI_IPMB.h
+$(BUILD)/inc/com_IPMI_Storage.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_Storage.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_Storage.h $(BUILD)/inc/com_IPMI_Storage.h
+$(BUILD)/inc/com_IPMI_LANConfig.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_LANConfig.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_LANConfig.h $(BUILD)/inc/com_IPMI_LANConfig.h
+$(BUILD)/inc/com_IPMI_PEF.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_PEF.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_PEF.h $(BUILD)/inc/com_IPMI_PEF.h
+$(BUILD)/inc/com_IPMI_RMCP.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_IPMI_RMCP.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_IPMI_RMCP.h $(BUILD)/inc/com_IPMI_RMCP.h
+$(BUILD)/inc/com_BmcType.h: $(DEPS_USER_H2)
+	@echo '      [Copy] $(BUILD)/inc/com_BmcType.h'
+	mkdir -p "$(BUILD)/inc"
+	cp ../common_include/com_BmcType.h $(BUILD)/inc/com_BmcType.h
 
 #
 #   LUSA, ResultUtils
@@ -351,16 +482,44 @@ $(BUILD)/obj/cJSON.o: \
 	@echo '   [Compile] $(BUILD)/obj/cJSON.o'
 	$(CC) -c -o $(BUILD)/obj/cJSON.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" -DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) "-I$(ME_COM_OPENSSL_PATH)/include" src/cJSON/cJSON.c
 
-
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_fru.h
 DEPS_USER_C2 += $(BUILD)/inc/libipmi_session.h
 DEPS_USER_C2 += $(BUILD)/inc/libipmi.h
 DEPS_USER_C2 += $(BUILD)/inc/libipmi_errorcodes.h
 DEPS_USER_C2 += $(BUILD)/inc/libipmi_struct.h
 DEPS_USER_C2 += $(BUILD)/inc/libipmi_IPM.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_PEF.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_rmcp.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_sdr.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_sensor.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_StorDevice.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_storlead_OEM.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_usermgmt.h
+DEPS_USER_C2 += $(BUILD)/inc/libsensor.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_ChassisDevice.h
+DEPS_USER_C2 += $(BUILD)/inc/libipmi_AppDevice.h
+DEPS_USER_C2 += $(BUILD)/inc/sensor_helpers.h
+
+
 DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_AppDevice.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_AppDevice+.h
 DEPS_USER_C2 += $(BUILD)/inc/com_IPMIDefs.h
 DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_IPM.h
 DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_App.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_ChassisDevice.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_Chassis.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_SEL.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_FRU.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_IPMB.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_Storage.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_SDR.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_SensorEvent.h
+DEPS_USER_C2 += $(BUILD)/inc/com_BmcType.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_Sensor.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_SDRRecord.h
+DEPS_USER_C2 += $(BUILD)/inc/com_IPMI_PEF.h
+
+
 
 $(BUILD)/obj/libipmi_session.o: \
     src/libipmi/src/libipmi_session.c $(DEPS_USER_C2)
@@ -370,6 +529,59 @@ $(BUILD)/obj/libipmi_uds_session.o: \
     src/libipmi/src/libipmi_uds_session.c $(DEPS_USER_C2)
 	@echo '   [Compile] $(BUILD)/obj/libipmi_uds_session.o'
 	$(CC) -c -o $(BUILD)/obj/libipmi_uds_session.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" -DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) "-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_uds_session.c
+$(BUILD)/obj/libipmi_IPM.o: \
+    src/libipmi/src/libipmi_IPM.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_IPM.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_IPM.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) -D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" -DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) "-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_IPM.c
+$(BUILD)/obj/libipmi_Chassis.o: \
+    src/libipmi/src/libipmi_Chassis.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_Chassis.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_Chassis.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) \
+		-D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" \
+		-DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) \
+		"-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_Chassis.c
+$(BUILD)/obj/libipmi_fru.o: \
+    src/libipmi/src/libipmi_fru.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_fru.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_fru.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) \
+		-D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" \
+		-DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) \
+		"-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_fru.c
+$(BUILD)/obj/libipmi_PEF.o: \
+    src/libipmi/src/libipmi_PEF.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_PEF.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_PEF.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) \
+		-D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" \
+		-DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) \
+		"-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_PEF.c
+$(BUILD)/obj/libipmi_sdr.o: \
+    src/libipmi/src/libipmi_sdr.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_sdr.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_sdr.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) \
+		-D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" \
+		-DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) \
+		"-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_sdr.c
+$(BUILD)/obj/libipmi_sensor.o: \
+    src/libipmi/src/libipmi_sensor.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_sensor.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_sensor.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) \
+		-D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" \
+		-DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) \
+		"-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_sensor.c
+$(BUILD)/obj/libipmi_storlead_OEM.o: \
+    src/libipmi/src/libipmi_storlead_OEM.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/libipmi_storlead_OEM.o'
+	$(CC) -c -o $(BUILD)/obj/libipmi_storlead_OEM.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) \
+		-D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" \
+		-DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) \
+		"-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/libipmi_storlead_OEM.c
+$(BUILD)/obj/sensor_helpers.o: \
+    src/libipmi/src/sensor_helpers.c $(DEPS_USER_C2)
+	@echo '   [Compile] $(BUILD)/obj/sensor_helpers.o'
+	$(CC) -c -o $(BUILD)/obj/sensor_helpers.o $(LDFLAGS) $(CFLAGS) $(DFLAGS) \
+		-D_FILE_OFFSET_BITS=64 -D_FILE_OFFSET_BITS=64 -DMBEDTLS_USER_CONFIG_FILE=\"embedtls.h\" \
+		-DME_COM_OPENSSL_PATH=$(ME_COM_OPENSSL_PATH) $(IFLAGS) \
+		"-I$(ME_COM_OPENSSL_PATH)/include" src/libipmi/src/sensor_helpers.c
 
 
 DEPS_USER_C3 += $(BUILD)/inc/goahead.h
@@ -791,10 +1003,17 @@ DEPS_36 += $(BUILD)/obj/time.o
 DEPS_36 += $(BUILD)/obj/upload.o
 DEPS_36 += $(BUILD)/obj/libipmi_session.o
 DEPS_36 += $(BUILD)/obj/libipmi_uds_session.o
-<<<<<<< HEAD
 
-=======
 DEPS_36 += $(BUILD)/obj/libipmi_IPM.o
+DEPS_36 += $(BUILD)/obj/libipmi_Chassis.o
+DEPS_36 += $(BUILD)/obj/libipmi_fru.o
+DEPS_36 += $(BUILD)/obj/libipmi_PEF.o
+DEPS_36 += $(BUILD)/obj/libipmi_sdr.o
+DEPS_36 += $(BUILD)/obj/libipmi_sensor.o
+DEPS_36 += $(BUILD)/obj/libipmi_storlead_OEM.o
+DEPS_36 += $(BUILD)/obj/sensor_helpers.o
+
+
 DEPS_36 += $(BUILD)/obj/config.o
 DEPS_36 += $(BUILD)/obj/dashboard.o
 DEPS_36 += $(BUILD)/obj/fan.o
@@ -803,24 +1022,24 @@ DEPS_36 += $(BUILD)/obj/fw_update.o
 DEPS_36 += $(BUILD)/obj/remote_control.o
 DEPS_36 += $(BUILD)/obj/sel.o
 DEPS_36 += $(BUILD)/obj/server_health.o
->>>>>>> 62e2f54f0c6a6c4a634828a115139a52376334ba
+
 
 
 $(BUILD)/bin/libgo.a: $(DEPS_36)
 	@echo '      [Link] $(BUILD)/bin/libgo.a'
-<<<<<<< HEAD
-	$(AR) -cr $(BUILD)/bin/libgo.a "$(BUILD)/obj/ResultUtils.o" "$(BUILD)/obj/action.o" "$(BUILD)/obj/alloc.o" "$(BUILD)/obj/auth.o" "$(BUILD)/obj/cgi.o" "$(BUILD)/obj/crypt.o" "$(BUILD)/obj/file.o" "$(BUILD)/obj/fs.o" "$(BUILD)/obj/http.o" "$(BUILD)/obj/js.o" "$(BUILD)/obj/jst.o" "$(BUILD)/obj/options.o" "$(BUILD)/obj/osdep.o" "$(BUILD)/obj/rom.o" "$(BUILD)/obj/route.o" "$(BUILD)/obj/runtime.o" "$(BUILD)/obj/socket.o" "$(BUILD)/obj/time.o" "$(BUILD)/obj/upload.o" "$(BUILD)/obj/cJSON.o" "$(BUILD)/obj/libipmi_session.o" "$(BUILD)/obj/libipmi_uds_session.o" 
-=======
 	$(AR) -cr $(BUILD)/bin/libgo.a "$(BUILD)/obj/ResultUtils.o" "$(BUILD)/obj/action.o" \
 		"$(BUILD)/obj/alloc.o" "$(BUILD)/obj/auth.o" "$(BUILD)/obj/cgi.o" "$(BUILD)/obj/crypt.o" \
 		"$(BUILD)/obj/file.o" "$(BUILD)/obj/fs.o" "$(BUILD)/obj/http.o" "$(BUILD)/obj/js.o" \
 		"$(BUILD)/obj/jst.o" "$(BUILD)/obj/options.o" "$(BUILD)/obj/osdep.o" "$(BUILD)/obj/rom.o" \
 		"$(BUILD)/obj/route.o" "$(BUILD)/obj/runtime.o" "$(BUILD)/obj/socket.o" "$(BUILD)/obj/time.o" \
 		"$(BUILD)/obj/upload.o" "$(BUILD)/obj/cJSON.o" "$(BUILD)/obj/libipmi_session.o" \
-		"$(BUILD)/obj/libipmi_uds_session.o" "$(BUILD)/obj/libipmi_IPM.o" \
+		"$(BUILD)/obj/libipmi_uds_session.o" "$(BUILD)/obj/libipmi_IPM.o" "$(BUILD)/obj/libipmi_fru.o" \
+		"$(BUILD)/obj/libipmi_Chassis.o" "$(BUILD)/obj/libipmi_PEF.o" "$(BUILD)/obj/libipmi_sdr.o" \
+		"$(BUILD)/obj/libipmi_sensor.o" "$(BUILD)/obj/libipmi_storlead_OEM.o" "$(BUILD)/obj/sensor_helpers.o"  \
 		"$(BUILD)/obj/config.o" "$(BUILD)/obj/dashboard.o" "$(BUILD)/obj/fan.o" "$(BUILD)/obj/fru.o" \
-		"$(BUILD)/obj/fw_update.o" "$(BUILD)/obj/remote_control.o" "$(BUILD)/obj/sel.o" "$(BUILD)/obj/server_health.o" 
->>>>>>> 62e2f54f0c6a6c4a634828a115139a52376334ba
+		"$(BUILD)/obj/fw_update.o" "$(BUILD)/obj/remote_control.o" "$(BUILD)/obj/sel.o" \
+		"$(BUILD)/obj/server_health.o" 
+
 
 #
 #   install-certs

+ 2 - 2
app/goahead-5.1.0/src/goahead.c

@@ -47,8 +47,8 @@ static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp);
 static void sigHandler(int signo);
 #endif
 
-static void buy(Webs *wp);
-static void actionTest(Webs *wp);
+// static void buy(Webs *wp);
+// static void actionTest(Webs *wp);
 // static void personInfoAction(Webs *wp);
 
 

+ 9 - 1
app/goahead-5.1.0/src/goahead.h

@@ -3990,13 +3990,21 @@ PUBLIC void websRemoveSessionVar(Webs *wp, cchar *name);
 PUBLIC int websSetSessionVar(Webs *wp, cchar *name, cchar *value);
 
 
-//add by lusa
+////////////////////////////////////add by lusa///////////////////////////
 PUBLIC void personInfoAction(Webs *wp);
 
 PUBLIC void getDeviceInfo(Webs *wp);
 
 
 PUBLIC void getDeviceInfoBak(Webs *wp);
+
+
+PUBLIC void actionTest(Webs *wp);
+
+PUBLIC void buy(Webs *wp);
+
+
+////////////////////////////////end/////////////////
 /************************************ Legacy **********************************/
 /*
     Legacy mappings for pre GoAhead 3.X applications

+ 34 - 546
app/goahead-5.1.0/src/libipmi/inc/libipmi.h

@@ -3,70 +3,66 @@
 #ifndef LIBIPMI_H
 #define LIBIPMI_H
 
-#define u8 	unsigned char
-#define u16	unsigned short int
-#define s32 long int
-
 /*! Return value that indicates a specified sensor is disabled, and cannot be read */
 #define IPMI_SENSOR_DISABLED        ( -3 )
 
 /* IPMI threshold state definitions for monitoring */
-#define THRESH_UNINITIALIZED        ( (u16)0x00 ) /*!< Threshold state on first run */
-#define THRESH_NORMAL               ( (u16)0x01 ) /*!< Sensor is normal (unused in IPMI ) */
-#define THRESH_UP_NONCRIT           ( (u16)0x02 ) /*!< IPMI Upper Non-Critical Threshold */
-#define THRESH_UP_CRITICAL          ( (u16)0x04 ) /*!< IPMI Upper Critical Threshold */
-#define THRESH_LOW_NONCRIT          ( (u16)0x08 ) /*!< IPMI Lower Non-Critical Threshold */
-#define THRESH_LOW_CRITICAL         ( (u16)0x10 ) /*!< IPMI Lower Critical Threshold */
-#define THRESH_ACCESS_FAILED        ( (u16)0x20 ) /*!< Access failed sensor state */
-#define THRESH_UP_NON_RECOV         ( (u16)0x40 ) /*!< IPMI Upper Non-Recoverable Threshold */
-#define THRESH_LOW_NON_RECOV        ( (u16)0x80 ) /*!< IPMI Lower Non-Recoverable Threshold */
+#define THRESH_UNINITIALIZED        ( (uint16_t)0x00 ) /*!< Threshold state on first run */
+#define THRESH_NORMAL               ( (uint16_t)0x01 ) /*!< Sensor is normal (unused in IPMI ) */
+#define THRESH_UP_NONCRIT           ( (uint16_t)0x02 ) /*!< IPMI Upper Non-Critical Threshold */
+#define THRESH_UP_CRITICAL          ( (uint16_t)0x04 ) /*!< IPMI Upper Critical Threshold */
+#define THRESH_LOW_NONCRIT          ( (uint16_t)0x08 ) /*!< IPMI Lower Non-Critical Threshold */
+#define THRESH_LOW_CRITICAL         ( (uint16_t)0x10 ) /*!< IPMI Lower Critical Threshold */
+#define THRESH_ACCESS_FAILED        ( (uint16_t)0x20 ) /*!< Access failed sensor state */
+#define THRESH_UP_NON_RECOV         ( (uint16_t)0x40 ) /*!< IPMI Upper Non-Recoverable Threshold */
+#define THRESH_LOW_NON_RECOV        ( (uint16_t)0x80 ) /*!< IPMI Lower Non-Recoverable Threshold */
 
 /* Macros for converting netfn/lun combos */
-#define NETFN( netfnlun )       ( ( netfnlun & (u8)0xFC ) >> 2 )
-#define NETLUN( netfnlun )      ( ( netfnlun & (u8)0x03 ) )
+#define NETFN( netfnlun )       ( ( netfnlun & (uint8_t)0xFC ) >> 2 )
+#define NETLUN( netfnlun )      ( ( netfnlun & (uint8_t)0x03 ) )
 #define NETFNLUN( netfn,lun )   ( ( netfn << 2 ) | ( lun ) )
 
 /* Macros for converting seq/lun combos */
-#define SEQ( seqlun )           ( ( seqlun & (u8)0xFC ) >> 2 )
-#define SLUN( seqlun )          ( ( seqlun & (u8)0x03 ) )
+#define SEQ( seqlun )           ( ( seqlun & (uint8_t)0xFC ) >> 2 )
+#define SLUN( seqlun )          ( ( seqlun & (uint8_t)0x03 ) )
 #define SEQLUN( seq, lun )      ( ( seq << 2 ) | ( lun ) )
 
 
 /*****                 IPMI Constant Definitions                         *****/
 
 /* Completion Codes */
-#define IPMI_SUCCESS            ( (u8)0x00 )
+#define IPMI_SUCCESS            ( (uint8_t)0x00 )
 
 /* Sensor Data Record types */
-#define SDR_FULL                ( (u8)0x01 ) /**< SDR RecordType for Full Sensor Record */
-#define SDR_COMPACT             ( (u8)0x02 ) /**< SDR RecordType for Compact Sensor Record */
+#define SDR_FULL                ( (uint8_t)0x01 ) /**< SDR RecordType for Full Sensor Record */
+#define SDR_COMPACT             ( (uint8_t)0x02 ) /**< SDR RecordType for Compact Sensor Record */
 
 /* Raw sensor reading numeric format codes */
-#define SDR_READING_UNSIGNED    ( (u8)0 )
-#define SDR_READING_1SCOMP      ( (u8)1 )
-#define SDR_READING_2SCOMP      ( (u8)2 )
-#define SDR_READING_NONANALOG   ( (u8)3 )
+#define SDR_READING_UNSIGNED    ( (uint8_t)0 )
+#define SDR_READING_1SCOMP      ( (uint8_t)1 )
+#define SDR_READING_2SCOMP      ( (uint8_t)2 )
+#define SDR_READING_NONANALOG   ( (uint8_t)3 )
 
 /* Max size of an SDR of type SDR_FULL.  SDR_COMPACT records are smaller. */
 #define SDR_MAX_SIZE            ( 64 )
 
 /* Chassis control codes */
-#define CHASSIS_POWER_DOWN      ( (u8)0x00 )
-#define CHASSIS_POWER_UP        ( (u8)0x01 )
-#define CHASSIS_POWER_CYCLE     ( (u8)0x02 )
-#define CHASSIS_HARD_RESET      ( (u8)0x03 )
-#define CHASSIS_PULSE_DUMP      ( (u8)0x04 )
-#define CHASSIS_ACPI_POWER_DOWN ( (u8)0x05 )
+#define CHASSIS_POWER_DOWN      ( (uint8_t)0x00 )
+#define CHASSIS_POWER_UP        ( (uint8_t)0x01 )
+#define CHASSIS_POWER_CYCLE     ( (uint8_t)0x02 )
+#define CHASSIS_HARD_RESET      ( (uint8_t)0x03 )
+#define CHASSIS_PULSE_DUMP      ( (uint8_t)0x04 )
+#define CHASSIS_ACPI_POWER_DOWN ( (uint8_t)0x05 )
 
 /* Sensor Type Codes */
-#define IPMI_SENSOR_TEMPERATURE     ( (u8)0x01 )
-#define IPMI_SENSOR_VOLTAGE         ( (u8)0x02 )
-#define IPMI_SENSOR_CURRENT         ( (u8)0x03 )
-#define IPMI_SENSOR_FAN             ( (u8)0x04 )
-#define IPMI_SENSOR_POWER_SUPPLY    ( (u8)0x08 )
-#define IPMI_SENSOR_POWER_UNIT      ( (u8)0x09 )
-#define IPMI_SENSOR_COOLING_DEVICE  ( (u8)0x0A )
-#define IPMI_SENSOR_MEMORY          ( (u8)0x0C )
+#define IPMI_SENSOR_TEMPERATURE     ( (uint8_t)0x01 )
+#define IPMI_SENSOR_VOLTAGE         ( (uint8_t)0x02 )
+#define IPMI_SENSOR_CURRENT         ( (uint8_t)0x03 )
+#define IPMI_SENSOR_FAN             ( (uint8_t)0x04 )
+#define IPMI_SENSOR_POWER_SUPPLY    ( (uint8_t)0x08 )
+#define IPMI_SENSOR_POWER_UNIT      ( (uint8_t)0x09 )
+#define IPMI_SENSOR_COOLING_DEVICE  ( (uint8_t)0x0A )
+#define IPMI_SENSOR_MEMORY          ( (uint8_t)0x0C )
 
 /* Sensor Unit Type Codes from the IPMI spec */
 #define IPMI_UNIT_UNSPECIFIED   0
@@ -163,512 +159,4 @@
 
 
 
-/** \name IPMI Functions */
-/** \{ */
-
-/** \brief Send the IPMI Get Sensor Reading command and get the response
- *
- *  Send the GetSensorReading command to the specified slave with \a sensor as
- *  the sensor number, and get the response.
- *
- *  \param slave The slave address of the IPMI device (8-bit format)
- *  \param sensor The sensor number on the IPMI device
- *  \param reading The address of a u8 that will be filled with the sensor
- *  reading.  Note that this is a raw sensor value which must be converted
- *  by use of the \ref ipmi_convert_reading function.
- *  \param response The address of a \ref GetSensorReadingResponseStruct
- *  if you want the entire sensor response, not just the sensor reading.
- *  Pass \c NULL if you just want the sensor reading.
- *
- *  \retval "IPMI response code" Success
- *  \retval HHM_FAILURE The sensor reading could not be retrieved.
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-
-/*@external@*/extern int
-ipmi_get_sensor_reading( u8 slave, u8 sensor, /*@out@*/u8 *reading,
-                         /*@null@*//*@out@*/GetSensorReadingResponseStruct *response )
-/*@globals fileSystem@*/
-/*@modifies *reading,fileSystem,response@*/;
-
-/** \brief Get a reservation to access the SDR repository
- *
- *  This is required for certain IPMI commands, such as GetSDR when doing
- *  partial reads and from non-zero offsets, as well as other commands.
- *  See the IPMI spec for details.
- *
- *  \param slave The slave address of the IPMI device (8-bit format)
- *  \param response A pointer to an \ref IPMBReserveSDRRepositoryStruct that
- *  this function fills in
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-
-/*@external@*/extern int
-ipmi_reserve_sdr_repository( u8 slave, /*@out@*/IPMBReserveSDRRepositoryStruct *response )
-/*@globals fileSystem@*/
-/*@modifies *response,fileSystem@*/;
-
-
-/** \brief Get a reservation to access the SEL
- *
- *  Get a reservation to access the SEL.  This is required for
- *  certain IPMI commands  See the IPMI spec for details.
- *
- *  \param slave The slave address of the IPMI device (8-bit format)
- *  \param response An \ref ReserveSELResponseStruct that this
- *  function fills in.
- *  
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-
-/*@external@*/extern int
-ipmi_reserve_sel_repository( u8 slave, /*@out@*/ReserveSELResponseStruct *response )	//jimbo notice!
-/*@globals fileSystem@*/
-/*@modifies *response,fileSystem@*/;
-
-
-/** \brief Read an SDR entry or part of an SDR entry from an IPMI device
- *
- *  Read an SDR entry from the SDR repository.  Usually only BMCs have SDR
- *  repositories.  SDR entries have useful info such as sensor numbers,
- *  sensor types, and data conversion equations, and can be used to determine
- *  the type of sensors available, and how to monitor them.
- *  This is probably not the function you are looking for.  This function is
- *  a raw interface to the GetSDR function, suitable for performing partial
- *  reads and testing.  If you just want to read the entire SDR entry, use
- *  \ref ipmi_get_sdr_full which is much easier to use.
- *
- *  \param slave The slave address of the IPMI device (8-bit format)
- *  \param reservation_id An SDR reservation ID obtained from the 
- *  \ref ipmi_reserve_sdr_repository command, or zero if not doing a partial
- *  read and \a offset_into_record is zero.
- *  \param record_id The SDR record ID to read
- *  \param bytes_to_read The number of bytes to read from the record. Pass
- *  0xFF to read the entire record.   Be aware, however, that most BMCs do not
- *  support sending a response large enough to contain the entire record.
- *  \param offset_into_record The starting point for the SDR read operation in
- *  the record.  If this is not 0, you need to call
- *  \ref ipmi_reserve_sdr_repository before this function.
- *  \param record_data A buffer that will be filled in with the entire GetSDR
- *  response (cast this buffer to an \ref IPMBGetSDRResponseStruct after
- *  calling).  The length of the SDR entry is variable, so the data buffer
- *  should be ~255 bytes long to be safe.
- *
- *  \retval "Length of the SDR read" Success.  The IPMI completion code is 
- *  contained within the \ref IPMBGetSDRResponseStruct returned in
- *  \a record_data
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-/*@external@*/extern int
-ipmi_get_sdr( u8 slave, u16 reservation_id, u16 record_id,
-              u8 offset_into_record, u8 bytes_to_read, /*@out@*/u8 *record_data )
-/*@globals fileSystem@*/
-/*@modifies *record_data,fileSystem@*/;
-
-
-/** \brief Read an entire SDR entry from an IPMI device
- *
- *  Like \ref ipmi_get_sdr, but this command always reads the entire SDR entry,
- *  even if it needs to break the operation down into a series of partial
- *  reads.  Like \ref ipmi_get_sdr, \a record_data should be able to accomodate
- *  255 bytes.
- *
- *  \param slave The slave address of the IPMI device (8-bit format)
- *  \param record_id The SDR record to read
- *  \param record_data A buffer the function fills in that will contain the
- *  \ref IPMBGetSDRResponseStruct and the entire SDR entry specified in 
- *  \a record_id
- *
- *  \retval "Length of the SDR read" Success.  The completion code is contained
- *  within the \ref IPMBGetSDRResponseStruct returned in \a record_data
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-/*@external@*/extern int
-ipmi_get_sdr_full( u8 slave, u16 record_id, /*@out@*/u8 *record_data )
-/*@globals fileSystem@*/
-/*@modifies *record_data,fileSystem@*/;
-
-
-/** \brief Get an SEL entry from an IPMI device
- *
- *  Read an SEL entry from the SEL.  Usually only BMCs have an SEL.  This is
- *  probably not the function you are looking for.  This function is a raw
- *  interface to the GetSEL function, suitable for performing partial reads
- *  and testing.  If you just want to read the entire SEL entry, use
- *  \ref ipmi_get_sel_full, which is much easier to use.
- *
- *  \param slave The slave address of the IPMI device (8-bit format)
- *  \param reservation_id An SEL reservation ID obtained from the
- *  \ref ipmi_reserve_sel_repository command, or zero if not doing a partial
- *  read and \a offset_into_record is zero.
- *  \param record_id The SEL record ID to read.
- *  \param offset_into_record The offset into the specified record to read
- *  from.  Zero for the beginning of the record.
- *  \param bytes_to_read The number of bytes to read from the record. Pass
- *  0xFF to read the entire record.   Be aware, however, that most BMCs do
- *  not support sending a response large enough to contain the entire record
- *  \param response A \ref GetSELEntryResponseStruct that will be filled in
- *  with the entire GetSEL response.
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-///*@external@*/extern int
-//ipmi_get_sel_entry( u8 slave, u16 reservation_id, u16 record_id,
-//                    u8 offset_into_record, u8 bytes_to_read,
-//                    /*@out@*/GetSELEntryResponseStruct *response )
-/*@globals fileSystem@*/
-/*@modifies *response,fileSystem@*/;
-
-
-/** \brief Get an entire SEL entry from an IPMI device
- *
- *  Like \ref ipmi_get_sel_entry, but this command always reads the entire SEL
- *  entry, even if it needs to break the operation down into a series of
- *  partial reads
- *
- *  \param slave The slave address of the IPMI device (8-bit format)
- *  \param record_id The SEL entry to read
- *  \param response A \ref GetSELEntryResponseStruct pointer which will
- *  be filled in by this function.
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- */
-///*@external@*/extern int
-//ipmi_get_sel_full( u8 slave, u16 record_id, /*@out@*/GetSELEntryResponseStruct *response )
-///*@globals fileSystem@*/
-///*@modifies *response,fileSystem@*/;
-
-
-/** \brief Send the IPMI Get Device ID command and get the response
- *
- *  Send the get device ID IPMI command to a slave address on the I2C bus, and
- *  receive the response.
- *
- *  \param slave Slave address of the IPMI device (8-bit format)
- *  \param response The above slave's complete response to the get device
- *  ID command.
- *
- *  \retval "IPMI Completion Code" Succes
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-///*@external@*/extern int
-//ipmi_get_device_id( u8 slave, /*@out@*/IPMBGetDeviceIDResponseStruct *response )
-///*@globals fileSystem@*/
-///*@modifies *response,fileSystem@*/;
-
-
-/** \brief Send the IPMI Chassis Power Down command
- *
- *  \param slave Slave address of the IPMI device (8-bit format)
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-/*@external@*/extern int
-ipmi_chassis_power_down( u8 slave )
-/*@globals fileSystem@*//*@modifies fileSystem@*/;
-
-
-/** \brief Send the IPMI Chassis Power Up command
- *
- *  \param slave Slave address of the IPMI device (8-bit format)
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-/*@external@*/extern int
-ipmi_chassis_power_up( u8 slave )
-/*@globals fileSystem@*//*@modifies fileSystem@*/;
-
-
-/** \brief Send the IPMI Chassis Power Cycle command
- *
- *  \param slave Slave address of the IPMI device (8-bit format)
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-/*@external@*/extern int
-ipmi_chassis_power_cycle( u8 slave )
-/*@globals fileSystem@*//*@modifies fileSystem@*/;
-
-
-/** \brief Send the IPMI Chassis Hard Reset command
- *
- *  \param slave Slave address of the IPMI device (8-bit format)
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-/*@external@*/extern int
-ipmi_chassis_hard_reset( u8 slave )
-/*@globals fileSystem@*//*@modifies fileSystem@*/;
-
-
-/** \brief Send the IPMI Chassis ACPI Power Down command
- *
- *  \param slave Slave address of the IPMI device (8-bit format)
- *
- *  \retval "IPMI Completion Code" Success
- *  \retval HHM_FAILURE Failure, errno set
- *
- *  \note For almost all sensors, the IPMI response code should be 0x00.
- *  Some devices might return other completion codes to convey OEM specific
- *  information, or just to be contrary.  If the behaviour of a particular
- *  device is not well known with respect to completion codes, assume that if
- *  a completion code other than 0x00 is returned, the value in \a reading
- *  is invalid.
- */
-/*@external@*/extern int
-ipmi_chassis_acpi_power_down( u8 slave )
-/*@globals fileSystem@*//*@modifies fileSystem@*/;
-
-
-/** \brief Send an arbitrary IPMI command, and get the response
- *
- *  Send any IPMI command your heart desires to any I2C/LUN combo and receive
- *  the response.  See the IPMI spec for further info.
- *
- *  \param slave Slave address of the IPMI device (8-bit format)
- *  \param netFn The net function of the command to send
- *  \param targetLUN The LUN of the IPMI device
- *  \param command A buffer containing the command number, and any extra data
- *  which is needed for the command.
- *  \param cmd_len The length of the command buffer
- *  \param response_buffer The buffer which will be filled with the response
- *  to your ipmi command.
- *  \param response_len The size of the buffer to which
- *  \a response_buffer points
- *
- *  \retval "Length of the IPMI response" Success
- *  \retval HHM_FAILURE Failure, errno set
- */
-/*@external@*/extern int
-ipmi_generic_command( u8 slave, u8 netFn, u8 targetLUN, u8 *command,
-                      size_t cmd_len, /*@out@*/u8 *response_buffer,
-                      size_t response_len )
-/*@globals fileSystem@*/
-/*@modifies *response_buffer,fileSystem@*/;
-
-
-/** \brief Convert a raw sensor reading to its final reading using an SDR
- *
- *  Use the standard IPMI method and SDR data to convert a raw sensor reading
- *  into its converted value.  See the IPMI spec for further info on this
- *  conversion.
- *
- *  \param sdr_buffer A pointer to a complete SDR entry which contains reading
- *  conversion data.  IE, it is a Full SDR entry.
- *  \param raw_reading The raw sensor reading you want to convert
- *  \param converted_reading Pointer to an s32 that will be assigned the
- *  converted reading on success.
- *
- *  \retval 0 Success, or sensor out of IPMI sensor min/max reading range, with
- *  0 in \a converted_reading
- *  \retval HHM_FAILURE Not enough information to perform the conversion
- */
-/*@external@*/extern int
-ipmi_convert_reading( u8 *sdr_buffer, u8 raw_reading, /*@out@*/float *converted_reading )
-/*@modifies *converted_reading@*/;
-
-
-/** \brief Use an SDR entry to read the corresponding sensor
- *
- *  Use a (usually saved) SDR entry to read the current value of
- *  a sensor.  The reading is performed as specified by the SDR
- *  entry passed in \a sdr_buffer.  The reading obtained is the
- *  final, converted sensor reading
- *
- *  \param sdr_buffer Pointer to a complete SDR buffer that contains
- *  information on accessing a sensor.
- *  \param raw_reading The raw sensor reading fresh from the BMC.
- *  \param reading The converted sensor reading read and converted
- *  as specified by the SDR entry.
- *  \param discrete Pointer to a u8 used as a boolean, indicates if
- *  the sensor read is a discrete sensor instead of an analog sensor
- *
- *  \retval HHM_FAILURE Failure
- *  \retval IPMI_SENSOR_DISABLED Reading is invalid, this sensor is disabled
- *  \retval 0 Success
- */
-/*@external@*/extern int
-hhm_access_sdr_sensors( u8 *sdr_buffer, /*@out@*/u8 *raw_reading,
-                        /*@out@*/float *reading, /*@out@*/u8 *discrete )
-/*@globals fileSystem@*/
-/*@modifies *raw_reading,*reading,fileSystem,discrete@*/;
-
-/** \} */
-
-/** \brief Extract a descriptive string from an SDR entry
- *
- *  Read the text description field from the provided SDR, convert it
- *  to a nice standard ascii string, and copy it into \a description.
- *
- *  \param sdr_buffer Pointer to a buffer containing an SDR
- *  \param description Pointer to a buffer that will be filled with the
- *  description of this SDR.  \a Description should have 17 bytes of storage,
- *  to account for the 16 possible bytes of description defined by IPMI, and
- *  the \c NULL terminator.
- *
- *  \retval 0 Success
- *  \retval HHM_FAILURE Failure, errno set
- */
-/*@external@*/extern int
-extract_sdr_id( u8 *sdr_buffer, /*@out@*/char *description )
-/*@modifies *description@*/;
-
-
-/** \brief Convert an IPMI (or AMI OEM) unit type code to a descriptive string
- *
- *  Convert an IPMI or AMI OEM unit type code into a string suitable for
- *  display.  This function could (for example), convert the unit type 0x01 to
- *  the string "degrees C".
- *
- *  \param unit_type_code An IPMI (or AMI OEM) unit type code
- *  \param unit_type_string A char buffer that will contain the unit string
- *  on completion.
- *  \param unit_string_len The length of the unit string.  Expect around 20
- *  chars at most, but there is no internal limit to any particular size.
- *
- *  \retval 0 Success
- *  \retval HHM_FAILURE Failure, errno set, "Unrecognized" is set in
- *  \a unit_type_string.
- */
-/*@external@*/extern int
-sdk_unit_to_string( u8 unit_type_code, /*@out@*/char *unit_type_string,
-                    size_t unit_string_len )
-/*@modifies unit_type_string@*/;
-
-
-/** \brief Generate a string corresponding to a discrete reading code
- *
- *  Convert a discrete state (supplied in \a reading) into a string using the
- *  \a reading_type_code and the IPMI table of discrete states.
- *
- *  \param reading The sensor reading (discrete state)
- *  \param reading_type_code The reading type code from the SDR
- *  \param sensor_type The sensor type code from the SDR
- *  \param discrete_string Pointer to a buffer we will fill with text
- *  describing the discrete state
- *  \param string_size The amount of storage at \a discrete_string
- *
- *  \retval 0 Success
- *  \retval HHM_FAILURE Failure, errno set
- */
-/*@external@*/extern int
-ipmi_discrete_reading_string( s32 reading, u8 reading_type_code,
-                              u8 sensor_type,
-                              /*@out@*/char *discrete_string,
-                              size_t string_size )
-/*@modifies discrete_string@*/;
-
-
-/** \brief Get the threshold state of a sensor based on its SDR
- *
- *  Determine the state of a given sensor based on threshold information
- *  from its SDR.  This state is a bitfield with individual bits indicating
- *  which thresholds have been passed.  A bit is set to 1 when the threshold
- *  it represents has been passed.  This function also handles threshold
- *  hysteresis values correctly.
- *
- *  \param sensor_reading A raw, unconverted sensor reading
- *  \param sdr_buffer A pointer to a buffer containing an SDR
- *  \param last_state The previous state of the sensor, obtained from a prior
- *  call to this function.  Pass \ref THRESH_UNINITIALIZED if there is no
- *  \a last_state because this is the first call to \ref get_sdr_sensor_state
- *  for this sensor.
- *  \param current_state Variable that will be filled with the current state
- *  of the sensor, based on information passed in \a sensor_reading and 
- *  \a sdr_buffer.  See \ref THRESH_UP_NONCRIT for an example of a state
- *  bitfield.
- *
- *  \retval 0 Success
- *  \retval HHM_FAILURE Failure, errno set
- */
-/*@external@*/extern int
-get_sdr_sensor_state( u8 sensor_reading, u8 *sdr_buffer, u16 last_state,
-                      /*@out@*/u16 *current_state )
-/*@modifies *current_state@*/;
-
 #endif

+ 11 - 12
app/goahead-5.1.0/src/libipmi/inc/libipmi_AppDevice.h

@@ -14,11 +14,10 @@
 /* LIIPMI core header files */
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
-#include "libipmiifc.h"
 
 /* command specific header files */
-#include "IPMI_AppDevice.h"
-#include "IPMI_AppDevice+.h"
+#include "com_IPMI_AppDevice.h"
+#include "com_IPMI_AppDevice+.h"
 
 #ifdef  __cplusplus
 extern "C" {
@@ -54,21 +53,21 @@ uint16_t IPMICMD_GetChannelInfo(IPMI20_SESSION_T* pSession,
 							 GetChInfoRes_T* pResGetChInfo,
 							 int timeout);
 
-LIBIPMI_API uint16_t	IPMICMD_GetSystemGUID( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSystemGUID( IPMI20_SESSION_T *pSession,
                                             GetSysGUIDRes_T *pGetSystemGUID,
                                             int timeout );
-LIBIPMI_API uint16_t IPMICMD_SendMessage(IPMI20_SESSION_T *pSession,uint8_t *pSendMsgReq,
+  uint16_t IPMICMD_SendMessage(IPMI20_SESSION_T *pSession,uint8_t *pSendMsgReq,
                                                           uint8_t *pSendMsgRes,uint32_t SendMsgReqLen,int timeout);
 
 /*---------- LIBIPMI Higher level routines -----------*/
 
 /* User Management functions */
-LIBIPMI_API uint16_t LIBIPMI_HL_SetUser( IPMI20_SESSION_T *pSession/*in*/, char *pszUsername/*in*/,
+  uint16_t LIBIPMI_HL_SetUser( IPMI20_SESSION_T *pSession/*in*/, char *pszUsername/*in*/,
 										uint8_t byID/*in*/, int timeout/*in*/);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetUser( IPMI20_SESSION_T *pSession/*in*/, char *pszUsername/*out*/,
+  uint16_t LIBIPMI_HL_GetUser( IPMI20_SESSION_T *pSession/*in*/, char *pszUsername/*out*/,
 										uint8_t byID/*in*/, int timeout/*in*/);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_AddUser(IPMI20_SESSION_T *pSession/*in*/,uint8_t UserID/*in*/,
+  uint16_t LIBIPMI_HL_AddUser(IPMI20_SESSION_T *pSession/*in*/,uint8_t UserID/*in*/,
                                     char* UserName/*in*/,   char* ClearPswd/*in*/,
                                     uint8_t NetworkPriv/*in*/,uint8_t SerialPriv/*in*/,
                                     int timeout);
@@ -78,9 +77,9 @@ uint16_t LIBIPMI_HL_ModUser(IPMI20_SESSION_T *pSession,
 					uint8_t NetworkPriv,uint8_t SerialPriv,uint8_t EnableUser,
 					uint8_t ModifyUserName, uint8_t EnableSOL,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_DelUser(IPMI20_SESSION_T *pSession/*in*/,uint8_t UserID/*in*/,
+  uint16_t LIBIPMI_HL_DelUser(IPMI20_SESSION_T *pSession/*in*/,uint8_t UserID/*in*/,
                                     int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetMaxNumUsers(IPMI20_SESSION_T* pSession/*in*/,
+  uint16_t LIBIPMI_HL_GetMaxNumUsers(IPMI20_SESSION_T* pSession/*in*/,
                                     uint8_t *nNumUsers/*in*/, int timeout);
 uint16_t LIBIPMI_HL_GetAllUserInfo(IPMI20_SESSION_T *pSession,
 							uint8_t* nNumUsers,
@@ -103,9 +102,9 @@ uint16_t LIBIPMI_HL_SetChannelAccessPrivilege(IPMI20_SESSION_T* pSession,
                                    uint8_t ChannelMedium,uint8_t Privilege,
                                       SetChAccessRes_T* pChAccessRes, int timeout);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetSystemGUID( IPMI20_SESSION_T *pSession, char *pszSystemGUID, int timeout );
+  uint16_t LIBIPMI_HL_GetSystemGUID( IPMI20_SESSION_T *pSession, char *pszSystemGUID, int timeout );
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetUserPrivilege(IPMI20_SESSION_T *pSession, uint8_t UserID, uint32_t *Privilege, int timeout);
+  uint16_t LIBIPMI_HL_GetUserPrivilege(IPMI20_SESSION_T *pSession, uint8_t UserID, uint32_t *Privilege, int timeout);
 
 #ifdef  __cplusplus
 }

+ 10 - 11
app/goahead-5.1.0/src/libipmi/inc/libipmi_ChassisDevice.h

@@ -8,11 +8,10 @@
 /* LIIPMI core header files */
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
-#include "libipmiifc.h"
 
 /* command specific header files */
-#include "IPMI_ChassisDevice.h"
-#include "IPMI_Chassis.h"
+#include "com_IPMI_ChassisDevice.h"
+#include "com_IPMI_Chassis.h"
 
 #ifdef  __cplusplus
 extern "C" {
@@ -42,7 +41,7 @@ extern "C" {
 
    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-LIBIPMI_API uint16_t LIBIPMI_HL_PowerOff( IPMI20_SESSION_T *pSession/*in*/, int timeout/*in*/);
+  uint16_t LIBIPMI_HL_PowerOff( IPMI20_SESSION_T *pSession/*in*/, int timeout/*in*/);
 
 
 
@@ -53,7 +52,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_PowerOff( IPMI20_SESSION_T *pSession/*in*/, int
 
    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-LIBIPMI_API uint16_t LIBIPMI_HL_PowerUp( IPMI20_SESSION_T *pSession/*in*/, int timeout/*in*/);
+  uint16_t LIBIPMI_HL_PowerUp( IPMI20_SESSION_T *pSession/*in*/, int timeout/*in*/);
 
 
 
@@ -64,7 +63,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_PowerUp( IPMI20_SESSION_T *pSession/*in*/, int t
 
    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-LIBIPMI_API uint16_t LIBIPMI_HL_PowerCycle( IPMI20_SESSION_T *pSession, int timeout );
+  uint16_t LIBIPMI_HL_PowerCycle( IPMI20_SESSION_T *pSession, int timeout );
 
 
 
@@ -75,7 +74,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_PowerCycle( IPMI20_SESSION_T *pSession, int time
 
    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-LIBIPMI_API uint16_t LIBIPMI_HL_HardReset( IPMI20_SESSION_T *pSession, int timeout );
+  uint16_t LIBIPMI_HL_HardReset( IPMI20_SESSION_T *pSession, int timeout );
     
 
 /**
@@ -85,7 +84,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_HardReset( IPMI20_SESSION_T *pSession, int timeo
 
    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-LIBIPMI_API uint16_t LIBIPMI_HL_DiagInt( IPMI20_SESSION_T *pSession, int timeout );
+  uint16_t LIBIPMI_HL_DiagInt( IPMI20_SESSION_T *pSession, int timeout );
     
 
 /**
@@ -95,7 +94,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_DiagInt( IPMI20_SESSION_T *pSession, int timeout
 
    @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-LIBIPMI_API uint16_t LIBIPMI_HL_SoftOff( IPMI20_SESSION_T *pSession, int timeout );
+  uint16_t LIBIPMI_HL_SoftOff( IPMI20_SESSION_T *pSession, int timeout );
     
 
 
@@ -123,7 +122,7 @@ typedef struct tag_chassis_status_T
  * 
  * @return  Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  */
-LIBIPMI_API uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_SESSION_T *pSession, int timeout,  chassis_status_T *status);
+  uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_SESSION_T *pSession, int timeout,  chassis_status_T *status);
 
 /*---------------------Chassis Idnetify defines ---------------------*/
 #define CHASSIS_ID_INTERVAL_TURN_OFF		0
@@ -145,7 +144,7 @@ typedef enum tag_FORCE_CHASSIS_ID
  * 
  * @return  Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  */
-LIBIPMI_API uint16_t LIBIPMI_HL_ChassisIdentify(IPMI20_SESSION_T *pSession, int timeout,uint8_t BlinkTimeSecs,FORCE_CHASSIS_ID ForceOn);
+  uint16_t LIBIPMI_HL_ChassisIdentify(IPMI20_SESSION_T *pSession, int timeout,uint8_t BlinkTimeSecs,FORCE_CHASSIS_ID ForceOn);
 
 uint16_t	LIBIPMI_HL_GetSystemBootOptions_BootFlags( IPMI20_SESSION_T *pSession, BootFlags_T* pBootFlags,int timeout);
 uint16_t	LIBIPMI_HL_SetSystemBootOptions_BootFlags( IPMI20_SESSION_T *pSession, BootFlags_T* pBootFlags,int timeout);

+ 20 - 21
app/goahead-5.1.0/src/libipmi/inc/libipmi_PEF.h

@@ -4,14 +4,13 @@
 /* LIIPMI core header files */
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
-#include "libipmiifc.h"
 
 /* command specific header files */
 #pragma pack(1)
-#include "IPMI_PEF.h"
+#include "com_IPMI_PEF.h"
 #pragma pack()
 
-#include "IPMI_SensorEvent.h"
+#include "com_IPMI_SensorEvent.h"
 
 
 #define SET_IN_PROGRESS_PARAM 0x00
@@ -26,97 +25,97 @@ extern "C" {
 #endif
 
 /* Get PEF Capabilities Command */
-LIBIPMI_API uint16_t	IPMICMD_GetPEFCapabilities( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetPEFCapabilities( IPMI20_SESSION_T *pSession,
 							GetPEFCapRes_T *pResGetPEFCap,
 							int timeout);
 
 /* Arm PEF Postpone Timer Command */
-LIBIPMI_API uint16_t	IPMICMD_ArmPEFTimer( IPMI20_SESSION_T *pSession/*in*/,
+  uint16_t	IPMICMD_ArmPEFTimer( IPMI20_SESSION_T *pSession/*in*/,
 							uint8_t*	pReqTmrTimeout/*in*/,
 							ArmPEFTmrRes_T *pResArmPEFTmr/*out*/,
 							int timeout/*in*/);
 
 /* Set PEF Configuration Parameters Command */
-LIBIPMI_API uint16_t	IPMICMD_SetPEFConf( IPMI20_SESSION_T *pSession/*in*/,
+  uint16_t	IPMICMD_SetPEFConf( IPMI20_SESSION_T *pSession/*in*/,
 							uint8_t *pReqSetPEFConf/*in*/,
 							uint32_t dwReqBufLen,
 							uint8_t *pResSetPEFConf/*out*/,
 							int timeout/*in*/);
 
 /* Get PEF Configuration Parameters Command */
-LIBIPMI_API uint16_t	IPMICMD_GetPEFConf( IPMI20_SESSION_T *pSession/*in*/,
+  uint16_t	IPMICMD_GetPEFConf( IPMI20_SESSION_T *pSession/*in*/,
 							GetPEFConfigReq_T *pReqGetPEFConf/*in*/,
 							uint8_t *pResGetPEFConf/*out*/,
 							int timeout/*in*/);
 
 /* Set Last Processed Event ID Command */
-LIBIPMI_API uint16_t	IPMICMD_SetLastEventID( IPMI20_SESSION_T *pSession/*in*/,
+  uint16_t	IPMICMD_SetLastEventID( IPMI20_SESSION_T *pSession/*in*/,
 							SetLastEvtIDReq_T *pReqSetLastEvt/*in*/,
 							uint8_t *pResSetLastEvt/*out*/,
 							int timeout/*in*/);
 
 /* Get Last Processed Event ID Command */
-LIBIPMI_API uint16_t	IPMICMD_GetLastEventID( IPMI20_SESSION_T *pSession/*in*/,
+  uint16_t	IPMICMD_GetLastEventID( IPMI20_SESSION_T *pSession/*in*/,
 							GetLastEvtIDRes_T *pResGetLastEvt/*out*/,
 							int timeout/*in*/);
 
 /* Alert Immediate Command */
-LIBIPMI_API uint16_t	IPMICMD_AlertImmediate( IPMI20_SESSION_T *pSession/*in*/,
+  uint16_t	IPMICMD_AlertImmediate( IPMI20_SESSION_T *pSession/*in*/,
 							AlertImmReq_T *pReqAlertImmediate/*in*/,
 							AlertImmRes_T *pResAlertImmediate/*out*/,
 							int timeout/*in*/);
 
 /* PET Acknowledge Command */
-LIBIPMI_API uint16_t	IPMICMD_PETAck( IPMI20_SESSION_T *pSession/*in*/,
+  uint16_t	IPMICMD_PETAck( IPMI20_SESSION_T *pSession/*in*/,
 							PETAckReq_T *pReqPETAck /*out*/,
 							uint8_t *pResPETACK /*out*/,
 							int timeout/*in*/);
 
 /*---------- PEF Higher level routines -----------*/
 /*********** Alert Table **********/
-LIBIPMI_API uint16_t LIBIPMI_HL_GetNumOfAlertPolicyEntries(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetNumOfAlertPolicyEntries(IPMI20_SESSION_T *pSession,
 					uint8_t* pNumOfAlertPolicyEntries,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAnAlertEntry(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAnAlertEntry(IPMI20_SESSION_T *pSession,
 					uint8_t AlertEntryNumber,
 					AlertPolicyTblEntry_T* pAlertEntry,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_SetAnAlertEntry(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_SetAnAlertEntry(IPMI20_SESSION_T *pSession,
 					uint8_t AlertEntryNumber,
 					AlertPolicyTblEntry_T* pAlertEntry,
 					int timeout);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAlertTable(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAlertTable(IPMI20_SESSION_T *pSession,
 					AlertPolicyTblEntry_T* pAlertTable,
 					uint8_t* pNumOfAlertEntries,
 					int timeout);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_SetGraspAlertLevel(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_SetGraspAlertLevel(IPMI20_SESSION_T *pSession,
 					uint8_t IndexNum,
 					uint8_t AlertLevel, 
 					uint8_t Channel, 
 					int timeout);
 
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetGraspAlertLevel(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetGraspAlertLevel(IPMI20_SESSION_T *pSession,
 					uint8_t IndexNum,
 					uint8_t* AlertLevel, 
 					uint8_t* DestIndex,
 					int timeout);
 /*********** PEF Table ********/
-LIBIPMI_API uint16_t LIBIPMI_HL_GetPEFTable(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetPEFTable(IPMI20_SESSION_T *pSession,
 					EvtFilterTblEntry_T* pPEFTable,
 					uint8_t* pNumOfPEFEntries,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetPEFEntry(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetPEFEntry(IPMI20_SESSION_T *pSession,
 					uint8_t PEFEntryNumber,
 					EvtFilterTblEntry_T* pPEFEntry,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_SetPEFEntry(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_SetPEFEntry(IPMI20_SESSION_T *pSession,
 					uint8_t PEFEntryNumber,
 					EvtFilterTblEntry_T* pPEFEntry,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetNumOfPEFEntries(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetNumOfPEFEntries(IPMI20_SESSION_T *pSession,
 					uint8_t* pNumOfPEFEntries,
 					int timeout);
 

+ 28 - 31
app/goahead-5.1.0/src/libipmi/inc/libipmi_StorDevice.h

@@ -14,18 +14,16 @@
 /* LIIPMI core header files */
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
-#include "libipmiifc.h"
 
 /* command specific header files */
-#include "IPMI_SEL.h"
-#include "IPMI_FRU.h"
-#include "IPMI_IPMB.h"
-#include "IPMI_Storage.h"
+#include "com_IPMI_SEL.h"
+#include "com_IPMI_FRU.h"
+#include "com_IPMI_IPMB.h"
+#include "com_IPMI_Storage.h"
 //#include "IPMIConf.h"
-#include "SELRecord.h"
+//#include "SELRecord.h"
 
 #include "libipmi_sdr.h"
-#include "std_macros.h"
 
 #ifdef  __cplusplus
 extern "C" {
@@ -34,45 +32,45 @@ extern "C" {
 /*****************************************************************************
 	System Event Log
 ******************************************************************************/
-LIBIPMI_API uint16_t IPMICMD_GetSELInfo(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSELInfo(IPMI20_SESSION_T *pSession,
 					SELInfo_T *pResGetSELInfo,
 					int timeout);
-LIBIPMI_API uint16_t IPMICMD_GetSELAllocationInfo(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSELAllocationInfo(IPMI20_SESSION_T *pSession,
 					SELAllocInfo_T *pResGetSELAllocInfo,
 					int timeout);
-LIBIPMI_API uint16_t IPMICMD_ReserveSEL(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_ReserveSEL(IPMI20_SESSION_T *pSession,
 					ReserveSELRes_T* pReserveSelRes,
 					int timeout);
-LIBIPMI_API uint16_t IPMICMD_GetSELEntry(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSELEntry(IPMI20_SESSION_T *pSession,
 					GetSELReq_T* pGetSELReqData,
 					uint8_t* pGetSELResData,
 					uint32_t ResDataLen,
 					int timeout);
-LIBIPMI_API uint16_t IPMICMD_AddSELEntry(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_AddSELEntry(IPMI20_SESSION_T *pSession,
 					SELEventRecord_T* pSELReqData,
 					AddSELRes_T* pSELResData,
 					int timeout);
-LIBIPMI_API uint16_t IPMICMD_DeleteSELEntry(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_DeleteSELEntry(IPMI20_SESSION_T *pSession,
 					uint16_t RecordID,
 					int timeout);
 
 /*---------- LIBIPMI Higher level routines -----------*/
-LIBIPMI_API uint16_t LIBIPMI_HL_GetNumOfSELEntries(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetNumOfSELEntries(IPMI20_SESSION_T *pSession,
 					uint16_t* nNumOfSELEntries,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetMaxPossibleSELEntries(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetMaxPossibleSELEntries(IPMI20_SESSION_T *pSession,
 					uint16_t* nMaxPossibleSELEntries,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSELEntries(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllSELEntries(IPMI20_SESSION_T *pSession,
 					SELEventRecord_T *pSELEntriesBuffer,
 					int timeout);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSensorInfo(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllSensorInfo(IPMI20_SESSION_T *pSession,
 					uint8_t **SDRBuff,
 					int *SDRCount,
 					int *MaxSDRLen,
 					int timeout);
-LIBIPMI_API uint16_t LIBIPMI_HL_GetSensorName(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetSensorName(IPMI20_SESSION_T *pSession,
 					uint8_t SlaveAdd,
 					uint8_t LUNid,
 					uint8_t SensorNum,
@@ -96,8 +94,7 @@ typedef struct _SELEventRecordWithSensorName
 {
 	SELRec_T EventRecord;
 	uint8_t SensorName[65]; //65 is the max possible because SensorName len in SDR is indicated by 6 bits
-} PACKED
-SELEventRecordWithSensorName_T;
+} SELEventRecordWithSensorName_T;
 
 #ifndef MAX_FRU_DEVICES
 #define MAX_FRU_DEVICES	32
@@ -114,7 +111,7 @@ typedef struct _SDRHeader
     uint8_t RecordType;
     /** The length of the SDR that follows this header */
     uint8_t RecordLength;
-}PACKED  SDRHeader;
+}  SDRHeader;
 
 #pragma pack()
 
@@ -124,45 +121,45 @@ uint8_t libipmi_GetBits(uint8_t orig, uint8_t startbit, uint8_t endbit);
 //Will remove this macro when all projects stop using it
 #define GetBits libipmi_GetBits
 
-LIBIPMI_API uint16_t IPMICMD_GetFRUInventoryAreaInfo(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetFRUInventoryAreaInfo(IPMI20_SESSION_T *pSession,
 				FRUInventoryAreaInfoReq_T *pReqFRUInventoryAreaInfo,
 				FRUInventoryAreaInfoRes_T *pResFRUInventoryAreaInfo,
 				int timeout);
 
-LIBIPMI_API uint16_t IPMICMD_ReadFRUData(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_ReadFRUData(IPMI20_SESSION_T *pSession,
 				FRUReadReq_T* pFRUReadReqData,
 				FRUReadRes_T* pFRUReadResData,
 				int timeout);
 
-LIBIPMI_API uint16_t IPMICMD_WriteFRUData(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_WriteFRUData(IPMI20_SESSION_T *pSession,
 				FRUWriteReq_T* pFRUWriteReqData,
 				uint32_t ReqDataLen /* Bytes to be written + sizeof(FRUWriteReq_T) */,
 				FRUWriteRes_T* pFRUWriteResData,
 				int timeout);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllFRUDevices(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllFRUDevices(IPMI20_SESSION_T *pSession,
 				uint8_t *pFRUIDs,
 				uint8_t *pFRUNames,
 				uint8_t *nFRUs,
 				int timeout);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllSelEntriesWithSensorNames(IPMI20_SESSION_T *pSession,
 	SELEventRecordWithSensorName_T *pSELEntriesBuffer,
 	int timeout);
 
-LIBIPMI_API uint16_t IPMICMD_ClearSEL(IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_ClearSEL(IPMI20_SESSION_T *pSession,
 				int timeout);
 
-LIBIPMI_API uint8_t IPMICMD_GetSELTime(IPMI20_SESSION_T *pSession,
+  uint8_t IPMICMD_GetSELTime(IPMI20_SESSION_T *pSession,
 				GetSELTimeRes_T *pGetSELTimeRes, int timeout);
 
-LIBIPMI_API uint8_t IPMICMD_SetSELTime(IPMI20_SESSION_T *pSession,
+  uint8_t IPMICMD_SetSELTime(IPMI20_SESSION_T *pSession,
 				SetSELTimeReq_T *pSetSELTimeReq, int timeout);
 
-LIBIPMI_API uint8_t IPMICMD_GetSELTimeUTCOffset(IPMI20_SESSION_T *pSession,
+  uint8_t IPMICMD_GetSELTimeUTCOffset(IPMI20_SESSION_T *pSession,
 				GetSELTimeUTCOffsetRes_T *pGetSELTimeUTCOffsetRes, int timeout);
 
-LIBIPMI_API uint8_t IPMICMD_SetSELTimeUTCOffset(IPMI20_SESSION_T *pSession,
+  uint8_t IPMICMD_SetSELTimeUTCOffset(IPMI20_SESSION_T *pSession,
 				SetSELTimeUTCOffsetReq_T *pSetSELTimeUTCOffsetReq, int timeout);
 
 

+ 0 - 474
app/goahead-5.1.0/src/libipmi/inc/libipmi_XportDevice.h

@@ -1,474 +0,0 @@
-/**
- * @file   libipmi_XportDevice.h
- * @author Anurag Bhatia
- * @date   21-Sep-2004
- *
- * @brief  Contains exported APIs by LIBIPMI for
- *  		communicating with the BMC for NetFn type Transport.
- *
- */
-
-#ifndef __LIBIPMI_XPORTDEVICE_H__
-#define __LIBIPMI_XPORTDEVICE_H__
-
-/* LIIPMI core header files */
-#include "libipmi_session.h"
-#include "libipmi_errorcodes.h"
-#include "libipmiifc.h"
-
-/* command specific header files */
-#include "IPMIDefs.h"
-#include "IPMI_DeviceConfig.h"
-#include "IPMI_LANConfig.h" // For LAN configuration parameters union definition
-
-
-#include "IPMI_SOLConfig.h"
-#include "IPMI_SerialModem.h"
-
-
-/* Handling for packing structs */
-#ifdef __GNUC__
-#define PACKED __attribute__ ((packed))
-#else
-#define PACKED
-#pragma pack( 1 )
-#endif
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-#define CHANNEL_MEDIUM_TYPE_LAN 0x04
-#define MAX_IPV6_ADDRS 16
-
-/* ----------------- Multiple IPv6 Response Structure ----------------- */
-
-typedef struct 
-{
-	unsigned char Address[MAX_IPV6_ADDRS][IP6_ADDR_LEN];
-	unsigned char Prefix[MAX_IPV6_ADDRS];
-	unsigned char Source;
-} GetAllIPv6Address_T;
-	
-/*---------- IPMI Command direct routines ----------*/
-/* LAN related functions */
-LIBIPMI_API uint16_t IPMICMD_GetLANConfig(IPMI20_SESSION_T *pSession,
-				GetLanConfigReq_T* pGetLANConfigReqData,
-				GetLanConfigRes_T* pGetLANConfigResData,
-				int timeout);
-LIBIPMI_API uint16_t IPMICMD_SetLANConfig(IPMI20_SESSION_T *pSession,
-				SetLanConfigReq_T* pSetLANConfigReqData,
-				unsigned int ReqDataLen,
-				SetLanConfigRes_T* pSetLANConfigResData,
-				int timeout);
-
-
-/*---------- LIBIPMI Higher level routines -----------*/
-#define LAN_DEST_TYPE_SNMP 0x0
-#define LAN_DEST_TYPE_OEM1 0x6
-#define LAN_DEST_ADDR_FORMAT_IPV4 0x0
-#define LAN_DEST_ADDR_FORMAT_IPV6 0x1
-#define VLAN_STATUS_BIT 0x8000
-
-uint16_t LIBIPMI_HL_GetNumOfLANInterfaces(IPMI20_SESSION_T *pSession, uint8_t* pLanInfo,
-					uint8_t* pNumOfLANDestEntries, int timeout);
-
-uint16_t LIBIPMI_HL_GetPHYConfig(IPMI20_SESSION_T *pSession, uint8_t Channel,
-               		       PHYConfig_T *PHYConfigRes, int timeout);
-
-uint16_t LIBIPMI_HL_GetPHYConfigTable(IPMI20_SESSION_T *pSession, PHYConfig_T* pPHYConfigTable,
-       				    uint8_t* pNumOfLANInterfaces, int timeout);
-
-uint16_t LIBIPMI_HL_SetPHYConfig(IPMI20_SESSION_T *pSession, uint8_t Channel, uint8_t AutoNegotiation,
-         		       uint16_t Speed, uint8_t Duplex, int timeout);
-
-uint16_t LIBIPMI_HL_GetNCSIMode(IPMI20_SESSION_T *pSession, uint8_t Channel,
-                                                                    uint8_t Index,uint8_t *AutoSelect, int timeout);
-
-uint16_t LIBIPMI_HL_SetNCSIMode(IPMI20_SESSION_T *pSession, uint8_t Channel, uint8_t Index,
-                                                                   uint8_t AutoSelect, int timeout);
-
-uint16_t LIBIPMI_HL_SetNCSISetting(IPMI20_SESSION_T *pSession, uint8_t Channel, uint8_t Index,
-                                                                   uint8_t ChannelID, uint8_t PackageID, int timeout);
-
-uint16_t LIBIPMI_HL_GetNCSISetting(IPMI20_SESSION_T *pSession, uint8_t Channel,
-                                                                    uint8_t Index,uint8_t *ChannelID,uint8_t *PackageID, int timeout);
-
-uint16_t LIBIPMI_HL_GetNCSIConfigNUM(IPMI20_SESSION_T *pSession, uint8_t Channel,
-                                                                            uint8_t *ConfigNum, int timeout);
-
-uint16_t LIBIPMI_HL_GetNumOfLANDestinationEntries(IPMI20_SESSION_T *pSession,
-					uint8_t* pNumOfLANDestEntries,
-					uint8_t Channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_GetLANDestinationType(IPMI20_SESSION_T *pSession,
-					uint8_t Channel,
-					uint8_t  index,
-					LANDestType_T *LANDestTypeRes,
-					int timeout);
-
-uint16_t LIBIPMI_HL_GetLANDestinationAddress(IPMI20_SESSION_T *pSession,
-					uint8_t Channel,
-					uint8_t  index,
-					LANDestAddr_T *LANDestAddrRes,
-					int timeout);
-
-uint16_t LIBIPMI_HL_GetLANDestinationV6Address(IPMI20_SESSION_T *pSession,
-					uint8_t Channel,
-					uint8_t  index,
-					LANDestv6Addr_T *LANDestv6AddrRes,
-					int timeout);
-
-uint16_t LIBIPMI_HL_GetLANDestinationType_AddrTable(IPMI20_SESSION_T *pSession,
-					LANDestType_T* pDestTypeTable,
-					LANDestAddr_T* pDestAddrTable,
-					uint8_t* pNumOfLANDestEntries,
-					uint8_t Channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetLANDestinationType(IPMI20_SESSION_T *pSession,
-					uint8_t Channel,
-					uint8_t  index,
-					uint8_t desttype,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetLANDestinationAddress(IPMI20_SESSION_T *pSession,
-					uint8_t Channel,
-					uint8_t  index,
-					uint8_t addrFormat,
-					uint8_t* destAddr,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetLANDestinationV6Address(IPMI20_SESSION_T *pSession,
-					uint8_t Channel,
-					uint8_t  index,
-					uint8_t addrFormat,
-					uint8_t* destAddr,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetLANAlertEntry(IPMI20_SESSION_T *pSession,
-					uint8_t DestSel,
-					uint8_t* pDestAddr,uint8_t channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetLANAlertEntry_IPv6(IPMI20_SESSION_T *pSession,
-					uint8_t DestSel,
-					uint8_t* pDestAddr,uint8_t channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_EnableVlan (IPMI20_SESSION_T *pSession, 
-		            uint8_t VlanStatus, uint16_t vlanID, uint8_t Priority, uint8_t Channel, int timeout);
-
-uint16_t LIBIPMI_HL_GetVlanStatus (IPMI20_SESSION_T *pSession, 
-		            uint8_t *VlanStatus, uint16_t *vlanID, uint8_t *Priority, uint8_t Channel, int timeout);
-
-LIBIPMI_API uint16_t IPMICMD_SetLANAlertEntryType(IPMI20_SESSION_T *pSession,
-					uint8_t DestSel,
-					uint8_t AlertType,uint8_t Channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_GetLANEnable(IPMI20_SESSION_T *pSession,
-									uint8_t EthIndex, uint8_t *LANEnable, int timeout);
-
-uint16_t LIBIPMI_HL_SetLANEnable(IPMI20_SESSION_T *pSession,
-									uint8_t EthIndex, uint8_t LANEnable, int timeout);
-
-uint16_t LIBIPMI_HL_GetBondEnable(IPMI20_SESSION_T *pSession,
-                                                           uint8_t Index,uint8_t * BondCfg,int timeout);
-
-uint16_t LIBIPMI_HL_SetBondEnable(IPMI20_SESSION_T * pSession, 
-                                                           uint8_t * BondCfg, int timeout);
-
-uint16_t LIBIPMI_HL_SetActiveSlave(IPMI20_SESSION_T * pSession,uint8_t Index,
-                                                               uint8_t ActiveSlave, int timeout);
-
-uint16_t LIBIPMI_HL_GetActiveSlave(IPMI20_SESSION_T * pSession, 
-                                                                    uint8_t Index, uint8_t * Activeslave, int timeout);
-
-uint16_t LIBIPMI_HL_IsBondEnabled(IPMI20_SESSION_T * pSession, 
-                                                                    uint8_t * BondEnabled, int timeout);
-
-uint16_t LIBIPMI_HL_BondVLANEnabled(IPMI20_SESSION_T * pSession, 
-                                                                    uint8_t * BondVLANEnabled, int timeout);
-
-uint16_t LIBIPMI_HL_GetLANCount(IPMI20_SESSION_T * pSession, 
-                                                         uint8_t* LANCount,uint8_t * LANIndex, int timeout);
-
-uint16_t LIBIPMI_HL_GetChannelNum(IPMI20_SESSION_T * pSession, 
-                                                                    uint8_t Index, uint8_t * Channel, int timeout);
-
-uint16_t LIBIPMI_HL_GetLANIndex(IPMI20_SESSION_T * pSession, 
-                                                                    uint8_t Index, uint8_t * IfcName, int timeout);
-
-uint16_t LIBIPMI_HL_GetSNMPCommunity(IPMI20_SESSION_T *pSession,
-                    uint8_t* pCommunityStr, uint8_t Channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetSNMPCommunity(IPMI20_SESSION_T *pSession,
-                    uint8_t* CommunityStr,uint8_t Channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_GetMACAddress(IPMI20_SESSION_T *pSession,
-		            uint8_t *MACAddr,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetAllIPv6Addresses(IPMI20_SESSION_T *pSession,
-				uint8_t Channel, uint8_t *Address, uint8_t *pIPCount,
-				int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv4Source(IPMI20_SESSION_T *pSession, 
-		            uint8_t Source,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv4Source(IPMI20_SESSION_T *pSession,
-		            uint8_t *Source,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv6Source(IPMI20_SESSION_T *pSession,
-		            uint8_t Source,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv6Source(IPMI20_SESSION_T *pSession, 
-		            uint8_t *Source,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv4Address(IPMI20_SESSION_T *pSession, 
-		            uint8_t *Address,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv4Address(IPMI20_SESSION_T *pSession,
-		            uint8_t *Address,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv6Address(IPMI20_SESSION_T *pSession,
-		            uint8_t *Address,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv6Address(IPMI20_SESSION_T *pSession,
-		            uint8_t *Address,uint8_t Channel,
-		            int timeout);
-		            
-uint16_t LIBIPMI_HL_GetIPv6LinkAddress(IPMI20_SESSION_T *pSession, 
-		            uint8_t *Address,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv4NetMask(IPMI20_SESSION_T *pSession,
-		            uint8_t *Mask,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv4NetMask(IPMI20_SESSION_T *pSession, 
-		            uint8_t *Mask,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv6Prefix(IPMI20_SESSION_T *pSession,
-		            uint8_t Prefix,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv6Prefix(IPMI20_SESSION_T *pSession,
-		            uint8_t *Prefix,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv6LinkPrefix (IPMI20_SESSION_T *pSession, 
-		            uint8_t *Prefix,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv4Gateway(IPMI20_SESSION_T *pSession,
-		            uint8_t *Gateway,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv4Gateway(IPMI20_SESSION_T *pSession,
-		            uint8_t *Gateway,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv6Gateway(IPMI20_SESSION_T *pSession, 
-		            uint8_t *Gateway,uint8_t Channel,
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv6Gateway(IPMI20_SESSION_T *pSession, 
-		            uint8_t *Gateway,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv6Enable(IPMI20_SESSION_T *pSession, 
-		            uint8_t Enable,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv6Enable(IPMI20_SESSION_T *pSession,
-		            uint8_t *Enable,uint8_t Channel, 
-		            int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv4NetworkCfg(IPMI20_SESSION_T *pSession, 
-					uint8_t *Source,
-					uint8_t *Address,
-					uint8_t *Mask,
-					uint8_t *Gateway,
-					uint8_t Channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv4NetworkCfg(IPMI20_SESSION_T *pSession,
-                                        uint8_t *Address,
-                                        uint8_t *Mask,
-                                        uint8_t *Gateway,
-                                        uint8_t Channel,
-                                        int timeout);
-
-uint16_t LIBIPMI_HL_GetIPv6NetworkCfg(IPMI20_SESSION_T *pSession, 
-					uint8_t *Source,
-					uint8_t *Address,
-					uint8_t *Prefix,
-					uint8_t *Gateway,
-					uint8_t Channel,
-					int timeout);
-
-uint16_t LIBIPMI_HL_SetIPv6NetworkCfg(IPMI20_SESSION_T *pSession,
-                                        uint8_t *Address,
-                                        uint8_t Prefix,
-                                        uint8_t *Gateway,
-                                        uint8_t Channel,
-                                        int timeout);
-
-/********************SERIAL PORT RELATED************************************/
-
-
-#define SOL_SERIAL_PORT 0x01
-#define SERIAL_MODEM_PORT 0x02
-#define DEFAULT_TIMEOUT 2
-#pragma pack(1)
-typedef struct
-{
-    GetSOLConfigRes_T Res;
-    uint8_t   BaudRate;
-
-}  Wrapper_GetSOLConfigRes_T;
-
-
-
-typedef struct
-{
-    SetSOLConfigReq_T Req;
-    uint8_t   BaudRate;
-
-}  Wrapper_SetSOLConfigReq_T;
-
-typedef struct
-{
-
-    struct
-        {
-        uint8_t   Reserved    : 4;
-        uint8_t	DtrHangup   : 1;
-        uint8_t	FlowControl : 2;
-        
-	
-    } PACKED Control;
-
-    struct 
-    {
-        uint8_t BitRate	    : 4;
-        uint8_t Reserved	    : 4;
-	
-
-    }  PACKED BaudRate;
-
-} PACKED Serial_Port_Settings_T;
-
-
-
-
-typedef enum
-{
-    None_Parity,
-    Odd_Parity,
-    Even_Parity
-} PARITY_TYPE;
-
-typedef enum
-{
-    None_FlowControl,
-    XonXoff_FlowControl,
-    Hardware_FlowControl
-} FLOW_CONTROL_TYPE;
-
-
-typedef struct
-{
-    unsigned long BaudRate;
-    unsigned char  DataBits;
-    PARITY_TYPE Parity;
-    unsigned char StopBits;
-    FLOW_CONTROL_TYPE FlowControl;
-    unsigned char DtrHangup;
-    
-
-} PACKED SERIAL_STRUCT;
-
-typedef struct
-{
-    GetSerialModemConfigRes_T Res;
-    Serial_Port_Settings_T serial;
-
-}  PACKED Wrapper_GetSerialModemConfigRes_T;
-
-
-typedef struct
-{
-    SetSerialModemConfigReq_T Req;
-    Serial_Port_Settings_T serial;
-
-}  Wrapper_SetSerialModemConfigReq_T;
-
-#pragma pack()
-
-/*---------- LIBIPMI Higher level routines -----------*/
-
-uint16_t IPMICMD_GetSerialCfg_SOL_Advanced( IPMI20_SESSION_T *pSession, uint8_t* char_acc_interval,uint8_t* char_send_threshold,int timeout );
-uint16_t IPMICMD_SetSerialCfg_SOL_Advanced( IPMI20_SESSION_T *pSession, uint8_t char_acc_interval,uint8_t char_send_threshold,int timeout );
-
-uint16_t LIBIPMI_HL_GetSerialCfg_Messaging(IPMI20_SESSION_T *pSession, \
-					 SERIAL_STRUCT *serial, int timeout );
-
-uint16_t LIBIPMI_HL_SetSerialCfg_Messaging(IPMI20_SESSION_T *pSession,  \
-					 SERIAL_STRUCT *serial, int timeout);
-
-uint16_t LIBIPMI_HL_GetSerialCfg_SOL(IPMI20_SESSION_T *pSession, \
-					 SERIAL_STRUCT *serial, uint8_t* Enabled,int timeout );
-
-uint16_t LIBIPMI_HL_SetSerialCfg_SOL(IPMI20_SESSION_T *pSession, \
-                                   SERIAL_STRUCT *serial, uint8_t Enabled,int timeout);
-
-
-/** 
- * \breif Sets the Serial Port configurations of the serial ports, SOL, Modem/Serial 
- * 
- * @param pSession 
- * @param type SOL or Modem/Serial
- * @param serial 
- * @param timeout 
- * 
- * @return -1 on error 0 on success.
- */
-uint16_t	LIBIPMI_HL_Generic_SetSerialConfig( IPMI20_SESSION_T *pSession, int type, \
-						    SERIAL_STRUCT *serial, int timeout );
-
-/** 
- * \brief Gets the Serial Port Configuration from the BMC.
- * 
- * @param pSession 
- * @param type SOL or Modem/Serial
- * @param serial 
- * @param timeout 
- * 
- * @return 
- */
-uint16_t	LIBIPMI_HL_Generic_GetSerialConfig( IPMI20_SESSION_T *pSession, int type, \
-					    SERIAL_STRUCT *serial, int timeout );
-
-/********************SERIAL PORT RELATED************************************/
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif
-
-

+ 5 - 6
app/goahead-5.1.0/src/libipmi/inc/libipmi_fru.h

@@ -27,9 +27,8 @@
 #include "libipmi_AppDevice.h"
 #include "libipmi_StorDevice.h"
 #include "libipmi_sensor.h"
-#include "libipmi_XportDevice.h"
-#include "IPMI_SDRRecord.h"
-#include "IPMI_FRU.h"
+#include "com_IPMI_SDRRecord.h"
+#include "com_IPMI_FRU.h"
 
 
 typedef struct
@@ -83,9 +82,9 @@ typedef struct fru_t
 }FRU_T;
 
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetFRUData(IPMI20_SESSION_T *pSession,
-					u8 fru_device_id,
-				  	u32* p_fru_size,
+  uint16_t LIBIPMI_HL_GetFRUData(IPMI20_SESSION_T *pSession,
+					uint8_t fru_device_id,
+				  	uint32_t* p_fru_size,
 				  	FRUData_T* fru_data,
 					int timeout);
 

+ 21 - 30
app/goahead-5.1.0/src/libipmi/inc/libipmi_rmcp.h

@@ -12,14 +12,9 @@
 #define __LIBIPMI_RMCP_H__
 
 //#include "RMCP.h"
+#include "com_IPMI_RMCP.h"
 
-#if LIBIPMI_IS_OS_LINUX()
 #define PACK __attribute__ ((packed))
-#else
-#define PACK
-#pragma pack(1)
-#endif/* LIBIPMI_IS_OS_LINUX() */
-
 
 /**
  * @def RMCPPing_T
@@ -29,11 +24,11 @@
 typedef struct
 {
 	RMCPHdr_T	Hdr;				/*< RMCP Header 		*/
-	uint8		IANANum[4];		/*< 4542 (ASF IANA) 	*/
-	uint8		MsgType;			/*< 80h = Presence Ping */
-	uint8		MsgTag;				/*< 0-FEh, generated by remote console */
-	uint8		Reserved1;			/*< 00h 				*/
-	uint8		DataLen;			/*< 00h					*/
+	uint8_t		IANANum[4];		/*< 4542 (ASF IANA) 	*/
+	uint8_t		MsgType;			/*< 80h = Presence Ping */
+	uint8_t		MsgTag;				/*< 0-FEh, generated by remote console */
+	uint8_t		Reserved1;			/*< 00h 				*/
+	uint8_t		DataLen;			/*< 00h					*/
 
 } PACK RMCPPing_T;
 
@@ -45,16 +40,16 @@ typedef struct
 typedef struct
 {
 	RMCPHdr_T	Hdr;				/*< RMCP Header 		*/
-	uint8		IANANum[4];			/*< 4542 (ASF IANA) 	*/
-	uint8		MsgType;			/*< 40h = Presence Ping */
-	uint8		MsgTag;				/*< From Pin Request    */
-	uint8		Reserved1;			/*< 00h 				*/
-	uint8		DataLen;			/*< 10h					*/
-	uint8		OEMIANANum [4];			/*< OEM's IANA Number	*/
-	uint8		OEM [4];			/*< OEM Defined field	*/
-	uint8		Support;			/*< 81h for IPMI		*/
-	uint8		InteractionSupport;	/*< Reserved			*/
-	uint8		Reserved [6];
+	uint8_t		IANANum[4];			/*< 4542 (ASF IANA) 	*/
+	uint8_t		MsgType;			/*< 40h = Presence Ping */
+	uint8_t		MsgTag;				/*< From Pin Request    */
+	uint8_t		Reserved1;			/*< 00h 				*/
+	uint8_t		DataLen;			/*< 10h					*/
+	uint8_t		OEMIANANum [4];			/*< OEM's IANA Number	*/
+	uint8_t		OEM [4];			/*< OEM Defined field	*/
+	uint8_t		Support;			/*< 81h for IPMI		*/
+	uint8_t		InteractionSupport;	/*< Reserved			*/
+	uint8_t		Reserved [6];
 
 } PACK RMCPPong_T;
 
@@ -62,10 +57,6 @@ typedef struct
 #undef PACK
 #endif
 
-#if !LIBIPMI_IS_OS_LINUX()
-#pragma pack()
-#endif/* LIBIPMI_IS_OS_LINUX() */
-
 /**
 \breif	Connects to BMC's RMCP layer.
  @param	LanInfo			[in]Lan Info handle
@@ -74,7 +65,7 @@ typedef struct
 
  @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-uint8 RMCP_Connect(LAN_CHANNEL_T *LanInfo, char *szIPAddress, uint16 wPort);
+uint8_t RMCP_Connect(LAN_CHANNEL_T *LanInfo, char *szIPAddress, uint16 wPort);
 
 /**
 \breif	Closes connection with BMC at RCMP layer
@@ -93,7 +84,7 @@ void RMCP_Close(LAN_CHANNEL_T *LanInfo );
 
  @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-uint8 RMCP_SendData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32 dwSize, int timeout);
+uint8_t RMCP_SendData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32 dwSize, int timeout);
 
 /**
 \breif	Receives data from network layer and validates RMCP Header.
@@ -104,7 +95,7 @@ uint8 RMCP_SendData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32 dwSize, int t
 
  @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-uint8 RMCP_ReceiveData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32* pdwSize, int timeout);
+uint8_t RMCP_ReceiveData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32* pdwSize, int timeout);
 
 /**
 \breif	Sends RMCP Ping message to BMC
@@ -113,7 +104,7 @@ uint8 RMCP_ReceiveData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32* pdwSize,
 
  @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-uint8 RMCP_Ping(LAN_CHANNEL_T *LanInfo, int timeout);
+uint8_t RMCP_Ping(LAN_CHANNEL_T *LanInfo, int timeout);
 
 /**
 \breif	Receives RMCP Pong message from BMC
@@ -122,7 +113,7 @@ uint8 RMCP_Ping(LAN_CHANNEL_T *LanInfo, int timeout);
 
  @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
 */
-uint8 RMCP_Pong(LAN_CHANNEL_T *LanInfo, int timeout);
+uint8_t RMCP_Pong(LAN_CHANNEL_T *LanInfo, int timeout);
 
 #endif
 

+ 22 - 22
app/goahead-5.1.0/src/libipmi/inc/libipmi_sdr.h

@@ -4,14 +4,14 @@
 /* LIIPMI core header files */
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
-#include "libipmiifc.h"
+#include "com_BmcType.h"
 
 /* command specific header files */
 #pragma pack(1)
-#include "IPMI_SDR.h"
+#include "com_IPMI_SDR.h"
 #pragma pack()
 
-#include "IPMI_SensorEvent.h"
+#include "com_IPMI_SensorEvent.h"
 
 #ifdef  __cplusplus
 extern "C" {
@@ -21,100 +21,100 @@ extern "C" {
 
 
 /* Get SDR Repository Info Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSDRRepositoryInfo( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSDRRepositoryInfo( IPMI20_SESSION_T *pSession,
 										SDRRepositoryInfo_T *pResGetSDRRepositoryInfo,
 										int timeout);
 
 /* Get SDR Repository Allocation Info Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSDRRepositoryAllocInfo( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSDRRepositoryAllocInfo( IPMI20_SESSION_T *pSession,
 										SDRRepositoryAllocInfo_T *pResGetSDRRepositoryAllocInfo,
 										int timeout);
 
 /* Reserve SDR Repository Command */
-LIBIPMI_API uint16_t	IPMICMD_ReserveSDRRepository( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_ReserveSDRRepository( IPMI20_SESSION_T *pSession,
 										ReserveSDRRepositoryRes_T *pResReserveSDRRepository,
 										int timeout);
 
 /* Get SDR Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSDR( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSDR( IPMI20_SESSION_T *pSession,
 									GetSDRReq_T *pReqGetSDR,
 									GetSDRRes_T *pResGetSDR,
 									uint32_t		*pdwOutBuffLen,
 									int timeout);
 
 /* Add SDR Command */
-LIBIPMI_API uint16_t	IPMICMD_AddSDR( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_AddSDR( IPMI20_SESSION_T *pSession,
 									uint8_t		*pReqAddSDR,
 									uint32_t		dwInBuffLen,
 									AddSDRRes_T *pResAddSDR,
 									int timeout);
 
 /* Partial Add SDR Command */
-LIBIPMI_API uint16_t	IPMICMD_PartialAddSDR( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_PartialAddSDR( IPMI20_SESSION_T *pSession,
 									PartialAddSDRReq_T *pReqPartialAddSDR,
 									uint32_t		dwInBuffLen,
 									PartialAddSDRRes_T *pResPartialAddSDR,
 									int timeout);
 
 /* Delete SDR Command */
-LIBIPMI_API uint16_t	IPMICMD_DeleteSDR( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_DeleteSDR( IPMI20_SESSION_T *pSession,
 									DeleteSDRReq_T *pReqDeleteSDR,
 									DeleteSDRReq_T *pResDeleteSDR,
 									int timeout);
 
 /* Clear SDR Repository Command */
-LIBIPMI_API uint16_t	IPMICMD_ClearSDRRepository( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_ClearSDRRepository( IPMI20_SESSION_T *pSession,
 									ClearSDRReq_T *pReqClearSDR,
 									ClearSDRRes_T *pResClearSDR,
 									int timeout);
 
 /* Get SDR Repository Time Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
 									GetSDRRepositoryTimeRes_T *pResGetSDRRepositoryTime,
 									int timeout);
 
 /* Set SDR Repository Time Command */
-LIBIPMI_API uint16_t	IPMICMD_SetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_SetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
 									SetSDRRepositoryTimeReq_T *pReqSetSDRRepositoryTime,
 									uint8_t *pResSetSDRRepositoryTime,
 									int timeout);
 
 /* Enter SDR Repository Update Mode Command */
-LIBIPMI_API uint16_t	IPMICMD_EnterSDRUpdateMode( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_EnterSDRUpdateMode( IPMI20_SESSION_T *pSession,
 									EnterSDRUpdateModeRes_T *pResEnterSDRUpdateMode,
 									int timeout);
 
 /* Exit SDR Repository Update Mode Command */
-LIBIPMI_API uint16_t	IPMICMD_ExitSDRUpdateMode( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_ExitSDRUpdateMode( IPMI20_SESSION_T *pSession,
 									ExitSDRUpdateModeRes_T *pResExitSDRUpdateMode,
 									int timeout);
 
 /* Run Initialization Agent Command */
-LIBIPMI_API uint16_t	IPMICMD_RunInitAgent( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_RunInitAgent( IPMI20_SESSION_T *pSession,
 									RunInitAgentReq_T *pReqRunInitAgent,
 									RunInitAgentRes_T *pResRunInitAgent,
 									int timeout);
 
 /*---------- LIBIPMI Higher level routines -----------*/
-LIBIPMI_API uint16_t LIBIPMI_HL_GetCompleteSDR( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetCompleteSDR( IPMI20_SESSION_T *pSession,
                                               uint16_t record_id,
                                               uint16_t *next_record_id,
                                               uint8_t *sdr_buffer,
                                               size_t buffer_len,
                                               int timeout );
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSDRs( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllSDRs( IPMI20_SESSION_T *pSession,
                                           uint8_t *sdr_buffer, size_t buffer_len,
                                           int timeout );
 
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetSDR( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetSDR( IPMI20_SESSION_T *pSession,
                                             uint16_t reservation_id,
                                             uint16_t record_id,
                                             GetSDRRes_T *pGetSDRRes,
                                             uint32_t *dwDataLen,
                                             int timeout );
-#define SDR_CACHE_PATH "/var/sdrcache"
+//#define SDR_CACHE_PATH "/var/sdrcache"
 
 #define ERR_SDRCACHE_SUCCESS 		0
 #define ERR_SDRCACHE_FILEOP  		1
@@ -122,14 +122,14 @@ LIBIPMI_API uint16_t LIBIPMI_HL_GetSDR( IPMI20_SESSION_T *pSession,
 #define ERR_SDRCACHE_BUFFSIZE		3
 
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSDRs_Cached( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllSDRs_Cached( IPMI20_SESSION_T *pSession,
                                           uint8_t *sdr_buffer, 
 										  uint32_t* sdr_buff_size,
 										  uint32_t* max_sdr_len,
 										  uint32_t * sdr_count,
                                           int timeout );
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetSpecificSDR( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetSpecificSDR( IPMI20_SESSION_T *pSession,
 										uint8_t *sdr_buffer, 
 										uint32_t* sdr_buff_size,
 										int SensorNumber,

+ 37 - 38
app/goahead-5.1.0/src/libipmi/inc/libipmi_sensor.h

@@ -4,109 +4,108 @@
 /* LIIPMI core header files */
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
-#include "libipmiifc.h"
 #include "libsensor.h"
 
 /* command specific header files */
 #pragma pack(1)
-#include "IPMI_Sensor.h"
+#include "com_IPMI_Sensor.h"
 #pragma pack()
-#include "IPMI_SensorEvent.h"
-#include "IPMI_AMI.h"
+#include "com_IPMI_SensorEvent.h"
+//#include "IPMI_AMI.h"
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 /* 35.2 Get Device SDR Info Command */
-LIBIPMI_API uint16_t IPMICMD_GetSDRInfo( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSDRInfo( IPMI20_SESSION_T *pSession,
                                        uint8_t *pReqGetSDRInfo,
                                        GetSDRInfoRes_T *pResGetSDRInfo,
                                        int timeout);
     
 /* 35.3 Get Device SDR Command */
-LIBIPMI_API uint16_t IPMICMD_GetDevSDR( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetDevSDR( IPMI20_SESSION_T *pSession,
                                       GetDevSDRReq_T *pReqDevSDR,
                                       GetDevSDRRes_T *pResDevSDR,
                                       uint32_t *pOutBuffLen,
                                       int timeout);
 
 /* 35.4 Reserve Device SDR Repository Command */
-LIBIPMI_API uint16_t IPMICMD_ReserveDevSDR( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_ReserveDevSDR( IPMI20_SESSION_T *pSession,
                                           ReserveDevSDRRes_T *pResReserveDevSDR,
                                           int timeout);
 
 /* 35.5 Get Sensor Reading Factors Command */
-LIBIPMI_API uint16_t IPMICMD_GetSensorReadingFactor( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSensorReadingFactor( IPMI20_SESSION_T *pSession,
                                                    GetSensorReadingFactorReq_T *pReqGetSensorReadingFactor,
                                                    GetSensorReadingFactorRes_T *pResGetSensorReadingFactor,
                                                    int timeout);
 
 /* 35.6 Set Sensor Hysteresis Command */
-LIBIPMI_API uint16_t IPMICMD_SetSensorHysterisis( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_SetSensorHysterisis( IPMI20_SESSION_T *pSession,
                                                 SetSensorHysterisisReq_T *pReqSetSensorHysterisis,
                                                 SetSensorHysterisisRes_T *pResSetSensorHysterisis,
                                                 int timeout);
 /* 35.7 Get Sensor Hysteresis Command */
-LIBIPMI_API uint16_t IPMICMD_GetSensorHysterisis( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSensorHysterisis( IPMI20_SESSION_T *pSession,
                                                 GetSensorHysterisisReq_T *pReqGetSensorHysterisis,
                                                 GetSensorHysterisisRes_T *pResGetSensorHysterisis,
                                                 int timeout);
 
 /* 35.8 Set Sensor Thresholds Command */
-LIBIPMI_API uint16_t IPMICMD_SetSensorThreshold( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_SetSensorThreshold( IPMI20_SESSION_T *pSession,
                                                SetSensorThresholdReq_T *pReqSetSensorThreshold,
                                                SetSensorThresholdRes_T *pResSetSensorThreshold,
                                                int timeout);
 
 /* 35.9 Get Sensor Thresholds Command */
-LIBIPMI_API uint16_t IPMICMD_GetSensorThreshold( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSensorThreshold( IPMI20_SESSION_T *pSession,
                                                GetSensorThresholdReq_T *pReqGetSensorThreshold,
                                                GetSensorThresholdRes_T *pResGetSensorThreshold,
                                                int timeout);
 
 /* 35.10 Set Sensor Event Enable Command */
-LIBIPMI_API uint16_t IPMICMD_SetSensorEventEnable( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_SetSensorEventEnable( IPMI20_SESSION_T *pSession,
                                                  SetSensorEventEnableReq_T *pReqSetSensorEventEnable,
                                                  SetSensorEventEnableRes_T *pResSetSensorEventEnable,
                                                  int timeout);
 
 /* 35.11 Get Sensor Event Enable Command */
-LIBIPMI_API uint16_t IPMICMD_GetSensorEventEnable( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSensorEventEnable( IPMI20_SESSION_T *pSession,
                                                  GetSensorEventEnableReq_T *pReqGetSensorEventEnable,
                                                  GetSensorEventEnableRes_T *pResGetSensorEventEnable,
                                                  int timeout);
 
 /* 35.12 ReArm Sensor Events Command */
-LIBIPMI_API uint16_t	IPMICMD_ReArmSensorEvents( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_ReArmSensorEvents( IPMI20_SESSION_T *pSession,
                                                  ReArmSensorReq_T *pReArmSensorReq,
                                                  ReArmSensorRes_T *pReArmSensorRes,
                                                  int timeout);
 
 /* 35.13 Get Sensor Event Status Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorEventStatus( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorEventStatus( IPMI20_SESSION_T *pSession,
                                                  GetSensorEventStatusReq_T *pReqGetSensorEventStatus,
                                                  GetSensorEventStatusRes_T *pResGetSensorEventStatus,
                                                  int timeout);
 
 /* 35.14 Get Sensor Reading Command */
-LIBIPMI_API uint16_t IPMICMD_GetSensorReading( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSensorReading( IPMI20_SESSION_T *pSession,
                                              GetSensorReadingReq_T *pReqGetSensorReading,
                                              GetSensorReadingRes_T *pResGetSensorReading,
                                              int timeout);
 
 /* 35.15 Set Sensor Type Command */
-LIBIPMI_API uint16_t IPMICMD_SetSensorType( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_SetSensorType( IPMI20_SESSION_T *pSession,
                                           SetSensorTypeReq_T *pReqSetSensorType,
                                           SetSensorTypeRes_T *pResSetSensorType,
                                           int timeout);
 
 /* 35.16 Get Sensor Type Command */
-LIBIPMI_API uint16_t IPMICMD_GetSensorType( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_GetSensorType( IPMI20_SESSION_T *pSession,
                                           GetSensorTypeReq_T *pReqGetSensorType,
                                           GetSensorTypeRes_T *pResGetSensorType,
                                           int timeout);
-LIBIPMI_API uint16_t IPMICMD_SetSensorReading( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_SetSensorReading( IPMI20_SESSION_T *pSession,
                                            SetSensorReadingReq_T *pReqSetSensorReading,
                                            SetSensorReadingRes_T *pResSetSensorReading,
                                            int timeout);
@@ -118,16 +117,16 @@ LIBIPMI_API uint16_t IPMICMD_SetSensorReading( IPMI20_SESSION_T *pSession,
 struct sensor_info
 {
     /* SDR Entry */
-    u8 sdr_buffer[ 64 ];      
+    uint8_t sdr_buffer[ 64 ];      
 
     /*! Sensor description as a null terminated string */
     char description[ 17 ]; 
 
     /*! True if this sensor returns a discrete state */
-    bool discrete_sensor;
+    uint8_t discrete_sensor;
 
     /*! True if this sensor uses analog thresholds */
-    bool thresholds;
+    uint8_t thresholds;
 
     float low_non_recov_thresh;    /*!< Low non-recoverable threshold */
     float low_crit_thresh;         /*!< Low critical threshold */
@@ -137,16 +136,16 @@ struct sensor_info
     float high_non_recov_thresh;   /*!< High non-recoverable threshold */
 };
 
-/* IPMI threshold state definitions for monitoring */
-#define THRESH_UNINITIALIZED        ( (u16)0x00 )
-#define THRESH_NORMAL               ( (u16)0x01 )
-#define THRESH_UP_NONCRIT           ( (u16)0x02 )
-#define THRESH_UP_CRITICAL          ( (u16)0x04 )
-#define THRESH_LOW_NONCRIT          ( (u16)0x08 )
-#define THRESH_LOW_CRITICAL         ( (u16)0x10 )
-#define THRESH_ACCESS_FAILED        ( (u16)0x20 )
-#define THRESH_UP_NON_RECOV         ( (u16)0x40 )
-#define THRESH_LOW_NON_RECOV        ( (u16)0x80 )
+// /* IPMI threshold state definitions for monitoring */
+// #define THRESH_UNINITIALIZED        ( (u16)0x00 )
+// #define THRESH_NORMAL               ( (u16)0x01 )
+// #define THRESH_UP_NONCRIT           ( (u16)0x02 )
+// #define THRESH_UP_CRITICAL          ( (u16)0x04 )
+// #define THRESH_LOW_NONCRIT          ( (u16)0x08 )
+// #define THRESH_LOW_CRITICAL         ( (u16)0x10 )
+// #define THRESH_ACCESS_FAILED        ( (u16)0x20 )
+// #define THRESH_UP_NON_RECOV         ( (u16)0x40 )
+// #define THRESH_LOW_NON_RECOV        ( (u16)0x80 )
 
 #define SENSOR_NOT_AVAILABLE        0xD5
 #define UNABLE_TO_READ_SENSOR       0x20
@@ -156,23 +155,23 @@ struct sensor_info
 
 
 /*------------------------- HL sensor functions -----------------------------*/
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_ReadSensorFromSDR( IPMI20_SESSION_T *pSession, uint8_t *sdr_buffer,
                               uint8_t *raw_reading, float *reading,
                               uint8_t *discrete, int timeout );
 
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_LoadSensorSDRs( IPMI20_SESSION_T *pSession, uint8_t **sdr_buffer, int *count, int timeout );
 
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_GetSensorCount( IPMI20_SESSION_T *pSession, int *sdr_count, int timeout );
 
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession,
                                  struct sensor_data *sensor_list, uint32_t* nNumSensor,int timeout );
 
 
-LIBIPMI_API uint16_t 
+  uint16_t 
 LIBIPMI_HL_GetSensorHistoryReadingData( IPMI20_SESSION_T *pSession,            
                                                  SensorhistoryData_T *pHistoryData, uint8_t nNumSensor, int timeout);
 

+ 3 - 2
app/goahead-5.1.0/src/libipmi/inc/libipmi_storlead_OEM.h

@@ -6,7 +6,8 @@
 #ifndef __LIBIPMI_STORLEAD_OEM_H__
 #define __LIBIPMI_STORLEAD_OEM_H__
 
-#include "libipmi_AMIOEM.h"
+#include "libipmi_struct.h"
+#include <stdint.h>
 
 #define MAX_TITLE_LEN	20
 #define MAX_TEXT_LEN		256
@@ -103,7 +104,7 @@ typedef struct{
 } SensorHistoryCapability_T;
 
 extern OemWebFlags_T g_OemWebFlags;
-uint16_t LIBIPMI_HL_GetIPMCSensorInfo(IPMI20_SESSION_T *pSession,SenInfo_T *pSensorInfo,uint32_t *nNumSensor,int timeout);
+//uint16_t LIBIPMI_HL_GetIPMCSensorInfo(IPMI20_SESSION_T *pSession, SenInfo_T *pSensorInfo,uint32_t *nNumSensor,int timeout);
 
 uint16_t LIBIPMI_HL_FanCtrol( IPMI20_SESSION_T *pSession, uint8_t fanIndex, uint8_t fanMode, uint8_t fanLevel, int timeout);
 int LIBIPMI_HL_GetFanStatus( IPMI20_SESSION_T *pSession, uint8_t fanIndex, OemFanStatus_T *pFanStatus, int timeout);

+ 52 - 96
app/goahead-5.1.0/src/libipmi/inc/libipmi_struct.h

@@ -10,102 +10,29 @@
 #ifndef __LIBIPMI_STRUCT_H__
 #define __LIBIPMI_STRUCT_H__
 #include <stdint.h>
-
+#include "com_IPMIDefs.h"
+#include "com_IPMI_SDRRecord.h"
 #define PACK __attribute__ ((packed))
 
-#define	MAX_REQUEST_SIZE		1024
-#define	MAX_RESPONSE_SIZE		1024
-
-
-#define HANDLE			int
-#define SOCKET			int
-#define SOCKET_ERROR	-1
-
-#define IP4_VERSION     4
-#define IP6_VERSION     6
-#define IP4_ADDR_LEN    4
-#define IP6_ADDR_LEN   16
-
 /**
  @def UDS_CHANNEL_T
  @brief holds data required for network medium
 */
 typedef struct UDS_CHANNEL_T_tag {
 	uint16_t			hSocketPath;
-	SOCKET			hSocket;
+	int			hSocket;
 	uint8_t			byIsConnected;
 } PACK UDS_CHANNEL_T;
 
-/* Authentication Types */
-#define	AUTHTYPE_NONE									0x00
-#define	AUTHTYPE_MD2									0x01
-#define	AUTHTYPE_MD5									0x02
-#define	AUTHTYPE_RESERVED								0x03
-#define	AUTHTYPE_STRAIGHT_PASSWORD						0x04
-#define	AUTHTYPE_OEM_PROPRIETARY						0x05
-#define	AUTHTYPE_RMCP_PLUS_FORMAT						0x06
-
-/* Privilege levels */
-#define PRIV_LEVEL_NO_ACCESS                            0x0F
-#define PRIV_LEVEL_PROPRIETARY							0x05
-#define PRIV_LEVEL_ADMIN								0x04
-#define PRIV_LEVEL_OPERATOR								0x03
-#define PRIV_LEVEL_USER									0x02
-#define PRIV_LEVEL_CALLBACK								0x01
-#define PRIV_LEVEL_RESERVED								0x00
-
-
-/* Authentication Algorithms */
-#define AUTH_ALG_RAKP_NONE								0x00
-#define AUTH_ALG_RAKP_HMAC_SHA1							0x01
-#define AUTH_ALG_RAKP_HMAC_MD5							0x02
-
-/* Integrity Algorithms */
-#define INTEGRITY_ALG_NONE								0x00
-#define INTEGRITY_ALG_HMAC_SHA1_96						0x01
-#define INTEGRITY_ALG_HMAC_SHA1_128						0x02
-#define INTEGRITY_ALG_MD5_128							0x03
-
-/* Confidentiality Algorithms */
-#define CONFIDENTIALITY_ALG_NONE						0x00
-#define CONFIDENTIALITY_ALG_AES_CBC_128					0x01
-#define CONFIDENTIALITY_ALG_XRC4_128					0x02
-#define CONFIDENTIALITY_ALG_XRC4_40						0x03
-
-/* Payload Types */
-#define PAYLOAD_TYPE_IPMI								0
-#define PAYLOAD_TYPE_SOL								1
-#define PAYLOAD_TYPE_RSSP_OPEN_SES_REQ					0x10
-#define PAYLOAD_TYPE_RSSP_OPEN_SES_RES					0x11
-#define PAYLOAD_TYPE_RAKP_MSG_1							0x12
-#define PAYLOAD_TYPE_RAKP_MSG_2							0x13
-#define PAYLOAD_TYPE_RAKP_MSG_3							0x14
-#define PAYLOAD_TYPE_RAKP_MSG_4							0x15
-
-#define	MAX_KEY1_SIZE									20
-#define	MAX_KEY2_SIZE									20
-#define	MAX_GUID_SIZE									16
-#define	MAX_USER_NAME_LEN								(16+1) //1 for stroing the null character
-#define	MAX_USER_PWD_LEN								(20+1) //1 for storing the null character
-#define MAX_RAND_NO_LEN									16
-
-
-/* (0x6 << 2) == 0x18 */
-#define DEFAULT_NET_FN_LUN					0x18
-#define NETFNLUN_IPMI_APP					0x18
-#define NETFNLUN_IPMI_SENSOR					0x10
-#define NETFNLUN_IPMI_STORAGE					0x28
-#define NETFNLUN_IPMI_CHASSIS                                   0x00
-
 /**
  @def IPMI20_UDS_SESSION_T
  @brief holds data required for maintaining session with unix domain socket medium
 */
 typedef struct IPMI20_UDS_SESSION_T_tag {
   UDS_CHANNEL_T hUDSInfo;
-  char szUserName[MAX_USER_NAME_LEN];
-  char szPwd[MAX_USER_PWD_LEN];
-  char szUName[MAX_USER_NAME_LEN];
+  char szUserName[MAX_USERNAME_LEN];
+  char szPwd[MAX_PASSWORD_LEN];
+  char szUName[MAX_USERNAME_LEN];
   char abyIPAddr[IP6_ADDR_LEN];
   uint32_t dwSessionID;
   uint8_t byPreSession;
@@ -124,15 +51,6 @@ typedef struct IPMI20_UDS_SESSION_T_tag {
 typedef struct IPMI20_SESSION_T_tag {
 /* Medium type (Network, Serial, KCS, IPMB, USB) */
 	uint8_t	byMediumType;
-
-//#define NETWORK_MEDIUM_TCP      0x01
-//#define NETWORK_MEDIUM_UDP      0x04
-
-//#define	NETWORK_MEDIUM	        NETWORK_MEDIUM_TCP
-//#define	SERIAL_MEDIUM	        0x02
-//#define KCS_MEDIUM		        0x03
-//#define IPMB_MEDIUM		        0x05
-//#define USB_MEDIUM		        0x06
 #define	UDS_MEDIUM	          0x07
 
 /* tells whether session has started or not. */
@@ -144,23 +62,61 @@ typedef struct IPMI20_SESSION_T_tag {
 	uint8_t	byMaxRetries;
 /* LAN Eth Index for hold Eth number if multi NIc supported */
 	uint8_t         EthIndex;
-
-//	IPMI20_NETWORK_SESSION_T	*hNetworkSession;
-//	IPMI20_SERIAL_SESSION_T		*hSerialSession;
-//	IPMI20_KCS_SESSION_T		*hKCSSession;
-//	IPMI20_IPMB_SESSION_T		*hIPMBSession;
-//	IPMI20_USB_SESSION_T		*hUSBSession;
 	IPMI20_UDS_SESSION_T		*hUDSSession;
 
-//	LIBIPMI_SERIAL_SETTINGS_T	Settings;
-
 } PACK IPMI20_SESSION_T;
+
 typedef enum
 {
     AUTH_FLAG = 1,
     AUTH_BYPASS_FLAG,
 }USER_Auth;
 
+typedef struct
+{
+    uint8_t   CompletionCode;
+    uint16_t   Noofentries;
+} AMIGetSensorInfoRes_T;
+
+typedef struct
+{
+    SDRRecHdr_T    hdr;
+    uint8_t               OwnerID;
+    uint8_t               OwnerLUN;
+    uint8_t               SensorNumber;
+    uint8_t               SensorReading;
+    uint8_t               MaxReading;
+    uint8_t               MinReading;
+    uint8_t               Flags;
+    uint8_t               ComparisonStatus;
+    uint8_t               OptionalStatus;
+    uint8_t               SensorTypeCode;
+    uint8_t               EventTypeCode;
+    uint8_t               Units1;
+    uint8_t               Units2;
+    uint8_t               Units3;
+    uint8_t               Linearization;
+    uint8_t               M_LSB;
+    uint8_t               M_MSB_Tolerance;
+    uint8_t               B_LSB;
+    uint8_t               B_MSB_Accuracy;
+    uint8_t               Accuracy_MSB_Exp;
+    uint8_t               RExp_BExp;
+    uint8_t               LowerNonCritical;
+    uint8_t               LowerCritical;
+    uint8_t               LowerNonRecoverable;
+    uint8_t               UpperNonCritical;
+    uint8_t               UpperCritical;
+    uint8_t               UpperNonRecoverable;
+    uint8_t               AssertionEventByte1;
+    uint8_t               AssertionEventByte2;
+    uint8_t               DeassertionEventByte1;
+    uint8_t               DeassertionEventByte2;
+    char                SensorName[MAX_ID_STR_LEN];
+    uint16_t              Settable_Readable_ThreshMask;    
+
+}SenInfo_T;
+
 
 
 /* Undefine PACK so that it can be redefined in other header files */

+ 0 - 11
app/goahead-5.1.0/src/libipmi/inc/libipmi_usermgmt.h

@@ -1,15 +1,7 @@
 #ifndef __LIBIPMI_USER_MANAGEMENT_H__
 #define __LIBIPMI_USER_MANAGEMENT_H__
 
-#ifdef __GNUC__
 #define PACK __attribute__ ((packed))
-#else
-#define PACK
-#pragma pack( 1 )
-#endif
-
-#define			MAX_USERS				64
-#define			MAX_USER_NAME_LEN		16
 
 typedef struct {
 	uint8_t		byUserID;
@@ -22,9 +14,6 @@ typedef struct {
 } GetUser_T;
 
 #undef PACK
-#ifndef __GNUC__
-#pragma pack()
-#endif
 
 
 #endif

+ 0 - 20
app/goahead-5.1.0/src/libipmi/inc/libipmi_version.h

@@ -1,20 +0,0 @@
-#ifndef __LIBIPMI_VERSION_H__
-#define __LIBIPMI_VERSION_H__
-
-/*
-Version - 1.1
-Date - 14-Dec-2005
-Changes:
--Added IPMB Interface.
--Added LIBIPMI_HL_GetSDR in libipmi_sdr.c, a high level function to retreive SDRs based on medium type. In IPMB medium, SDRs must be retreived in chunks whereas in other mediums they can be retreived in a single stretch.
--Changed LIBIPMI_GetCompleteSDR to use LIBIPMI_HL_GetSDR instead of IPMICMD_GetSDR.
--Version information added.
--Fix: In LIBIPMI_SetUser, expected response length field was unassigned. It is corrected.
-*/
-
-#define LIBIPMI_VERSION		"1.1"
-
-#endif
-
-
-

+ 10 - 10
app/goahead-5.1.0/src/libipmi/inc/libsensor.h

@@ -12,16 +12,16 @@
 
 #include "libipmi_session.h"
 
-/* IPMI threshold state definitions for monitoring */
-#define THRESH_UNINITIALIZED        ( (u16)0x00 )
-#define THRESH_NORMAL               ( (u16)0x01 )
-#define THRESH_UP_NONCRIT           ( (u16)0x02 )
-#define THRESH_UP_CRITICAL          ( (u16)0x04 )
-#define THRESH_LOW_NONCRIT          ( (u16)0x08 )
-#define THRESH_LOW_CRITICAL         ( (u16)0x10 )
-#define THRESH_ACCESS_FAILED        ( (u16)0x20 )
-#define THRESH_UP_NON_RECOV         ( (u16)0x40 )
-#define THRESH_LOW_NON_RECOV        ( (u16)0x80 )
+// /* IPMI threshold state definitions for monitoring */
+// #define THRESH_UNINITIALIZED        ( (u16)0x00 )
+// #define THRESH_NORMAL               ( (u16)0x01 )
+// #define THRESH_UP_NONCRIT           ( (u16)0x02 )
+// #define THRESH_UP_CRITICAL          ( (u16)0x04 )
+// #define THRESH_LOW_NONCRIT          ( (u16)0x08 )
+// #define THRESH_LOW_CRITICAL         ( (u16)0x10 )
+// #define THRESH_ACCESS_FAILED        ( (u16)0x20 )
+// #define THRESH_UP_NON_RECOV         ( (u16)0x40 )
+// #define THRESH_LOW_NON_RECOV        ( (u16)0x80 )
 
 //#pragma pack(1)
 struct sensor_data

+ 37 - 0
app/goahead-5.1.0/src/libipmi/inc/sensor_helpers.h

@@ -0,0 +1,37 @@
+/*****************************************************************
+******************************************************************
+***                                                            ***
+***        (C)Copyright 2008, American Megatrends Inc.         ***
+***                                                            ***
+***                    All Rights Reserved                     ***
+***                                                            ***
+***       5555 Oakbrook Parkway, Norcross, GA 30093, USA       ***
+***                                                            ***
+***                     Phone 770.246.8600                     ***
+***                                                            ***
+******************************************************************
+******************************************************************
+******************************************************************
+* 
+* Filename: sensor_helpers.h
+*
+* Description: Prototypes for sensor helper functions 
+*
+* Author: Andrew McCallum
+*
+******************************************************************/
+#ifndef SENSOR_HELPERS_H_
+#define SENSOR_HELPERS_H_
+
+#include "libipmi_sensor.h"
+#include "com_IPMI_SDRRecord.h"
+
+int ipmi_convert_reading( uint8_t *sdr_buffer, uint8_t raw_reading, float *converted_reading );
+int read_sensor_sdrs( IPMI20_SESSION_T *pSession, struct sensor_info **sensor_list,
+					  int timeout );
+int get_sdr_sensor_state( uint8_t sensor_reading, uint8_t *sdr_buffer, uint16_t *current_state );
+int GetSensorState(IPMI20_SESSION_T *pSession, uint8_t sensor_reading, uint8_t *sdr_buffer, uint16_t *current_state, int timeout  );
+int ipmi_conv_reading(uint8_t SDRType, uint8_t raw_reading, float *converted_reading ,uint8_t Min,uint8_t Max,uint8_t Units1,uint8_t Lin,uint8_t Mval,uint8_t Bval,uint8_t M_Tol,uint8_t B_Acc,uint8_t R_B_Ex);
+int SensorState( uint8_t sensor_reading, uint16_t *current_state,uint8_t SDRType,uint8_t Lin,uint8_t Units1,uint8_t EvtType,uint8_t AssertEvt1,uint8_t AssertEvt2,uint8_t DeassertEvt1,uint8_t DeassertEvt2);
+unsigned char sdr_convert_sensor_value_to_raw(FullSensorRec_T	*sdr_record, double val);
+#endif

+ 0 - 150
app/goahead-5.1.0/src/libipmi/inc/std_macros.h

@@ -1,150 +0,0 @@
-/****************************************************************
- ****************************************************************
- **                                                            **
- **    (C)Copyright 2005-2006, American Megatrends Inc.        **
- **                                                            **
- **            All Rights Reserved.                            **
- **                                                            **
- **        6145-F, Northbelt Parkway, Norcross,                **
- **                                                            **
- **        Georgia - 30071, USA. Phone-(770)-246-8600.         **
- **                                                            **
- ****************************************************************
- ****************************************************************
- ****************************************************************
- ****************************************************************
- *
- * std_macros.h
- *
- *  Author: Anurag Bhatia
- *  Description: Taken from Platform.h inside IPMI stack.
- ******************************************************************/
-#ifndef STD_MACROS_H
-#define STD_MACROS_H
-
-#include "Types.h"
-#include "platform.h"
-
-
-/**
- * @def htoipmi_u32
- * @brief Converts unsigned 32 bit data from Host format to IPMI format.
- * @param Val 32bit value to be converted.
- **/
-
-#if LIBIPMI_IS_PLATFORM_X86() || LIBIPMI_IS_PLATFORM_ARM() || LIBIPMI_IS_PLATFORM_SH()
-#define htoipmi_u32(Val)    (Val)
-#elif LIBIPMI_IS_PLATFORM_PPC() || LIBIPMI_IS_PLATFORM_MIPS()
-#define htoipmi_u32(Val)    ipmitoh_u32(Val)
-#endif
-                            
-/**
- * @def ipmitoh_u32
- * @brief Converts unsigned 32 bit data from IPMI format to Host format.
- * @param Val 32bit value to be converted.
- **/
-#if LIBIPMI_IS_PLATFORM_X86() || LIBIPMI_IS_PLATFORM_ARM() || LIBIPMI_IS_PLATFORM_SH()
-#define ipmitoh_u32(Val)    (Val)
-#elif LIBIPMI_IS_PLATFORM_PPC() || LIBIPMI_IS_PLATFORM_MIPS()
-#define ipmitoh_u32(Val)    (((Val & 0xFF000000) >> 24)| \
-                             ((Val & 0x00FF0000) >> 8) | \
-                             ((Val & 0x0000FF00) << 8) | \
-                             ((Val & 0x000000FF) << 24 ))
-#endif
-
-/**
- * @def htoipmi_u16
- * @brief Converts unsigned 16 bit data from Host format to IPMI format.
- * @param Val 16bit value to be converted.
- **/
-#if LIBIPMI_IS_PLATFORM_X86() || LIBIPMI_IS_PLATFORM_ARM() || LIBIPMI_IS_PLATFORM_SH()
-#define htoipmi_u16(Val)    (Val)
-#elif LIBIPMI_IS_PLATFORM_PPC() || LIBIPMI_IS_PLATFORM_MIPS()
-#define htoipmi_u16(Val)   ipmitoh_u16(Val)
-#endif
-
-/**
- * @def htoipmi_u16
- * @brief Converts unsigned 16 bit data from IPMI format to Host format.
- * @param Val 16bit value to be converted.
- **/
-#if LIBIPMI_IS_PLATFORM_X86() || LIBIPMI_IS_PLATFORM_ARM() || LIBIPMI_IS_PLATFORM_SH()
-#define ipmitoh_u16(Val)    (Val)
-#elif LIBIPMI_IS_PLATFORM_PPC() || LIBIPMI_IS_PLATFORM_MIPS()
-#define ipmitoh_u16(Val)   (uint16_t)(((uint16_t)(Val) & 0xFF00) >> 8 | ((uint16_t)(Val) & 0x00FF) << 8)
-#endif
-
-
-#if 0
-//Anurag Written
-/**
- * @def htoipmi_u32
- * @brief Converts unsigned 32 bit data from Host format to IPMI format.
- * @param Val 32bit value to be converted.
- **/
-#define htoipmi_u32(Val)   (Val)
-/* ((uint32_t)(((Val & 0xff) << 24) +    \
-                            ((Val & 0xff00) << 8) +             \
-                            ((Val & 0xff0000) >> 8) +           \
-                            ((Val & 0xff000000) >> 24)))*/
-
-
-/**
- * @def ipmitoh_u32
- * @brief Converts unsigned 32 bit data from IPMI format to Host format.
- * @param Val 32bit value to be converted.
- **/
-#define ipmitoh_u32(Val)    (Val)
-/*((uint32_t)(((Val & 0xff) << 24) +    \
-                            ((Val & 0xff00) << 8) +             \
-                            ((Val & 0xff0000) >> 8) +           \
-                            ((Val & 0xff000000) >> 24)))
-*/
-/**
- * @def htoipmi_u16
- * @brief Converts unsigned 16 bit data from Host format to IPMI format.
- * @param Val 16bit value to be converted.
- **/
-#define htoipmi_u16(Val)    (Val)
-/*((uint16_t)(((Val & 0xff) << 8) + (Val >> 8)))*/
-
-/**
- * @def htoipmi_u16
- * @brief Converts unsigned 16 bit data from IPMI format to Host format.
- * @param Val 16bit value to be converted.
- **/
-#define ipmitoh_u16(Val)    (Val)
-/*((uint16_t)(((Val & 0xff) << 8) + (Val >> 8)))*/
-
-#endif
-
-#if 0
-/**
- * @def htons
- * @brief Converts unsigned 16 bit data from Host format to Network format.
- * @param Val 16bit value to be converted.
- **/
-#define htons(Val)          Val
-
-/**
- * @def htonl
- * @brief Converts unsigned 32 bit data from Host format to Network format.
- * @param Val 132bit value to be converted.
- **/
-#define htonl(Val)          Val
-
-/**
- * @def htons
- * @brief Converts unsigned 16 bit data from Network format to Host format.
- * @param Val 16bit value to be converted.
- **/
-#define ntohs(Val)          Val
-
-/**
- * @def ntohl
- * @brief Converts unsigned 32 bit data from Network format to Host format.
- * @param Val 32bit value to be converted.
- **/
-#define ntohl(Val)          Val
-#endif
-#endif  /* STD_MACROS_H */

+ 7 - 8
app/goahead-5.1.0/src/libipmi/src/libipmi_Chassis.c

@@ -26,7 +26,6 @@
 #include "libipmi_ChassisDevice.h"
 
 #include "string.h"
-#include <dbgout.h>
 
 
 /**
@@ -48,7 +47,7 @@ uint16_t	IPMICMD_ChassisControl( IPMI20_SESSION_T *pSession, int timeout, char c
     dwResLen = sizeof ( ChassisControlRes_T);
 
 
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 					    NETFNLUN_IPMI_CHASSIS, CMD_CHASSIS_CONTROL,
 					    (uint8_t *)&ChassisReq,sizeof(ChassisControlReq_T),
 					    (uint8_t*)&ChassisRes, &dwResLen,
@@ -65,7 +64,7 @@ uint16_t IPMICMD_GetSystemBootOptions(IPMI20_SESSION_T *pSession, GetBootOptions
 
 	dwResLen = reslen;
 	
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_CHASSIS, CMD_GET_SYSTEM_BOOT_OPTIONS,
 											(uint8_t*)pReqGetBootOptions, sizeof(GetBootOptionsReq_T),
 											(uint8_t *)pResGetBootOptions, &dwResLen,
@@ -90,7 +89,7 @@ uint16_t IPMICMD_SetSystemBootOptions(IPMI20_SESSION_T *pSession, SetBootOptions
 	local_ReqSetBootOptions.BootParam.SetInProgress = 1;
 	dwResLen = sizeof(SetBootOptionsRes_T);
 	//first do a set in progress
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_CHASSIS, CMD_SET_SYSTEM_BOOT_OPTIONS,
 											(uint8_t*)&local_ReqSetBootOptions, 2,
 											(uint8_t *)&local_ResSetBootOptions, &dwResLen,
@@ -104,7 +103,7 @@ uint16_t IPMICMD_SetSystemBootOptions(IPMI20_SESSION_T *pSession, SetBootOptions
 
 
 	dwResLen = sizeof(SetBootOptionsRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_CHASSIS, CMD_SET_SYSTEM_BOOT_OPTIONS,
 											(uint8_t*)pReqSetBootOptions, reqlen,
 											(uint8_t *)pResSetBootOptions, &dwResLen,
@@ -120,7 +119,7 @@ uint16_t IPMICMD_SetSystemBootOptions(IPMI20_SESSION_T *pSession, SetBootOptions
 	local_ReqSetBootOptions.BootParam.SetInProgress = 0;
 	dwResLen = sizeof(SetBootOptionsRes_T);
 	//first do a set in progress
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 										NETFNLUN_IPMI_CHASSIS, CMD_SET_SYSTEM_BOOT_OPTIONS,
 										(uint8_t*)&local_ReqSetBootOptions, 2,
 										(uint8_t *)&local_ResSetBootOptions, &dwResLen,
@@ -146,7 +145,7 @@ uint16_t IPMICMD_ChassisIdentify(IPMI20_SESSION_T *pSession,int timeout,ChassisI
 	 
 	 dwResLen = sizeof (ChassisIdentifyRes_T);
 	 
-	 wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	 wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 					    NETFNLUN_IPMI_CHASSIS, CMD_CHASSIS_IDENTIFY,
 					    (uint8_t *)ChassisIdReq,sizeof(ChassisIdentifyReq_T),
 					    (uint8_t*)&ChassisIdRes, &dwResLen,
@@ -251,7 +250,7 @@ uint16_t	LIBIPMI_HL_GetChassisStatus( IPMI20_SESSION_T *pSession, int timeout, c
 
     dwResLen = sizeof(GetChassisStatusRes_T);
     
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 					    NETFNLUN_IPMI_CHASSIS, CMD_GET_CHASSIS_STATUS,
 					    (uint8_t *)&ChassisStatusReq, 0 ,
 					    (uint8_t*)&ChassisStatusRes, &dwResLen,

+ 8 - 10
app/goahead-5.1.0/src/libipmi/src/libipmi_PEF.c

@@ -22,8 +22,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include "dbgout.h"
-#include "std_macros.h"
 
 #ifndef ALERT_POLICY_PER_CHANNEL
 #define ALERT_POLICY_PER_CHANNEL   15
@@ -40,7 +38,7 @@ uint16_t	IPMICMD_GetPEFCapabilities( IPMI20_SESSION_T *pSession,
 
 
 	dwResLen = sizeof(GetPEFCapRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_GET_PEF_CAPABILITIES,
 						(uint8_t*)Req, 0,
 						(uint8_t *)pResGetPEFCap, &dwResLen,
@@ -60,7 +58,7 @@ uint16_t	IPMICMD_ArmPEFTimer( IPMI20_SESSION_T *pSession/*in*/,
 
 
 	dwResLen = sizeof(ArmPEFTmrRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_ARM_PEF_POSTPONE_TIMER,
 						pReqTmrTimeout, sizeof(uint8_t),
 						(uint8_t *)pResArmPEFTmr, &dwResLen,
@@ -81,7 +79,7 @@ uint16_t	IPMICMD_SetPEFConf( IPMI20_SESSION_T *pSession/*in*/,
 
 
 	dwResLen = sizeof(uint8_t);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_SET_PEF_CONFIG_PARAMS,
 						pReqSetPEFConf, dwReqBufLen,
 						(uint8_t *)pResSetPEFConf, &dwResLen,
@@ -101,7 +99,7 @@ uint16_t	IPMICMD_GetPEFConf( IPMI20_SESSION_T *pSession/*in*/,
 
 
 	dwResLen = MAX_RESPONSE_SIZE;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_GET_PEF_CONFIG_PARAMS,
 						(uint8_t*)pReqGetPEFConf, sizeof(GetPEFConfigReq_T),
 						pResGetPEFConf, &dwResLen,
@@ -121,7 +119,7 @@ uint16_t	IPMICMD_SetLastEventID( IPMI20_SESSION_T *pSession/*in*/,
 
 
 	dwResLen = sizeof(uint8_t);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_SET_LAST_PROCESSED_EVENT_ID,
 						(uint8_t*)pReqSetLastEvt, sizeof(SetLastEvtIDReq_T),
 						pResSetLastEvt, &dwResLen,
@@ -141,7 +139,7 @@ uint16_t	IPMICMD_GetLastEventID( IPMI20_SESSION_T *pSession/*in*/,
 
 
 	dwResLen = sizeof(GetLastEvtIDRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_GET_LAST_PROCESSED_EVENT_ID,
 						(uint8_t*)Req, 0,
 						(uint8_t*)pResGetLastEvt, &dwResLen,
@@ -161,7 +159,7 @@ uint16_t	IPMICMD_AlertImmediate( IPMI20_SESSION_T *pSession/*in*/,
 
 
 	dwResLen = sizeof(AlertImmRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_ALERT_IMMEDIATE,
 						(uint8_t*)pReqAlertImmediate, sizeof(AlertImmReq_T),
 						(uint8_t*)pResAlertImmediate, &dwResLen,
@@ -180,7 +178,7 @@ uint16_t	IPMICMD_PETAck( IPMI20_SESSION_T *pSession/*in*/,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(uint8_t);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						NETFNLUN_IPMI_SENSOR, CMD_PET_ACKNOWLEDGE,
 						(uint8_t*)pReqPETAck, sizeof(PETAckReq_T),
 						(uint8_t*)pResPETACK, &dwResLen,

+ 0 - 3
app/goahead-5.1.0/src/libipmi/src/libipmi_StorDevice.c

@@ -24,13 +24,10 @@
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
 #include "libipmi_StorDevice.h"
-#include "std_macros.h"
-#include "IPMI_AMIDevice.h"
 #include "libipmi_AMIOEM.h"
 
 #include <stdlib.h>
 #include <string.h>
-#include "dbgout.h"
 
 /* Helper function */
 uint8_t libipmi_GetBits(uint8_t orig, uint8_t startbit, uint8_t endbit)

+ 0 - 81
app/goahead-5.1.0/src/libipmi/src/libipmi_device_api.c

@@ -1,81 +0,0 @@
-/*****************************************************************
-******************************************************************
-***                                                            ***
-***        (C)Copyright 2008, American Megatrends Inc.         ***
-***                                                            ***
-***                    All Rights Reserved                     ***
-***                                                            ***
-***       5555 Oakbrook Parkway, Norcross, GA 30093, USA       ***
-***                                                            ***
-***                     Phone 770.246.8600                     ***
-***                                                            ***
-******************************************************************
-******************************************************************
-******************************************************************
-* 
-* Filename: libipmi_device_api.c
-*
-******************************************************************/
-#include "libipmi_session.h"
-#include "libipmi_errorcodes.h"
-#include "libipmi_api.h"
-
-#include <string.h>
-uint16_t LIBIPMI_GetDeviceID( IPMI20_SESSION_T *pSession, char *pszDeviceID, int timeout )
-{
-	uint8_t	Res [20], Req [20];
-	uint32_t	dwResLen;
-	uint8_t	i;
-	uint16_t	wRet;
-	char	szTemp[10];
-
-	pszDeviceID[0] = (char)0;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
-											DEFAULT_NET_FN_LUN, 0x01,
-											Req, 0,
-											Res, &dwResLen,
-											timeout);
-	if (wRet == LIBIPMI_E_SUCCESS)
-	{
-		for (i = 0; i < (uint8_t)dwResLen; i++ )
-		{
-			sprintf (szTemp, "%x ", Res[i]);
-			strcat(pszDeviceID, szTemp);
-		}
-	}
-	
-	return wRet;
-}
-
-
-#if 0
-int main()
-{
-	IPMI20_SESSION_T hSession;
-	uint16_t	wRet;
-	uint8_t				m_KG [] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-
-	memset((void*)&hSession, 0, sizeof(IPMI20_SESSION_T) );
-
-	printf("*********************** Entering main **********************\n");
-	wRet = Create_IPMI20_Network_Session(&hSession, "10.0.0.217", 623,
-							"", "", 0,
-							0, 0, 0x04,
-							0xc2, 0x20,
-							m_KG, sizeof(m_KG),
-							1000);
-	printf("*************** Create_IPMI20_Session returned ***************\n");
-
-	if (wRet == LIBIPMI_E_SUCCESS)
-	{
-		GetDeviceID( &hSession );
-	}
-	else
-	{
-		printf("*********************** Error 1 ***************************");
-		printf("Error in creating the session\n");
-	}
-
-	return 0;
-}
-#endif

+ 21 - 36
app/goahead-5.1.0/src/libipmi/src/libipmi_fru.c

@@ -21,12 +21,8 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include "dbgout.h"
 #include "libipmi_fru.h"
 
-#if LIBIPMI_IS_OS_LINUX()
-#include <syslog.h>
-#endif
 
 #ifdef _USE_ARR_MALLOCS_
 #define MAX_MALLOCS			32
@@ -256,7 +252,7 @@ static int GetChassisInfoArea(uint8_t *pBuff, FRUData_T *FRU)
     pChassisArea++;
     FRU->ChassisInfo.ChassisInfoAreaLength = *pChassisArea;
     pChassisArea++;
-    TDBG ("Chassis type : %d %d\n", (uint8_t)*pChassisArea, sizeof (chassis_type)/ sizeof (char *));
+    printf ("Chassis type : %d %d\n", (uint8_t)*pChassisArea, sizeof (chassis_type)/ sizeof (char *));
     if ((*pChassisArea) >= sizeof (chassis_type)/ sizeof (char *))
         *pChassisArea = 0;
     size = strlen(chassis_type[*pChassisArea]);
@@ -1010,31 +1006,31 @@ return 0;
 
 
 static uint16_t get_fru_info (IPMI20_SESSION_T* psession,
-				  u8 fru_device_id,
-				  u32* p_fru_size,
+				  uint8_t fru_device_id,
+				  uint32_t* p_fru_size,
 				  FRUData_T* fru_data,
 				  int timeout)
 {
 	FRUInventoryAreaInfoReq_T 	fru_inv_area_req;
 	FRUInventoryAreaInfoRes_T 	fru_inv_area_res;
-	u8*							pFRUBuff = NULL;
-	u8*							tempFRUBuff = NULL;
-	u8*							fru_res_data = NULL;
-	u32							fru_res_data_len = 0;
+	uint8_t*							pFRUBuff = NULL;
+	uint8_t*							tempFRUBuff = NULL;
+	uint8_t*							fru_res_data = NULL;
+	uint32_t							fru_res_data_len = 0;
 	FRUReadReq_T				fru_read_req;
 
-	u32							wRet = 0;
-	u32							fru_size = 0;
-	u8								BLOCK_OF_DATA_TO_READ = 128;
-	u8                         isValidFRU = 0;
+	uint32_t							wRet = 0;
+	uint32_t							fru_size = 0;
+	uint8_t								BLOCK_OF_DATA_TO_READ = 128;
+	uint8_t                         isValidFRU = 0;
 	FRUCommonHeader_T *pTmp = NULL;
 	int i = 0;
 
-	if(psession->byMediumType == IPMB_MEDIUM)
-	{
-		BLOCK_OF_DATA_TO_READ = 24;	//IPMB max message packet is 32 bytes. 
-												//24 + message header + completion code + checksum2 = 32
-	}
+	// if(psession->byMediumType == IPMB_MEDIUM)
+	// {
+	// 	BLOCK_OF_DATA_TO_READ = 24;	//IPMB max message packet is 32 bytes. 
+	// 											//24 + message header + completion code + checksum2 = 32
+	// }
 	/**
 	 * returns the overall size(in bytes) of the FRU
 	 * inventory area in this device
@@ -1052,22 +1048,17 @@ static uint16_t get_fru_info (IPMI20_SESSION_T* psession,
 	}
 	else
 	{
-
-		#if LIBIPMI_IS_OS_LINUX()
-		syslog (LOG_INFO, "libipmi:get_fru_info: fru-size obtained for device-%d\n", fru_device_id);
-		#endif
-
 		if ((fru_inv_area_res.CompletionCode & 0xFF) == 0xCB)
 		{
 			printf("---> error log 2\n");
 			goto InterpretFRU;
 		}
 
-		*p_fru_size = fru_size = (u32)fru_inv_area_res.Size;
+		*p_fru_size = fru_size = (uint32_t)fru_inv_area_res.Size;
 		printf("---> fru_size = %d\n", fru_size);
 
 		//! Allocate the buffer size to read FRU data for this FRU device
-		tempFRUBuff = pFRUBuff 	= (u8* ) malloc (fru_size);
+		tempFRUBuff = pFRUBuff 	= (uint8_t* ) malloc (fru_size);
 		if( tempFRUBuff == NULL)
 		{
 		     printf ("libipmi_fru.c: Error allocating memory for tempFRUBuff\n");
@@ -1082,7 +1073,7 @@ static uint16_t get_fru_info (IPMI20_SESSION_T* psession,
 		fru_read_req.Offset 	 = 0x00; //! go to start of FRU area
 
 		fru_res_data_len		 = 	sizeof(FRUReadRes_T) + BLOCK_OF_DATA_TO_READ;
-		fru_res_data 			 = (u8* ) malloc ( fru_res_data_len );
+		fru_res_data 			 = (uint8_t* ) malloc ( fru_res_data_len );
 		if( fru_res_data == NULL)
 		{
 		     printf ("libipmi_fru.c: Error allocating memory for tempFRUBuff\n");
@@ -1110,12 +1101,6 @@ static uint16_t get_fru_info (IPMI20_SESSION_T* psession,
 			printf("\n");
 			if (wRet != 0)
 			{
-				#if LIBIPMI_IS_OS_LINUX()
-				syslog (LOG_ERR,
-						"libipmi:get_fru_info: error reading fru data for device-%d\n",
-						fru_device_id);
-				#endif
-
 				SAFE_FREE (fru_res_data);
 				SAFE_FREE (tempFRUBuff);
 				goto _exit_get_fru_info_;
@@ -1169,8 +1154,8 @@ _exit_get_fru_info_:
 }
 
 uint16_t LIBIPMI_HL_GetFRUData(IPMI20_SESSION_T *pSession,
-					u8 fru_device_id,
-				  	u32* p_fru_size,
+					uint8_t fru_device_id,
+				  	uint32_t* p_fru_size,
 				  	FRUData_T* fru_data,
 					int timeout)
 {

+ 47 - 61
app/goahead-5.1.0/src/libipmi/src/libipmi_sdr.c

@@ -19,38 +19,24 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "dbgout.h"
-
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
 #include "libipmi_sdr.h"
-#include "IPMI_Storage.h"
-#include "std_macros.h"
+#include "com_IPMI_Storage.h"
 
-#include "libipmi_sal_session.h"
 
 
-#ifdef __GNUC__
 /** \brief gcc method for designating a packed struct */
 #define PACKED __attribute__ ((packed))
-#else
-#define PACKED
-#pragma pack( 1 )
-#endif
 
 
-#include "IPMI_SDRRecord.h"
 
-
-#undef PACKED
-#ifndef __GNUC__
-#pragma pack( )
-#endif
+#include "com_IPMI_SDRRecord.h"
 
 
 
 /* Get SDR Repository Info Command */
-LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryInfo( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_GetSDRRepositoryInfo( IPMI20_SESSION_T *pSession,
                                         SDRRepositoryInfo_T *pResGetSDRRepositoryInfo,
                                         int timeout)
 {
@@ -59,7 +45,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryInfo( IPMI20_SESSION_T *pSession
     uint32_t    dwResLen;
 
     dwResLen = sizeof(SDRRepositoryInfo_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_GET_SDR_REPOSITORY_INFO,
                                             (uint8_t*)Req, 0,
                                             (uint8_t *)pResGetSDRRepositoryInfo, &dwResLen,
@@ -69,7 +55,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryInfo( IPMI20_SESSION_T *pSession
 }
 
 /* Get SDR Repository Allocation Info Command */
-LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryAllocInfo( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_GetSDRRepositoryAllocInfo( IPMI20_SESSION_T *pSession,
                                         SDRRepositoryAllocInfo_T *pResGetSDRRepositoryAllocInfo,
                                         int timeout)
 {
@@ -78,7 +64,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryAllocInfo( IPMI20_SESSION_T *pSe
     uint32_t    dwResLen;
 
     dwResLen = sizeof(SDRRepositoryAllocInfo_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_GET_SDR_REPOSITORY_ALLOCATION_INFO,
                                             (uint8_t*)Req, 0,
                                             (uint8_t *)pResGetSDRRepositoryAllocInfo, &dwResLen,
@@ -88,7 +74,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryAllocInfo( IPMI20_SESSION_T *pSe
 }
 
 /* Reserve SDR Repository Command */
-LIBIPMI_API uint16_t    IPMICMD_ReserveSDRRepository( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_ReserveSDRRepository( IPMI20_SESSION_T *pSession,
                                         ReserveSDRRepositoryRes_T *pResReserveSDRRepository,
                                         int timeout)
 {
@@ -97,7 +83,7 @@ LIBIPMI_API uint16_t    IPMICMD_ReserveSDRRepository( IPMI20_SESSION_T *pSession
     uint32_t    dwResLen;
 
     dwResLen = sizeof(ReserveSDRRepositoryRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_RESERVE_SDR_REPOSITORY,
                                             (uint8_t*)Req, 0,
                                             (uint8_t *)pResReserveSDRRepository, &dwResLen,
@@ -108,7 +94,7 @@ LIBIPMI_API uint16_t    IPMICMD_ReserveSDRRepository( IPMI20_SESSION_T *pSession
 
 
 /* Get SDR Command */
-LIBIPMI_API uint16_t    IPMICMD_GetSDR( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_GetSDR( IPMI20_SESSION_T *pSession,
                                     GetSDRReq_T *pReqGetSDR,
                                     GetSDRRes_T *pResGetSDR,
                                     uint32_t        *pdwOutBuffLen,
@@ -118,7 +104,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDR( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = *pdwOutBuffLen;
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_GET_SDR,
                                             (uint8_t*)pReqGetSDR, sizeof(GetSDRReq_T),
                                             (uint8_t *)pResGetSDR, &dwResLen,
@@ -131,7 +117,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDR( IPMI20_SESSION_T *pSession,
 
 
 /* Add SDR Command */
-LIBIPMI_API uint16_t    IPMICMD_AddSDR( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_AddSDR( IPMI20_SESSION_T *pSession,
                                     uint8_t        *pReqAddSDR,
                                     uint32_t        dwInBuffLen,
                                     AddSDRRes_T *pResAddSDR,
@@ -141,7 +127,7 @@ LIBIPMI_API uint16_t    IPMICMD_AddSDR( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = sizeof(AddSDRRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_ADD_SDR,
                                             (uint8_t*)pReqAddSDR, dwInBuffLen,
                                             (uint8_t *)pResAddSDR, &dwResLen,
@@ -152,7 +138,7 @@ LIBIPMI_API uint16_t    IPMICMD_AddSDR( IPMI20_SESSION_T *pSession,
 
 
 /* Partial Add SDR Command */
-LIBIPMI_API uint16_t    IPMICMD_PartialAddSDR( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_PartialAddSDR( IPMI20_SESSION_T *pSession,
                                     PartialAddSDRReq_T *pReqPartialAddSDR,
                                     uint32_t        dwInBuffLen,
                                     PartialAddSDRRes_T *pResPartialAddSDR,
@@ -162,7 +148,7 @@ LIBIPMI_API uint16_t    IPMICMD_PartialAddSDR( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = sizeof(PartialAddSDRRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_PARTIAL_ADD_SDR,
                                             (uint8_t*)pReqPartialAddSDR, dwInBuffLen,
                                             (uint8_t *)pResPartialAddSDR, &dwResLen,
@@ -173,7 +159,7 @@ LIBIPMI_API uint16_t    IPMICMD_PartialAddSDR( IPMI20_SESSION_T *pSession,
 
 
 /* Delete SDR Command */
-LIBIPMI_API uint16_t    IPMICMD_DeleteSDR( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_DeleteSDR( IPMI20_SESSION_T *pSession,
                                     DeleteSDRReq_T *pReqDeleteSDR,
                                     DeleteSDRReq_T *pResDeleteSDR,
                                     int timeout)
@@ -182,7 +168,7 @@ LIBIPMI_API uint16_t    IPMICMD_DeleteSDR( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = sizeof(DeleteSDRReq_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_DELETE_SDR,
                                             (uint8_t*)pReqDeleteSDR, sizeof(DeleteSDRReq_T),
                                             (uint8_t *)pResDeleteSDR, &dwResLen,
@@ -193,7 +179,7 @@ LIBIPMI_API uint16_t    IPMICMD_DeleteSDR( IPMI20_SESSION_T *pSession,
 
 
 /* Clear SDR Repository Command */
-LIBIPMI_API uint16_t    IPMICMD_ClearSDRRepository( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_ClearSDRRepository( IPMI20_SESSION_T *pSession,
                                     ClearSDRReq_T *pReqClearSDR,
                                     ClearSDRRes_T *pResClearSDR,
                                     int timeout)
@@ -202,7 +188,7 @@ LIBIPMI_API uint16_t    IPMICMD_ClearSDRRepository( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = sizeof(ClearSDRRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_CLEAR_SDR_REPOSITORY,
                                             (uint8_t*)pReqClearSDR, sizeof(ClearSDRReq_T),
                                             (uint8_t *)pResClearSDR, &dwResLen,
@@ -213,7 +199,7 @@ LIBIPMI_API uint16_t    IPMICMD_ClearSDRRepository( IPMI20_SESSION_T *pSession,
 
 
 /* Get SDR Repository Time Command */
-LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_GetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
                                     GetSDRRepositoryTimeRes_T *pResGetSDRRepositoryTime,
                                     int timeout)
 {
@@ -222,7 +208,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryTime( IPMI20_SESSION_T *pSession
     uint32_t    dwResLen;
 
     dwResLen = sizeof(GetSDRRepositoryTimeRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_GET_SDR_REPOSITORY_TIME,
                                             (uint8_t*)Req, 0,
                                             (uint8_t *)pResGetSDRRepositoryTime, &dwResLen,
@@ -233,7 +219,7 @@ LIBIPMI_API uint16_t    IPMICMD_GetSDRRepositoryTime( IPMI20_SESSION_T *pSession
 
 
 /* Set SDR Repository Time Command */
-LIBIPMI_API uint16_t    IPMICMD_SetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_SetSDRRepositoryTime( IPMI20_SESSION_T *pSession,
                                     SetSDRRepositoryTimeReq_T *pReqSetSDRRepositoryTime,
                                     uint8_t *pResSetSDRRepositoryTime,
                                     int timeout)
@@ -242,7 +228,7 @@ LIBIPMI_API uint16_t    IPMICMD_SetSDRRepositoryTime( IPMI20_SESSION_T *pSession
     uint32_t    dwResLen;
 
     dwResLen = sizeof(uint8_t);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_SET_SDR_REPOSITORY_TIME,
                                             (uint8_t*)pReqSetSDRRepositoryTime, sizeof(SetSDRRepositoryTimeReq_T),
                                             (uint8_t *)pResSetSDRRepositoryTime, &dwResLen,
@@ -253,7 +239,7 @@ LIBIPMI_API uint16_t    IPMICMD_SetSDRRepositoryTime( IPMI20_SESSION_T *pSession
 
 
 /* Enter SDR Repository Update Mode Command */
-LIBIPMI_API uint16_t    IPMICMD_EnterSDRUpdateMode( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_EnterSDRUpdateMode( IPMI20_SESSION_T *pSession,
                                     EnterSDRUpdateModeRes_T *pResEnterSDRUpdateMode,
                                     int timeout)
 {
@@ -262,7 +248,7 @@ LIBIPMI_API uint16_t    IPMICMD_EnterSDRUpdateMode( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = sizeof(EnterSDRUpdateModeRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_ENTER_SDR_REPOSITORY_UPDATE_MODE,
                                             (uint8_t*)Req, 0,
                                             (uint8_t *)pResEnterSDRUpdateMode, &dwResLen,
@@ -272,7 +258,7 @@ LIBIPMI_API uint16_t    IPMICMD_EnterSDRUpdateMode( IPMI20_SESSION_T *pSession,
 }
 
 /* Exit SDR Repository Update Mode Command */
-LIBIPMI_API uint16_t    IPMICMD_ExitSDRUpdateMode( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_ExitSDRUpdateMode( IPMI20_SESSION_T *pSession,
                                     ExitSDRUpdateModeRes_T *pResExitSDRUpdateMode,
                                     int timeout)
 {
@@ -281,7 +267,7 @@ LIBIPMI_API uint16_t    IPMICMD_ExitSDRUpdateMode( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = sizeof(ExitSDRUpdateModeRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_EXIT_SDR_REPOSITORY_UPDATE_MODE,
                                             (uint8_t*)Req, 0,
                                             (uint8_t *)pResExitSDRUpdateMode, &dwResLen,
@@ -291,7 +277,7 @@ LIBIPMI_API uint16_t    IPMICMD_ExitSDRUpdateMode( IPMI20_SESSION_T *pSession,
 }
 
 /* Run Initialization Agent Command */
-LIBIPMI_API uint16_t    IPMICMD_RunInitAgent( IPMI20_SESSION_T *pSession,
+  uint16_t    IPMICMD_RunInitAgent( IPMI20_SESSION_T *pSession,
                                     RunInitAgentReq_T *pReqRunInitAgent,
                                     RunInitAgentRes_T *pResRunInitAgent,
                                     int timeout)
@@ -300,7 +286,7 @@ LIBIPMI_API uint16_t    IPMICMD_RunInitAgent( IPMI20_SESSION_T *pSession,
     uint32_t    dwResLen;
 
     dwResLen = sizeof(RunInitAgentRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_STORAGE, CMD_RUN_INITIALIZATION_AGENT,
                                             (uint8_t*)pReqRunInitAgent, sizeof(RunInitAgentReq_T),
                                             (uint8_t *)pResRunInitAgent, &dwResLen,
@@ -319,7 +305,7 @@ static uint16_t ipmb_get_sdr( IPMI20_SESSION_T *pSession,
                                               int timeout )
 {
 #define IPMB_SDR_MAX_SINGLE_READ	(22)	//32 bytes - ipmb message header - response header - checksum2
-	uint8_t offset = (u8)0;
+	uint8_t offset = (uint8_t)0;
 	uint8_t remaining_bytes;
 	uint8_t bytes_to_read;
 	uint32_t dwRetLen;
@@ -383,7 +369,7 @@ static uint16_t ipmb_get_sdr( IPMI20_SESSION_T *pSession,
 	return LIBIPMI_E_SUCCESS;	
 }
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetSDR( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetSDR( IPMI20_SESSION_T *pSession,
                                               uint16_t reservation_id,
                                               uint16_t record_id,
 					      GetSDRRes_T *pGetSDRRes,
@@ -393,15 +379,15 @@ LIBIPMI_API uint16_t LIBIPMI_HL_GetSDR( IPMI20_SESSION_T *pSession,
 	uint16_t	wRet=LIBIPMI_E_SUCCESS;
 	
 	
-	if( pSession->byMediumType == IPMB_MEDIUM )
-	{
-		wRet = ipmb_get_sdr(pSession, reservation_id, 
-					record_id,
-					pGetSDRRes,
-					dwDataLen,
-					timeout );
-	}
-	else
+	// if( pSession->byMediumType == IPMB_MEDIUM )
+	// {
+	// 	wRet = ipmb_get_sdr(pSession, reservation_id, 
+	// 				record_id,
+	// 				pGetSDRRes,
+	// 				dwDataLen,
+	// 				timeout );
+	// }
+	// else
 	{
 		GetSDRReq_T get_sdr_req;
 			
@@ -416,7 +402,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_GetSDR( IPMI20_SESSION_T *pSession,
 	return wRet;	
 }
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetCompleteSDR( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetCompleteSDR( IPMI20_SESSION_T *pSession,
                                               uint16_t record_id,
                                               uint16_t *next_record_id,
                                               uint8_t *sdr_buffer,
@@ -451,10 +437,10 @@ LIBIPMI_API uint16_t LIBIPMI_HL_GetCompleteSDR( IPMI20_SESSION_T *pSession,
         return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_NOMEM ) );
     
     get_sdr_res = (GetSDRRes_T *)temp_buffer;
-	if(pSession->byMediumType == NETWORK_MEDIUM_UDP_SAL)
-    {
-        blen = max_sdr_len + sizeof(GetSDRRes_T);
-    }
+	// if(pSession->byMediumType == NETWORK_MEDIUM_UDP_SAL)
+ //    {
+ //        blen = max_sdr_len + sizeof(GetSDRRes_T);
+ //    }
 
 #if 0        
     get_sdr_req.ReservationID = reservation.ReservationID;
@@ -483,7 +469,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_GetCompleteSDR( IPMI20_SESSION_T *pSession,
 }
 
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSDRs( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllSDRs( IPMI20_SESSION_T *pSession,
                                           uint8_t *sdr_buffer, size_t buffer_len,
                                           int timeout )
 {
@@ -535,7 +521,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSDRs( IPMI20_SESSION_T *pSession,
 
 int CacheGetAllSDRS(IPMI20_SESSION_T* pSession,uint8_t* sdr_buffer,uint32_t* buff_size,uint32_t* max_sdr_len,uint32_t* sdr_count);
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSDRs_Cached( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetAllSDRs_Cached( IPMI20_SESSION_T *pSession,
                                           uint8_t *sdr_buffer, 
 										  uint32_t* sdr_buff_size,
 										  uint32_t* max_sdr_len,
@@ -550,7 +536,7 @@ LIBIPMI_API uint16_t LIBIPMI_HL_GetAllSDRs_Cached( IPMI20_SESSION_T *pSession,
 	return wRet;
 }
 
-LIBIPMI_API uint16_t LIBIPMI_HL_GetSpecificSDR( IPMI20_SESSION_T *pSession,
+  uint16_t LIBIPMI_HL_GetSpecificSDR( IPMI20_SESSION_T *pSession,
                                                 uint8_t *sdr_buffer, 
                                                 uint32_t* sdr_buff_size,
                                                 int SensorNumber,

+ 405 - 418
app/goahead-5.1.0/src/libipmi/src/libipmi_sensor.c

@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include "dbgout.h"
 
 
 
@@ -28,8 +27,8 @@
 #include "libipmi_errorcodes.h"
 #include "libipmi_sensor.h"
 #include "libipmi_AppDevice.h"
-#include "libipmi_AMIOEM.h"
 #include "libipmi_storlead_OEM.h"
+#include "com_BmcType.h"
 
 #if 0
 /* A bunch of defines that SDRRecord needs.  We don't care about the actual */
@@ -41,26 +40,14 @@
 #include "SDRRecord.h"
 #endif
 
-#ifdef __GNUC__
-/** \brief gcc method for designating a packed struct */
-#define PACKED __attribute__ ((packed))
-#else
-#define PACKED
-#pragma pack( 1 )
-#endif
 
-#include "IPMI_SDRRecord.h"
+#define PACKED __attribute__ ((packed))
 
 
-#undef PACKED
-#ifndef __GNUC__
-#pragma pack( )
-#endif
+#include "com_IPMI_SDRRecord.h"
 
 
-#include "IPMI_SensorEvent.h"
-
-#include "sensor_helpers.h"
+#include "com_IPMI_SensorEvent.h"
 
 /* 35.2 Get Device SDR Info Command */
 uint16_t	IPMICMD_GetSDRInfo( IPMI20_SESSION_T *pSession,
@@ -72,7 +59,7 @@ uint16_t	IPMICMD_GetSDRInfo( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = MAX_RESPONSE_SIZE;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_DEV_SDR_INFO,
 											(uint8_t*)pReqGetSDRInfo, sizeof(uint8_t),
 											(uint8_t *)pResGetSDRInfo, &dwResLen,
@@ -82,7 +69,7 @@ uint16_t	IPMICMD_GetSDRInfo( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.3 Get Device SDR Command */
-LIBIPMI_API uint16_t	IPMICMD_GetDevSDR( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetDevSDR( IPMI20_SESSION_T *pSession,
 										GetDevSDRReq_T	*pReqDevSDR,
 										GetDevSDRRes_T	*pResDevSDR,
 										uint32_t			*pOutBuffLen,
@@ -92,7 +79,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetDevSDR( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetDevSDRRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_DEV_SDR,
 											(uint8_t*)pReqDevSDR, sizeof(GetDevSDRReq_T),
 											(uint8_t *)pResDevSDR, &dwResLen,
@@ -104,7 +91,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetDevSDR( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.4 Reserve Device SDR Repository Command */
-LIBIPMI_API uint16_t	IPMICMD_ReserveDevSDR( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_ReserveDevSDR( IPMI20_SESSION_T *pSession,
 										ReserveDevSDRRes_T *pResReserveDevSDR,
 										int timeout)
 {
@@ -113,7 +100,7 @@ LIBIPMI_API uint16_t	IPMICMD_ReserveDevSDR( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(ReserveDevSDRRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_RESERVE_DEV_SDR_REPOSITORY,
 											(uint8_t*)Req, 0,
 											(uint8_t *)pResReserveDevSDR, &dwResLen,
@@ -123,7 +110,7 @@ LIBIPMI_API uint16_t	IPMICMD_ReserveDevSDR( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.5 Get Sensor Reading Factors Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorReadingFactor( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorReadingFactor( IPMI20_SESSION_T *pSession,
 										GetSensorReadingFactorReq_T	*pReqGetSensorReadingFactor,
 										GetSensorReadingFactorRes_T *pResGetSensorReadingFactor,
 										int timeout)
@@ -132,7 +119,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorReadingFactor( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetSensorReadingFactorRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_READING_FACTORS,
 											(uint8_t*)pReqGetSensorReadingFactor, sizeof(GetSensorReadingFactorReq_T),
 											(uint8_t *)pResGetSensorReadingFactor, &dwResLen,
@@ -142,7 +129,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorReadingFactor( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.6 Set Sensor Hysteresis Command */
-LIBIPMI_API uint16_t	IPMICMD_SetSensorHysterisis( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_SetSensorHysterisis( IPMI20_SESSION_T *pSession,
 										SetSensorHysterisisReq_T *pReqSetSensorHysterisis,
 										SetSensorHysterisisRes_T *pResSetSensorHysterisis,
 										int timeout)
@@ -151,7 +138,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorHysterisis( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(SetSensorHysterisisRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_SET_SENSOR_HYSTERISIS,
 											(uint8_t*)pReqSetSensorHysterisis, sizeof(SetSensorHysterisisReq_T),
 											(uint8_t *)pResSetSensorHysterisis, &dwResLen,
@@ -161,7 +148,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorHysterisis( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.7 Get Sensor Hysteresis Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorHysterisis( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorHysterisis( IPMI20_SESSION_T *pSession,
 										GetSensorHysterisisReq_T *pReqGetSensorHysterisis,
 										GetSensorHysterisisRes_T *pResGetSensorHysterisis,
 										int timeout)
@@ -170,7 +157,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorHysterisis( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetSensorHysterisisRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_HYSTERISIS,
 											(uint8_t*)pReqGetSensorHysterisis, sizeof(GetSensorHysterisisReq_T),
 											(uint8_t *)pResGetSensorHysterisis, &dwResLen,
@@ -180,7 +167,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorHysterisis( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.8 Set Sensor Thresholds Command */
-LIBIPMI_API uint16_t	IPMICMD_SetSensorThreshold( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_SetSensorThreshold( IPMI20_SESSION_T *pSession,
 										SetSensorThresholdReq_T *pReqSetSensorThreshold,
 										SetSensorThresholdRes_T *pResSetSensorThreshold,
 										int timeout)
@@ -189,7 +176,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorThreshold( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(SetSensorThresholdRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_SET_SENSOR_THRESHOLDS,
 											(uint8_t*)pReqSetSensorThreshold, sizeof(SetSensorThresholdReq_T),
 											(uint8_t *)pResSetSensorThreshold, &dwResLen,
@@ -199,7 +186,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorThreshold( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.9 Get Sensor Thresholds Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorThreshold( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorThreshold( IPMI20_SESSION_T *pSession,
 										GetSensorThresholdReq_T *pReqGetSensorThreshold,
 										GetSensorThresholdRes_T *pResGetSensorThreshold,
 										int timeout)
@@ -208,7 +195,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorThreshold( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetSensorThresholdRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_THRESHOLDS,
 											(uint8_t*)pReqGetSensorThreshold, sizeof(GetSensorThresholdReq_T),
 											(uint8_t *)pResGetSensorThreshold, &dwResLen,
@@ -218,7 +205,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorThreshold( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.10 Set Sensor Event Enable Command */
-LIBIPMI_API uint16_t	IPMICMD_SetSensorEventEnable( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_SetSensorEventEnable( IPMI20_SESSION_T *pSession,
 										SetSensorEventEnableReq_T *pReqSetSensorEventEnable,
 										SetSensorEventEnableRes_T *pResSetSensorEventEnable,
 										int timeout)
@@ -227,7 +214,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorEventEnable( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(SetSensorEventEnableRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_SET_SENSOR_EVENT_ENABLE,
 											(uint8_t*)pReqSetSensorEventEnable, sizeof(SetSensorEventEnableReq_T),
 											(uint8_t *)pResSetSensorEventEnable, &dwResLen,
@@ -237,7 +224,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorEventEnable( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.11 Get Sensor Event Enable Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorEventEnable( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorEventEnable( IPMI20_SESSION_T *pSession,
 										GetSensorEventEnableReq_T *pReqGetSensorEventEnable,
 										GetSensorEventEnableRes_T *pResGetSensorEventEnable,
 										int timeout)
@@ -246,7 +233,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorEventEnable( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetSensorEventEnableRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_EVENT_ENABLE,
 											(uint8_t*)pReqGetSensorEventEnable, sizeof(GetSensorEventEnableReq_T),
 											(uint8_t *)pResGetSensorEventEnable, &dwResLen,
@@ -257,7 +244,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorEventEnable( IPMI20_SESSION_T *pSession,
 
 
 /* 35.12 ReArm Sensor Events Command */
-LIBIPMI_API uint16_t	IPMICMD_ReArmSensorEvents( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_ReArmSensorEvents( IPMI20_SESSION_T *pSession,
 										ReArmSensorReq_T *pReArmSensorReq,
 										ReArmSensorRes_T *pReArmSensorRes,
 										int timeout)
@@ -266,7 +253,7 @@ LIBIPMI_API uint16_t	IPMICMD_ReArmSensorEvents( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(ReArmSensorRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_REARM_SENSOR_EVENTS,
 											(uint8_t*)pReArmSensorReq, sizeof(ReArmSensorReq_T),
 											(uint8_t *)pReArmSensorRes, &dwResLen,
@@ -277,7 +264,7 @@ LIBIPMI_API uint16_t	IPMICMD_ReArmSensorEvents( IPMI20_SESSION_T *pSession,
 
 
 /* 35.13 Get Sensor Event Status Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorEventStatus( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorEventStatus( IPMI20_SESSION_T *pSession,
 										GetSensorEventStatusReq_T *pReqGetSensorEventStatus,
 										GetSensorEventStatusRes_T *pResGetSensorEventStatus,
 										int timeout)
@@ -286,7 +273,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorEventStatus( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetSensorEventStatusRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_EVENT_STATUS,
 											(uint8_t*)pReqGetSensorEventStatus, sizeof(GetSensorEventEnableReq_T),
 											(uint8_t *)pResGetSensorEventStatus, &dwResLen,
@@ -296,7 +283,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorEventStatus( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.14 Get Sensor Reading Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorReading( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorReading( IPMI20_SESSION_T *pSession,
 										GetSensorReadingReq_T *pReqGetSensorReading,
 										GetSensorReadingRes_T *pResGetSensorReading,
 										int timeout)
@@ -305,7 +292,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorReading( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetSensorReadingRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_READING,
 											(uint8_t*)pReqGetSensorReading, sizeof(GetSensorReadingReq_T),
 											(uint8_t *)pResGetSensorReading, &dwResLen,
@@ -315,7 +302,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorReading( IPMI20_SESSION_T *pSession,
 }
 
 /* 35.15 Set Sensor Type Command */
-LIBIPMI_API uint16_t	IPMICMD_SetSensorType( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_SetSensorType( IPMI20_SESSION_T *pSession,
 										SetSensorTypeReq_T *pReqSetSensorType,
 										SetSensorTypeRes_T *pResSetSensorType,
 										int timeout)
@@ -324,7 +311,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorType( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(SetSensorTypeRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_READING,
 											(uint8_t*)pReqSetSensorType, sizeof(SetSensorTypeReq_T),
 											(uint8_t *)pResSetSensorType, &dwResLen,
@@ -335,7 +322,7 @@ LIBIPMI_API uint16_t	IPMICMD_SetSensorType( IPMI20_SESSION_T *pSession,
 
 
 /* 35.16 Get Sensor Type Command */
-LIBIPMI_API uint16_t	IPMICMD_GetSensorType( IPMI20_SESSION_T *pSession,
+  uint16_t	IPMICMD_GetSensorType( IPMI20_SESSION_T *pSession,
 										GetSensorTypeReq_T *pReqGetSensorType,
 										GetSensorTypeRes_T *pResGetSensorType,
 										int timeout)
@@ -344,7 +331,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorType( IPMI20_SESSION_T *pSession,
 	uint32_t	dwResLen;
 
 	dwResLen = sizeof(GetSensorTypeRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_READING,
 											(uint8_t*)pReqGetSensorType, sizeof(GetSensorTypeReq_T),
 											(uint8_t *)pResGetSensorType, &dwResLen,
@@ -352,7 +339,7 @@ LIBIPMI_API uint16_t	IPMICMD_GetSensorType( IPMI20_SESSION_T *pSession,
 
 	return wRet;
 }
-LIBIPMI_API uint16_t IPMICMD_SetSensorReading( IPMI20_SESSION_T *pSession,
+  uint16_t IPMICMD_SetSensorReading( IPMI20_SESSION_T *pSession,
                                             SetSensorReadingReq_T *pReqSetSensorReading,
                                             SetSensorReadingRes_T *pResSetSensorReading,
                                             int timeout)
@@ -361,7 +348,7 @@ LIBIPMI_API uint16_t IPMICMD_SetSensorReading( IPMI20_SESSION_T *pSession,
     uint32_t	dwResLen;
 
     dwResLen = sizeof(SetSensorReadingRes_T);
-    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+    wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
                                             NETFNLUN_IPMI_SENSOR,CMD_SET_SENSOR_READING,
                                             (uint8_t*)pReqSetSensorReading, sizeof(SetSensorReadingReq_T),
                                             (uint8_t *)pResSetSensorReading , &dwResLen,
@@ -373,258 +360,258 @@ LIBIPMI_API uint16_t IPMICMD_SetSensorReading( IPMI20_SESSION_T *pSession,
 
 
 /* ------------------ High level functions ------------------ */
-#define SDR_FILE_PATH   "/tmp/sdr_data"
+//#define SDR_FILE_PATH   "/tmp/sdr_data"
 
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_ReadSensorFromSDR( IPMI20_SESSION_T *pSession, uint8_t *sdr_buffer,
 							  uint8_t *raw_reading, float *reading,
 							  uint8_t *discrete, int timeout )
 {
-    SDRRecHdr_T *header = (SDRRecHdr_T *)sdr_buffer;
-    BOOL SendMsg= FALSE;
-    GetSensorReadingReq_T get_reading_req;
-    GetSensorReadingRes_T get_reading_res;
-    AMIGetChNumRes_T pAMIGetChNumRes;	
-    uint8_t SendMsgReq[5]; 
-    uint32_t SendMsgReqLen = 0;
-    uint8_t record_type;
-    uint16_t wRet;
-
-    *discrete = (u8)0;
-
-    record_type = header->Type;
-	if( record_type == 0x01 )
-    {
-        FullSensorRec_T *record;
-
-        /* Determine if sensor is discrete, and pull out the sensor number */
-        record = (FullSensorRec_T *)sdr_buffer;
-        if( record->EventTypeCode > 0x01 )
-            *discrete = record->EventTypeCode;
-        if(record->OwnerID != 0x20)
-        {
-            wRet = IPMICMD_AMIGetChNum (pSession,&pAMIGetChNumRes,
-                                                                    timeout);
-            SendMsg = TRUE;
-            SendMsgReq[0] = 0x40 | pAMIGetChNumRes.ChannelNum;
-            SendMsgReq[1] = record->OwnerID;
-            SendMsgReq[2] = NETFN_SENSOR;
-            SendMsgReq[3] = CMD_GET_SENSOR_READING;
-            SendMsgReq[4] = record->SensorNum;
-            SendMsgReqLen = 5;
-        }
-        else
-        {
-            get_reading_req.SensorNum = record->SensorNum;
-        }        
-    }
-    else if( record_type == 0x02 )
-    {
-        CompactSensorRec_T *record;
-
-        /* Determine if sensor is discrete, and pull out the sensor number */
-        record = (CompactSensorRec_T *)sdr_buffer;
-        if( record->EventTypeCode > 0x01 )
-            *discrete = record->EventTypeCode;
-        if(record->OwnerID != 0x20)
-        {
-            wRet = IPMICMD_AMIGetChNum (pSession,&pAMIGetChNumRes,
-                                                                    timeout);        
-            SendMsg = TRUE;
-            SendMsgReq[0] = 0x40 | pAMIGetChNumRes.ChannelNum;
-            SendMsgReq[1] = record->OwnerID;
-            SendMsgReq[2] = NETFN_SENSOR;
-            SendMsgReq[3] = CMD_GET_SENSOR_READING;
-            SendMsgReq[4] = record->SensorNum;
-            SendMsgReqLen = 5;
-        }
-        else
-        {
-            get_reading_req.SensorNum = record->SensorNum;
-        }       
-    }
-    else
-    {
-        /* We only know how to read sensors with records */
-        /* of type full or compact                       */
-        return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_INVALID_SDR_ENTRY ) );
-    }
+ //    SDRRecHdr_T *header = (SDRRecHdr_T *)sdr_buffer;
+ //    uint8_t SendMsg= FALSE;
+ //    GetSensorReadingReq_T get_reading_req;
+ //    GetSensorReadingRes_T get_reading_res;
+ //    AMIGetChNumRes_T pAMIGetChNumRes;	
+ //    uint8_t SendMsgReq[5]; 
+ //    uint32_t SendMsgReqLen = 0;
+ //    uint8_t record_type;
+ //    uint16_t wRet;
+
+ //    *discrete = (u8)0;
+
+ //    record_type = header->Type;
+	// if( record_type == 0x01 )
+ //    {
+ //        FullSensorRec_T *record;
+
+ //        /* Determine if sensor is discrete, and pull out the sensor number */
+ //        record = (FullSensorRec_T *)sdr_buffer;
+ //        if( record->EventTypeCode > 0x01 )
+ //            *discrete = record->EventTypeCode;
+ //        if(record->OwnerID != 0x20)
+ //        {
+ //            wRet = IPMICMD_AMIGetChNum (pSession,&pAMIGetChNumRes,
+ //                                                                    timeout);
+ //            SendMsg = TRUE;
+ //            SendMsgReq[0] = 0x40 | pAMIGetChNumRes.ChannelNum;
+ //            SendMsgReq[1] = record->OwnerID;
+ //            SendMsgReq[2] = NETFN_SENSOR;
+ //            SendMsgReq[3] = CMD_GET_SENSOR_READING;
+ //            SendMsgReq[4] = record->SensorNum;
+ //            SendMsgReqLen = 5;
+ //        }
+ //        else
+ //        {
+ //            get_reading_req.SensorNum = record->SensorNum;
+ //        }        
+ //    }
+ //    else if( record_type == 0x02 )
+ //    {
+ //        CompactSensorRec_T *record;
+
+ //        /* Determine if sensor is discrete, and pull out the sensor number */
+ //        record = (CompactSensorRec_T *)sdr_buffer;
+ //        if( record->EventTypeCode > 0x01 )
+ //            *discrete = record->EventTypeCode;
+ //        if(record->OwnerID != 0x20)
+ //        {
+ //            wRet = IPMICMD_AMIGetChNum (pSession,&pAMIGetChNumRes,
+ //                                                                    timeout);        
+ //            SendMsg = TRUE;
+ //            SendMsgReq[0] = 0x40 | pAMIGetChNumRes.ChannelNum;
+ //            SendMsgReq[1] = record->OwnerID;
+ //            SendMsgReq[2] = NETFN_SENSOR;
+ //            SendMsgReq[3] = CMD_GET_SENSOR_READING;
+ //            SendMsgReq[4] = record->SensorNum;
+ //            SendMsgReqLen = 5;
+ //        }
+ //        else
+ //        {
+ //            get_reading_req.SensorNum = record->SensorNum;
+ //        }       
+ //    }
+ //    else
+ //    {
+ //        /* We only know how to read sensors with records */
+ //        /* of type full or compact                       */
+ //        return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_INVALID_SDR_ENTRY ) );
+ //    }
      
-    if(SendMsg == TRUE)
-    {
-        /*SendMessage Command to Get Sensor Reading when sensor Owner ID is not 0x20 */
-        wRet = IPMICMD_SendMessage(pSession,SendMsgReq,(uint8_t *)&get_reading_res,
-                                                           SendMsgReqLen,timeout);
+ //    if(SendMsg == TRUE)
+ //    {
+ //        /*SendMessage Command to Get Sensor Reading when sensor Owner ID is not 0x20 */
+ //        wRet = IPMICMD_SendMessage(pSession,SendMsgReq,(uint8_t *)&get_reading_res,
+ //                                                           SendMsgReqLen,timeout);
         
-        if(get_reading_res.CompletionCode == CC_TIMEOUT)
-        {
-             get_reading_res.Flags &= 0x20;
-        }
-        else if( wRet != LIBIPMI_E_SUCCESS)
-        {
-            return( wRet );
-        }    
+ //        if(get_reading_res.CompletionCode == CC_TIMEOUT)
+ //        {
+ //             get_reading_res.Flags &= 0x20;
+ //        }
+ //        else if( wRet != LIBIPMI_E_SUCCESS)
+ //        {
+ //            return( wRet );
+ //        }    
         
-    }
-    else
-    {
-        /* Get the sensor reading */
-        wRet = IPMICMD_GetSensorReading( pSession, &get_reading_req,
-                                     &get_reading_res, timeout );
-        if( wRet != LIBIPMI_E_SUCCESS )
-        {
-            //printf("falied when readinf sensor no %d\n",get_reading_req.SensorNum);
-            return( wRet );
-        }
-    }
-    /* Pass the raw reading out to the caller. */
-    /* We need this for discrete sensors.      */
-    *raw_reading = get_reading_res.SensorReading;
-
-    /* If sensor scanning is disabled or the reading is unavailable... */
-    if( !( get_reading_res.Flags & 0x40 )  ||  ( get_reading_res.Flags & 0x20) )
-    {
-        /* Return an error code to let the caller know */
-        return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_SENSOR_DISABLED ) );
-    }
-
-    if( *discrete )
-    {
-        /* Pass the discrete state information back in the reading variable */
-        *reading = (float)( get_reading_res.ComparisonStatus |
-                            ( get_reading_res.OptionalStatus << 8 ) );
-    }
-    else
-    {
-        /* Convert raw sensor reading to final form */
-        ipmi_convert_reading( sdr_buffer, *raw_reading, reading );
-    }
+ //    }
+ //    else
+ //    {
+ //        /* Get the sensor reading */
+ //        wRet = IPMICMD_GetSensorReading( pSession, &get_reading_req,
+ //                                     &get_reading_res, timeout );
+ //        if( wRet != LIBIPMI_E_SUCCESS )
+ //        {
+ //            //printf("falied when readinf sensor no %d\n",get_reading_req.SensorNum);
+ //            return( wRet );
+ //        }
+ //    }
+ //    /* Pass the raw reading out to the caller. */
+ //    /* We need this for discrete sensors.      */
+ //    *raw_reading = get_reading_res.SensorReading;
+
+ //    /* If sensor scanning is disabled or the reading is unavailable... */
+ //    if( !( get_reading_res.Flags & 0x40 )  ||  ( get_reading_res.Flags & 0x20) )
+ //    {
+ //        /* Return an error code to let the caller know */
+ //        return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_SENSOR_DISABLED ) );
+ //    }
+
+ //    if( *discrete )
+ //    {
+ //        /* Pass the discrete state information back in the reading variable */
+ //        *reading = (float)( get_reading_res.ComparisonStatus |
+ //                            ( get_reading_res.OptionalStatus << 8 ) );
+ //    }
+ //    else
+ //    {
+ //        /* Convert raw sensor reading to final form */
+ //        ipmi_convert_reading( sdr_buffer, *raw_reading, reading );
+ //    }
 
     return( LIBIPMI_E_SUCCESS );
 }
 
 
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_LoadSensorSDRs( IPMI20_SESSION_T *pSession, uint8_t **sdr_buffer, 
                            int *count, int timeout )
 {
-    FILE *sdrfile;
-    uint8_t *local_sdr_buffer = NULL;
+    // FILE *sdrfile;
+    // uint8_t *local_sdr_buffer = NULL;
     
-    /* Open the SDR file */
-    sdrfile = fopen( SDR_FILE_PATH, "r" );
-    if( sdrfile == NULL )
-    {
-        /* If sdr file does not exist...    */
-        if( errno == ENOENT )
-        {
-            /* ...create it */
-            sdrfile = fopen( SDR_FILE_PATH, "w+" );
-            if( sdrfile == NULL )
-            {
-                /* Uh-oh, something bad happened. */
-                printf( "Cannot create SDR file: %s\n", strerror( errno ) );
-                return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
-            }
-
-            /* Read the SDRs from the BMC (Note: this function calls malloc) */
-            *count = read_sensor_sdrs( pSession,
-                                       (struct sensor_info **)&local_sdr_buffer,
-                                       timeout );
-            if( *count < 0 )
-            {
-                printf( "Cannot read SDRs from BMC: %s\n", strerror( errno ) );
-                fclose( sdrfile );
-                return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
-            }
-
-            /* Write the SDR data to file */
-            if( fwrite( local_sdr_buffer, (size_t)1,
-                        sizeof( struct sensor_info ) * *count, sdrfile ) < 0 )
-            {
-                printf( "Cannot write to SDR file: %s\n", strerror( errno ) );
-                fclose( sdrfile );
-                return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
-            }
-
-            fclose( sdrfile );
-        }
-        else
-        {
-            /* Uh-oh, something bad happened. */
-            printf( "Cannot open SDR file: %s\n", strerror( errno ) );
-            return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
-        }
-    }
-    else
-    {
-        int retval;
-        size_t filelen;
-
-        /* Determine the length of the file */
-        retval = fseek( sdrfile, 0, SEEK_END );
-        if( retval < 0 )
-        {
-            printf( "Cannot seek SDR file: %s\n", strerror( errno ) );
-            fclose( sdrfile );
-            return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
-        }
-        filelen = (size_t)ftell( sdrfile );
-
-        /* If the caller actually wants the sdrs... */
-        if( sdr_buffer != NULL )
-        {
-            /* Allocate some memory for 'em, and copy them in */
-            local_sdr_buffer = malloc( filelen );
-            if( local_sdr_buffer == NULL )
-            {
-                printf( "Cannot allocate memory for SDR file: %s\n", strerror( errno ) );
-                fclose( sdrfile );
-                return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_NOMEM ) );
-            }
-
-            /* Back to the beginning of the file (after seeking to the end above) */
-            retval = fseek( sdrfile, 0, SEEK_SET );
-            if( retval < 0 )
-            {
-                printf( "Cannot seek SDR file: %s\n", strerror( errno ) );
-                fclose( sdrfile );
-                free( local_sdr_buffer );
-                return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
-            }
-
-            /* Read the entire file into the buffer we allocated */
-            if( fread( local_sdr_buffer, (size_t)1, filelen, sdrfile ) != filelen )
-            {
-                printf( "Cannot read from SDR file: %s\n", strerror( errno ) );
-                fclose( sdrfile );
-                free( local_sdr_buffer );
-                return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
-            }
-        }
-
-        fclose( sdrfile );
-
-        /* Size of sensor info structs is regular, so it's easy to */
-        /* calculate the number of SDRs in the file                */
-        *count = filelen / sizeof( struct sensor_info );
-    }
-
-    /* If sdr_buffer is not null, pass a pointer to the allocated */
-    /* storage that contains the sdr data.                        */
-    if( sdr_buffer != NULL )
-        *sdr_buffer = local_sdr_buffer;
-    else
-    {
-        if( local_sdr_buffer != NULL )
-            free( local_sdr_buffer );
-    }
+    // /* Open the SDR file */
+    // sdrfile = fopen( SDR_FILE_PATH, "r" );
+    // if( sdrfile == NULL )
+    // {
+    //     /* If sdr file does not exist...    */
+    //     if( errno == ENOENT )
+    //     {
+    //         /* ...create it */
+    //         sdrfile = fopen( SDR_FILE_PATH, "w+" );
+    //         if( sdrfile == NULL )
+    //         {
+    //             /* Uh-oh, something bad happened. */
+    //             printf( "Cannot create SDR file: %s\n", strerror( errno ) );
+    //             return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
+    //         }
+
+    //         /* Read the SDRs from the BMC (Note: this function calls malloc) */
+    //         *count = read_sensor_sdrs( pSession,
+    //                                    (struct sensor_info **)&local_sdr_buffer,
+    //                                    timeout );
+    //         if( *count < 0 )
+    //         {
+    //             printf( "Cannot read SDRs from BMC: %s\n", strerror( errno ) );
+    //             fclose( sdrfile );
+    //             return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
+    //         }
+
+    //         /* Write the SDR data to file */
+    //         if( fwrite( local_sdr_buffer, (size_t)1,
+    //                     sizeof( struct sensor_info ) * *count, sdrfile ) < 0 )
+    //         {
+    //             printf( "Cannot write to SDR file: %s\n", strerror( errno ) );
+    //             fclose( sdrfile );
+    //             return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
+    //         }
+
+    //         fclose( sdrfile );
+    //     }
+    //     else
+    //     {
+    //         /* Uh-oh, something bad happened. */
+    //         printf( "Cannot open SDR file: %s\n", strerror( errno ) );
+    //         return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
+    //     }
+    // }
+    // else
+    // {
+    //     int retval;
+    //     size_t filelen;
+
+    //     /* Determine the length of the file */
+    //     retval = fseek( sdrfile, 0, SEEK_END );
+    //     if( retval < 0 )
+    //     {
+    //         printf( "Cannot seek SDR file: %s\n", strerror( errno ) );
+    //         fclose( sdrfile );
+    //         return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
+    //     }
+    //     filelen = (size_t)ftell( sdrfile );
+
+    //     /* If the caller actually wants the sdrs... */
+    //     if( sdr_buffer != NULL )
+    //     {
+    //         /* Allocate some memory for 'em, and copy them in */
+    //         local_sdr_buffer = malloc( filelen );
+    //         if( local_sdr_buffer == NULL )
+    //         {
+    //             printf( "Cannot allocate memory for SDR file: %s\n", strerror( errno ) );
+    //             fclose( sdrfile );
+    //             return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_NOMEM ) );
+    //         }
+
+    //         /* Back to the beginning of the file (after seeking to the end above) */
+    //         retval = fseek( sdrfile, 0, SEEK_SET );
+    //         if( retval < 0 )
+    //         {
+    //             printf( "Cannot seek SDR file: %s\n", strerror( errno ) );
+    //             fclose( sdrfile );
+    //             free( local_sdr_buffer );
+    //             return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
+    //         }
+
+    //         /* Read the entire file into the buffer we allocated */
+    //         if( fread( local_sdr_buffer, (size_t)1, filelen, sdrfile ) != filelen )
+    //         {
+    //             printf( "Cannot read from SDR file: %s\n", strerror( errno ) );
+    //             fclose( sdrfile );
+    //             free( local_sdr_buffer );
+    //             return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_FILE_ERR ) );
+    //         }
+    //     }
+
+    //     fclose( sdrfile );
+
+    //     /* Size of sensor info structs is regular, so it's easy to */
+    //     /* calculate the number of SDRs in the file                */
+    //     *count = filelen / sizeof( struct sensor_info );
+    // }
+
+    // /* If sdr_buffer is not null, pass a pointer to the allocated */
+    // /* storage that contains the sdr data.                        */
+    // if( sdr_buffer != NULL )
+    //     *sdr_buffer = local_sdr_buffer;
+    // else
+    // {
+    //     if( local_sdr_buffer != NULL )
+    //         free( local_sdr_buffer );
+    // }
 
     return( LIBIPMI_E_SUCCESS );   
 }
 
 
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_GetSensorCount( IPMI20_SESSION_T *pSession, int *sdr_count, int timeout )
 {
     uint16_t wRet;
@@ -644,7 +631,7 @@ LIBIPMI_HL_GetSensorCount( IPMI20_SESSION_T *pSession, int *sdr_count, int timeo
 }
 
 #if 0
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession,
                                  struct sensor_data *sensor_list, int timeout )
 {
@@ -781,7 +768,7 @@ LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession,
 #endif
 
 
-LIBIPMI_API uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSession,
+  uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSession,
 										GetSensorReadingFactorReq_T	*pReqGetSensorReadingFactor,
 										GetSensorReadingFactorRes_T *pResGetSensorReadingFactor,
 										uint32_t* nNumSensor,
@@ -792,7 +779,7 @@ LIBIPMI_API uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSess
 
 	dwResLen = sizeof(GetSensorReadingFactorRes_T);
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, 
-		                                    PAYLOAD_TYPE_IPMI,
+		                                     
 											NETFNLUN_IPMI_SENSOR, 
 											CMD_GET_SENSOR_READING_FACTORS,
 											(uint8_t*)pReqGetSensorReadingFactor, 
@@ -803,7 +790,7 @@ LIBIPMI_API uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSess
 	
 #if 0
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,
-	                    PAYLOAD_TYPE_IPMI,
+	                     
 						NetFnLunBladeSts, 
 						CMD_GET_BLADE_STS,
 						(uint8_t*)&ReqData, 
@@ -816,7 +803,7 @@ LIBIPMI_API uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSess
 	uint32_t	dwResLen;
 	
 	dwResLen = sizeof(GetSensorReadingFactorRes_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 											NETFNLUN_IPMI_SENSOR, CMD_GET_SENSOR_READING_FACTORS,
 											(uint8_t*)pReqGetSensorReadingFactor, 
 											sizeof(GetSensorReadingFactorReq_T),
@@ -828,7 +815,7 @@ LIBIPMI_API uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSess
 }
 
 //
-//LIBIPMI_API uint16_t LIBIPMI_HL_GetSensorHistoryReadingData( IPMI20_SESSION_T *pSession,            SensorhistoryData_T *pHistoryData, uint8_t nNumSensor, int timeout)
+//  uint16_t LIBIPMI_HL_GetSensorHistoryReadingData( IPMI20_SESSION_T *pSession,            SensorhistoryData_T *pHistoryData, uint8_t nNumSensor, int timeout)
 //{
 //	uint8_t	nReq;
 //	uint16_t	wRet;
@@ -839,7 +826,7 @@ LIBIPMI_API uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSess
 //	printf("LIBIPMI_HL_GetSensorHistoryReadingData: nReq=%d\n",nReq);
 //	dwResLen = sizeof(SensorhistoryData_T);
 //	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, 
-//		                                    PAYLOAD_TYPE_IPMI,
+//		                                     
 //										    NETFN_OEM<<2,  
 //										    0x0A,
 //										    (uint8_t*)&nReq, 
@@ -865,143 +852,143 @@ LIBIPMI_API uint16_t	LIBIPMI_HL_GetSensorReadingFactors( IPMI20_SESSION_T *pSess
  * @return proper completion code on success
  */
 
-LIBIPMI_API uint16_t
+  uint16_t
 LIBIPMI_HL_GetAllSensorReadings( IPMI20_SESSION_T *pSession,          struct sensor_data *sensor_list, uint32_t* nNumSensor, int timeout )
 {
     uint16_t wRet;
-    int sdr_count;
-    int i ;
-    SenInfo_T * pSensorBuff = NULL;
-    unsigned char* pSensor = NULL;
-
-    /* Load the SDRs related to sensors into memory */
-    wRet = LIBIPMI_HL_GetSensorCount( pSession,&sdr_count, timeout );
-    if( wRet != LIBIPMI_E_SUCCESS )
-    {
-        printf( "Cannot load sensor SDRs\n" );
-        return( wRet );
-    }
-
-    pSensorBuff = (SenInfo_T*) malloc(sdr_count* sizeof(SenInfo_T));
-    if(pSensorBuff == NULL)
-    {
-        printf("Error in Allocating the Memory\n");
-        return -1;
-    }
-    pSensor = (unsigned char *)pSensorBuff;
-
-    if(pSession->byMediumType == 5)	//IPMB
-    {
-    	wRet = LIBIPMI_HL_GetIPMCSensorInfo(pSession, pSensorBuff, nNumSensor, timeout);
-		if ( wRet != LIBIPMI_E_SUCCESS )
-		{
-			free(pSensorBuff);
-			if( wRet == LIBIPMI_E_SENSOR_INFO_EMPTY)
-			{
-				TINFO("Sensor Info is empty\n");
-			}
-			else
-			{
-				printf("Error in getting sensor info\n");
-			}
-			return (wRet);
-		}
-    }
-    else
-    {
-    	wRet = LIBIPMI_HL_AMIGetSensorInfo(pSession, pSensorBuff, nNumSensor, timeout);
-		if ( wRet != LIBIPMI_E_SUCCESS )
-		{
-			free(pSensorBuff);
-			if( wRet == LIBIPMI_E_SENSOR_INFO_EMPTY)
-			{
-				TINFO("Sensor Info is empty\n");
-			}
-			else
-			{
-				printf("Error in getting sensor info\n");
-			}
-			return (wRet);
-		}
-    }
-
-    for(i = 0; i < *nNumSensor; i++)
-    {
-        sensor_list[ i ].sensor_num = pSensorBuff->SensorNumber;
-        sensor_list[ i ].owner_id = pSensorBuff->OwnerID;
-        sensor_list[ i ].owner_lun = pSensorBuff->OwnerLUN;
-        sensor_list[ i ].sensor_type = pSensorBuff->SensorTypeCode;
-        sensor_list[ i ].sensor_units[ 0 ] = pSensorBuff->Units1;
-        sensor_list[ i ].sensor_units[ 1 ] = pSensorBuff->Units2;
-        sensor_list[ i ].sensor_units[ 2 ] = pSensorBuff->Units3;
-        sensor_list[ i ].raw_reading = pSensorBuff->SensorReading;
-        strncpy(sensor_list[ i ].sensor_name,pSensorBuff->SensorName,MAX_ID_STR_LEN);
-        sensor_list[i].SensorAccessibleFlags = 0;
-
-        if(pSensorBuff->EventTypeCode > 1)
-        {
-            /*Updating the discrete sensor details*/
-            sensor_list[i].discrete_state = pSensorBuff->EventTypeCode;
-            sensor_list[i].sensor_state = 0;
-            sensor_list[ i ].sensor_reading = (float)(pSensorBuff->ComparisonStatus | (pSensorBuff->OptionalStatus << 8));
-        }
-        else
-        {
-            sensor_list[ i ].discrete_state = 0;
-            sensor_list[ i ].Settable_Readable_ThreshMask=pSensorBuff->Settable_Readable_ThreshMask;
+  //   int sdr_count;
+  //   int i ;
+  //   SenInfo_T * pSensorBuff = NULL;
+  //   unsigned char* pSensor = NULL;
+
+  //   /* Load the SDRs related to sensors into memory */
+  //   wRet = LIBIPMI_HL_GetSensorCount( pSession,&sdr_count, timeout );
+  //   if( wRet != LIBIPMI_E_SUCCESS )
+  //   {
+  //       printf( "Cannot load sensor SDRs\n" );
+  //       return( wRet );
+  //   }
+
+  //   pSensorBuff = (SenInfo_T*) malloc(sdr_count* sizeof(SenInfo_T));
+  //   if(pSensorBuff == NULL)
+  //   {
+  //       printf("Error in Allocating the Memory\n");
+  //       return -1;
+  //   }
+  //   pSensor = (unsigned char *)pSensorBuff;
+
+  //   if(pSession->byMediumType == 5)	//IPMB
+  //   {
+  //   	wRet = LIBIPMI_HL_GetIPMCSensorInfo(pSession, pSensorBuff, nNumSensor, timeout);
+		// if ( wRet != LIBIPMI_E_SUCCESS )
+		// {
+		// 	free(pSensorBuff);
+		// 	if( wRet == LIBIPMI_E_SENSOR_INFO_EMPTY)
+		// 	{
+		// 		TINFO("Sensor Info is empty\n");
+		// 	}
+		// 	else
+		// 	{
+		// 		printf("Error in getting sensor info\n");
+		// 	}
+		// 	return (wRet);
+		// }
+  //   }
+  //   else
+  //   {
+  //   	wRet = LIBIPMI_HL_AMIGetSensorInfo(pSession, pSensorBuff, nNumSensor, timeout);
+		// if ( wRet != LIBIPMI_E_SUCCESS )
+		// {
+		// 	free(pSensorBuff);
+		// 	if( wRet == LIBIPMI_E_SENSOR_INFO_EMPTY)
+		// 	{
+		// 		TINFO("Sensor Info is empty\n");
+		// 	}
+		// 	else
+		// 	{
+		// 		printf("Error in getting sensor info\n");
+		// 	}
+		// 	return (wRet);
+		// }
+  //   }
+
+  //   for(i = 0; i < *nNumSensor; i++)
+  //   {
+  //       sensor_list[ i ].sensor_num = pSensorBuff->SensorNumber;
+  //       sensor_list[ i ].owner_id = pSensorBuff->OwnerID;
+  //       sensor_list[ i ].owner_lun = pSensorBuff->OwnerLUN;
+  //       sensor_list[ i ].sensor_type = pSensorBuff->SensorTypeCode;
+  //       sensor_list[ i ].sensor_units[ 0 ] = pSensorBuff->Units1;
+  //       sensor_list[ i ].sensor_units[ 1 ] = pSensorBuff->Units2;
+  //       sensor_list[ i ].sensor_units[ 2 ] = pSensorBuff->Units3;
+  //       sensor_list[ i ].raw_reading = pSensorBuff->SensorReading;
+  //       strncpy(sensor_list[ i ].sensor_name,pSensorBuff->SensorName,MAX_ID_STR_LEN);
+  //       sensor_list[i].SensorAccessibleFlags = 0;
+
+  //       if(pSensorBuff->EventTypeCode > 1)
+  //       {
+  //           /*Updating the discrete sensor details*/
+  //           sensor_list[i].discrete_state = pSensorBuff->EventTypeCode;
+  //           sensor_list[i].sensor_state = 0;
+  //           sensor_list[ i ].sensor_reading = (float)(pSensorBuff->ComparisonStatus | (pSensorBuff->OptionalStatus << 8));
+  //       }
+  //       else
+  //       {
+  //           sensor_list[ i ].discrete_state = 0;
+  //           sensor_list[ i ].Settable_Readable_ThreshMask=pSensorBuff->Settable_Readable_ThreshMask;
             
-            if(pSensorBuff->SensorReading>0)
-            /*Convert Sensor Reading*/
-            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->SensorReading, &sensor_list[i].sensor_reading, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-            /*Convert LowerNonRecoverable*/
-            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT2)
-            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonRecoverable, &sensor_list[i].low_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-            /*Convert LowerCritical*/
-            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT1)
-            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerCritical, &sensor_list[i].low_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-            /*Convert LowerNonCritical*/
-            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT0)
-            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonCritical, &sensor_list[i].low_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-            /*Convert UpperNonCritical*/
-            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT3)
-            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonCritical, &sensor_list[i].high_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-            /*Convert UpperCritical*/
-            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT4)
-            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperCritical, &sensor_list[i].high_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-            /*Convert UpperNonRecoverable*/
-            if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT5)
-            ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonRecoverable, &sensor_list[i].high_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
-                                    pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
-
-            /*Get the Sensor state*/
-            SensorState(pSensorBuff->SensorReading,&sensor_list[i].sensor_state,pSensorBuff->hdr.Type,pSensorBuff->Linearization,pSensorBuff->Units1,pSensorBuff->EventTypeCode,pSensorBuff->AssertionEventByte1,pSensorBuff->AssertionEventByte2,pSensorBuff->DeassertionEventByte1,pSensorBuff->DeassertionEventByte2);
-
-        }
-
-        /* If sensor scanning is disabled or the reading is unavailable... */
-        if( !( pSensorBuff->Flags & SENSOR_SCANNING_BIT)  || (pSensorBuff->Flags & UNABLE_TO_READ_SENSOR) )
-        {
-            /* Return an error code to let the caller know */
-            sensor_list[i].SensorAccessibleFlags = SENSOR_NOT_AVAILABLE;
-            sensor_list[i].sensor_reading = 0;
-            sensor_list[i].discrete_state = 0;
-            sensor_list[i].raw_reading = 0;
-        }
-        pSensorBuff++;
-    }
-    free(pSensor);
+  //           if(pSensorBuff->SensorReading>0)
+  //           /*Convert Sensor Reading*/
+  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->SensorReading, &sensor_list[i].sensor_reading, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+  //           /*Convert LowerNonRecoverable*/
+  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT2)
+  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonRecoverable, &sensor_list[i].low_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+  //           /*Convert LowerCritical*/
+  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT1)
+  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerCritical, &sensor_list[i].low_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+  //           /*Convert LowerNonCritical*/
+  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT0)
+  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->LowerNonCritical, &sensor_list[i].low_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+  //           /*Convert UpperNonCritical*/
+  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT3)
+  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonCritical, &sensor_list[i].high_non_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+  //           /*Convert UpperCritical*/
+  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT4)
+  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperCritical, &sensor_list[i].high_crit_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+  //           /*Convert UpperNonRecoverable*/
+  //           if(sensor_list[ i ].Settable_Readable_ThreshMask & BIT5)
+  //           ipmi_conv_reading(pSensorBuff->hdr.Type,pSensorBuff->UpperNonRecoverable, &sensor_list[i].high_non_recov_thresh, pSensorBuff->MinReading, pSensorBuff->MaxReading, pSensorBuff->Units1, 
+  //                                   pSensorBuff->Linearization, pSensorBuff->M_LSB, pSensorBuff->B_LSB, pSensorBuff->M_MSB_Tolerance, pSensorBuff->B_MSB_Accuracy,pSensorBuff->RExp_BExp);
+
+  //           /*Get the Sensor state*/
+  //           SensorState(pSensorBuff->SensorReading,&sensor_list[i].sensor_state,pSensorBuff->hdr.Type,pSensorBuff->Linearization,pSensorBuff->Units1,pSensorBuff->EventTypeCode,pSensorBuff->AssertionEventByte1,pSensorBuff->AssertionEventByte2,pSensorBuff->DeassertionEventByte1,pSensorBuff->DeassertionEventByte2);
+
+  //       }
+
+  //       /* If sensor scanning is disabled or the reading is unavailable... */
+  //       if( !( pSensorBuff->Flags & SENSOR_SCANNING_BIT)  || (pSensorBuff->Flags & UNABLE_TO_READ_SENSOR) )
+  //       {
+  //           /* Return an error code to let the caller know */
+  //           sensor_list[i].SensorAccessibleFlags = SENSOR_NOT_AVAILABLE;
+  //           sensor_list[i].sensor_reading = 0;
+  //           sensor_list[i].discrete_state = 0;
+  //           sensor_list[i].raw_reading = 0;
+  //       }
+  //       pSensorBuff++;
+  //   }
+  //   free(pSensor);
     return wRet ;
 }
 

+ 1 - 2
app/goahead-5.1.0/src/libipmi/src/libipmi_session.c

@@ -23,7 +23,6 @@
 #include "com_IPMI_AppDevice.h"
 #include "com_IPMIDefs.h"
 #define MAX_RETRIES	10
-#define MAX_USERS 16
 //void *dl_salhandler = NULL;  //This handler will be used by SAL layer.
 void DeallocateMemory(IPMI20_SESSION_T *pSession);
 
@@ -214,7 +213,7 @@ int LIBIPMI_GetUserIDForUserName(IPMI20_SESSION_T *pSession, char *UserName, cha
 	int retval = 0;
 	*UserID = 0;
 
-	for(Index = 1; Index <= MAX_USERS; Index++)
+	for(Index = 1; Index <= MAX_USER_NUM; Index++)
 	{
 		memset(IPMI_Username, 0, MAX_USERNAME_LEN);
 		retval = GetUserNameForUserID(pSession, Index, IPMI_Username, timeout);

+ 102 - 124
app/goahead-5.1.0/src/libipmi/src/libipmi_storlead_OEM.c

@@ -7,35 +7,13 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "dbgout.h"
 #include "libipmi_AppDevice.h"
-#include "libipmi_AMIOEM.h"
 #include "libipmi_session.h"
 #include "libipmi_errorcodes.h"
 #include "libipmi_struct.h"
-#include "IPMI_AMIDevice.h"
-#include "std_macros.h"
-#include "IPMI_AMISmtp.h"
-#include "AMIDevice.h"
-#include "IPMI_AMIResetPass.h"
-#include "IPMI_AMIConf.h"
-#include "ncml.h"
-#include "AMIRestoreDefaults.h"
-#include "libipmi_StorDevice.h"
-#include "SELRecord.h"
-#include "SEL.h"
-#include "IPMI_SEL.h"
-#if LIBIPMI_IS_OS_LINUX()
-#include <time.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include "pam_helper.h"
-#endif
-#include "coreTypes.h"
 #include "libipmi_sdr.h"
 #include "libipmi_sensor.h"
 #include "libipmi_storlead_OEM.h"
-#include "sensor_helpers.h"
 
 
 OemWebFlags_T g_OemWebFlags;
@@ -150,17 +128,17 @@ uint16_t IPMICMD_GetIPMCSensorInfo(IPMI20_SESSION_T *pSession, AMIGetSensorInfoR
 				}
 				else if((SensorInfo.Units1 & 0xc0) == 0x80)	//2's complement
 				{
-					if((int8)SensorInfo.SensorReading > (int8)SensorInfo.UpperCritical)
+					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperCritical)
 						SensorInfo.AssertionEventByte2 |= 0x02;
-					if((int8)SensorInfo.SensorReading > (int8)SensorInfo.UpperNonCritical)
+					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperNonCritical)
 						SensorInfo.AssertionEventByte1 |= 0x80;
-					if((int8)SensorInfo.SensorReading > (int8)SensorInfo.UpperNonRecoverable)
+					if((char)SensorInfo.SensorReading > (char)SensorInfo.UpperNonRecoverable)
 						SensorInfo.AssertionEventByte2 |= 0x08;
-					if((int8)SensorInfo.SensorReading < (int8)SensorInfo.LowerCritical)
+					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerCritical)
 						SensorInfo.AssertionEventByte1 |= 0x04;
-					if((int8)SensorInfo.SensorReading < (int8)SensorInfo.LowerNonCritical)
+					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerNonCritical)
 						SensorInfo.AssertionEventByte1 |= 0x01;
-					if((int8)SensorInfo.SensorReading < (int8)SensorInfo.LowerNonRecoverable)
+					if((char)SensorInfo.SensorReading < (char)SensorInfo.LowerNonRecoverable)
 						SensorInfo.AssertionEventByte1 |= 0x10;
 				}
 				
@@ -243,7 +221,7 @@ uint16_t LIBIPMI_HL_FanCtrol( IPMI20_SESSION_T *pSession, uint8_t fanIndex, uint
 	Req[0]	= fanIndex;
 	Req[1] 	= fanMode;
 	Req[2]	= fanLevel;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x87,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x87,
 													(uint8_t*)Req, 3,
 													(uint8_t *)Res, &dwResLen,
 													timeout);
@@ -255,7 +233,7 @@ int LIBIPMI_HL_GetFanStatus( IPMI20_SESSION_T *pSession, uint8_t fanIndex, OemFa
 	uint16_t wRet = 0;
 	uint8_t	Res[32];
 	uint32_t dwResLen;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x86,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x86,
 														(uint8_t*)&fanIndex, 1,
 														(uint8_t *)Res, &dwResLen,
 														timeout);
@@ -300,7 +278,7 @@ uint16_t LIBIPMI_HL_GetExtraInfo( IPMI20_SESSION_T *pSession, ExtraInfo_T *extra
 		Req[2] = 0;
 		Req[3] = (MAX_TITLE_LEN>>8)&0xff;	//max title len
 		Req[4] = MAX_TITLE_LEN&0xff;
-		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x83,
+		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x83,
 																(uint8_t*)Req, 5,
 																(uint8_t *)Res, &dwResLen,
 																timeout);
@@ -319,7 +297,7 @@ uint16_t LIBIPMI_HL_GetExtraInfo( IPMI20_SESSION_T *pSession, ExtraInfo_T *extra
 		Req[2] = 0;
 		Req[3] = (MAX_TEXT_LEN>>8)&0xff;	//max text len
 		Req[4] = MAX_TEXT_LEN&0xff;
-		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x83,
+		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x83,
 																(uint8_t*)Req, 5,
 																(uint8_t *)Res, &dwResLen,
 																timeout);
@@ -332,63 +310,63 @@ uint16_t LIBIPMI_HL_GetExtraInfo( IPMI20_SESSION_T *pSession, ExtraInfo_T *extra
 		remainLen = (Res[3]<<8) | Res[4];
 		memcpy(extraInfo->text,&Res[5],strLen);
 	}
-	else if(pSession->byMediumType == IPMB_MEDIUM)
-	{
-		//get title
-		do{
-			Req[0] = 0;
-			Req[1] = (offset>>8)&0xff;
-			Req[2] = offset&0xff;
-			Req[3] = 0;	
-			Req[4] = 25;	//32 bytes - ipmb message header - response - checksum2
-			wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x83,
-																	(uint8_t*)Req, 5,
-																	(uint8_t *)Res, &dwResLen,
-																	timeout);
-			if((wRet != 0) || (Res[0] != 0))
-			{
-				printf("---> get Title error\n");
-				return -1;
-			}
-			strLen = (Res[1]<<8) | Res[2];
-			remainLen = (Res[3]<<8) | Res[4];
+	// else if(pSession->byMediumType == IPMB_MEDIUM)
+	// {
+	// 	//get title
+	// 	do{
+	// 		Req[0] = 0;
+	// 		Req[1] = (offset>>8)&0xff;
+	// 		Req[2] = offset&0xff;
+	// 		Req[3] = 0;	
+	// 		Req[4] = 25;	//32 bytes - ipmb message header - response - checksum2
+	// 		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x83,
+	// 																(uint8_t*)Req, 5,
+	// 																(uint8_t *)Res, &dwResLen,
+	// 																timeout);
+	// 		if((wRet != 0) || (Res[0] != 0))
+	// 		{
+	// 			printf("---> get Title error\n");
+	// 			return -1;
+	// 		}
+	// 		strLen = (Res[1]<<8) | Res[2];
+	// 		remainLen = (Res[3]<<8) | Res[4];
 			
-			memcpy(extraInfo->title + offset,&Res[5],strLen);
-			offset += strLen;
-		}while(remainLen > 0);
+	// 		memcpy(extraInfo->title + offset,&Res[5],strLen);
+	// 		offset += strLen;
+	// 	}while(remainLen > 0);
 		
-		//get text
-		offset = 0;
-		do{
+	// 	//get text
+	// 	offset = 0;
+	// 	do{
 			
-			Req[0] = 1;
-			Req[1] = (offset>>8)&0xff;
-			Req[2] = offset&0xff;
-			Req[3] = 0;	
-			Req[4] = 20;	//32 bytes - ipmb message header - response header - checksum2
-			wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x83,
-																	(uint8_t*)Req, 5,
-																	(uint8_t *)Res, &dwResLen,
-																	timeout);
-			if((wRet != 0) || (Res[0] != 0))
-			{
-				printf("---> get Text error\n");
-				return -1;
-			}
-			strLen = (Res[1]<<8) | Res[2];
-			remainLen = (Res[3]<<8) | Res[4];
+	// 		Req[0] = 1;
+	// 		Req[1] = (offset>>8)&0xff;
+	// 		Req[2] = offset&0xff;
+	// 		Req[3] = 0;	
+	// 		Req[4] = 20;	//32 bytes - ipmb message header - response header - checksum2
+	// 		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x83,
+	// 																(uint8_t*)Req, 5,
+	// 																(uint8_t *)Res, &dwResLen,
+	// 																timeout);
+	// 		if((wRet != 0) || (Res[0] != 0))
+	// 		{
+	// 			printf("---> get Text error\n");
+	// 			return -1;
+	// 		}
+	// 		strLen = (Res[1]<<8) | Res[2];
+	// 		remainLen = (Res[3]<<8) | Res[4];
 			
-			memcpy(extraInfo->text + offset,&Res[5],strLen);
-			offset += strLen;
-		}while(remainLen > 0);
-	}
+	// 		memcpy(extraInfo->text + offset,&Res[5],strLen);
+	// 		offset += strLen;
+	// 	}while(remainLen > 0);
+	// }
 	
 	return 0;
 }
 
 
 
-LIBIPMI_API uint16_t
+uint16_t
 LIBIPMI_HL_GetSensorHistory( IPMI20_SESSION_T *pSession, sensor_history_st *pSensorHistory_st, int card_index, int sensor_number, int IPMB_ADDR)
 {
 	printf(">come in history\n");
@@ -407,47 +385,47 @@ LIBIPMI_HL_GetSensorHistory( IPMI20_SESSION_T *pSession, sensor_history_st *pSen
 	LIBIPMI_HL_GetSpecificSDR( pSession, (uint8_t*)&sdr_buffer, &sdr_buff_size, sensor_number, timeout );	
 	
 	//get history
-	if( pSession->byMediumType == IPMB_MEDIUM )
-	{
-		reqLen = 22;	//32 bytes - ipmb message header - response header - checksum2
-		do{
-			Req[0] = sensor_number;
-			Req[1] = (offset>>8)&0xff;
-			Req[2] = offset&0xff;
-			Req[3] = (reqLen>>8)&0xff;
-			Req[4] = reqLen&0xff;
-			wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x89,
-													(uint8_t*)Req, 5,
-													(uint8_t *)Res, &dwResLen,
-													timeout);
-			if(wRet != 0)
-			{
-				return -1;
-			}
-			resLen = (Res[1]<<8) | Res[2];
-			if(resLen > MAX_HISTORY_LEN)
-			{
-				printf("---> response length error: resLen = %#x\n", resLen);
-				return -1;
-			}
-			memcpy(&RawHistory[offset],&Res[3],resLen);
-			offset += resLen;
-			if(offset >= MAX_HISTORY_LEN)	//get all history datas
-			{
-				reqLen = 0;
-				break;
-			}
-			reqLen = ((MAX_HISTORY_LEN-offset)>22) ? 22 : (MAX_HISTORY_LEN-offset);		
-		}while(reqLen);		
-	}
-	else
+	// if( pSession->byMediumType == IPMB_MEDIUM )
+	// {
+	// 	reqLen = 22;	//32 bytes - ipmb message header - response header - checksum2
+	// 	do{
+	// 		Req[0] = sensor_number;
+	// 		Req[1] = (offset>>8)&0xff;
+	// 		Req[2] = offset&0xff;
+	// 		Req[3] = (reqLen>>8)&0xff;
+	// 		Req[4] = reqLen&0xff;
+	// 		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x89,
+	// 												(uint8_t*)Req, 5,
+	// 												(uint8_t *)Res, &dwResLen,
+	// 												timeout);
+	// 		if(wRet != 0)
+	// 		{
+	// 			return -1;
+	// 		}
+	// 		resLen = (Res[1]<<8) | Res[2];
+	// 		if(resLen > MAX_HISTORY_LEN)
+	// 		{
+	// 			printf("---> response length error: resLen = %#x\n", resLen);
+	// 			return -1;
+	// 		}
+	// 		memcpy(&RawHistory[offset],&Res[3],resLen);
+	// 		offset += resLen;
+	// 		if(offset >= MAX_HISTORY_LEN)	//get all history datas
+	// 		{
+	// 			reqLen = 0;
+	// 			break;
+	// 		}
+	// 		reqLen = ((MAX_HISTORY_LEN-offset)>22) ? 22 : (MAX_HISTORY_LEN-offset);		
+	// 	}while(reqLen);		
+	// }
+	// else
 	{
 		Req[0] = sensor_number;
 		Req[1] = 0;
 		Req[2] = 0;
 		Req[3] = (MAX_HISTORY_LEN>>8)&0xff;
 		Req[4] = MAX_HISTORY_LEN & 0xff;
-		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI, 0x2e<<2, 0x89,
+		wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,   0x2e<<2, 0x89,
 														(uint8_t*)Req, 5,
 														(uint8_t *)Res, &dwResLen,
 														timeout);
@@ -487,7 +465,7 @@ uint16_t	LIBIPMI_HL_GetAllCards(IPMI20_SESSION_T *pSession,
 	uint8_t	  ReqData = g_OemWebFlags.bladeNum;
 	
 	dwResLen = sizeof(CardStatus_T);
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 						0x2e<<2, 0x82,
 						(uint8_t*)&ReqData, (uint32_t)1,
 						(uint8_t*)pResBladeSts, &dwResLen,
@@ -504,7 +482,7 @@ int LIBIPMI_HL_GetChassisInfo(IPMI20_SESSION_T *pSession, OemChassisInfo_T* pCha
 	uint8_t pRes[10];
 	int wRet = 0;
 	uint32_t	dwResLen;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 							0x2e<<2, 0x80,
 							NULL, 0,
 							(uint8_t*)pRes,  &dwResLen,
@@ -524,7 +502,7 @@ int LIBIPMI_HL_GetBladeStatus(IPMI20_SESSION_T *pSession, OemBladeStatus_T Blade
 	int wRet = 0;
 	uint32_t	dwResLen;
 	uint8_t pRes[MAX_BLADE_NUM*sizeof(OemBladeStatus_T)+1];
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 							0x2e<<2, 0x81,
 							NULL, 0,
 							(uint8_t*)pRes,  &dwResLen,
@@ -555,7 +533,7 @@ int LIBIPMI_HL_GetIPMCCapability(IPMI20_SESSION_T *pSession, uint8_t bladeIndex,
 	}
 	else
 	{
-			wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+			wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 									0x2e<<2, 0x88,
 									NULL, 0,
 									(uint8_t*)pRes,  &dwResLen,
@@ -577,7 +555,7 @@ int LIBIPMI_HL_SetBladeManageFn(IPMI20_SESSION_T *pSession, uint8_t enable, int
 	uint8_t pRes[10];
 	
 	pReq[0] = enable;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 							0x2e<<2, 0x8a,
 							(uint8_t*)pReq,	(uint32_t)1,
 							(uint8_t*)pRes,  &dwResLen,
@@ -594,7 +572,7 @@ int LIBIPMI_HL_GetManageWebName(IPMI20_SESSION_T *pSession, char* webName, int t
 	uint32_t	dwResLen;
 	uint8_t pRes[20];
 	
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 							0x2e<<2, 0x84,
 							NULL,	0,
 							(uint8_t*)pRes,  &dwResLen,
@@ -613,7 +591,7 @@ int LIBIPMI_HL_GetFanInfo(IPMI20_SESSION_T *pSession, OemFanInfo_T* pFanInfo, in
 	uint32_t	dwResLen;
 	uint8_t pRes[10];
 	
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 							0x2e<<2, 0x85,
 							NULL,	0,
 							(uint8_t*)pRes,  &dwResLen,
@@ -631,7 +609,7 @@ int LIBIPMI_HL_GetSensorHistoryCapability(IPMI20_SESSION_T *pSession, uint8_t se
 	uint32_t	dwResLen;
 	uint8_t pRes[10];
 	
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 							0x2e<<2, 0x88,
 							(uint8_t*)&sensorNum,	1,
 							(uint8_t*)pRes,  &dwResLen,
@@ -650,7 +628,7 @@ int LIBIPMI_HL_GetSensorHistoryCapability(IPMI20_SESSION_T *pSession, uint8_t se
 // uint32_t dwResLen;
 // uint8_t pRes[10];
 // 
-// wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+// wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
 //       0x2e<<2, 0x8c,
 //       NULL, 0,
 //       (uint8_t*)pRes,  &dwResLen,
@@ -671,7 +649,7 @@ int LIBIPMI_HL_SetSensorHistoryEn(IPMI20_SESSION_T *pSession, uint8_t sensorNum,
  
  pReq[0] = sensorNum;
  pReq[1] = SensorHistoryEnable;
- wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession, PAYLOAD_TYPE_IPMI,
+ wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pSession,  
        0x2e<<2, 0x8d,
        (uint8_t*)pReq, 2,
        (uint8_t*)pRes,  &dwResLen,

+ 8 - 8
app/goahead-5.1.0/src/libipmi/src/libipmi_uds_session.c

@@ -41,7 +41,7 @@
 #include <sys/syscall.h>
 #define gettid()  syscall(SYS_gettid)
 
-#define MAX_USERS 16
+
 #define MAX_IPMI_MESSAGE_SIZE 1024   //1024
 
 
@@ -78,7 +78,7 @@
 /*This Function is used to connect UDS Client Socket*/
 int UDS_Connect(UDS_CHANNEL_T *UDSInfo,char *SocketPath)
 {
-    SOCKET client_sock;
+    int client_sock;
     struct sockaddr_un serv_addr;
 
     /* Open the socket */
@@ -133,7 +133,7 @@ uint32_t FillUDSMessagePacket(IPMI20_SESSION_T *pSession, uint8_t *Buffer,
     pUDSMsg->Cmd = byCommand;
     pUDSMsg->NetFnLUN = byNetFnLUN;
 
-    memcpy(pUDSMsg->UserName, pSession->hUDSSession->szUName, MAX_USER_NAME_LEN);
+    memcpy(pUDSMsg->UserName, pSession->hUDSSession->szUName, MAX_USERNAME_LEN);
     memcpy(pUDSMsg->IPAddr, pSession->hUDSSession->abyIPAddr, IP6_ADDR_LEN);
     printf("---> FillUDSMessagePacket log2\n");
     pUDSMsg->ProcessID = getpid();
@@ -172,7 +172,7 @@ uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSi
         /* wait for specified amount of time */
         ret = select (nDes, &rdfs, NULL, NULL, pwait_time);
         /* socket error */
-        if(ret == SOCKET_ERROR)
+        if(ret == -1)
         {
             if(errno == EINTR)
             {
@@ -201,7 +201,7 @@ uint8_t UDS_ReceiveData( UDS_CHANNEL_T *UDSInfo, char *szBuffer, uint32_t* pdwSi
                 close(UDSInfo->hSocket);
                 return LIBIPMI_MEDIUM_E_RECV_DATA_FAILURE;
             }
-            if(nBytesRecvd == SOCKET_ERROR)
+            if(nBytesRecvd == -1)
             {
                 printf("Socket Error... may be socket closure\n");
                 close(UDSInfo->hSocket);
@@ -261,7 +261,7 @@ TCPSendUDSDataSelect:
     /* wait for specified amount of time */
     ret = select (nDes, NULL, &wdfs, NULL, pwait_time);
     /* socket error */
-    if(ret == SOCKET_ERROR)
+    if(ret == -1)
     {
         if(errno == EINTR)
         {
@@ -304,7 +304,7 @@ TCPSendUDSDataSelect:
             printf("\n");
 
             /* send failure */
-            if ((nBytesSent == SOCKET_ERROR) && ((EBADF == errno) || (EPIPE == errno)))
+            if ((nBytesSent == -1) && ((EBADF == errno) || (EPIPE == errno)))
             {
                 printf("Error while sending data \n");
                 close(UDSInfo->hSocket);
@@ -501,7 +501,7 @@ uint16_t Create_IPMI20_UDS_Session(IPMI20_SESSION_T *pSession, char *pszSocketPa
         strcpy(pSession->hUDSSession->szPwd,pszPassword);
     }
 
-    if( (NULL != pUserName) && (0 != strlen(pUserName)) && (strlen(pUserName) < MAX_USER_NAME_LEN) )
+    if( (NULL != pUserName) && (0 != strlen(pUserName)) && (strlen(pUserName) < MAX_USERNAME_LEN) )
     {
         strcpy(pSession->hUDSSession->szUName, pUserName);
     }

+ 2 - 2
app/goahead-5.1.0/src/libipmi/src/libipmi_usermgmt.c

@@ -33,7 +33,7 @@ uint16_t LIBIPMI_SetUser( IPMI20_SESSION_T *pSession, char *pszUsername, uint8_t
 	uint16_t		wRet;
 	
 	
-	if(byID	>= MAX_USERS)
+	if(byID	>= MAX_USER_NUM)
 	{
 		printf("Invalid UserID\n");
 		return STATUS_CODE(0, LIBIPMI_E_INVALID_USER_ID);
@@ -72,7 +72,7 @@ uint16_t LIBIPMI_GetUser( IPMI20_SESSION_T *pSession, char *pszUsername, uint8_t
 	uint32_t		dwRetLen;
 	uint16_t		wRet;
 	
-	if(byID	>= MAX_USERS)
+	if(byID	>= MAX_USER_NUM)
 	{
 		printf("Invalid UserID\n");
 		return STATUS_CODE(0, LIBIPMI_E_INVALID_USER_ID);

+ 1064 - 0
app/goahead-5.1.0/src/libipmi/src/sensor_helpers.c

@@ -0,0 +1,1064 @@
+/*****************************************************************
+******************************************************************
+***                                                            ***
+***        (C)Copyright 2008, American Megatrends Inc.         ***
+***                                                            ***
+***                    All Rights Reserved                     ***
+***                                                            ***
+***       5555 Oakbrook Parkway, Norcross, GA 30093, USA       ***
+***                                                            ***
+***                     Phone 770.246.8600                     ***
+***                                                            ***
+******************************************************************
+******************************************************************
+******************************************************************
+* 
+* Filename: sensor_helpers.c
+*
+* Description: Helper functions for working with sensors    
+*
+* Author: Andrew McCallum
+*
+******************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <math.h>
+
+#include "com_BmcType.h"
+#include "com_IPMIDefs.h"
+#include "libipmi.h"
+
+#if 0
+/* A bunch of defines that SDRRecord needs.  We don't care about the actual */
+/* values, since we don't really use them, but I pulled these from the      */
+/* Rules.make for the IPMI stack                                            */
+#define MAX_NUM_USERS           ( 20 )
+#define NUM_USER_PER_CHANNEL    ( 10 )
+#define SDR_DEVICE_SIZE         ( 3 )
+#include "SDRRecord.h"
+#endif
+#include "com_IPMI_SDRRecord.h"
+#include "com_IPMI_SDR.h"
+#include "libipmi_sdr.h"
+
+#include "sensor_helpers.h"
+
+
+/* Raw sensor reading numeric format codes */
+#define SDR_READING_UNSIGNED    ( (uint8_t)0 )
+#define SDR_READING_1SCOMP      ( (uint8_t)1 )
+#define SDR_READING_2SCOMP      ( (uint8_t)2 )
+#define SDR_READING_NONANALOG   ( (uint8_t)3 )
+
+typedef enum { Unsigned, OnesComp, TwosComp, NonNumeric } number_type;
+
+
+static uint8_t lessthan( uint8_t x, uint8_t y, number_type format )
+{
+    int signed_x;
+    int signed_y;
+
+    switch( format )
+    {
+        case Unsigned:
+            /* Numbers are already unsigned, just compare */
+            if( x < y )
+                return( TRUE );
+            else
+                return( 0 );
+            
+            /*@-unreachable@*/
+            break;
+            /*@=unreachable@*/
+
+        case OnesComp:
+            /* Convert the numbers to 1's complement before comparing */
+            if( ( x & (uint8_t)0x80 ) != (uint8_t)0 )
+                signed_x = -( ~x & 0xff );
+            else
+                signed_x = (int)x;
+
+            if( ( y & (uint8_t)0x80 ) != (uint8_t)0 )
+                signed_y = -( ~y & 0xff );
+            else
+                signed_y = (int)y;
+
+            if( signed_x < signed_y )
+                return( TRUE );
+            else
+                return( 0 );
+            
+            /*@-unreachable@*/
+            break;
+            /*@=unreachable@*/
+
+        case TwosComp:
+            /* 2's complement signed numbers are the default, so we can */
+            /* let C do the conversion for us.                          */
+            signed_x = (int)*( (char *)&x );
+            signed_y = (int)*( (char *)&y );
+            
+            if( signed_x < signed_y )
+                return( 1 );
+            else
+                return( 0 );
+
+            /*@-unreachable@*/
+            break;
+            /*@=unreachable@*/
+
+        default:
+            printf( "Attempted numeric comparison of "
+                   "non-numeric sensor readings\n" );
+            return( 0 );
+    }
+    
+    printf( "Programmer failure in lessthan()\n" );
+    return( 1 );
+}
+
+
+static uint8_t greaterthan( uint8_t x, uint8_t y, number_type format )
+{
+    int signed_x;
+    int signed_y;
+
+    switch( format )
+    {
+        case Unsigned:
+            /* Numbers are already unsigned, just compare */
+            if( x > y )
+                return( 1 );
+            else
+                return( 0 );
+            
+            /*@-unreachable@*/
+            break;
+            /*@=unreachable@*/
+
+        case OnesComp:
+            /* Convert the numbers to 1's complement before comparing */
+            if( ( x & (uint8_t)0x80 ) != (uint8_t)0 )
+                signed_x = -( ~x & 0xff );
+            else
+                signed_x = (int)x;
+
+            if( ( y & (uint8_t)0x80 ) != (uint8_t)0 )
+                signed_y = -( ~y & 0xff );
+            else
+                signed_y = (int)y;
+
+            if( signed_x > signed_y )
+                return( 1 );
+            else
+                return( 0 );
+            
+            /*@-unreachable@*/
+            break;
+            /*@=unreachable@*/
+
+        case TwosComp:
+            /* 2's complement signed numbers are the default, so we can */
+            /* let C do the conversion for us.                          */
+            signed_x = (int)*( (char *)&x );
+            signed_y = (int)*( (char *)&y );
+            
+            if( signed_x > signed_y )
+                return( 1 );
+            else
+                return( 0 );
+
+            /*@-unreachable@*/
+            break;
+            /*@=unreachable@*/
+
+        default:
+            printf( "Attempted numeric comparison of "
+                   "non-numeric sensor readings\n" );
+            return( 0 );
+    }
+
+    printf( "Programmer failure in greaterthan()\n" );
+    return( 0 );
+}
+
+
+static float power( int base, int power )
+{
+    int i;
+    float retval = 1;
+    uint8_t invert = 0;
+
+    if( power == 0 )
+        return( (float)1 );
+
+    if( power < 0 )
+    {
+        power = -power;
+        invert = 1;
+    }
+
+    for( i = 1; i <= power; i++ )
+        retval *= base;
+
+    if( invert )
+        retval = 1/retval;
+
+    return( retval );
+}
+
+
+static int ipmi_sensor_reading_conversion( int x, uint8_t L, int M, int B,
+                                           int K1, int K2, float *y )
+{
+    switch( ( L & (uint8_t)0x7f ) )
+    {
+        case (uint8_t)0:
+            /* Essential formula: y = ( ( Mx + B * 10^K1 ) * 10^K2 ) */
+            *y = ( (float)M * x + ( (float)B * power( (int)10, (int)K1 ) ) ) * power( (int)10, (int)K2 );
+            break;
+
+        case (uint8_t)7:
+            /* Essential formula here is the same as above, but inverted.   */
+            /* This works out just fine for K2 < 0, but is likely to result */
+            /* in a fraction for K2 >= 0.  For K2 < 0, we use:              */
+            /* ( 10^-K2 / ( mx + b*10^K1 ) )                                */
+            /* and a simple rearrangement for K1 < 0.  For K2 >= 0, we just */
+            /* invert the linear formula and hope for the best.             */
+
+            /* Watch for divide by zero errors caused by SDR writers who did */
+            /* not think clearly about the values they stick in for threshold*/
+            /* values and other such foolishness.                            */
+            if( ( ( M == 0 ) || ( x == 0 ) ) && ( B == 0 ) )
+            {
+                printf( "Caught divide by zero - error in SDR. Working around...\n" );
+                *y = 0;
+                return( 0 );
+            }
+
+            if( ( K2 < 0 ) && ( K1 >= 0 ) )
+                *y = ( power( (int)10, -(int)K2 ) ) / ( (int)M * (int)x + ( (float)B * power( (int)10, (int)K1 ) ) );
+            else if( ( K2 < 0 ) && ( K1 < 0 ) )
+                *y = ( power( (int)10, -(int)K2 ) ) / ( (int)M * (int)x + ( (float)B / power( (int)10, -(int)K1 ) ) );
+            else
+                *y = 1 / ( ( (float)M * (int)x + ( (float)B * power( (int)10, (int)K1 ) ) ) * power( (int)10, (int)K2 ) );
+            break;
+
+        default:
+            printf( "Unsupported linearization %d\n", (int)( L & (uint8_t)0x7f ) );
+            *y = 0;
+            return( -1 );
+    }
+
+    return( 0 );
+}
+
+
+int extract_sdr_id( uint8_t *sdr_buffer, char *description )
+{
+    SDRRecHdr_T *header = (SDRRecHdr_T *)sdr_buffer;
+
+    /* Make sure the description always goes back null terminated */
+    *description = '\0';
+
+    /* Full and compact records are of different sizes */
+    if( header->Type == FULL_SDR_REC )
+    {
+        FullSensorRec_T *record;
+
+        record = (FullSensorRec_T *)sdr_buffer;
+    
+        /* Low 5 bits of typelengthcode is length of ID */
+        if( ( record->IDStrTypeLen & 0x1f ) != (uint8_t)0 )
+        {
+            /* High 2 bits == 11b, string is 8 bit ascii */
+            if( ( record->IDStrTypeLen >> 6 ) == (uint8_t)3 )
+            {
+                /* Copy the ID string out */
+                (void)memcpy( description, record->IDStr, (size_t)( record->IDStrTypeLen & 0x1f ) );
+
+                /* Make sure the string is null terminated */
+                description[ record->IDStrTypeLen & 0x1f ] = '\0';
+            }
+            else
+            {
+                /* Do handling of 6 bit packed ascii IDs here */
+                printf( "Handling for 6 bit packed ascii IDs unimplemented\n" );
+                return( -1 );
+            }
+        }
+    }
+    else if( header->Type == COMPACT_SDR_REC )
+    {
+        CompactSensorRec_T *record;
+
+        record = (CompactSensorRec_T *)sdr_buffer;
+
+        /* Low 5 bits of typelengthcode is length of ID */
+        if( ( record->IDStrTypeLen & 0x1f ) != (uint8_t)0 )
+        {
+            /* High 2 bits == 11b, string is 8 bit ascii */
+            if( ( record->IDStrTypeLen >> 6 ) == (uint8_t)3 )
+            {
+                /* Copy the ID string out */
+                (void)memcpy( description, record->IDStr, (size_t)( record->IDStrTypeLen & 0x1f ) );
+
+                /* Make sure the string is null terminated */
+                description[ record->IDStrTypeLen & 0x1f ] = '\0';
+            }
+            else
+            {
+                /* Do handling of 6 bit packed ascii IDs here */
+                printf( "Handling for 6 bit packed ascii IDs unimplemented\n" );
+                return( -1 );
+            }
+        }
+    }
+    
+    return( 0 );
+}
+
+
+int ipmi_convert_reading( uint8_t *sdr_buffer, uint8_t raw_reading, float *converted_reading )
+{
+    SDRRecHdr_T *header = (SDRRecHdr_T *)sdr_buffer;
+    FullSensorRec_T *record = (FullSensorRec_T *)sdr_buffer;
+    uint8_t L;
+    int M, B, K1, K2;
+    int raw_number;
+    int sensor_min, sensor_max;
+
+    if( header->Type != 0x01 )
+    {
+        /* Not enough info to convert */
+        printf( "SDRs of type 0x%02x do not provide conversion information\n",
+               (unsigned)header->Type );
+        *converted_reading = (float)raw_reading;
+        return( -1 );
+    }
+
+    /* Convert raw_reading and SensorMin/MaxReading to correct numeric */
+    /* formats before continuing                                       */
+    raw_number = (int)raw_reading;
+    sensor_min = (int)record->MinReading;
+    sensor_max = (int)record->MaxReading;
+    
+    switch( record->Units1 >> 6 )
+    {
+        case SDR_READING_UNSIGNED:
+            printf( "Sensor reading number format is unsigned\n" );
+            printf( "Sensor min: %d\n", sensor_min );
+            printf( "Sensor max: %d\n", sensor_max );
+            break;
+
+        case SDR_READING_1SCOMP:
+            /* Do 1's comp conversion */
+            if( raw_number & (uint8_t)0x80 )
+                raw_number = -( ~raw_number & 0xff );
+
+            if( sensor_min & (uint8_t)0x80 )
+                sensor_min = -( ~sensor_min & 0xff );
+
+            if( sensor_max & (uint8_t)0x80 )
+                sensor_max = -( ~sensor_max & 0xff );
+
+            printf( "Sensor reading number format is 1's complement: %d\n", raw_number );
+            printf( "Sensor min: %d\n", sensor_min );
+            printf( "Sensor max: %d\n", sensor_max );
+            break;
+
+        case SDR_READING_2SCOMP:
+            /* Do 2's comp conversion */
+            if( raw_number & (uint8_t)0x80 )
+                raw_number = -( ( ~raw_number & 0xff ) + 1 );
+
+            if( sensor_min & (uint8_t)0x80 )
+                sensor_min = -( ( ~sensor_min & 0xff ) + 1 );
+
+            if( sensor_max & (uint8_t)0x80 )
+                sensor_max = -( ( ~sensor_max & 0xff ) + 1 );
+
+            printf( "Sensor reading number format is 2's complement: %d\n", raw_number );
+            printf( "Sensor min: %d\n", sensor_min );
+            printf( "Sensor max: %d\n", sensor_max );
+            break;
+
+        case SDR_READING_NONANALOG:
+        default:
+            printf( "Sensor reading number format is non-analog!\n" );
+            /* Can't convert this one */
+            *converted_reading = (float)raw_reading;
+            return( -1 );
+    }
+
+    /* This sensor is out of bounds.  No meaningful conversion can be done */
+    /* This frequently happens when a sensor is reporting some kind of     */
+    /* error, like a fan stopped/missing.                                  */
+    if( ( raw_number < sensor_min ) || ( raw_number > sensor_max ) )
+    {
+        *converted_reading = 0;
+        return( 0 );
+    }
+
+    /* Linearization type.  Most sensors are already linear, so this is   */
+    /* zero in most cases.  If not, it specifies a way to make the sensor */
+    /* response linear.  Only linear sensors are supported now.           */
+    L = record->Linearization;
+
+    /* Convert M from split 10 bit 2s-complement to our int format */
+    M = (int)record->M;
+    if( ( record->M_Tolerance & (uint8_t)0x80 ) != (uint8_t)0 )
+    {
+        /* Number is negative */
+        M = M + ( ( (uint16_t)record->M_Tolerance & (uint16_t)0xC0 ) << 2 );
+        M = -( ( ~M & 0x1ff ) + 1 );
+    }
+    else
+    {
+        /* Number is positive */
+        M = M + ( ( (uint16_t)record->M_Tolerance & (uint16_t)0xC0 ) << 2 );
+    }
+
+    /* Convert B from split 10 bit 2s-complement to our int format */
+    B = (int)record->B;
+    if( ( record->B_Accuracy & (uint8_t)0x80 ) != (uint8_t)0 )
+    {
+        /* Number is negative */
+        B = B + ( ( (uint16_t)record->B_Accuracy & (uint16_t)0xC0 ) << 2 );
+        B = -( ( ~B & 0x1ff ) + 1 );
+    }
+    else
+    {
+        /* Number is positive */
+        B = B + ( ( (uint16_t)record->B_Accuracy & (uint16_t)0xC0 ) << 2 );
+    }
+
+    /* Convert K1 from 4 bit 2s-complement to our int format */
+    K1 = (int)( record->R_B_Exp & 0x0f );
+    if( K1 & 0x08 )
+    {
+        /* Number is negative */
+        K1 = -( ( ~K1 & 0x0f ) + 1 );
+    }
+
+    /* Convert K2 from 4 bit 2s-complement to our int format */
+    K2 = (int)( record->R_B_Exp >> 4 );
+    if( K2 & 0x08 )
+    {
+        /* Number is negative */
+        K2 = -( ( ~K2 & 0x0f ) + 1 );
+    }
+
+    return( ipmi_sensor_reading_conversion( raw_number, L, M, B, K1, K2, converted_reading ) );
+}
+
+
+int get_sdr_sensor_state( uint8_t sensor_reading, uint8_t *sdr_buffer, uint16_t *current_state )
+{
+    SDRRecHdr_T *header = (SDRRecHdr_T *)sdr_buffer;
+    number_type reading_format = Unsigned;
+    uint8_t raw_threshold;
+
+    *current_state = THRESH_UNINITIALIZED;
+
+    if( header->Type == FULL_SDR_REC )
+    {
+        FullSensorRec_T *record = (FullSensorRec_T *)sdr_buffer;
+
+        /* For inverse linear sensors, a raw reading of 0 is off the chart. */
+        /* We want a low reading, because this corresponds to what most     */
+        /* people expect for most sensors.  We usually get a raw reading of */
+        /* 0 when the device (like a fan) is not connected, and so          */
+        /* (logically), it is below low thresholds, not above high ones.    */
+        /* So, for purposes of determining our state, use 0xff for the      */
+        /* reading instead of 0.                                            */
+        if( ( record->Linearization == (uint8_t)7 ) && ( sensor_reading == (uint8_t)0 ) )
+            sensor_reading = (uint8_t)0xff;
+
+        /* Get the format of the sensor/threshold readings */
+        reading_format = (number_type)( record->Units1 >> 6 );
+
+        /* If the sensor is threshold based... */
+        if( record->EventTypeCode == 0x01 )
+        {
+            /* ...check all thresholds */
+
+            raw_threshold = record->LowerNonCritical;
+            if( lessthan( sensor_reading, raw_threshold, reading_format ) )
+                *current_state |= THRESH_LOW_NONCRIT;
+
+            raw_threshold = record->LowerCritical;
+            if( lessthan( sensor_reading, raw_threshold, reading_format ) )
+                *current_state |= THRESH_LOW_CRITICAL;
+
+            raw_threshold = record->LowerNonRecoverable;
+            if( lessthan( sensor_reading, raw_threshold, reading_format ) )
+                *current_state |= THRESH_LOW_NON_RECOV;
+
+            raw_threshold = record->UpperNonCritical;
+            if( greaterthan( sensor_reading, raw_threshold, reading_format ) )
+                *current_state |= THRESH_UP_NONCRIT;
+
+            raw_threshold = record->UpperCritical;
+            if( greaterthan( sensor_reading, raw_threshold, reading_format ) )
+                *current_state |= THRESH_UP_CRITICAL;
+
+            raw_threshold = record->UpperNonRecoverable;
+            if( greaterthan( sensor_reading, raw_threshold, reading_format ) )
+                *current_state |= THRESH_UP_NON_RECOV;
+
+            /* If no states were added,  we're normal */
+            if( *current_state == THRESH_UNINITIALIZED )
+                *current_state = THRESH_NORMAL;
+
+        } /* if sensor is threshold based */
+        else
+        {
+            /* This sensor is discrete */
+            *current_state = (uint16_t)sensor_reading;
+        }
+    }
+    else if( header->Type == COMPACT_SDR_REC )
+    {
+        CompactSensorRec_T *record = (CompactSensorRec_T *)sdr_buffer;
+
+        if( record->EventTypeCode > (uint8_t)1 )
+            *current_state = (uint16_t)sensor_reading;
+        else
+            *current_state = THRESH_UNINITIALIZED;
+    }
+    else
+    {
+        *current_state = THRESH_UNINITIALIZED;
+        return( -1 );
+    }
+
+    return( 0 );
+}
+
+int GetSensorState(IPMI20_SESSION_T *pSession, uint8_t sensor_reading, 
+	uint8_t *sdr_buffer, uint16_t *current_state, int timeout  )
+{
+	SDRRecHdr_T *header = (SDRRecHdr_T *)sdr_buffer;
+	//number_type reading_format = Unsigned;
+	int  RetVal = 0;
+       GetSensorEventStatusReq_T pReqGetSensorEventStatus;
+       GetSensorEventStatusRes_T pResGetSensorEventStatus;
+#ifdef CFG_PROJ_REARM_SENSOR
+       ReArmSensorReq_T ReArmSensorReq;
+       ReArmSensorRes_T ReArmSensorRes;
+#endif
+	//INT16U AssertionEvent = 0, DeAssertionEvent = 0;
+
+	*current_state = THRESH_UNINITIALIZED;
+
+	if( header->Type == FULL_SDR_REC )
+	{
+		FullSensorRec_T *record = (FullSensorRec_T *)sdr_buffer;
+
+		/* For inverse linear sensors, a raw reading of 0 is off the chart. */
+		/* We want a low reading, because this corresponds to what most     */
+		/* people expect for most sensors.  We usually get a raw reading of */
+		/* 0 when the device (like a fan) is not connected, and so          */
+		/* (logically), it is below low thresholds, not above high ones.    */
+		/* So, for purposes of determining our state, use 0xff for the      */
+		/* reading instead of 0.                                            */
+
+		if((record->Linearization == (uint8_t)7 ) && ( sensor_reading == (uint8_t)0))
+		{
+			sensor_reading = (uint8_t)0xff;
+		}
+
+		/* Get the format of the sensor/threshold readings */
+		//reading_format = (number_type)( record->Units1 >> 6 );
+
+		/*Threshold EventMask were swapped in SDR*/
+	//	printf("->SensorNum %d \t AssertionMask %X \t DeAssertionMask %X reading_format %d \n", 
+	//	record->SensorNum, record->AssertionEventMask, record->DeAssertionEventMask, reading_format);
+		/* If the sensor is threshold based... */
+		if( record->EventTypeCode == 0x01 )
+		{
+			/*Default Sensor State*/
+			*current_state = THRESH_NORMAL;
+
+
+#ifdef CFG_PROJ_REARM_SENSOR
+            /*Get Sensor Event Status*/
+            ReArmSensorReq.SensorNum = record->SensorNum;
+            RetVal = IPMICMD_ReArmSensorEvents(pSession, &ReArmSensorReq, 
+                                &ReArmSensorRes, timeout);
+#endif
+            /*Get Sensor Event Status*/
+            pReqGetSensorEventStatus.SensorNum = record->SensorNum;
+            RetVal = IPMICMD_GetSensorEventStatus(pSession, &pReqGetSensorEventStatus, 
+                                &pResGetSensorEventStatus, timeout);
+			
+	     if( RetVal != LIBIPMI_E_SUCCESS )
+	    		return -1;
+	    
+	     /*Do not Change the sequence of condition*/
+	     if((pResGetSensorEventStatus.AssertionEvents1 & 0x80) == 0x80)
+			*current_state = THRESH_UP_NONCRIT;
+						
+	     if((pResGetSensorEventStatus.AssertionEvents2 & 0x02) == 0x02)
+			*current_state = THRESH_UP_CRITICAL;
+						
+	     if((pResGetSensorEventStatus.AssertionEvents2 & 0x08) == 0x08)
+			*current_state = THRESH_UP_NON_RECOV;
+			
+	     if((pResGetSensorEventStatus.AssertionEvents1 & 0x01 ) == 0x01)
+			*current_state = THRESH_LOW_NONCRIT;
+						
+	     if((pResGetSensorEventStatus.AssertionEvents1 & 0x04 ) == 0x04)
+			*current_state = THRESH_LOW_CRITICAL;
+							
+	     if((pResGetSensorEventStatus.AssertionEvents1 & 0x10) == 0x10)
+			*current_state = THRESH_LOW_NON_RECOV;
+	   } /* if sensor is threshold based */
+	   else
+	   {
+			/* This sensor is discrete */
+			*current_state = (uint16_t)sensor_reading;
+	   }
+	}
+	else if( header->Type == COMPACT_SDR_REC )
+	{
+		CompactSensorRec_T *record = (CompactSensorRec_T *)sdr_buffer;
+
+		if( record->EventTypeCode > (uint8_t)1 )
+		*current_state = (uint16_t)sensor_reading;
+		else
+		*current_state = THRESH_UNINITIALIZED;
+	}
+	else
+	{
+		*current_state = THRESH_UNINITIALIZED;
+		return( -1 );
+	}
+
+	return( 0 );
+}
+
+
+int read_sensor_sdrs( IPMI20_SESSION_T *pSession, struct sensor_info **sensor_list,
+                      int timeout )
+{
+    uint16_t wRet;
+    SDRRepositoryAllocInfo_T alloc_info;
+    SDRRepositoryInfo_T repo_info;
+    int max_sdr_len;
+    uint8_t *sdr_buffer;
+    int buffer_len;
+    int i;
+    struct sensor_info *sensor_buffer = NULL;
+    struct sensor_info *sensor_buffer_temp;
+    int sensor_count = 0;
+    int sdr_count;
+
+    /* Get repository allocation information */
+    wRet = IPMICMD_GetSDRRepositoryAllocInfo( pSession, &alloc_info, timeout );
+    if( wRet != LIBIPMI_E_SUCCESS )
+        return( wRet );
+
+    /* Get repository information */
+    wRet = IPMICMD_GetSDRRepositoryInfo( pSession, &repo_info, timeout );
+    if( wRet != LIBIPMI_E_SUCCESS )
+        return( -1 );
+
+    /* Determine max SDR entry length */
+    max_sdr_len = alloc_info.MaxRecSize * ipmitoh_u16( alloc_info.AllocUnitSize );
+    printf("max sdr len is %d\n",max_sdr_len);
+
+    /* Determine total number of SDRs stored */
+    sdr_count = ipmitoh_u16( repo_info.RecCt );
+    printf("sdr_count is %d\n",sdr_count);
+
+    /* Maximum size needed to store all the SDRs */
+    buffer_len = max_sdr_len * sdr_count;
+    printf("buffer len is %d\n",buffer_len);
+
+    /* Allocate some space to store the SDRs */
+    sdr_buffer = malloc( buffer_len );
+    if( sdr_buffer == NULL )
+        return( STATUS_CODE( IPMI_ERROR_FLAG, OEMCC_NOMEM ) );
+
+    /* Read all the SDRs */
+    wRet = LIBIPMI_HL_GetAllSDRs( pSession, sdr_buffer, buffer_len, timeout );
+    if( wRet != LIBIPMI_E_SUCCESS )
+    {
+        printf( "Failure getting all SDRs\n" );
+        free( sdr_buffer );
+        return( wRet );
+    }
+
+    /* For each SDR... */
+    for( i = 0; i < sdr_count; i++ )
+    {
+        SDRRecHdr_T *header;
+
+        header = (SDRRecHdr_T *)( sdr_buffer + ( i * max_sdr_len ) );
+
+        /* If the SDR is for a sensor... */
+        if( ( header->Type == FULL_SDR_REC ) ||
+            ( header->Type == COMPACT_SDR_REC ) )
+        {
+            /* We've found another sensor */
+            sensor_count++;
+
+            /* Get more memory for this sensor entry */
+            sensor_buffer_temp =
+                realloc( sensor_buffer, sizeof( struct sensor_info ) * sensor_count );
+            if( sensor_buffer_temp == NULL )
+            {
+                printf( "Cannot allocate memory for SDR entry, failing...\n" );
+                if( sensor_buffer != NULL )
+                    free( sensor_buffer );
+                free( sdr_buffer );
+                return( -1 );
+            }
+            sensor_buffer = sensor_buffer_temp;
+
+            /* Copy the SDR data into the newly allocated structure */
+            memcpy( &sensor_buffer[ sensor_count - 1 ].sdr_buffer,
+                    ( sdr_buffer + ( i * max_sdr_len ) ),
+                    sizeof( SDRRecHdr_T ) + header->Len );
+
+            /* Save sensor ID */
+            if( extract_sdr_id( sensor_buffer[ sensor_count - 1 ].sdr_buffer,
+                                sensor_buffer[ sensor_count - 1 ].description ) < 0 )
+                sprintf( sensor_buffer[ sensor_count - 1 ].description, "Unknown" );
+
+            /* Only full records contain sensor conversion data */
+            if( header->Type == FULL_SDR_REC )
+            {
+                uint8_t inverse_linear = 0;
+                FullSensorRec_T *record = (FullSensorRec_T *)( sdr_buffer + ( i * max_sdr_len ) );
+                float converted_threshold;
+
+                if( record->Linearization == 7 )
+                inverse_linear = 1;
+
+                /* Save Low Non-recoverable sensor threshold */
+                ipmi_convert_reading( (uint8_t *)record, record->LowerNonRecoverable,
+                                      &converted_threshold );
+                if( inverse_linear )
+                    sensor_buffer[ sensor_count - 1 ].high_non_recov_thresh = converted_threshold;
+                else
+                    sensor_buffer[ sensor_count - 1 ].low_non_recov_thresh = converted_threshold;
+
+                /* Save Low Critical sensor threshold */
+                ipmi_convert_reading( (uint8_t *)record, record->LowerCritical,
+                                      &converted_threshold );
+                if( inverse_linear )
+                    sensor_buffer[ sensor_count - 1 ].high_crit_thresh = converted_threshold;
+                else
+                    sensor_buffer[ sensor_count - 1 ].low_crit_thresh = converted_threshold;
+
+                /* Save Low Non-Critical sensor threshold */
+                ipmi_convert_reading( (uint8_t *)record, record->LowerNonCritical,
+                                       &converted_threshold );
+                if( inverse_linear )
+                    sensor_buffer[ sensor_count - 1 ].high_non_crit_thresh = converted_threshold;
+                else
+                    sensor_buffer[ sensor_count - 1 ].low_non_crit_thresh = converted_threshold;
+
+                /* Save Upper Non-Recoverable sensor threshold */
+                ipmi_convert_reading( (uint8_t *)record, record->UpperNonRecoverable,
+                                      &converted_threshold );
+                if( inverse_linear )
+                    sensor_buffer[ sensor_count - 1 ].low_non_recov_thresh = converted_threshold;
+                else
+                    sensor_buffer[ sensor_count - 1 ].high_non_recov_thresh = converted_threshold;
+
+                /* Save Upper Critical sensor threshold */
+                ipmi_convert_reading( (uint8_t *)record, record->UpperCritical,
+                                      &converted_threshold );
+                if( inverse_linear )
+                    sensor_buffer[ sensor_count - 1 ].low_crit_thresh = converted_threshold;
+                else
+                    sensor_buffer[ sensor_count - 1 ].high_crit_thresh = converted_threshold;
+
+                /* Save Upper Non-Critical sensor threshold */
+                ipmi_convert_reading( (uint8_t *)record, record->UpperNonCritical,
+                                      &converted_threshold );
+                if( inverse_linear )
+                    sensor_buffer[ sensor_count - 1 ].low_non_crit_thresh = converted_threshold;
+                else
+                    sensor_buffer[ sensor_count - 1 ].high_non_crit_thresh = converted_threshold;
+            }
+        }
+    }
+
+    /* We don't need the complete SDR list now that we've got the */
+    /* SDRs that are sensor related.                              */
+    free( sdr_buffer );
+
+    /* Pass the pointer to the sensor data we allocated back */
+    /* Freeing this memory is the caller's responsibility    */
+    *sensor_list = sensor_buffer;
+
+    return( sensor_count );
+}
+
+/**
+ * @fn ipmi_conv_reading
+ * @brief Helper function to convert the Sensor related readings 
+ * @params SDRType[in],SensorReading,MinReading,MaxReading,SensorUnits1,Linear fn,M value,B Value, M tolerace, B accuracy,Rand B exponent
+ * @returns converted reading
+ */
+
+//ipmi_conv_reading(1,RawHistory.SensorHistory[i], &pSensorHistory_st->sensor_history[i], 
+//0x00, 0xff,
+//0, 0, 
+//25, 0, 0, 0,0xfc);
+//Min = 0x00, Max=0xff, Units1=0x00,Lin=0x00,Mval=25, Bval=0,M_Tol=0,B_Acc=0, R_B_Ex=0xfc
+int ipmi_conv_reading(uint8_t SDRType, uint8_t raw_reading, float *converted_reading ,uint8_t Min,uint8_t Max,uint8_t Units1,uint8_t Lin,uint8_t Mval,uint8_t Bval,uint8_t M_Tol,uint8_t B_Acc,uint8_t R_B_Ex)
+{
+    uint8_t L;
+    int M, B, K1, K2;
+    int raw_number;
+    int sensor_min, sensor_max;
+    
+ //   printf("uint8_t Min : 0x%02x,uint8_t Max : 0x%02x,uint8_t Units1: 0x%02x,uint8_t Lin: 0x%02x,uint8_t Mval: 0x%02x,uint8_t Bval: 0x%02x,uint8_t M_Tol: 0x%02x,uint8_t B_Acc: 0x%02x,uint8_t R_B_Ex: 0x%02x\n",
+ //   		 Min, Max, Units1, Lin, Mval, Bval, M_Tol, B_Acc, R_B_Ex
+ //   );
+
+    if( SDRType != FULL_SDR_REC )
+    {
+        /* Not enough info to convert */
+        printf( "SDRs of type 0x%02x do not provide conversion information\n",SDRType );
+        *converted_reading = (float)raw_reading;
+        return( -1 );
+    }
+
+    /* Convert raw_reading and SensorMin/MaxReading to correct numeric */
+    /* formats before continuing                                       */
+    raw_number = (int)raw_reading;
+    sensor_min = (int)Min;
+    sensor_max = (int)Max;
+    
+    switch( Units1 >> 6 )
+    {
+        case SDR_READING_UNSIGNED:
+            printf( "Sensor reading number format is unsigned\n" );
+            printf( "Sensor min: %d\n", sensor_min );
+            printf( "Sensor max: %d\n", sensor_max );
+            break;
+
+        case SDR_READING_1SCOMP:
+            /* Do 1's comp conversion */
+            if( raw_number & (uint8_t)0x80 )
+                raw_number = -( ~raw_number & 0xff );
+
+            if( sensor_min & (uint8_t)0x80 )
+                sensor_min = -( ~sensor_min & 0xff );
+
+            if( sensor_max & (uint8_t)0x80 )
+                sensor_max = -( ~sensor_max & 0xff );
+
+            printf( "Sensor reading number format is 1's complement: %d\n", raw_number );
+            printf( "Sensor min: %d\n", sensor_min );
+            printf( "Sensor max: %d\n", sensor_max );
+            break;
+
+        case SDR_READING_2SCOMP:
+            /* Do 2's comp conversion */
+            if( raw_number & (uint8_t)0x80 )
+                raw_number = -( ( ~raw_number & 0xff ) + 1 );
+
+            if( sensor_min & (uint8_t)0x80 )
+                sensor_min = -( ( ~sensor_min & 0xff ) + 1 );
+
+            if( sensor_max & (uint8_t)0x80 )
+                sensor_max = -( ( ~sensor_max & 0xff ) + 1 );
+
+            printf( "Sensor reading number format is 2's complement: %d\n", raw_number );
+            printf( "Sensor min: %d\n", sensor_min );
+            printf( "Sensor max: %d\n", sensor_max );
+            break;
+
+        case SDR_READING_NONANALOG:
+        default:
+            printf( "Sensor reading number format is non-analog!\n" );
+            /* Can't convert this one */
+            *converted_reading = (float)raw_reading;
+            return( -1 );
+    }
+
+    /* This sensor is out of bounds.  No meaningful conversion can be done */
+    /* This frequently happens when a sensor is reporting some kind of     */
+    /* error, like a fan stopped/missing.                                  */
+    if( ( raw_number < sensor_min ) || ( raw_number > sensor_max ) )
+    {
+        *converted_reading = 0;
+        return( 0 );
+    }
+
+    /* Linearization type.  Most sensors are already linear, so this is   */
+    /* zero in most cases.  If not, it specifies a way to make the sensor */
+    /* response linear.  Only linear sensors are supported now.           */
+    L = Lin;
+
+    /* Convert M from split 10 bit 2s-complement to our int format */
+    M = (int)Mval;
+    if( ( M_Tol & (uint8_t)0x80 ) != (uint8_t)0 )
+    {
+        /* Number is negative */
+        M = M + ( ( (uint16_t)M_Tol & (uint16_t)0xC0 ) << 2 );
+        M = -( ( ~M & 0x1ff ) + 1 );
+    }
+    else
+    {
+        /* Number is positive */
+        M = M + ( ( (uint16_t)M_Tol & (uint16_t)0xC0 ) << 2 );
+    }
+
+    /* Convert B from split 10 bit 2s-complement to our int format */
+    B = (int)Bval;
+    if( ( B_Acc & (uint8_t)0x80 ) != (uint8_t)0 )
+    {
+        /* Number is negative */
+        B = B + ( ( (uint16_t)B_Acc & (uint16_t)0xC0 ) << 2 );
+        B = -( ( ~B & 0x1ff ) + 1 );
+    }
+    else
+    {
+        /* Number is positive */
+        B = B + ( ( (uint16_t)B_Acc & (uint16_t)0xC0 ) << 2 );
+    }
+
+    /* Convert K1 from 4 bit 2s-complement to our int format */
+    K1 = (int)( R_B_Ex & 0x0f );
+    if( K1 & 0x08 )
+    {
+        /* Number is negative */
+        K1 = -( ( ~K1 & 0x0f ) + 1 );
+    }
+
+    /* Convert K2 from 4 bit 2s-complement to our int format */
+    K2 = (int)( R_B_Ex >> 4 );
+    if( K2 & 0x08 )
+    {
+        /* Number is negative */
+        K2 = -( ( ~K2 & 0x0f ) + 1 );
+    }
+
+    return( ipmi_sensor_reading_conversion( raw_number, L, M, B, K1, K2, converted_reading ) );
+}
+
+/**
+ * @fn SensorState
+ * @brief Helper function to get the sensor state of threshold
+ * @params SensorReading,SensorState,SDRType[in],Linear fn,SensorUnits1,SensorEvtType,AssertionEvtbyte1,AssertionEvtbyte2,DeaasertionEvtbyte1,DeassertionEvtbyte2
+ * @returns Sensor state for FULL SDR Record
+ */
+int SensorState( uint8_t sensor_reading, uint16_t *current_state,uint8_t SDRType,uint8_t Lin,uint8_t Units1,uint8_t EvtType,uint8_t AssertEvt1,uint8_t AssertEvt2,uint8_t DeassertEvt1,uint8_t DeassertEvt2)
+{
+  //  number_type reading_format = Unsigned;
+
+    *current_state = THRESH_UNINITIALIZED;
+
+    if( SDRType == FULL_SDR_REC )
+    {
+        /* For inverse linear sensors, a raw reading of 0 is off the chart. */
+        /* We want a low reading, because this corresponds to what most     */
+        /* people expect for most sensors.  We usually get a raw reading of */
+        /* 0 when the device (like a fan) is not connected, and so          */
+        /* (logically), it is below low thresholds, not above high ones.    */
+        /* So, for purposes of determining our state, use 0xff for the      */
+        /* reading instead of 0.                                            */
+
+        if((Lin == (uint8_t)7 ) && ( sensor_reading == (uint8_t)0))
+        {
+            sensor_reading = (uint8_t)0xff;
+        }
+
+        /* Get the format of the sensor/threshold readings */
+     //   reading_format = (number_type)( Units1 >> 6 );
+
+        /* If the sensor is threshold based... */
+        if( EvtType == 0x01 )
+        {
+            /*Default Sensor State*/
+            *current_state = THRESH_NORMAL;
+
+            /*Do not Change the sequence of condition*/
+            if((AssertEvt1 & 0x80) == 0x80)
+            *current_state = THRESH_UP_NONCRIT;
+
+            if((AssertEvt2 & 0x02) == 0x02)
+            *current_state = THRESH_UP_CRITICAL;
+
+            if((AssertEvt2 & 0x08) == 0x08)
+            *current_state = THRESH_UP_NON_RECOV;
+
+            if((AssertEvt1 & 0x01 ) == 0x01)
+            *current_state = THRESH_LOW_NONCRIT;
+
+            if((AssertEvt1 & 0x04 ) == 0x04)
+            *current_state = THRESH_LOW_CRITICAL;
+
+            if((AssertEvt1 & 0x10) == 0x10)
+            *current_state = THRESH_LOW_NON_RECOV;
+            
+        } /* if sensor is threshold based */
+        else
+        {
+            /* This sensor is discrete */
+            *current_state = (uint16_t)sensor_reading;
+        }
+    }
+    else if( SDRType == COMPACT_SDR_REC )
+    {
+        if( EvtType > (uint8_t)1 )
+        *current_state = (uint16_t)sensor_reading;
+        else
+        *current_state = THRESH_UNINITIALIZED;
+    }
+    else
+    {
+        *current_state = THRESH_UNINITIALIZED;
+        return( -1 );
+    }
+
+    return( 0 );
+}
+
+/* sdr_convert_sensor_value_to_raw  -  convert sensor reading back to raw
+ *
+ * @sdr_record:	sdr_record
+ * @val:	converted sensor reading
+ *
+ * returns raw sensor reading
+ * Reference: This function is implement IPMI SPEC. 2.0 
+ * Session 36.3 Sensor Reading Conversion Formula
+ */
+unsigned char sdr_convert_sensor_value_to_raw(FullSensorRec_T	*sdr_record, double val)
+{
+    int m, b, k1, k2;
+    double result;
+    
+    #define tos(val, bits)    ((val & ((1<<((bits)-1)))) ? (-((val) & (1<<((bits)-1))) | (val)) : (val))
+    m = tos((((unsigned short int) sdr_record->M_Tolerance << 2 & 0x300) | sdr_record->M), 10);
+    b = tos((((unsigned short int) sdr_record->B_Accuracy << 2 & 0x300) | sdr_record->B), 10);
+    k1 = tos(sdr_record->R_B_Exp & 0x0f, 4);
+    k2 = tos((sdr_record->R_B_Exp & 0xf0) >> 4, 4);
+    
+    /* only works for analog sensors */
+    if (sdr_record->Units1 >> 6 > 2)
+        return 0;
+    
+    /* don't divide by zero */
+    if (m == 0)
+        return 0;
+    
+    result = (((val / pow(10, k2)) - (b * pow(10, k1))) / m);
+    
+    if ((result - (int) result) >= .5)
+        return (unsigned char) ceil(result);
+    else
+        return (unsigned char) result;
+}
+

+ 74 - 7
app/goahead-5.1.0/src/web_interface/src/dashboard.c

@@ -11,21 +11,84 @@ void getDeviceInfo(Webs *wp){
 
     uint16_t    wRet = LIBIPMI_E_SUCCESS;
     GetDevIDRes_T   DeviceID;
+    struct ifreq ifreq;
+    int sock;
+    struct sockaddr_in *myaddr;
+
     char BuildTime[30] = {0};
     char FwVersion[10] = {0};
+    char MacAddr[18] = {0};
+    char IpAddr[16] = {0};
+    
+
     //Create session
     LIBIPMI_CreateSession(&wp->ipmi_session, 10);
+
+    //get build time
     sprintf(BuildTime, "%s %s", __DATE__, __TIME__);
+
+    //get firmware version
     wRet = IPMICMD_GetDeviceID( &wp->ipmi_session, &DeviceID, DEFAULT_TIMEOUT);
     if (wRet == LIBIPMI_E_SUCCESS)
     {
         sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
     }
-    printf("BuildTime: %s\n", BuildTime);
-    printf("FwVersion: %s\n", FwVersion);
+
+    //get mac address
+    if((sock=socket(AF_INET,SOCK_STREAM,0))<0)
+    {
+        printf("Get mac address socket fail!\n");
+    }
+    else
+    {
+        strcpy(ifreq.ifr_name,"eth0");
+        if(ioctl(sock,SIOCGIFHWADDR,&ifreq)<0)
+        {
+            printf("Get mac address ioctl fail!\n");
+        }
+        else
+        {
+            sprintf(MacAddr, "%02x:%02x:%02x:%02x:%02x:%02x\n",
+                    (unsigned char)ifreq.ifr_hwaddr.sa_data[0],
+                    (unsigned char)ifreq.ifr_hwaddr.sa_data[1],
+                    (unsigned char)ifreq.ifr_hwaddr.sa_data[2],
+                    (unsigned char)ifreq.ifr_hwaddr.sa_data[3],
+                    (unsigned char)ifreq.ifr_hwaddr.sa_data[4],
+                    (unsigned char)ifreq.ifr_hwaddr.sa_data[5]);
+        }
+    }
+    close(sock);
+
+    //get ip address
+    strcpy(ifreq.ifr_name, "eth0");
+    if((sock=socket(AF_INET, SOCK_STREAM, 0))<0)
+    {
+        printf("Get ip address socket fail!\n");
+    }
+    else
+    {
+        wRet = ioctl(sock, SIOCGIFADDR, &ifreq);
+        if(wRet < 0)
+        {
+            printf("Get ip address ioctl fail!\n");
+        }
+        else
+        {
+            myaddr = (struct sockaddr_in *)&(ifreq.ifr_addr);
+            strcpy(IpAddr, inet_ntoa(myaddr->sin_addr));   
+        }
+    }
+    close(sock);
+    
     //Close session
     LIBIPMI_CloseSession(&wp->ipmi_session );
-    char *pStr;
+
+    printf("BuildTime: %s\n", BuildTime);
+    printf("FwVersion: %s\n", FwVersion);
+    printf("MacAddr: %s\n", MacAddr);
+    printf("IpAddr: %s\n", IpAddr);
+
+    cchar *pStr;
     int code = 200;
     cJSON * root =  cJSON_CreateObject();
     cJSON * data =  cJSON_CreateObject();
@@ -40,17 +103,21 @@ void getDeviceInfo(Webs *wp){
 
     printf("first json:\n%s\n", pStr);
     logmsg(2, "-----------------------jso1n----------------------%s", pStr);
+
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp); 
-    websWrite(wp, "[ {\"name\":\"kangkang\",\"age\":\"12\",\"gender\":\"male\"}, {\"name\":\"Jane\",\"age\":\"14\",\"gender\":\"female\"}]");
+    //websWrite(wp, "[");
+    websWrite(wp, " {\"name\":\"jimbo\"}");
+    //websWrite(wp, "]");
+    //websFlush(wp, 0);
     websDone(wp);
-    // retrun 1;
 }
 
 
 
 
+
 /*获取设备信息*/
 void getDeviceInfoBak(Webs *wp){
     logmsg(2, "--------------------ggggggggg----------------");
@@ -97,7 +164,7 @@ void getDeviceInfoBak(Webs *wp){
 
 
 
-static void buy(Webs *wp)
+void buy(Webs *wp)
 {
     cchar    *name, *age;
     name = websGetVar(wp, "name", NULL);
@@ -120,7 +187,7 @@ static void buy(Webs *wp)
 // /*
 //     Implement /action/actionTest. Parse the form variables: name, address and echo back.
 //  */
-static void actionTest(Webs *wp)
+void actionTest(Webs *wp)
 {
 
 

+ 15 - 15
app/goahead-5.1.0/test/test.c

@@ -52,7 +52,7 @@ static int aspTest(int eid, Webs *wp, int argc, char **argv);
 static int bigTest(int eid, Webs *wp, int argc, char **argv);
 #endif
 
-static void actionTest(Webs *wp);
+// static void actionTest(Webs *wp);
 static void sessionTest(Webs *wp);
 static void showTest(Webs *wp);
 
@@ -175,7 +175,7 @@ MAIN(goahead, int argc, char **argv, char **envp)
     websDefineJst("aspTest", aspTest);
     websDefineJst("bigTest", bigTest);
 #endif
-    websDefineAction("test", actionTest);
+    // websDefineAction("test", actionTest);
     websDefineAction("sessionTest", sessionTest);
     websDefineAction("showTest", showTest);
 #if ME_GOAHEAD_UPLOAD && !ME_ROM
@@ -326,19 +326,19 @@ static int bigTest(int eid, Webs *wp, int argc, char **argv)
 /*
     Implement /action/actionTest. Parse the form variables: name, address and echo back.
  */
-static void actionTest(Webs *wp)
-{
-	cchar	*name, *address;
-
-	name = websGetVar(wp, "name", NULL);
-	address = websGetVar(wp, "address", NULL);
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteEndHeaders(wp);
-	websWrite(wp, "<html><body><h2>name: %s, address: %s</h2></body></html>\n", name, address);
-    websFlush(wp, 0);
-	websDone(wp);
-}
+// static void actionTest(Webs *wp)
+// {
+// 	cchar	*name, *address;
+
+// 	name = websGetVar(wp, "name", NULL);
+// 	address = websGetVar(wp, "address", NULL);
+//     websSetStatus(wp, 200);
+//     websWriteHeaders(wp, -1, 0);
+//     websWriteEndHeaders(wp);
+// 	websWrite(wp, "<html><body><h2>name: %s, address: %s</h2></body></html>\n", name, address);
+//     websFlush(wp, 0);
+// 	websDone(wp);
+// }
 
 
 static void sessionTest(Webs *wp)

BIN
gd32450i-eval.uImage