libipmi_rmcp.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /**
  2. * @file libipmi_rmcp.h
  3. * @author Rajasekhar (rajasekharj@amiindia.co.in)
  4. * @date 02-Sep-2004
  5. *
  6. * @brief Contains definition of RMCP layer API
  7. * required by Session layer for communicating with BMC.
  8. *
  9. */
  10. #ifndef __LIBIPMI_RMCP_H__
  11. #define __LIBIPMI_RMCP_H__
  12. //#include "RMCP.h"
  13. #if LIBIPMI_IS_OS_LINUX()
  14. #define PACK __attribute__ ((packed))
  15. #else
  16. #define PACK
  17. #pragma pack(1)
  18. #endif/* LIBIPMI_IS_OS_LINUX() */
  19. /**
  20. * @def RMCPPing_T
  21. * @brief RMCP Ping Message
  22. */
  23. /* IPMI2.0 Specification Table 13-6 */
  24. typedef struct
  25. {
  26. RMCPHdr_T Hdr; /*< RMCP Header */
  27. uint8 IANANum[4]; /*< 4542 (ASF IANA) */
  28. uint8 MsgType; /*< 80h = Presence Ping */
  29. uint8 MsgTag; /*< 0-FEh, generated by remote console */
  30. uint8 Reserved1; /*< 00h */
  31. uint8 DataLen; /*< 00h */
  32. } PACK RMCPPing_T;
  33. /**
  34. * @def RMCPPong_T
  35. * @brief RMCP Pong Response
  36. */
  37. /* IPMI2.0 Specification Table 13-7 */
  38. typedef struct
  39. {
  40. RMCPHdr_T Hdr; /*< RMCP Header */
  41. uint8 IANANum[4]; /*< 4542 (ASF IANA) */
  42. uint8 MsgType; /*< 40h = Presence Ping */
  43. uint8 MsgTag; /*< From Pin Request */
  44. uint8 Reserved1; /*< 00h */
  45. uint8 DataLen; /*< 10h */
  46. uint8 OEMIANANum [4]; /*< OEM's IANA Number */
  47. uint8 OEM [4]; /*< OEM Defined field */
  48. uint8 Support; /*< 81h for IPMI */
  49. uint8 InteractionSupport; /*< Reserved */
  50. uint8 Reserved [6];
  51. } PACK RMCPPong_T;
  52. #if defined (PACK)
  53. #undef PACK
  54. #endif
  55. #if !LIBIPMI_IS_OS_LINUX()
  56. #pragma pack()
  57. #endif/* LIBIPMI_IS_OS_LINUX() */
  58. /**
  59. \breif Connects to BMC's RMCP layer.
  60. @param LanInfo [in]Lan Info handle
  61. @param szIPAddress [in]IP Address of BMC
  62. @param wPort [in]socke port to be connected.
  63. @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  64. */
  65. uint8 RMCP_Connect(LAN_CHANNEL_T *LanInfo, char *szIPAddress, uint16 wPort);
  66. /**
  67. \breif Closes connection with BMC at RCMP layer
  68. @param LanInfo [in]Lan Info handle
  69. @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  70. */
  71. void RMCP_Close(LAN_CHANNEL_T *LanInfo );
  72. /**
  73. \breif Fills RMCP Header and sends the data to network layer.
  74. @param LanInfo [in]Lan Info handle
  75. @param szBuffer [in]Data to be sent
  76. @param dwSize [in]Size of the data to be sent.
  77. @param timeout [in]timeout value in seconds.
  78. @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  79. */
  80. uint8 RMCP_SendData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32 dwSize, int timeout);
  81. /**
  82. \breif Receives data from network layer and validates RMCP Header.
  83. @param LanInfo [in]Lan Info handle
  84. @param szBuffer [out]Data that will be received
  85. @param dwSize [out]Size of the data received.
  86. @param timeout [in]timeout value in seconds.
  87. @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  88. */
  89. uint8 RMCP_ReceiveData(LAN_CHANNEL_T *LanInfo, char *szBuffer, uint32* pdwSize, int timeout);
  90. /**
  91. \breif Sends RMCP Ping message to BMC
  92. @param LanInfo [in]Lan Info handle
  93. @param timeout [in]timeout value in seconds.
  94. @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  95. */
  96. uint8 RMCP_Ping(LAN_CHANNEL_T *LanInfo, int timeout);
  97. /**
  98. \breif Receives RMCP Pong message from BMC
  99. @param LanInfo [in]Lan Info handle
  100. @param timeout [in]timeout value in seconds.
  101. @retval Returns LIBIPMI_STATUS_SUCCESS on success and error codes on failure
  102. */
  103. uint8 RMCP_Pong(LAN_CHANNEL_T *LanInfo, int timeout);
  104. #endif