/**
 * @file   libipmi_AppDevice.h
 * @author Rajasekhar (rajasekharj@amiindia.co.in)
 * @date   02-Sep-2004
 *
 * @brief  Contains exported AppDevice API by LIBIPMI for
 *			communicating with the BMC.
 *
 */

#ifndef __LIBIPMI_APPDEVICE_H__
#define __LIBIPMI_APPDEVICE_H__

/* LIIPMI core header files */
#include "libipmi_session.h"
#include "libipmi_errorcodes.h"

/* command specific header files */
#include "com_IPMI_AppDevice.h"
#include "com_IPMI_AppDevice+.h"

#ifdef  __cplusplus
extern "C" {
#endif

#define TWENTY_BYTE_PWD 0x80
#define MAX_CHANNEL_NUM 15
#define LAN_CHANNEL_MEDIUM_TYPE      0x04
#define SERIAL_CHANNEL_MEDIUM_TYPE   0x05
/*---------- IPMI Command direct routines ----------*/
/* User Management functions */
uint16_t IPMICMD_GetUserAccess(IPMI20_UDS_SESSION_T* pUDSSession,
								 GetUserAccessReq_T* pReqGetUserAccess,
								 GetUserAccessRes_T* pResGetUserAccess,
								 int timeout);

uint16_t	IPMICMD_GetUser(IPMI20_UDS_SESSION_T *pUDSSession/*in*/, GetUserNameReq_T	*pReqGetUser/*in*/,
							GetUserNameRes_T *pResGetUser/*out*/, int timeout/*in*/);
uint16_t	IPMICMD_SetUser(IPMI20_UDS_SESSION_T *pUDSSession/*in*/, SetUserNameReq_T	*pReqSetUser/*in*/,
							SetUserNameRes_T	*pResSetUser/*out*/, int timeout/*in*/);
uint16_t	IPMICMD_GetSessionInfo(IPMI20_UDS_SESSION_T *pUDSSession/*in*/, GetSesInfoReq_T	*pReqSetUser/*in*/,
							GetSesInfoRes_T	*pResSetUser/*out*/, int timeout/*in*/);
uint16_t IPMICMD_GetUserAccessPayload(IPMI20_UDS_SESSION_T* pUDSSession,
							 GetUsrPayldAccReq_T* pReqGetUserAccessPayload,
							 GetUsrPayldAccRes_T* pResGetUserAccessPayload,
							 int timeout);
uint16_t IPMICMD_GetWDT(IPMI20_UDS_SESSION_T* pUDSSession,
							 GetWDTRes_T* pResGetWDT,
							 int timeout);

uint16_t IPMICMD_GetChannelInfo(IPMI20_UDS_SESSION_T* pUDSSession,
							 GetChInfoReq_T* pReqGetChInfo,
							 GetChInfoRes_T* pResGetChInfo,
							 int timeout);

  uint16_t	IPMICMD_GetSystemGUID( IPMI20_UDS_SESSION_T *pUDSSession,
                                            GetSysGUIDRes_T *pGetSystemGUID,
                                            int timeout );
  uint16_t IPMICMD_SendMessage(IPMI20_UDS_SESSION_T *pUDSSession,uint8_t *pSendMsgReq,
                                                          uint8_t *pSendMsgRes,uint32_t SendMsgReqLen,int timeout);

/*---------- LIBIPMI Higher level routines -----------*/

/* User Management functions */
  uint16_t LIBIPMI_HL_SetUser( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, char *pszUsername/*in*/,
										uint8_t byID/*in*/, int timeout/*in*/);
  uint16_t LIBIPMI_HL_GetUser( IPMI20_UDS_SESSION_T *pUDSSession/*in*/, char *pszUsername/*out*/,
										uint8_t byID/*in*/, int timeout/*in*/);

  uint16_t LIBIPMI_HL_AddUser(IPMI20_UDS_SESSION_T *pUDSSession/*in*/,uint8_t UserID/*in*/,
                                    char* UserName/*in*/,   char* ClearPswd/*in*/,
                                    uint8_t NetworkPriv/*in*/,uint8_t SerialPriv/*in*/,
                                    int timeout);
uint16_t LIBIPMI_HL_ModUser(IPMI20_UDS_SESSION_T *pUDSSession,
					uint8_t UserID,uint8_t IsPwdChange,
					char* UserName,char* ClearPswd,
					uint8_t NetworkPriv,uint8_t SerialPriv,uint8_t EnableUser,
					uint8_t ModifyUserName, uint8_t EnableSOL,
					int timeout);
  uint16_t LIBIPMI_HL_DelUser(IPMI20_UDS_SESSION_T *pUDSSession/*in*/,uint8_t UserID/*in*/,
                                    int timeout);
  uint16_t LIBIPMI_HL_GetMaxNumUsers(IPMI20_UDS_SESSION_T* pUDSSession/*in*/,
                                    uint8_t *nNumUsers/*in*/, int timeout);
uint16_t LIBIPMI_HL_GetAllUserInfo(IPMI20_UDS_SESSION_T *pUDSSession,
							uint8_t* nNumUsers,
							GetUserNameRes_T* pResGetUserName,
							GetUserAccessRes_T* pResGetUserAccess_Network,
							GetUserAccessRes_T* pResGetUserAccess_Serial,
                            GetUsrPayldAccRes_T* pResGetUserAccessPayload_SOL,
							int timeout);
uint16_t LIBIPMI_HL_GetOneUserInfo(IPMI20_UDS_SESSION_T *pUDSSession,
                            int UserID,
                            GetUserNameRes_T* pResGetUserName,
							GetUserAccessRes_T* pResGetUserAccess_Network,
							GetUserAccessRes_T* pResGetUserAccess_Serial,
                            GetUsrPayldAccRes_T* pResGetUserAccessPayload_SOL,
							int timeout);

uint16_t LIBIPMI_HL_GetSessionInfoCurrent( IPMI20_UDS_SESSION_T *pUDSSession, GetSesInfoRes_T* SesInfoRes, int timeout );
uint16_t LIBIPMI_HL_GetChannelAccess(IPMI20_UDS_SESSION_T* pUDSSession,uint8_t ChannelMedium,GetChAccessRes_T* pChAccessRes, int timeout);
uint16_t LIBIPMI_HL_SetChannelAccessPrivilege(IPMI20_UDS_SESSION_T* pUDSSession,
                                   uint8_t ChannelMedium,uint8_t Privilege,
                                      SetChAccessRes_T* pChAccessRes, int timeout);

  uint16_t LIBIPMI_HL_GetSystemGUID( IPMI20_UDS_SESSION_T *pUDSSession, char *pszSystemGUID, int timeout );

  uint16_t LIBIPMI_HL_GetUserPrivilege(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t UserID, uint32_t *Privilege, int timeout);

#ifdef  __cplusplus
}
#endif

#endif


