libipmi_struct.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /**
  2. * @file libipmi_struct.h
  3. * @author Rajasekhar (rajasekharj@amiindia.co.in)
  4. * @date 02-Sep-2004
  5. *
  6. * @brief Contains data structures required for establishing a session
  7. *
  8. */
  9. #ifndef __LIBIPMI_STRUCT_H__
  10. #define __LIBIPMI_STRUCT_H__
  11. #include <stdint.h>
  12. #define PACK __attribute__ ((packed))
  13. #define MAX_REQUEST_SIZE 1024 * 60
  14. #define MAX_RESPONSE_SIZE 1024 * 60
  15. #define HANDLE int
  16. #define SOCKET int
  17. #define SOCKET_ERROR -1
  18. #define IP4_VERSION 4
  19. #define IP6_VERSION 6
  20. #define IP4_ADDR_LEN 4
  21. #define IP6_ADDR_LEN 16
  22. /**
  23. @def UDS_CHANNEL_T
  24. @brief holds data required for network medium
  25. */
  26. typedef struct UDS_CHANNEL_T_tag {
  27. uint16_t hSocketPath;
  28. SOCKET hSocket;
  29. uint8_t byIsConnected;
  30. } PACK UDS_CHANNEL_T;
  31. /* Authentication Types */
  32. #define AUTHTYPE_NONE 0x00
  33. #define AUTHTYPE_MD2 0x01
  34. #define AUTHTYPE_MD5 0x02
  35. #define AUTHTYPE_RESERVED 0x03
  36. #define AUTHTYPE_STRAIGHT_PASSWORD 0x04
  37. #define AUTHTYPE_OEM_PROPRIETARY 0x05
  38. #define AUTHTYPE_RMCP_PLUS_FORMAT 0x06
  39. /* Privilege levels */
  40. #define PRIV_LEVEL_NO_ACCESS 0x0F
  41. #define PRIV_LEVEL_PROPRIETARY 0x05
  42. #define PRIV_LEVEL_ADMIN 0x04
  43. #define PRIV_LEVEL_OPERATOR 0x03
  44. #define PRIV_LEVEL_USER 0x02
  45. #define PRIV_LEVEL_CALLBACK 0x01
  46. #define PRIV_LEVEL_RESERVED 0x00
  47. /* Authentication Algorithms */
  48. #define AUTH_ALG_RAKP_NONE 0x00
  49. #define AUTH_ALG_RAKP_HMAC_SHA1 0x01
  50. #define AUTH_ALG_RAKP_HMAC_MD5 0x02
  51. /* Integrity Algorithms */
  52. #define INTEGRITY_ALG_NONE 0x00
  53. #define INTEGRITY_ALG_HMAC_SHA1_96 0x01
  54. #define INTEGRITY_ALG_HMAC_SHA1_128 0x02
  55. #define INTEGRITY_ALG_MD5_128 0x03
  56. /* Confidentiality Algorithms */
  57. #define CONFIDENTIALITY_ALG_NONE 0x00
  58. #define CONFIDENTIALITY_ALG_AES_CBC_128 0x01
  59. #define CONFIDENTIALITY_ALG_XRC4_128 0x02
  60. #define CONFIDENTIALITY_ALG_XRC4_40 0x03
  61. /* Payload Types */
  62. #define PAYLOAD_TYPE_IPMI 0
  63. #define PAYLOAD_TYPE_SOL 1
  64. #define PAYLOAD_TYPE_RSSP_OPEN_SES_REQ 0x10
  65. #define PAYLOAD_TYPE_RSSP_OPEN_SES_RES 0x11
  66. #define PAYLOAD_TYPE_RAKP_MSG_1 0x12
  67. #define PAYLOAD_TYPE_RAKP_MSG_2 0x13
  68. #define PAYLOAD_TYPE_RAKP_MSG_3 0x14
  69. #define PAYLOAD_TYPE_RAKP_MSG_4 0x15
  70. #define MAX_KEY1_SIZE 20
  71. #define MAX_KEY2_SIZE 20
  72. #define MAX_GUID_SIZE 16
  73. #define MAX_USER_NAME_LEN (16+1) //1 for stroing the null character
  74. #define MAX_USER_PWD_LEN (20+1) //1 for storing the null character
  75. #define MAX_RAND_NO_LEN 16
  76. /* (0x6 << 2) == 0x18 */
  77. #define DEFAULT_NET_FN_LUN 0x18
  78. #define NETFNLUN_IPMI_APP 0x18
  79. #define NETFNLUN_IPMI_SENSOR 0x10
  80. #define NETFNLUN_IPMI_STORAGE 0x28
  81. #define NETFNLUN_IPMI_CHASSIS 0x00
  82. /**
  83. @def IPMI20_UDS_SESSION_T
  84. @brief holds data required for maintaining session with unix domain socket medium
  85. */
  86. typedef struct IPMI20_UDS_SESSION_T_tag {
  87. UDS_CHANNEL_T hUDSInfo;
  88. char szUserName[MAX_USER_NAME_LEN];
  89. char szPwd[MAX_USER_PWD_LEN];
  90. char szUName[MAX_USER_NAME_LEN];
  91. char abyIPAddr[IP6_ADDR_LEN];
  92. uint32_t dwSessionID;
  93. uint8_t byPreSession;
  94. uint8_t byAuthType;
  95. uint8_t byRole;
  96. uint8_t byChannelNum;
  97. uint8_t byDefTimeout;
  98. uint8_t byMaxRetries;
  99. }PACK IPMI20_UDS_SESSION_T;
  100. /**
  101. @def IPMI20_SESSION_T
  102. @brief holds info for maintaining a session
  103. */
  104. typedef struct IPMI20_SESSION_T_tag {
  105. /* Medium type (Network, Serial, KCS, IPMB, USB) */
  106. uint8_t byMediumType;
  107. //#define NETWORK_MEDIUM_TCP 0x01
  108. //#define NETWORK_MEDIUM_UDP 0x04
  109. //#define NETWORK_MEDIUM NETWORK_MEDIUM_TCP
  110. //#define SERIAL_MEDIUM 0x02
  111. //#define KCS_MEDIUM 0x03
  112. //#define IPMB_MEDIUM 0x05
  113. //#define USB_MEDIUM 0x06
  114. #define UDS_MEDIUM 0x07
  115. /* tells whether session has started or not. */
  116. uint8_t bySessionStarted;
  117. #define SESSION_NOT_STARTED 0x00
  118. #define SESSION_STARTED 0x01
  119. /* if this value is > 0, session reestablishment will be tried for byMaxRetries times. */
  120. uint8_t byMaxRetries;
  121. /* LAN Eth Index for hold Eth number if multi NIc supported */
  122. uint8_t EthIndex;
  123. // IPMI20_NETWORK_SESSION_T *hNetworkSession;
  124. // IPMI20_SERIAL_SESSION_T *hSerialSession;
  125. // IPMI20_KCS_SESSION_T *hKCSSession;
  126. // IPMI20_IPMB_SESSION_T *hIPMBSession;
  127. // IPMI20_USB_SESSION_T *hUSBSession;
  128. IPMI20_UDS_SESSION_T *hUDSSession;
  129. // LIBIPMI_SERIAL_SETTINGS_T Settings;
  130. } PACK IPMI20_SESSION_T;
  131. typedef enum
  132. {
  133. AUTH_FLAG = 1,
  134. AUTH_BYPASS_FLAG,
  135. }USER_Auth;
  136. /* Undefine PACK so that it can be redefined in other header files */
  137. #if defined (PACK)
  138. #undef PACK
  139. #endif
  140. #endif /* __LIBIPMI_STRUCT_H__ */