123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335 |
- ///****************************************************************
- // ****************************************************************
- // ** **
- // ** (C)Copyright 2005-2006, American Megatrends Inc. **
- // ** **
- // ** All Rights Reserved. **
- // ** **
- // ** 6145-F, Northbelt Parkway, Norcross, **
- // ** **
- // ** Georgia - 30071, USA. Phone-(770)-246-8600. **
- // ** **
- // ****************************************************************
- // ****************************************************************/
- ///*****************************************************************
- // *
- // * Session.c
- // * Session related functions
- // *
- // * Author: Govind Kothandapani <govindk@ami.com>
- // * : Rama Bisa <ramab@ami.com>
- // * : Basavaraj Astekar <basavaraja@ami.com>
- // * : Bakka Ravinder Reddy <bakkar@ami.com>
- // *
- // *****************************************************************/
- //#define ENABLE_DEBUG_MACROS 0
- #include "com_IPMIDefs.h"
- //#include "MsgHndlr.h"
- #include "PMConfig.h"
- //#include "SharedMem.h"
- //#include "NVRAccess.h"
- #include "Session.h"
- //#include "Debug.h"
- ////#include "SerialRegs.h"
- //#include "SensorEvent.h"
- #include "com_IPMI_Sensor.h"
- #include "Support.h"
- //#include "Ethaddr.h"
- #include "AppDevice.h"
- #include "MsgHndlr.h"
- #include <stdio.h>
- #include "main.h"
- #include <string.h>
- //#define TOTAL_INFINITE_CMDS sizeof(m_InfiniteCmdsTbl)/sizeof(IPMICmdsFilterTbl_T)
- //static IPMICmdsFilterTbl_T m_InfiniteCmdsTbl [] =
- //{ /* NetFn */ /* Command# */
- // { NETFN_AMI, CMD_AMI_YAFU_COMMON_NAK },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_FLASH_INFO },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_FIRMWARE_INFO },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_FMH_INFO },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_STATUS, },
- // { NETFN_AMI, CMD_AMI_YAFU_ACTIVATE_FLASH },
- // { NETFN_AMI, CMD_AMI_YAFU_ALLOCATE_MEMORY },
- // { NETFN_AMI, CMD_AMI_YAFU_FREE_MEMORY },
- // { NETFN_AMI, CMD_AMI_YAFU_READ_FLASH },
- // { NETFN_AMI, CMD_AMI_YAFU_WRITE_FLASH },
- // { NETFN_AMI, CMD_AMI_YAFU_ERASE_FLASH },
- // { NETFN_AMI, CMD_AMI_YAFU_PROTECT_FLASH },
- // { NETFN_AMI, CMD_AMI_YAFU_ERASE_COPY_FLASH },
- // { NETFN_AMI, CMD_AMI_YAFU_VERIFY_FLASH },
- // { NETFN_AMI, CMD_AMI_YAFU_READ_MEMORY },
- // { NETFN_AMI, CMD_AMI_YAFU_WRITE_MEMORY },
- // { NETFN_AMI, CMD_AMI_YAFU_COPY_MEMORY },
- // { NETFN_AMI, CMD_AMI_YAFU_COMPARE_MEMORY },
- // { NETFN_AMI, CMD_AMI_YAFU_CLEAR_MEMORY },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_BOOT_CONFIG },
- // { NETFN_AMI, CMD_AMI_YAFU_SET_BOOT_CONFIG },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_BOOT_VARS },
- // { NETFN_AMI, CMD_AMI_YAFU_DEACTIVATE_FLASH_MODE },
- // { NETFN_AMI, CMD_AMI_YAFU_RESET_DEVICE },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_ECF_STATUS },
- // { NETFN_AMI, CMD_AMI_YAFU_GET_VERIFY_STATUS },
- // { NETFN_AMI, CMD_AMI_GET_CHANNEL_NUM },
- // { NETFN_AMI, CMD_AMI_GET_ETH_INDEX },
- // { NETFN_AMI, CMD_AMI_START_TFTP_FW_UPDATE },
- // { NETFN_AMI, CMD_AMI_GET_TFTP_FW_PROGRESS_STATUS },
- // { NETFN_AMI, CMD_AMI_SET_FW_CONFIGURATION },
- // { NETFN_AMI, CMD_AMI_GET_FW_CONFIGURATION },
- // { NETFN_AMI, CMD_AMI_SET_FW_PROTOCOL},
- // { NETFN_AMI, CMD_AMI_GET_FW_PROTOCOL},
- // { NETFN_AMI, CMD_AMI_YAFU_FIRMWARE_SELECT_FLASH},
- //};
- ///*********************************************************************************************
- // Name : SessionTimeOutTask
- // Input : void
- // Output : void
- // This program checks for session timeout
- //*********************************************************************************************/
- //void SessionTimerTask (int BMCInst)
- //{
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // uint8_t Index;
- // char solsessionfile[MAXFILESIZE] = {0};
- // struct stat fp;
- // for (Index=0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // continue;
- // }
- // if(pBMCInfo->IpmiConfig.SerialIfcSupport == 1)
- // {
- // if (pBMCInfo->SERIALch == pSessionTblInfo->SessionTbl[Index].Channel)
- // {
- // continue;
- // if (!(pBMCInfo->SMConfig.SessionTermination & 0x02)) /* If Session Inactivity timeout disabled */
- // {
- // continue;
- // }
- // else if (0 == pBMCInfo->SMConfig.SessionInactivity) /* Never Time Out */
- // {
- // continue;
- // }
- // }
- // }
- //
- // if(pBMCInfo->IpmiConfig.SOLIfcSupport == 1)
- // {
- // if(pSessionTblInfo->SessionTbl[Index].SessPyldInfo [PAYLOAD_SOL].Type == PAYLOAD_SOL)
- // {
- // if (pBMCInfo->IpmiConfig.SOLSessionTimeOut == 0 ) // Never Time Out
- // {
- // continue;
- // }
- //
- // if(pSessionTblInfo->SessionTbl[Index].TimeOutValue == 0)
- // {
- // sprintf(solsessionfile,"%s%d",SOL_SESSION_FILE,BMCInst);
- //
- // if(stat(solsessionfile,&fp) == 0)
- // {
- // unlink(solsessionfile);
- // }
- // }
- // }
- // }
- // if(GetLinkStatus(pSessionTblInfo->SessionTbl[Index].Channel,BMCInst) !=0)
- // {
- // if (pSessionTblInfo->SessionTbl[Index].TimeOutValue > 0)
- // {
- // pSessionTblInfo->SessionTbl[Index].TimeOutValue--;
- // continue;
- // }
- // }
- // else
- // {
- // pSessionTblInfo->SessionTbl[Index].Linkstat = TRUE;
- // continue;
- // }
- // IPMI_DBG_PRINT ("\nSessionTimerTask: Session Time Out Occured\n");
- // IPMI_DBG_PRINT_2 ("SessionID = 0x%lX Num of Sessions = %X\n", pSessionTblInfo->SessionTbl[Index].SessionID,
- // pSessionTblInfo->Count);
- // if(pBMCInfo->IpmiConfig.SerialIfcSupport == 1)
- // {
- // if (pBMCInfo->SERIALch == pSessionTblInfo->SessionTbl[Index].Channel)
- // {
- // BMC_GET_SHARED_MEM (BMCInst)->SerialSessionActive = FALSE;
- // }
- // }
- // /* Delete the Session from session table */
- // DeleteSession (&pSessionTblInfo->SessionTbl[Index],BMCInst);
- // }
- //}
- ///*********************************************************************************************
- // Name : getChannelInfo
- // Input : ch - ChannelNumber
- // Output : channelInformations
- // This program returns informations about the channel
- //*********************************************************************************************/
- // ChannelInfo_T* getChannelInfo (uint8_t ch,int BMCInst)
- //{
- // uint8_t Index;
- // ChcfgInfo_T *pChannelInfo=NULL;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // if(IsLANChannel(ch, BMCInst))
- // {
- // if(pBMCInfo->IpmiConfig.LANIfcSupport != 1)
- // {
- // return NULL;
- // }
- // }else
- // {
- // if( PRIMARY_IPMB_CHANNEL == ch && pBMCInfo->IpmiConfig.PrimaryIPMBSupport != 1 )
- // {
- // return NULL;
- // }
- // else if (pBMCInfo->IpmiConfig.SecondaryIPMBSupport != 1 && (pBMCInfo->SecondaryIPMBCh != CH_NOT_USED && ch == pBMCInfo->SecondaryIPMBCh))
- // {
- // return NULL;
- // }
- // else if (pBMCInfo->IpmiConfig.SerialIfcSupport != 1 && (pBMCInfo->SERIALch != CH_NOT_USED && ch == pBMCInfo->SERIALch))
- // {
- // return NULL;
- // }
- // else if (pBMCInfo->IpmiConfig.ICMBIfcSupport != 1 && (pBMCInfo->ICMBCh != CH_NOT_USED && ch == pBMCInfo->ICMBCh))
- // {
- // return NULL;
- // }
- // else if (pBMCInfo->IpmiConfig.SMBUSIfcSupport !=1 && (pBMCInfo->SMBUSCh != CH_NOT_USED && ch == pBMCInfo->SMBUSCh))
- // {
- // return NULL;
- // }
- // else if (pBMCInfo->IpmiConfig.USBIfcSupport != 1 && (ch == USB_CHANNEL))
- // {
- // return NULL;
- // }
- // else if (pBMCInfo->IpmiConfig.SMMIfcSupport != 1 && (pBMCInfo->SMMCh != CH_NOT_USED && ch == pBMCInfo->SMMCh))
- // {
- // return NULL;
- // }
- // else if(pBMCInfo->IpmiConfig.SYSIfcSupport !=1 && ch == SYS_IFC_CHANNEL)
- // {
- // return NULL;
- // }
- // }
- // for(Index=0;Index<MAX_NUM_CHANNELS;Index++)
- // {
- // if(pBMCInfo->ChConfig[Index].ChType != 0xff)
- // {
- // pChannelInfo = &pBMCInfo->ChConfig[Index];
- // //printf("Channel numb is %x %x \n",pChannelInfo->ChannelInfo.ChannelNumber,ch);
- // if(pChannelInfo->ChannelInfo.ChannelNumber == ch)
- // {
- // return (ChannelInfo_T *)&pBMCInfo->ChConfig[Index].ChannelInfo;
- // }
- // }
- // }
- // return NULL;
- //}
- int UpdateUserInfoTable(void)
- {
- uint8_t buf[1000];
- uint8_t UserNameLen = 0;
- uint8_t PassWordLen = 0;
- uint8_t *pUserName;
- uint8_t *pPassword;
- uint8_t *pStr;
- uint8_t usercnt = 0;
- uint32_t len = 0;
- uint8_t namesize = 0;
- FILE *fp = NULL;
- printf("\n\nUpdateUserInfoTable\n");
- fp = fopen(AUTH_FILE_PATH, "r");
- if(fp == NULL)
- {
- printf("Open %s fail!\n", AUTH_FILE_PATH);
- return -1;
- }
- while(fgets(buf, 1000, fp) != NULL){
- pStr = buf;
- //remove blank
- while(*pStr == ' ')
- {
- pStr++;
- }
- if(strncmp(pStr, "user name=", 10) == 0)
- {
- pStr+=10;
- //get name
- pUserName = pStr;
- UserNameLen = 0;
- while(*pStr != ' ')
- {
- UserNameLen++;
- pStr++;
- }
- memset(g_BMCInfo.UserInfoTbl[usercnt].UserName, 0, MAX_USERNAME_LEN);
- memcpy(g_BMCInfo.UserInfoTbl[usercnt].UserName, pUserName, UserNameLen);
-
- //remove blank
- while(*pStr == ' ')
- {
- pStr++;
- }
- if(strncmp(pStr, "password=", 9) == 0)
- {
- pStr += 9;
- //get password
- pPassword = pStr;
- PassWordLen = 0;
- while(*pStr != ' ')
- {
- PassWordLen++;
- pStr++;
- }
- memset(g_BMCInfo.UserInfoTbl[usercnt].UserPassword, 0, MAX_PASSWORD_LEN);
- memcpy(g_BMCInfo.UserInfoTbl[usercnt].UserPassword, pPassword, PassWordLen);
-
- g_BMCInfo.UserInfoTbl[usercnt].UserId = usercnt;
- if(usercnt < 10)
- usercnt++;
- else
- break;
- }
- else
- continue;
- }
- else
- continue;
- }
- g_BMCInfo.CurrentNoUser = usercnt;
- fclose(fp);
- return 0;
- }
- /*********************************************************************************************
- Name : CheckForDuplicateUsers
- Input : UserName - Name of the User
- Output : returns 0 for success and -1 for failure
- This program returns Informations about the user
- *********************************************************************************************/
- uint8_t CheckForDuplicateUsers ( uint8_t* UserName)
- {
- int i = 0;
-
- for(i=0; i<=MAX_USER_NUM; i++)
- {
- if(g_BMCInfo.UserInfoTbl[i].UserId != 0)
- {
- if (0 == memcmp(g_BMCInfo.UserInfoTbl[i].UserName, UserName, MAX_USERNAME_LEN))
- return FALSE;
- }
- }
- return TRUE;
- }
- /*********************************************************************************************
- Name : getUserIdInfo
- Input : UserID - User ID
- Output : User information
- This program returns Informations about the user
- *********************************************************************************************/
- UserInfo_T* getUserIdInfo (uint8_t UserId)
- {
- UpdateUserInfoTable();
- //if (UserId == 0) { return NULL; }
- if (UserId < MAX_USER_NUM)
- {
- return &g_BMCInfo.UserInfoTbl[UserId];
- }
- else
- {
- return NULL;
- }
- }
- /*********************************************************************************************
- Name : getUserNameInfo
- Input : UserName - User name
- Output : User information
- This program returns Informations about the user
- *********************************************************************************************/
- UserInfo_T* getUserNameInfo (uint8_t *UserName)
- {
- int i = 0;
- UpdateUserInfoTable();
- if (UserName[0] == 0) { return NULL; }
- if( (UserName[0] >= '0') && (UserName[0] <= '9') ) {return NULL;}
- for (i = 0; i < MAX_USERNAME_LEN; i++)
- {
- if(UserName[i] > 127)
- {
- return NULL;
- }
- }
-
- for(i=0; i < MAX_USER_NUM; i++)
- {
- //if(g_BMCInfo.UserInfoTbl[i].UserId != 0)
- {
- if (0 == strcmp(g_BMCInfo.UserInfoTbl[i].UserName, UserName))
- {
- return &g_BMCInfo.UserInfoTbl[i];
- }
- }
- }
- return NULL;
- }
- ///*********************************************************************************************
- // Name : getChUserPrivInfo
- // Input : userName - user name
- // Role - requested role
- // chIndex - channel's user index
- // pChUserInfo - channel's user information
- // Output : channel's matching user Information
- //This program returns information about the user for the given channel,
- // & Index of the user in Channel User Array.
- //*********************************************************************************************/
- // ChannelUserInfo_T* getChUserPrivInfo ( char *userName, uint8_t Role, uint8_t* chIndex, ChannelUserInfo_T *pChUserInfo, int BMCInst)
- //{
- // UserInfo_T* pUserTable = (UserInfo_T *) GetNVRUsrCfgAddr (NVRH_USERCONFIG, BMCInst);
- // int userIndex;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // /* search the table */
- // for(userIndex = 0; userIndex < pBMCInfo->IpmiConfig.MaxUsers; userIndex++)
- // {
- // for(*chIndex = 0; *chIndex < pBMCInfo->IpmiConfig.MaxChUsers; (*chIndex)++)
- // {
- // if ((Role <= pChUserInfo[*chIndex].AccessLimit) &&
- // (1 == pUserTable[userIndex].UserStatus) &&
- // (pUserTable[userIndex].UserId == pChUserInfo[*chIndex].UserId))
- // {
- // /* if userName is not NULL then it is username/privilege
- // lookup else it is name_only lookup */
- // if (0 != *userName)
- // {
- // if (0 != _fmemcmp(pUserTable[userIndex].UserName, userName, MAX_USERNAME_LEN))
- // {
- // continue;
- // }
- // }
- // return (pChUserInfo + *chIndex);
- // }
- // }
- // }
- // return NULL;
- //}
- ///*********************************************************************************************
- // Name : getChUserInfo
- // Input : userName - user name
- // chIndex - to return Index of user in channelUser Array
- // pChUserInfo - channel's user information
- // Output : channel's matching user Information
- //This program returns information about the user for the given channel,
- // & Index of the user in Channel User Array.
- //*********************************************************************************************/
- // ChannelUserInfo_T* getChUserInfo ( char *userName, uint8_t* chIndex, ChannelUserInfo_T *pChUserInfo,int BMCInst)
- //{
- // UserInfo_T* pUserTable = (UserInfo_T *) GetNVRUsrCfgAddr (NVRH_USERCONFIG, BMCInst);
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // int userIndex;
- // /* search the table */
- // for(userIndex = 0; userIndex < pBMCInfo->IpmiConfig.MaxUsers; userIndex++)
- // {
- // for(*chIndex = 0; *chIndex < pBMCInfo->IpmiConfig.MaxChUsers; (*chIndex)++)
- // {
- // if ((0 == _fmemcmp(pUserTable[userIndex].UserName, userName, MAX_USERNAME_LEN)) &&
- // /* Commented to return the pointer for disabled user */
- // /* (1 == pUserTable[userIndex].UserStatus) && */
- // (pUserTable[userIndex].UserId == pChUserInfo[*chIndex].UserId))
- // return (pChUserInfo + *chIndex);
- // }
- // }
- // return NULL;
- //}
- ///*********************************************************************************************
- // Name : getChUserIdInfo
- // Input : userId - User ID
- // Index - to return Index of user in channelUser Array.
- // pChUserInfo - channel's user information
- // Output : channel's matching user Information
- //This program returns information about the user for the given channel,
- // & Index of the user inChannel User Array.
- //*********************************************************************************************/
- // ChannelUserInfo_T* getChUserIdInfo (uint8_t userId, uint8_t *Index, ChannelUserInfo_T* pChUserInfo, int BMCInst)
- //{
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // if (userId == 0) { return NULL; }
- // for(*Index=0; *Index < pBMCInfo->IpmiConfig.MaxChUsers; (*Index)++)
- // {
- // if ((pChUserInfo->UserId == userId) && ((pChUserInfo->ID == USER_ID )))
- // {
- // return pChUserInfo;
- // }
- // pChUserInfo++;
- // }
- // return NULL;
- //}
- ///*********************************************************************************************
- // Name : GetNVRChConfigs
- // Input : pChannelInfo -Channel Information
- // Filename - Channel Name Information
- // Output : Respective Channel's Information
- //This program returns information about the respective channel.
- //*********************************************************************************************/
- //ChannelInfo_T* GetNVRChConfigs(ChannelInfo_T *pChannelInfo, int BMCInst)
- //{
- // int i=0;
- // ChannelInfo_T *pNVRChInfo=NULL;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // for(i=0;i<MAX_NUM_CHANNELS;i++)
- // {
- // if( pBMCInfo->NVRChcfgInfo[i].ChType != 0xff)
- // {
- // pNVRChInfo = &pBMCInfo->NVRChcfgInfo[i].ChannelInfo;
- // if(pChannelInfo->ChannelNumber == pNVRChInfo->ChannelNumber)
- // {
- // return (ChannelInfo_T *)&pBMCInfo->NVRChcfgInfo[i].ChannelInfo;
- // }
- // }
- // }
- // return NULL;
- //}
- ///**
- //*@fn GetNVRChUserConfigs
- //*@brief This function is invoked to get NVR User informations of the channel
- //*@param pChannelInfo - Channel Information
- //*@param Filename - Size of the SDR repository
- //*@return Returns Address of user information for the channel on success
- //* Returns NULL on Failure
- //*/
- //ChannelUserInfo_T* GetNVRChUserConfigs(ChannelInfo_T *pChannelInfo, int BMCInst)
- //{
- // int i=0;
- // ChannelInfo_T *pNVRChInfo = NULL;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // for(i=0;i<MAX_NUM_CHANNELS;i++)
- // {
- // if(pBMCInfo->NVRChcfgInfo [i].ChType != 0xff)
- // {
- // pNVRChInfo = &pBMCInfo->NVRChcfgInfo[i].ChannelInfo;
- // if(pChannelInfo->ChannelNumber == pNVRChInfo->ChannelNumber)
- // {
- // return (ChannelUserInfo_T *)&pBMCInfo->NVRChcfgInfo[i].ChannelInfo.ChannelUserInfo[0];
- // }
- // }
- // }
- // return NULL;
- //}
- /*********************************************************************************************
- Name : getSessionInfo
- Input : Arg - Tells the type of data passed in Session
- Session - Either one of these: session ID, session handle, session index or
- channel number
- Output : Session Information
- This program returns the session information.
- *********************************************************************************************/
- //SessionInfo_T* getSessionInfo (uint8_t Arg, void *Session)
- //{
- // uint8_t Index;
- // uint8_t ActiveSesIndex = 0;
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // continue;
- // }
- // if (TRUE == pSessionTblInfo->SessionTbl[Index].Activated)
- // {
- // ActiveSesIndex++;
- // }
- // switch (Arg)
- // {
- // case SESSION_ID_INFO:
- // if(pSessionTblInfo->SessionTbl[Index].SessionID == *((uint32_t *)Session) )
- // {
- // return &pSessionTblInfo->SessionTbl[Index];
- // }
- // break;
- // case SESSION_REMOTE_INFO:
- // if(pSessionTblInfo->SessionTbl[Index].RemConSessionID == *((uint32_t *)Session) )
- // {
- // return &pSessionTblInfo->SessionTbl[Index];
- // }
- // break;
- // case SESSION_HANDLE_INFO:
- // if (pSessionTblInfo->SessionTbl[Index].SessionHandle == *(( uint8_t*)Session) && pSessionTblInfo->SessionTbl[Index].Activated)
- // {
- // //printf("---> SessionHandle = %#x\n",pSessionTblInfo->SessionTbl[Index].SessionHandle);
- // return &pSessionTblInfo->SessionTbl[Index];
- // }
- // break;
- // case SESSION_INDEX_INFO:
- // if (ActiveSesIndex == *(( uint8_t*)Session))
- // {
- // return &pSessionTblInfo->SessionTbl[Index];
- // }
- // break;
- // case SESSION_CHANNEL_INFO:
- // if (pSessionTblInfo->SessionTbl[Index].Channel == *(( uint8_t*)Session))
- // {
- // return &pSessionTblInfo->SessionTbl[Index];
- // }
- // break;
- // default:
- // return NULL;
- // }
- // }
- // return NULL;
- //}
- ///*********************************************************************************************
- // Name : AddChUser
- // Input : ChannelUserInfo
- // Output : Pointer to the free entry from the channel's user table.
- //This program returns the free entry from the channel's user table.
- //*********************************************************************************************/
- // ChannelUserInfo_T* AddChUser ( ChannelUserInfo_T* pChUserInfo, uint8_t* Index, int BMCInst)
- //{
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // *Index =0;
- // while (*Index <pBMCInfo->IpmiConfig.MaxChUsers)
- // {
- // if(FALSE == pChUserInfo->IPMIMessaging )
- // {
- // if(pChUserInfo->ID != USER_ID )
- // return pChUserInfo;
- // }
- // (*Index)++;
- // pChUserInfo++;
- // }
- // return NULL;
- //}
- ///*---------------------------------------
- // * GetSelTimeStamp
- // *---------------------------------------*/
- //uint32_t
- //GetTimeStamp(void)
- //{
- // return (htoipmi_u32 (GET_SYSTEM_TIME_STAMP()));
- //}
- ///*********************************************************************************************
- // Name : GetNumOfActiveSessions
- // Input : Nothing
- // Output : Number of active Sessions
- //This program returns the number of active session(s) from the session table
- //*********************************************************************************************/
- //uint8_t GetNumOfActiveSessions (int BMCInst)
- //{
- // uint8_t Index, Count = 0;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // continue;
- // }
- // if (pSessionTblInfo->SessionTbl[Index].Activated)
- // Count++;
- // }
- // return Count;
- //}
- ///*********************************************************************************************
- // Name : GetNumOfUsedSessions
- // Input : Nothing
- // Output : Number of used Sessions
- //This program returns the number of used session(s) from the session table
- //*********************************************************************************************/
- //uint8_t GetNumOfUsedSessions (int BMCInst)
- //{
- // uint8_t Index, Count = 0;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // continue;
- // }
- // Count++;
- // }
- // return Count;
- //}
- ///*********************************************************************************************
- // Name : CleanSession
- // Input : Nothing
- // Output : None
- //This program delete the oldest session filled but not activate
- //*********************************************************************************************/
- //uint8_t CleanSession(int BMCInst)
- //{
- // uint8_t Index;
- // OldSessionInfo_T OldSession;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // OldSession.Time=0xFFFFFFFF;
- // OldSession.Index= 0xFF;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (TRUE == pSessionTblInfo->SessionTbl[Index].Activated)
- // {
- // continue;
- // }
- // if(pSessionTblInfo->SessionTbl[Index].Time <OldSession.Time )
- // {
- // OldSession.Time=pSessionTblInfo->SessionTbl[Index].Time;
- // OldSession.Index=Index;
- // }
- // }
- // if(OldSession.Index !=0xFF)
- // {
- // pSessionTblInfo->SessionTbl[OldSession.Index].Used = FALSE;
- // pSessionTblInfo->Count--;
- // pSessionTblInfo->SessionTbl[OldSession.Index].Time=0xffffffff;
- // }else
- // {
- // return FALSE;
- // }
- // return TRUE;
- //}
- ///*********************************************************************************************
- // Name : DeleteSession
- // Input : pSessionInfo - session information
- // Output : Nothing
- //This program deletes the session from the session table
- //*********************************************************************************************/
- //void DeleteSession( SessionInfo_T* pSessionInfo,int BMCInst)
- //{
- // uint8_t Index;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // UserInfo_T* pUserInfo;
- // ChannelInfo_T * pChannelInfo;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // continue;
- // }
- // if (0 == _fmemcmp (&pSessionTblInfo->SessionTbl[Index], pSessionInfo , sizeof(SessionInfo_T)))
- // {
- // /* We have decrement the Active session only .If session is activated */
- // if(TRUE ==pSessionTblInfo->SessionTbl[Index].Activated)
- // {
- // if(!pSessionTblInfo->SessionTbl[Index].IsLoopBack)
- // {
- // pChannelInfo= getChannelInfo(pSessionInfo->Channel, BMCInst);
- // if(NULL == pChannelInfo)
- // {
- // TDBG("Failed to get channel info while Deleting Session for Channel: %d\n",pSessionInfo->Channel);
- // return;
- // }
- // if(pChannelInfo!=NULL)
- // pChannelInfo->ActiveSession--;
- // pUserInfo = getUserIdInfo (pSessionInfo->UserId, BMCInst);
- // if (pUserInfo != NULL) { pUserInfo->CurrentSession--; }
- // }
- // pSessionTblInfo->SessionTbl[Index].Activated=FALSE;
- // pSessionTblInfo->SessionTbl[Index].EventFlag = 0;
- // }
- // pSessionTblInfo->SessionTbl[Index].Used = FALSE;
- // pSessionTblInfo->Count--;
- // pSessionTblInfo->SessionTbl[Index].Time=0xFFFFFFFF;
- // IPMI_DBG_PRINT_3("DeleteSession: SessionID = %lX Num Session %X\t%x\n",
- // pSessionInfo->SessionID, pSessionTblInfo->Count,Index);
- //// Don't create a DEACTIVATE_SOL task again. This is already done in Deactivate Payload
- //// while communicate via freeipmi, it will send the Deactivate packet to the newly created session, so removed.
- //#if 0
- // if(pBMCInfo->IpmiConfig.SOLIfcSupport == 1)
- // {
- // if(pSessionInfo->SessPyldInfo [PAYLOAD_SOL].Type == PAYLOAD_SOL)
- // {
- // MsgPkt_T MsgPkt;
- // MsgPkt.Param = DEACTIVATE_SOL;
- // MsgPkt.Size = 0;
- // if( 0 != PostMsg (&MsgPkt, SOL_IFC_Q,BMCInst))
- // {
- // IPMI_WARNING ("AppDevice+.c : Error posting message to SOLIfc_Q\n");
- // }
- // }
- // }
- //#endif
- // return;
- // }
- // }
- // return;
- //}
- ///*********************************************************************************************
- // Name : AddSession
- // Input : pSessionInfo - session information
- // Output : Nothing
- //This program adds the session to the session table
- //*********************************************************************************************/
- //void AddSession ( SessionInfo_T* pSessionInfo, int BMCInst)
- //{
- // uint8_t Index;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // _fmemcpy (&pSessionTblInfo->SessionTbl[Index], ( uint8_t*)pSessionInfo, sizeof (SessionInfo_T));
- // pSessionTblInfo->SessionTbl[Index].Used = TRUE;
- // pSessionTblInfo->Count++;
- // pSessionTblInfo->SessionTbl[Index].Time= GetTimeStamp ();
- // pSessionTblInfo->SessionTbl[Index].TimeOutValue=pBMCInfo->IpmiConfig.SessionTimeOut;
- // IPMI_DBG_PRINT_3 ("AddSession: SessionID = %lX Num Session %X\t%x\n",pSessionInfo->SessionID, pSessionTblInfo->Count,Index);
- // break;
- // }
- // }
- //}
- ///*********************************************************************************************
- // Name : getPayloadActiveInst
- // Input : PayloadType
- // Output : Activated Instance information of a given payload type.
- //This program returns the information about the activated instances of a given payload type.
- //*********************************************************************************************/
- // uint16_t getPayloadActiveInst (uint8_t PayloadType,int BMCInst)
- //{
- // uint8_t PayloadIx;
- // uint8_t Index;
- // uint16_t ActivatedInst = 0;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // continue;
- // }
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Activated)
- // {
- // continue;
- // }
- // for (PayloadIx = 0; PayloadIx < MAX_PYLDS_SUPPORT; PayloadIx++)
- // {
- // if (pSessionTblInfo->SessionTbl[Index].SessPyldInfo [PayloadIx].Type == PayloadType)
- // {
- // ActivatedInst |= pSessionTblInfo->SessionTbl[Index].SessPyldInfo [PayloadIx].ActivatedInst;
- // }
- // }
- // }
- // return ActivatedInst;
- //}
- ///*********************************************************************************************
- // Name : getPayloadInstInfo
- // Input : Payloadtype, PayloadInst
- // Output : sessionID
- //This program returns the session ID of the session that was activated under the given payload
- //type and payload instance.
- //*********************************************************************************************/
- // uint32_t getPayloadInstInfo (uint8_t PayloadType, uint16_t PayloadInst, int BMCInst)
- //{
- // uint8_t PayloadIx;
- // uint8_t Index;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // SessionTblInfo_T* pSessionTblInfo = &pBMCInfo->SessionTblInfo;
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Used)
- // {
- // continue;
- // }
- // if (FALSE == pSessionTblInfo->SessionTbl[Index].Activated)
- // {
- // continue;
- // }
- // for (PayloadIx = 0; PayloadIx < MAX_PYLDS_SUPPORT; PayloadIx++)
- // {
- // if ((pSessionTblInfo->SessionTbl[Index].SessPyldInfo [PayloadIx].Type == PayloadType)
- // && (pSessionTblInfo->SessionTbl[Index].SessPyldInfo [PayloadIx].ActivatedInst & (1 << (PayloadInst - 1))))
- // {
- // return pSessionTblInfo->SessionTbl[Index].SessionID;
- // }
- // }
- // }
- // return 0;
- //}
- //static
- //MsgPkt_T m_MsgPkt = {
- // PARAM_IFC,
- // 0, /* Channel number not needed */
- // {0}, /* Source queue not needed */
- // CMD_PLATFORM_EVENT, /* Cmd */
- // (NETFN_SENSOR << 2),/* Net Function */
- // PRIV_LOCAL, /* Privilage */
- // 0, /* Session ID not needed */
- // 0,
- // WAIT_INFINITE,
- // 0,
- // {0}, /* IP Addr not needed */
- // 0, /* UDPPort not needed */
- // 0, /* Socket not needed */
- // sizeof(SELEventRecord_T) + sizeof (IPMIMsgHdr_T) + 1,
- // {
- // 0x20, /* Generator ID */
- // IPMI_EVM_REVISION, /* IPMI Version */
- // SENSOR_TYPE_SECUIRTY_VIOLATION,/*SensorType */
- // SECUIRTY_VIOLATION_SENSOR_NUMBER,
- // SENSOR_SPECIFIC_READ_TYPE,
- // PW_VIOLATION_OFFSET,
- // 0xff,
- // 0xff
- // },
- // };
- ///*--------------------------------------------------------------------------*
- //* PasswordViolation *
- //*--------------------------------------------------------------------------*/
- //void
- //PasswordViolation (int BMCInst)
- //{
- // /* Log the AC fail event to SEL & send an alert */
- // /* Post to Message Hndlr Queue */
- // PostMsg (&m_MsgPkt, MSG_HNDLR_Q,BMCInst);
- // return;
- //}
- ///*********************************************************************************************
- // Name : UDSSessionTimeOutTask
- // Input : void
- // Output : void
- // This program checks for UDS session timeout
- //*********************************************************************************************/
- //void UDSSessionTimerTask (int BMCInst)
- //{
- // uint8_t Index=0;
- // BMCInfo_t *pBMCInfo = &g_BMCInfo[BMCInst];
- // UDSSessionTblInfo_T *pUDSSessionTblInfo = &pBMCInfo->UDSSessionTblInfo;
- // for(Index=0;Index<pBMCInfo->IpmiConfig.MaxSession;Index++)
- // {
- // if(FALSE == pUDSSessionTblInfo->UDSSessionTbl[Index].Activated)
- // {
- // /* Continue until we find the Next Slot which is being used to reduce the timeout */
- // continue;
- // }
- // if((pUDSSessionTblInfo->UDSSessionTbl[Index].SessionTimeoutValue <= pBMCInfo->IpmiConfig.SessionTimeOut) && (pUDSSessionTblInfo->UDSSessionTbl[Index].SessionTimeoutValue != 0))
- // {
- // /* Reduce the Session Timeout Value if the session is not used */
- // pUDSSessionTblInfo->UDSSessionTbl[Index].SessionTimeoutValue--;
- // }
- // else if(pUDSSessionTblInfo->UDSSessionTbl[Index].SessionTimeoutValue <= 0)
- // {
- // DeleteUDSSession(&pUDSSessionTblInfo->UDSSessionTbl[Index],BMCInst);
- // }
- // }
- //}
- ///*********************************************************************************************
- // Name : GetUDSSessionInfo
- // Input : Session - session ID
- // Output : Session Information
- //This program returns the session information.
- //*********************************************************************************************/
- // UDSSessionTbl_T* GetUDSSessionInfo (uint8_t Type,void* Data,int BMCInst)
- //{
- // uint8_t Index;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // UDSSessionTblInfo_T* pUDSSessionTblInfo = &pBMCInfo->UDSSessionTblInfo;
- // for(Index=0;Index<pBMCInfo->IpmiConfig.MaxSession;Index++)
- // {
- // if(FALSE == pUDSSessionTblInfo->UDSSessionTbl[Index].Activated)
- // {
- // continue;
- // }
- // switch(Type)
- // {
- // case UDS_SESSION_ID_INFO:
- // if(*((uint32_t *)Data) == pUDSSessionTblInfo->UDSSessionTbl[Index].SessionID)
- // {
- // return &pUDSSessionTblInfo->UDSSessionTbl[Index];
- // }
- // break;
- // case UDS_SESSION_HANDLE_INFO:
- // if(*((uint8_t *)Data) == pUDSSessionTblInfo->UDSSessionTbl[Index].LoggedInSessionHandle)
- // {
- // return &pUDSSessionTblInfo->UDSSessionTbl[Index];
- // }
- // break;
- // case UDS_SESSION_INDEX_INFO:
- // if((*((uint8_t *)Data) < pBMCInfo->IpmiConfig.MaxSession) && ((Index) == *((uint8_t *)Data )))
- // {
- // return &pUDSSessionTblInfo->UDSSessionTbl[Index];
- // }
- // break;
- // case UDS_SOCKET_ID_INFO:
- // if(*((int *)Data) == pUDSSessionTblInfo->UDSSessionTbl[Index].UDSSocket)
- // {
- // return &pUDSSessionTblInfo->UDSSessionTbl[Index];
- // }
- // break;
- // default:
- // break;
- // }
- // }
- // return NULL;
- //}
- ///*********************************************************************************************
- // Name : AddUDSSession
- // Input : pUDSSessionInfo - session information
- // Output : return 0 on success ,-1 on failure
- //This program adds the session to the UDS session table
- //*********************************************************************************************/
- //int AddUDSSession ( UDSSessionTbl_T* pUDSSessionInfo, int BMCInst)
- //{
- // uint8_t Index;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // UDSSessionTblInfo_T* pUDSSessionTblInfo = &pBMCInfo->UDSSessionTblInfo;
- // /* Acquire the UDS Session Mutex Lock */
- // OS_THREAD_MUTEX_ACQUIRE(&pBMCInfo->UDSSessionTblMutex, WAIT_INFINITE);
- // for (Index = 0; Index < pBMCInfo->IpmiConfig.MaxSession; Index++)
- // {
- // if(TRUE == pUDSSessionTblInfo->UDSSessionTbl[Index].Activated)
- // {
- // /* Continue Inorder to get the next Free Slot in UDS Session Table */
- // continue;
- // }
- // /* Copy the Session Information to Global BMC Info UDS Session Table */
- // _fmemcpy (&pUDSSessionTblInfo->UDSSessionTbl[Index], ( uint8_t*)pUDSSessionInfo, sizeof (UDSSessionTbl_T));
- // pUDSSessionTblInfo->SessionCount++;
- // pUDSSessionTblInfo->UDSSessionTbl[Index].LoggedInTime = GetTimeStamp ();
- // pUDSSessionTblInfo->UDSSessionTbl[Index].SessionTimeoutValue = pBMCInfo->IpmiConfig.SessionTimeOut;
- // break;
- // }
- // /* Release the UDS Session Mutex Lock */
- // OS_THREAD_MUTEX_RELEASE(&pBMCInfo->UDSSessionTblMutex);
- // if(Index == pBMCInfo->IpmiConfig.MaxSession)
- // {
- // IPMI_WARNING("Add Session Failed for UDS\n");
- // return -1;
- // }
- // return 0;
- //}
- ///*********************************************************************************************
- // Name : DeleteUDSSession
- // Input : pUDSSessionInfo - session information
- // Output : return 0 on success,-1 on failure
- //This program deletes the session from the UDS session table
- //*********************************************************************************************/
- //int DeleteUDSSession( UDSSessionTbl_T *pUDSSessionInfo,int BMCInst)
- //{
- // uint8_t Index;
- // BMCInfo_t* pBMCInfo = &g_BMCInfo[BMCInst];
- // UDSSessionTblInfo_T* pUDSSessionTblInfo = &pBMCInfo->UDSSessionTblInfo;
- // /* Acquire the UDS Session Mutex Lock */
- // OS_THREAD_MUTEX_ACQUIRE(&pBMCInfo->UDSSessionTblMutex, WAIT_INFINITE);
- // for(Index=0;Index<pBMCInfo->IpmiConfig.MaxSession;Index++)
- // {
- // if(FALSE == pUDSSessionTblInfo->UDSSessionTbl[Index].Activated)
- // {
- // /* Continue to get the Next Occupied Session Slot in UDS Session Slot*/
- // continue;
- // }
- // if (0 == _fmemcmp (&pUDSSessionTblInfo->UDSSessionTbl[Index], pUDSSessionInfo , sizeof(UDSSessionTbl_T)))
- // {
- // /* Resetting the UDS Session Table Slot as the session is no longer required */
- // pUDSSessionTblInfo->UDSSessionTbl[Index].Activated = FALSE;
- // pUDSSessionTblInfo->UDSSessionTbl[Index].LoggedInTime = 0xFFFFFFFF;
- // pUDSSessionTblInfo->UDSSessionTbl[Index].SessionTimeoutValue = 0;
- // pUDSSessionTblInfo->UDSSessionTbl[Index].LoggedInUserID = 0;
- // pUDSSessionTblInfo->UDSSessionTbl[Index].LoggedInChannel = 0xFF;
- // pUDSSessionTblInfo->UDSSessionTbl[Index].LoggedInPrivilege = 0xFF;
- // pUDSSessionTblInfo->SessionCount--;
- // break;
- // }
- // }
- // /* Release the UDS Session Mutex Lock */
- // OS_THREAD_MUTEX_RELEASE(&pBMCInfo->UDSSessionTblMutex);
- // if(Index == pBMCInfo->IpmiConfig.MaxSession)
- // {
- // IPMI_WARNING("Delete Session Failed for UDS\n");
- // return -1;
- // }
- // return 0;
- //}
- ///*---------------------------------------------------
- // * @fn UpdateGetMsgTime
- // * @brief Updates the Current Uptime and timeout value
- // * for an IPMI Message
- // *
- // * @param pReq : IPMI Message Packet
- // * @param ResTimeOut : Timeout Macro string
- // * @param BMCInst : BMC Instance
- // *
- // * @return none
- // *----------------------------------------------------*/
- //void UpdateGetMsgTime (MsgPkt_T* pReq,IfcType_T IfcType, int BMCInst)
- //{
- // pReq->ReqTime = 0;
- // pReq->ResTimeOut = WAIT_INFINITE;
- // if( g_corefeatures.ipmi_res_timeout == ENABLED )
- // {
- // int i;
- // struct sysinfo sys_info;
- //
- // for( i = 0; i < TOTAL_INFINITE_CMDS; i++)
- // {
- // if( NET_FN(pReq->NetFnLUN) == m_InfiniteCmdsTbl[i].NetFn && pReq->Cmd == m_InfiniteCmdsTbl[i].Cmd )
- // {
- // return;
- // }
- // }
- //
- // if(g_PDKCmdsHandle[PDKCMDS_PDKISINFINITECOMMAND] != NULL)
- // {
- // if( ((BOOL(*)(uint8_t,uint8_t))g_PDKCmdsHandle[PDKCMDS_PDKISINFINITECOMMAND])(NET_FN(pReq->NetFnLUN), pReq->Cmd))
- // {
- // return;
- // }
- // }
- //
- // /* Request UpTime */
- // if(!sysinfo(&sys_info))
- // {
- // pReq->ReqTime = sys_info.uptime;
- // if(IfcType == IPMB_IFC)
- // {
- // pReq->ResTimeOut = g_coremacros.ipmb_res_timeout;
- // }
- // else if(IfcType == LAN_IFC)
- // {
- // pReq->ResTimeOut = g_coremacros.lan_res_timeout;
- // }
- // else if(IfcType == KCS_IFC)
- // {
- // pReq->ResTimeOut = g_coremacros.kcs_res_timeout;
- // }
- // else if(IfcType == SERIAL_IFC)
- // {
- // pReq->ResTimeOut = g_coremacros.serial_res_timeout;
- // }
- // }
- // }
- //}
- ///*---------------------------------------------------
- // * @fn IsMsgTimedOut
- // * @brief Checks if the time taken to process
- // * the IPMI Command expires
- // *
- // * @param pReq : IPMI Message Packet
- // *
- // * @return 1 if timed out
- // * 0 if error or timeout not set
- // *----------------------------------------------------*/
- //BOOL IsMsgTimedOut (MsgPkt_T* pReq)
- //{
- // struct sysinfo sys_info;
- //
- // if( pReq->ReqTime && (!sysinfo(&sys_info)) )
- // {
- // return ( (sys_info.uptime - pReq->ReqTime) > pReq->ResTimeOut) ? TRUE : FALSE;
- // }
- //
- // return FALSE;
- //}
- ///*-----------------------------------------------------
- // * @fn IsResponseMatch
- // * @brief Checks if the Response Message corresponds to
- // * the Request Message
- // *
- // * @param pReq : IPMI Request Message Packet
- // * @param pRes : IPMI Response Message Packet
- // *
- // * @return 1 if match
- // * 0 if mismatch
- // *----------------------------------------------------*/
- //BOOL IsResponseMatch (MsgPkt_T* pReq, MsgPkt_T* pRes)
- //{
- // if( ( ((((IPMIMsgHdr_T*)pRes->Data)->RqSeqLUN) >> 2) != ((((IPMIMsgHdr_T*)pReq->Data)->RqSeqLUN) >> 2) ) &&
- // ( (pReq->NetFnLUN & 0x4) && (NO_RESPONSE != pRes->Param) ) )
- // {
- // return FALSE;
- // }
- //
- // return TRUE;
- //}
- /*-------------------------------------------------------
- * @fn FillIPMIResFailure
- * @brief Frames the Response packet when the time taken
- * to process an IPMI Command expires
- *
- * @param pReq : IPMI Request Message Packet
- * @param pRes : IPMI Response Message Packet
- * BMCInst : BMC Instance Number
- *
- * @return none
- *------------------------------------------------------*/
- void FillIPMIResFailure ( MsgPkt_T* pReq, MsgPkt_T* pRes)
- {
- /* Set the Cmd and Net function in response packet */
- pRes->Cmd = pReq->Cmd;
- pRes->NetFnLUN = pReq->NetFnLUN & 0xFC;
-
- /* Normal IPMI Command response */
- pRes->Param = PARAM_NORMAL_RESPONSE;
-
-
- pRes->Size = sizeof (IPMIMsgHdr_T) + sizeof (uint8_t);
- pRes->Data[sizeof (IPMIMsgHdr_T)] = CC_TIMEOUT;
-
- /* Check for Request Message */
- if (0 == (pReq->NetFnLUN & 0x04))
- {
- /* Swap the header and copy in response */
- SwapIPMIMsgHdr (( IPMIMsgHdr_T*)pReq->Data, ( IPMIMsgHdr_T*)pRes->Data);
-
- /* Calculate Checksum 2 */
- pRes->Data[pRes->Size] = CalculateCheckSum2 (pRes->Data, pRes->Size);
- pRes->Size++;
- }
- }
|