Przeglądaj źródła

dashboard login ok

zhangbo 3 lat temu
rodzic
commit
da59d7ed5a

+ 0 - 1
app/bmc/msghndlr/Storlead/Storlead.c

@@ -491,7 +491,6 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 
                 if(ResPkt.Data[0] == 0)
                 {
-                    printf("enter here! \n");
                     gBladeStatus[index].healthStatus = ResPkt.Data[1];
                     memcpy(gBladeStatus[index].bladeName, &ResPkt.Data[2], 31);
                     gBladeStatus[index].slotID = ResPkt.Data[33];

+ 4 - 4
app/goahead-3.6.5/src/goahead.c

@@ -128,14 +128,14 @@ MAIN(goahead, int argc, char **argv, char **envp)
     }
  //   printf("---> initPlatform\n");
     initPlatform(); //注册信号
-    printf("---> websOpen\n");
+ //   printf("---> websOpen\n");
 //    printf(">>>>>>>>>>>>>>>>>>>>>>>>>>2>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
     if (websOpen(documents, route) < 0) {
         error("Cannot initialize server. Exiting.");
         return -1;
     }
 #if ME_GOAHEAD_AUTH
-    printf("---> websLoad\n");
+//    printf("---> websLoad\n");
     if (websLoad(auth) < 0) {
         error("Cannot load %s", auth);
         return -1;
@@ -145,7 +145,7 @@ MAIN(goahead, int argc, char **argv, char **envp)
     if (argind < argc) {
         while (argind < argc) {
             endpoint = argv[argind++];
-            printf("---> websListen log1\n");
+//            printf("---> websListen log1\n");
             if (websListen(endpoint) < 0) {
                 return -1;
             }
@@ -156,7 +156,7 @@ MAIN(goahead, int argc, char **argv, char **envp)
 #if !ME_COM_SSL
             if (strstr(endpoint, "https")) continue;
 #endif
-            printf("---> websListen log2\n");
+//            printf("---> websListen log2\n");
             if (websListen(endpoint) < 0) {
                 wfree(endpoints);
                 return -1;

+ 1 - 1
app/goahead-3.6.5/src/goahead.h

@@ -133,7 +133,7 @@ PUBLIC int websParseArgs(char *args, char **argv, int maxArgc);
 
 /************************************ Tunables ********************************/
 
-#define WEBS_MAX_LISTEN     8           /**< Maximum number of listen endpoints */
+#define WEBS_MAX_LISTEN     64  //8           /**< Maximum number of listen endpoints */
 #define WEBS_SMALL_HASH     31          /**< General small hash size */
 #define WEBS_MAX_PASSWORD   32          /**< Default maximum password */
 

+ 4 - 62
app/goahead-3.6.5/src/http.c

@@ -295,6 +295,7 @@ PUBLIC void websClose()
     Webs    *wp;
     int     i;
 
+printf("%s %d ---> websClose()\n", __FILE__, __LINE__);
     websCloseRoute();
 #if ME_GOAHEAD_AUTH
     websCloseAuth();
@@ -611,12 +612,12 @@ PUBLIC int websListen(char *endpoint)
     assert(endpoint && *endpoint);
 
     if (listenMax >= WEBS_MAX_LISTEN) {
-        error("Too many listen endpoints");
+        printf("Too many listen endpoints");
         return -1;
     }
     socketParseAddress(endpoint, &ip, &port, &secure, 80);
     if ((sid = socketListen(ip, port, websAccept, 0)) < 0) {
-        error("Unable to open socket on port %d.", port);
+        printf("Unable to open socket on port %d.", port);
         return -1;
     }
     sp = socketPtr(sid);
@@ -634,7 +635,7 @@ PUBLIC int websListen(char *endpoint)
     } else {
         ipaddr = "*";
     }
-    logmsg(2, "Started %s://%s:%d", secure ? "https" : "http", ipaddr, port);
+    printf("Started %s://%s:%d", secure ? "https" : "http", ipaddr, port);
 
     if (!websHostUrl) {
         if (port == 80) {
@@ -2384,65 +2385,6 @@ static int get_local_ip(const char *eth_inf, char *ip)
 
 static int setLocalHost()
 {
-//     struct in_addr  intaddr;
-//     char            host[128], *ipaddr;
-
-//     if (gethostname(host, sizeof(host)) < 0) {
-//         error("Cannot get hostname: errno %d", errno);
-//         return -1;
-//     }
-// #if VXWORKS
-//     intaddr.s_addr = (ulong) hostGetByName(host);
-//     ipaddr = inet_ntoa(intaddr);
-//     websSetIpAddr(ipaddr);
-//     websSetHost(ipaddr);
-//     #if _WRS_VXWORKS_MAJOR < 6
-//         free(ipaddr);
-//     #endif
-// #elif ECOS
-//     ipaddr = inet_ntoa(eth0_bootp_data.bp_yiaddr);
-//     websSetIpAddr(ipaddr);
-//     websSetHost(ipaddr);
-// #elif TIDSP
-// {
-//     struct hostent  *hp;
-//     if ((hp = gethostbyname(host)) == NULL) {
-//         error("Cannot get host address for host %s: errno %d", host, errno);
-//         return -1;
-//     }
-//     memcpy((char*) &intaddr, (char *) hp->h_addr[0], (size_t) hp->h_length);
-//     ipaddr = inet_ntoa(intaddr);
-//     websSetIpAddr(ipaddr);
-//     websSetHost(ipaddr);
-// }
-// #elif MACOSX
-// {
-//     struct hostent  *hp;
-//     if ((hp = gethostbyname(host)) == NULL) {
-//         if ((hp = gethostbyname(sfmt("%s.local", host))) == NULL) {
-//             error("Cannot get host address for host %s: errno %d", host, errno);
-//             return -1;
-//         }
-//     }
-//     memcpy((char*) &intaddr, (char *) hp->h_addr_list[0], (size_t) hp->h_length);
-//     ipaddr = inet_ntoa(intaddr);
-//     websSetIpAddr(ipaddr);
-//     websSetHost(ipaddr);
-// }
-// #else
-// {
-//     struct hostent  *hp;
-//     if ((hp = gethostbyname(host)) == NULL) {
-//         error("Cannot get host address for host %s: errno %d", host, errno);
-//         return -1;
-//     }
-//     memcpy((char*) &intaddr, (char *) hp->h_addr_list[0], (size_t) hp->h_length);
-//     ipaddr = inet_ntoa(intaddr);
-//     websSetIpAddr(ipaddr);
-//     websSetHost(ipaddr);
-// }
-// #endif
-
     char    ipaddr[16];
     get_local_ip("eth0", ipaddr);
     websSetIpAddr(ipaddr);

+ 3 - 1
app/goahead-3.6.5/src/socket.c

@@ -51,9 +51,10 @@ PUBLIC int socketOpen()
     socketHighestFd = -1;
     if ((fd = socket(AF_INET6, SOCK_STREAM, 0)) != -1) {
         hasIPv6 = 1;
+        printf("%s %d ---> closesocket\n", __FILE__, __LINE__);
         closesocket(fd);
     } else {
-        trace(1, "This system does not have IPv6 support");
+        printf("This system does not have IPv6 support");
     }
     return 0;
 }
@@ -941,6 +942,7 @@ PUBLIC void socketFree(int sid)
         if (shutdown(sp->sock, SHUT_RDWR) >= 0) {
             while (recv(sp->sock, buf, sizeof(buf), 0) > 0) {}
         }
+        printf("%s %d ---> closesocket %d\n", __FILE__, __LINE__, sp->sock);
         closesocket(sp->sock);
     }
     wfree(sp->ip);

+ 1 - 1
app/goahead-3.6.5/src/upload.c

@@ -224,7 +224,7 @@ static void processUploadHeader(Webs *wp, char *line)
             } else if (scaselesscmp(key, "name") == 0) {
                 wfree(wp->uploadVar);
                 wp->uploadVar = sclone(value);
-                printf("log1: name: %s\n", wp->uploadVar);
+//                printf("log1: name: %s\n", wp->uploadVar);
             } else if (scaselesscmp(key, "filename") == 0) {
                 if (wp->uploadVar == 0) {
                     websError(wp, HTTP_CODE_BAD_REQUEST, "Bad upload state. Missing name field");

+ 6 - 82
app/goahead-3.6.5/src/web_interface/src/dashboard.c

@@ -27,6 +27,8 @@ void getDeviceInfo(Webs *wp){
     char MacAddr[18] = {0};
     char IpAddr[16] = {0};
 
+    printf("---> getSensorInfo, wp.index = %d\n", wp->index);
+    
     //Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
@@ -118,6 +120,7 @@ void getSysInfo(Webs *wp){
     IPMI20_UDS_SESSION_T    UDSSession;
 
 
+    printf("---> getSysInfo, wp.index = %d\n", wp->index);
     sysInfo.title = walloc(MAX_TITLE_LEN);
     if(sysInfo.title == NULL)
     {
@@ -208,6 +211,7 @@ void getSensorInfo(Webs *wp){
     unsigned char *pStartBuff = NULL;
     IPMI20_UDS_SESSION_T    UDSSession;
     
+    printf("---> getSensorInfo, wp.index = %d\n", wp->index);
     //Create session
     LIBIPMI_CreateSession(&UDSSession, 10000);
    
@@ -238,7 +242,7 @@ void getSensorInfo(Webs *wp){
         memset(pSensorBuff, 0, nSensors * sizeof(struct sensor_data));
         pStartBuff = (unsigned char *)pSensorBuff;
 
-        printf("sensorcount = %d\n", nSensors);
+        //printf("sensorcount = %d\n", nSensors);
         nSensors -= 1;  //remove first sdr
         wRet = LIBIPMI_HL_GetAllSensorReadings(&UDSSession,pSensorBuff, nSensors,DEFAULT_TIMEOUT);
         
@@ -258,7 +262,6 @@ void getSensorInfo(Webs *wp){
             cJSON * root =  cJSON_CreateObject();
             cJSON  *pJsonArry,*pJsonsub;
             pJsonArry=cJSON_CreateArray();   /*创建数组*/
-            logmsg(2, "-----------------------sensor----------------------");
             while(nSensors)
             {
                 sprintf(reading, "%.3f", pSensorBuff->sensor_reading);
@@ -275,17 +278,7 @@ void getSensorInfo(Webs *wp){
                 cJSON_AddNumberToObject(pJsonsub, "sensorNum", pSensorBuff->sensor_num); 
                 cJSON_AddStringToObject(pJsonsub, "sensorName", pSensorBuff->sensor_name);
 
-                //cJSON_AddNumberToObject(pJsonsub, "ownerId",    pSensorBuff->owner_id);
-                //cJSON_AddNumberToObject(pJsonsub, "ownerNun",   pSensorBuff->owner_lun);
-                //cJSON_AddNumberToObject(pJsonsub, "sensorType", pSensorBuff->sensor_type);
-                // cJSON_AddNumberToObject(pJsonsub, "sensorUnits1", pSensorBuff->sensor_units[0]);
-                // cJSON_AddNumberToObject(pJsonsub, "sensorUnits2", pSensorBuff->sensor_units[1]);
-                // cJSON_AddNumberToObject(pJsonsub, "sensorUnits3", pSensorBuff->sensor_units[2]);
-
-                //cJSON_AddNumberToObject(pJsonsub, "rawReading", pSensorBuff->raw_reading);
-                //cJSON_AddNumberToObject(pJsonsub, "sensorState", pSensorBuff->sensor_state);
-                //cJSON_AddNumberToObject(pJsonsub, "discreteState", pSensorBuff->discrete_state);
-                //cJSON_AddNumberToObject(pJsonsub, "SensorAccessibleFlags", pSensorBuff->SensorAccessibleFlags); 
+            
                 cJSON_AddStringToObject(pJsonsub, "reading", reading);      /* 给对象增加内容 */    
                 cJSON_AddStringToObject(pJsonsub, "lownr", lownr);                                        
                 cJSON_AddStringToObject(pJsonsub, "lowct", lowct);   
@@ -401,49 +394,6 @@ void actionTest(Webs *wp)
         wfree(name);
     if(age)
         wfree(age);
-    // IPMI20_UDS_SESSION_T    UDSSession;
-    // GetDevIDRes_T   DeviceID;
-
-    // //Create session
-    // LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
-    // LIBIPMI_IPMC_GetDeviceID(&UDSSession, 0x8a, &DeviceID, DEFAULT_TIMEOUT);
-
-    // //Close session
-    // LIBIPMI_CloseSession(&UDSSession );
-
-
-    // char *pStr;
-
-    // cJSON * root =  cJSON_CreateObject();
-    // cJSON * data =  cJSON_CreateObject();
-    // cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    // cJSON_AddStringToObject(root, "msg", "");
-    // cJSON_AddNumberToObject(root, "code", 200);
-   
-    // cJSON_AddNumberToObject(data, "DeviceID", DeviceID.DeviceID);
-    // cJSON_AddNumberToObject(data, "DevRevision", DeviceID.DevRevision);
-    // cJSON_AddNumberToObject(data, "FirmwareRevision1", DeviceID.FirmwareRevision1);
-    // cJSON_AddNumberToObject(data, "FirmwareRevision2", DeviceID.FirmwareRevision2);
-    // cJSON_AddNumberToObject(data, "IPMIVersion", DeviceID.IPMIVersion);
-    // cJSON_AddNumberToObject(data, "DevSupport", DeviceID.DevSupport);
-    // cJSON_AddNumberToObject(data, "MfgID", DeviceID.MfgID[0]<<24 | DeviceID.MfgID[1]<<16 | DeviceID.MfgID[2]<<8 | DeviceID.MfgID[3]);
-    // cJSON_AddNumberToObject(data, "ProdID", DeviceID.ProdID);
-    // cJSON_AddNumberToObject(data, "AuxFirmwareRevision", DeviceID.AuxFirmwareRevision);
-
-    // pStr = cJSON_PrintUnformatted(root);
-
-    // printf("%s\n", pStr);
-    // websSetStatus(wp, 200);
-    // websWriteHeaders(wp, -1, 0);
-    // websWriteEndHeaders(wp);
-    // websWrite(wp,"%s", pStr);
-    // websFlush(wp, 0);
-    // websDone(wp);
-
-    // if(pStr)
-    //     wfree(pStr);
-    // if(root)
-    //     cJSON_Delete(root);
 
     
 }
@@ -505,35 +455,9 @@ void getAllBladeInfo(Webs *wp){
 }
 
 void setBladeManage(Webs *wp){
-    // uint16_t    wRet = LIBIPMI_E_SUCCESS;
-    // IPMI20_UDS_SESSION_T    UDSSession;
-
     char *strEnable = websGetVar(wp, "enable", NULL);
 
     gChassisManageEn = atoi(strEnable);
-
-    // if(enable > 1)
-    // {
-    //     websError(wp, 404, "Invalid param");
-    //     return ;
-    // } 
-    
-
-    // //Create session
-    // LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
-
-    // wRet = LIBIPMI_HL_SetBladeManageFn(&UDSSession, enable, DEFAULT_TIMEOUT);
-    // if(wRet != 0)
-    // {
-    //     printf("Set Blade Manage error!\n");
-    //     websError(wp, 404, "Set Blade Manage Error!");
-    //     LIBIPMI_CloseSession(&UDSSession );
-    //     return;
-    // }
-
-    // //Close session
-    // LIBIPMI_CloseSession(&UDSSession );
-
     
     char *pStr;
     cJSON * root =  cJSON_CreateObject();

+ 0 - 3
app/goahead-3.6.5/src/web_interface/src/user.c

@@ -284,10 +284,7 @@ void checkLoginStatus(Webs *wp){
     cJSON_AddStringToObject(root, "msg", "");
     cJSON_AddNumberToObject(root, "code", 200);
     cJSON_AddStringToObject(data, "loginStatus", loginStatus);
-   printf("---> come Str:\n");
     pStr = cJSON_PrintUnformatted(root);
-
-    printf("---> cJSON Str:\n%s\n", pStr);
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);