Explorar o código

1、添加hypertec客户配置
2、解决ip不显示的问题

guohui %!s(int64=2) %!d(string=hai) anos
pai
achega
aec4edb6da
Modificáronse 5 ficheiros con 49 adicións e 18 borrados
  1. BIN=BIN
      cust_data/logo/logo_hypertec.png
  2. BIN=BIN
      output/t113i/usr/sbin/smartUPG
  3. 14 0
      pro/config/cfg.h
  4. 28 18
      pro/src/netswitch.c
  5. 7 0
      pub

BIN=BIN
cust_data/logo/logo_hypertec.png


BIN=BIN
output/t113i/usr/sbin/smartUPG


+ 14 - 0
pro/config/cfg.h

@@ -24,6 +24,7 @@
 //#define CUST_GOM037     //xian
 //#define CUST_USASL
 #define CUST_ANDERSON
+//#define CUST_HYPERTEC
 
 
 #ifdef CUST_GOM037      //xian
@@ -63,6 +64,19 @@
     #define MAX_CHN_COUNT               24
 #endif
 
+
+#ifdef CUST_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT                 6
+    #define CHANNEL_DELAY_SEC               6
+#endif
+
+
+
 ////////////////////////////////////////////////////
 
 

+ 28 - 18
pro/src/netswitch.c

@@ -502,6 +502,7 @@ static int sw_get(netswitch_info_t *sw)
     int r=-1;
     int i,j,find=0;
     char temp[200];
+    char *p,*pstr,*tok;
     netswitch_info_t tmp;
     netsnmp_variable_list *var,*pvar;
     ns_handle_t *h=&nsHandle;
@@ -545,8 +546,6 @@ static int sw_get(netswitch_info_t *sw)
     char *dot1dTpFdbEntryOid="1.3.6.1.2.1.17.4.3.1";
     var = snmp_getbulk(SNMP_VERSION_2c, "public", h->host_ip, dot1dTpFdbEntryOid);
     if(var) {
-        char *tok;
-
         sw_init(&tmp);
 
         i = j = 0;
@@ -557,7 +556,7 @@ static int sw_get(netswitch_info_t *sw)
 
                 if(strstr(pstr, "2.17.4.3.1.1") || strstr(pstr, "3.6.1.2.1.17.4.3.1.1")) {  //mac
                     tok = "Hex-STRING: ";
-                    char *p=strstr(pstr, tok);
+                    p = strstr(pstr, tok);
                     if(p) {
                         p += strlen(tok);
                         get_mac(p, tmp.port[i].mac);
@@ -569,7 +568,7 @@ static int sw_get(netswitch_info_t *sw)
 
                 if(strstr(pstr, "2.17.4.3.1.2") || strstr(pstr, "3.6.1.2.1.17.4.3.1.2")) {  //port
                     tok = "INTEGER: ";
-                    char *p=strstr(pstr, tok);
+                    p = strstr(pstr, tok);
                     if(p) {
                         p += strlen(tok);
                         tmp.port[j].id = atoi(p) - h->port_start;
@@ -602,19 +601,17 @@ static int sw_get(netswitch_info_t *sw)
     char *ipNetToMediaEntryOid="1.3.6.1.2.1.4.22.1";
     var = snmp_getbulk(SNMP_VERSION_2c, "public", h->host_ip, ipNetToMediaEntryOid);
     if(var) {
-        char *tok=NULL;
-
         sw_init(&tmp);
 
         i = j = 0;
         for (pvar=var; pvar; pvar=pvar->next_variable) {
-            char *pstr = get_string(pvar);
+            pstr = get_string(pvar);
             if(pstr) {
                 //LOGD("__2__%s\n", pstr);
 
                 if(strstr(pstr, "ipNetToMediaPhysAddress")) {  //mac addr
                     tok = "STRING: ";
-                    char *p=strstr(pstr, tok);
+                    p = strstr(pstr, tok);
                     if(p) {
                         p += strlen(tok);
                         get_mac(p, tmp.port[i].mac);
@@ -623,19 +620,32 @@ static int sw_get(netswitch_info_t *sw)
                         i++;
                     }
                 }
-                else if(strstr(pstr, "3.6.1.2.1.4.22.1.2")) {
-                    tok = "Hex-STRING: ";
-                    char *p=strstr(pstr, tok);
+                else {
+                    tok = "3.6.1.2.1.4.22.1.2.";
+                    p = strstr(pstr, tok);
                     if(p) {
+                        char *tok1 = " =";
+                        char *tok2 = "Hex-STRING: ";
+
                         p += strlen(tok);
-                        get_mac(p, tmp.port[i].mac);
-                        //LOGD("__%d__ %s\n", i, tmp.port[i].mac);
+                        p = strstr(p, ".")+1;
 
-                        i++;
+                        char *p1=strstr(p, tok1);
+                        char *p2=strstr(p, tok2);
+                        if(p1 && p2) { 
+                            memcpy(tmp.port[i].ip, p, p1-p);
+                            tmp.port[i].ip[p1-p] = 0;
+
+                            p2 += strlen(tok2);
+                            get_mac(p2, tmp.port[i].mac);
+
+                            LOGD("__%d__ %s, %s\n", i, tmp.port[i].mac, tmp.port[i].ip);
+                            i++;
+                        }
                     }
                 }
 
-                if(strstr(pstr, "ipNetToMediaNetAddress") || strstr(pstr, "3.6.1.2.1.4.22.1.3")) {  //ip addr
+                if(strstr(pstr, "ipNetToMediaNetAddress")) {  //ip addr
                     tok = "IpAddress: ";
                     char *p=strstr(pstr, tok);
                     if(p) {
@@ -662,17 +672,17 @@ static int sw_get(netswitch_info_t *sw)
     }
 #endif
 
-#if 1
+#if 0
     char *ifEntry="1.3.6.1.2.1.2.2.1.8";
     for(i=0; i<SW_PORT_MAX; i++) {
         sprintf(temp, "%s.%d", ifEntry, i+h->port_start);
         var = snmp_get(SNMP_VERSION_2c, "public", h->host_ip, temp);
         if(var) {
             int id;
-            char *p,*tok="ifOperStatus.";
+            tok = "ifOperStatus.";
 
             for (pvar=var; pvar; pvar=pvar->next_variable) {
-                char *pstr = get_string(pvar);
+                pstr = get_string(pvar);
                 if(pstr) {
                     //LOGD("__3__%s\n", pstr);
 

+ 7 - 0
pub

@@ -7,6 +7,7 @@
 #  7:  NEUTER_CN
 #  8:  ANDERSON_EN
 #  9:  USA_SL
+# 10:  HYPERTEC_EN
 
 cust=8
 
@@ -86,6 +87,12 @@ function do_copy()
         #cp -f $custdir/db/ac_i3_o1_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/db/ac_i3_o3_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
+    elif [ $cust -eq 10 ]; then
+        rm -rf  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        
+        cp -f $custdir/db/ac_i3_o1_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/logo/logo_hypertec.png $curdir/output/t113i/root/run/app/image/logo.png
     else
         echo error!  customer value is wrong!!!
         exit 1