libipmi_session.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /**
  2. * @file libipmi_session.h
  3. * @author Rajasekhar (rajasekharj@amiindia.co.in)
  4. * @date 02-Sep-2004
  5. *
  6. * @brief Contains function definitions & data structures
  7. * required for establishing a session
  8. *
  9. */
  10. #ifndef __LIBIPMI_SESSION_H__
  11. #define __LIBIPMI_SESSION_H__
  12. #include <stdio.h>
  13. #include "libipmi_struct.h"
  14. #include "libipmi_errorcodes.h"
  15. //#include "libipmiifc.h"
  16. //#include "libipmi_version.h"
  17. #define PACK __attribute__ ((packed))
  18. //#include "IPMI_RMCP.h"
  19. #include "com_IPMIDefs.h"
  20. //#include "IPMI_App.h"
  21. //#include "IPMI_AppDevice.h"
  22. //#include "IPMI_RMCP+.h"
  23. //#include "IPMI_AMI.h"
  24. //#include "AES.h"
  25. //#include "hmac.h"
  26. //#include "sha1.h"
  27. //#include <time.h>
  28. //
  29. //typedef struct
  30. //{
  31. // uint32_t Param; /* Parameter */
  32. // uint8_t Channel; /* Originator's channel number */
  33. // uint8_t SrcQ [64]; /* Originator Queue */
  34. // uint8_t Cmd; /* Command that needs to be processed*/
  35. // uint8_t NetFnLUN; /* Net function and LUN of command */
  36. // uint8_t Privilege; /* Current privilege level */
  37. // uint32_t SessionID; /* Session ID if any */
  38. // time_t ReqTime; /* Request Timestamp */
  39. // uint16_t ResTimeOut; /* response timeout in secs */
  40. // uint16_t SessionType; /* Session Type */
  41. // uint8_t IPAddr [16]; /* IPv6 Address */
  42. // uint16_t UDPPort; /* UDP Port Number */
  43. // uint16_t Socket; /* socket handle */
  44. // uint32_t Size; /* Size of the data */
  45. // uint8_t Data [1024 * 60]; /* Data */
  46. //} PACKED MsgPkt_T;
  47. //
  48. //typedef union
  49. //{
  50. // IPMIMsgHdr_T IPMIMsgHdr;
  51. // IPMIUDSMsg_T UDSMsgHdr;
  52. //}PACKED ResMsgHdr_T;
  53. //#include "BridgeMsgAPI.h"
  54. /* Undefine PACK so that it can be redefined in other header files */
  55. #if defined (PACK)
  56. #undef PACK
  57. #endif
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61. extern uint16_t Create_IPMI20_UDS_Session(IPMI20_SESSION_T *pSession, char *pszSocketPath,
  62. char *pszUserName, char *pszPassword, uint8_t *byPrivLevel,
  63. char *pUserName, uint8_t *ipaddr, int timeout, int AuthFlag, uint8_t ChannelNum);
  64. /**
  65. This function is used to get the UserID for given Username and Password.
  66. It compares all IPMI username with the IN argument Username.
  67. If it matches, then it checks for the password.
  68. If password also matches, it will return SUCCESS and corresponding User ID.
  69. Since duplicate username is supported in IPMI specification,
  70. It will executes unless it gets SUCCESS or reaches MAX_USERS_COUNT.
  71. Username and Password are IN arguments, UserID is OUT argument.
  72. **/
  73. extern int LIBIPMI_GetUserIDForUserName(IPMI20_SESSION_T *pSession,
  74. char *UserName, char *Password,
  75. uint8_t *UserID, uint8_t AuthEnable,int timeout);
  76. /**
  77. \breif Sends RAW IPMI Command to the BMC
  78. @param pSession [in]Session Info handle
  79. @param byPayLoadType [in]Pay Load Type in NETWORK_MEDIUM.
  80. shd be 0 in case of serial and kcs mediums.
  81. @param byNetFnLUN [in] Net Function and LUN for the given byCommand
  82. @param byCommand [in] Command number.
  83. @param pszReqData [in] Command Request Data
  84. @param dwReqDataLen [in] size of Command Request data.
  85. @param pszResData [in] Command Response Data
  86. @param pdwResDataLen [in] size of Command Response data.
  87. @param timeout [in]timeout value in seconds.
  88. @retval Returns LIBIPMI_E_SUCCESS on success and error codes on failure
  89. */
  90. extern uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_SESSION_T *pSession,
  91. uint8_t byNetFnLUN, uint8_t byCommand,
  92. uint8_t *pszReqData, uint32_t dwReqDataLen,
  93. uint8_t *pszResData, uint32_t *pdwResDataLen,
  94. int timeout);
  95. /**
  96. \breif Closes the IPMI 2.0 Session
  97. @param pSession [in]Session Info handle
  98. @retval Returns LIBIPMI_E_SUCCESS on success and error codes on failure
  99. */
  100. extern uint16_t LIBIPMI_CloseSession( IPMI20_SESSION_T *pSession );
  101. /**
  102. \breif returns status whether the session is started or not
  103. @param pSession [in]Session Info handle
  104. @retval 1 if session is started and 0 if not
  105. */
  106. extern uint8_t IsSessionStarted(IPMI20_SESSION_T *pSession);
  107. /**
  108. \brief Sets the Cmd Retry Count and Interval
  109. @param pSession [in]Session Info handle
  110. @retval Returns LIBIPMI_E_SUCCESS on success and error codes on failure
  111. @note This function is not implemented
  112. */
  113. extern uint16_t LIBIPMI_SetRetryCfg( IPMI20_SESSION_T *pSession,
  114. int nCmdRetryCount,
  115. int nCmdRetryInterval);
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119. #endif /* __LIBIPMI_SESSION_H__ */