Changeset 3280 in genesis for tools/nodechk/nodechk.c
- Timestamp:
- Nov 22, 2004, 11:51:17 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/nodechk/nodechk.c
r3278 r3280 6 6 // Nodechck - Programma om wleiden.conf files te lezen 7 7 // en te vergelijken met actuele informatie uit de nodes 8 // 9 // Rev.0.5 23/11/2004 RO 10 // Fout verbeterd: 172.1.1.223 en 172.1.1.22 werden gelijk geacht, zodat lijsten niet klopten 11 // Uitvoer uit nodes aan alle lijsten gekoppeld 12 // Lijst toegevoegd: outputs1.csv, uitgaande van nodeuitvoer, waaraan genesis data toegevoegd is. 8 13 // 9 14 // Rev.0.4 22/11/2004 RO … … 154 159 void MaakCSV(int code); 155 160 void MaakCSV2(int code); 161 void MaakCSV3(int code); 156 162 void MaakIpOverzicht(void); 157 163 void AddKomma(void); … … 254 260 sprintf(buf,"\naantal nodes: %i\n\r",NodeTeller); 255 261 printf(buf); 256 MaakCSV(1);257 262 258 263 if (hConf=fopen("confs","r")) … … 261 266 fclose(hConf); 262 267 } 268 MaakCSV(1); 263 269 MaakIpOverzicht(); 270 MaakCSV3(1); 264 271 265 272 return 0; … … 793 800 strcpy(buf,"Current data from nodes");AddTekst();AddKomma(); 794 801 fwrite( "\n", sizeof( char ), 1, hConf ); 795 802 796 803 for (i=0;i<CardTeller;i++) 797 804 { … … 801 808 { //extra lege regel 802 809 if (CompareIp(&(pCd->ipstart),&((pCd-1)->ipstart))||CompareIp(&(pCd->ipend),&((pCd-1)->ipend))) 803 fwrite( "\n", sizeof( char ), 1, hConf );810 fwrite( "\n", sizeof( char ), 1, hConf ); 804 811 } 805 812 fwrite( pCN->status, sizeof( char ), strlen(pCN->status), hConf );AddKomma(); … … 824 831 int j; 825 832 IFOUTPUT *pIO; 833 char tbuf[30]; 834 strcpy(tbuf,pCd->ip); 835 for (j=0;j<strlen(pCd->ip);j++) 836 { 837 if (tbuf[j]=='/') tbuf[j]='\0'; 838 } 826 839 for (j=0;j<IfOutputTeller;j++) 827 840 { 828 pIO=&IfOutput[j]; 829 if ( !memcmp(pIO->ip,pCd->ip,strlen(pIO->ip))) break;841 pIO=&IfOutput[j];//lengtes moeten ook gelijk zijn anders: 172.1.1.227==172.1.1.22 842 if ((strlen(pIO->ip)==strlen(tbuf))&&(!memcmp(pIO->ip,tbuf,strlen(pIO->ip)))) break; 830 843 } 831 844 if (j<IfOutputTeller) 832 845 { 833 846 CARDOUTPUT *pCDO=&CardOutput[atoi(pIO->cardnr)]; 847 fwrite( pIO->ip, sizeof( char ), strlen(pIO->ip), hConf );AddKomma(); 834 848 fwrite( pCDO->configname, sizeof( char ), strlen(pCDO->configname), hConf );AddKomma(); 835 849 fwrite( pCDO->ether, sizeof( char ), strlen(pCDO->ether), hConf );AddKomma(); … … 839 853 fwrite( pCDO->channel, sizeof( char ), strlen(pCDO->channel), hConf );AddKomma(); 840 854 } 841 else 842 { 843 AddKomma(); 844 AddKomma(); 845 AddKomma(); 846 AddKomma(); 847 AddKomma(); 848 AddKomma(); 849 } 850 851 } 852 853 854 855 856 857 855 } 856 858 857 #ifdef xyz //even er uit 859 858 { … … 875 874 if (CompareIp(&pCd->ptp1,&pCd->ipstart)<0||CompareIp(&pCd->ptp1,&pCd->ipend)>0) 876 875 { 877 878 876 fwrite("point-to-point adres buiten range",sizeof( char ),33,hConf); 877 AddKomma(); 879 878 } 880 879 if (CompareIp(&pCd->on1,&pCd->ipstart)<0||CompareIp(&pCd->on1,&pCd->ipend)>0) 881 880 { 882 883 881 fwrite("ospf-neighbors adres buiten range",sizeof( char ),33,hConf); 882 AddKomma(); 884 883 } 885 884 #endif … … 899 898 if (hConf) 900 899 { 901 // strcpy(buf,"Volgnr");AddTekst();AddKomma();902 900 strcpy(buf,"location");AddTekst();AddKomma(); 903 901 strcpy(buf,"master_ip");AddTekst();AddKomma(); … … 913 911 strcpy(buf,"E");AddTekst();AddKomma(); 914 912 strcpy(buf,"ESSID");AddTekst();AddKomma(); 915 // strcpy(buf,"volgnr");AddTekst();AddKomma();916 913 strcpy(buf,"configname");AddTekst();AddKomma(); 917 914 strcpy(buf,"sprintfname");AddTekst();AddKomma(); … … 935 932 strcpy(buf,"cable");AddTekst();AddKomma(); 936 933 strcpy(buf,"heigth");AddTekst();AddKomma(); 937 934 938 935 fwrite( "\n", sizeof( char ), 1, hConf ); 939 936 940 937 for (i=0;i<CardTeller;i++) 941 938 { 942 939 pCd=&Card[i]; 943 940 pCN=&CNode[atoi(pCd->nodenr)]; 944 // fwrite( pCN->volgnr, sizeof( char ), strlen(pCN->volgnr), hConf );AddKomma();945 941 fwrite( pCN->location, sizeof( char ), strlen(pCN->location), hConf );AddKomma(); 946 942 fwrite( pCN->master_ip, sizeof( char ), strlen(pCN->master_ip), hConf );AddKomma(); … … 956 952 fwrite( pCN->E, sizeof( char ), strlen(pCN->E), hConf );AddKomma(); 957 953 fwrite( pCN->ESSID, sizeof( char ), strlen(pCN->ESSID), hConf );AddKomma(); 958 // fwrite( pCd->volgnr, sizeof( char ), strlen(pCd->volgnr), hConf );AddKomma();959 954 fwrite( pCd->configname, sizeof( char ), strlen(pCd->configname), hConf );AddKomma(); 960 955 fwrite( pCd->sprintfname, sizeof( char ), strlen(pCd->sprintfname), hConf );AddKomma(); … … 978 973 fwrite( pCd->cable, sizeof( char ), strlen(pCd->cable), hConf );AddKomma(); 979 974 fwrite( pCd->heigth, sizeof( char ), strlen(pCd->heigth), hConf );AddKomma(); 975 { 976 int j; 977 IFOUTPUT *pIO; 978 char tbuf[30]; 979 strcpy(tbuf,pCd->ip); 980 for (j=0;j<strlen(pCd->ip);j++) 981 { 982 if (tbuf[j]=='/') tbuf[j]='\0'; 983 } 984 for (j=0;j<IfOutputTeller;j++) 985 { 986 pIO=&IfOutput[j];//lengtes moeten ook gelijk zijn anders: 172.1.1.227==172.1.1.22 987 if ((strlen(pIO->ip)==strlen(tbuf))&&(!memcmp(pIO->ip,tbuf,strlen(pIO->ip)))) break; 988 } 989 if (j<IfOutputTeller) 990 { 991 CARDOUTPUT *pCDO=&CardOutput[atoi(pIO->cardnr)]; 992 fwrite( pIO->ip, sizeof( char ), strlen(pIO->ip), hConf );AddKomma(); 993 fwrite( pCDO->configname, sizeof( char ), strlen(pCDO->configname), hConf );AddKomma(); 994 fwrite( pCDO->ether, sizeof( char ), strlen(pCDO->ether), hConf );AddKomma(); 995 fwrite( pCDO->status, sizeof( char ), strlen(pCDO->status), hConf );AddKomma(); 996 fwrite( pCDO->ssid, sizeof( char ), strlen(pCDO->ssid), hConf );AddKomma(); 997 fwrite( pCDO->stationname, sizeof( char ), strlen(pCDO->stationname), hConf );AddKomma(); 998 fwrite( pCDO->channel, sizeof( char ), strlen(pCDO->channel), hConf );AddKomma(); 999 } 1000 } 1001 fwrite( "\n", sizeof( char ), 1, hConf ); 1002 } 1003 fclose(hConf); 1004 } 1005 } 1006 1007 void MaakCSV3(int code) 1008 { 1009 int i; 1010 CNODE *pCN; 1011 CARD *pCd; 1012 IFOUTPUT *pIO; 1013 CARDOUTPUT *pCDO; 1014 CNODEOUTPUT *pCNO; 1015 if (code==1) hConf=fopen("outputs1.csv","w"); 1016 if (code==2) hConf=fopen("outputs2.csv","w"); 1017 if (hConf) 1018 { 1019 strcpy(buf,"name");AddTekst();AddKomma(); 1020 strcpy(buf,"stationname");AddTekst();AddKomma(); 1021 strcpy(buf,"ssid");AddTekst();AddKomma(); 1022 strcpy(buf,"configname");AddTekst();AddKomma(); 1023 strcpy(buf,"status");AddTekst();AddKomma(); 1024 strcpy(buf,"ether");AddTekst();AddKomma(); 1025 strcpy(buf,"channel");AddTekst();AddKomma(); 1026 strcpy(buf,"ip");AddTekst();AddKomma(); 1027 strcpy(buf,"netmask");AddTekst();AddKomma(); 1028 strcpy(buf,"broadcast");AddTekst();AddKomma(); 1029 strcpy(buf,"wleiden.conf");AddTekst();AddKomma(); 1030 fwrite( "\n", sizeof( char ), 1, hConf ); 1031 1032 for (i=0;i<IfOutputTeller;i++) 1033 { 1034 pIO=&IfOutput[i]; 1035 pCDO=&CardOutput[atoi(pIO->cardnr)]; 1036 pCNO=&CNodeOutput[atoi(pCDO->nodenr)]; 1037 fwrite( pCNO->name, sizeof( char ), strlen(pCNO->name), hConf );AddKomma(); 1038 fwrite( pCDO->stationname, sizeof( char ), strlen(pCDO->stationname), hConf );AddKomma(); 1039 fwrite( pCDO->ssid, sizeof( char ), strlen(pCDO->ssid), hConf );AddKomma(); 1040 fwrite( pCDO->configname, sizeof( char ), strlen(pCDO->configname), hConf );AddKomma(); 1041 fwrite( pCDO->status, sizeof( char ), strlen(pCDO->status), hConf );AddKomma(); 1042 fwrite( pCDO->ether, sizeof( char ), strlen(pCDO->ether), hConf );AddKomma(); 1043 fwrite( pCDO->channel, sizeof( char ), strlen(pCDO->channel), hConf );AddKomma(); 1044 fwrite( pIO->ip, sizeof( char ), strlen(pIO->ip), hConf );AddKomma(); 1045 fwrite( pIO->netmask, sizeof( char ), strlen(pIO->netmask), hConf );AddKomma(); 1046 fwrite( pIO->broadcast, sizeof( char ), strlen(pIO->broadcast), hConf );AddKomma(); 1047 { 1048 int j; 1049 char tbuf[30]; 1050 for (j=0;j<CardTeller;j++) 1051 { 1052 int k; 1053 pCd=&Card[j]; 1054 strcpy(tbuf,pCd->ip); 1055 for (k=0;k<strlen(pCd->ip);k++) 1056 { 1057 if (tbuf[k]=='/') tbuf[k]='\0'; 1058 } 1059 if ((strlen(pIO->ip)==strlen(tbuf))&&(!memcmp(pIO->ip,tbuf,strlen(pIO->ip)))) break; 1060 } 1061 if (j<CardTeller) 1062 { 1063 pCN=&CNode[atoi(pCd->nodenr)]; 1064 fwrite( pCN->master_ip, sizeof( char ), strlen(pCN->master_ip), hConf );AddKomma(); 1065 fwrite( pCN->nodename, sizeof( char ), strlen(pCN->nodename), hConf );AddKomma(); 1066 fwrite( pCN->status, sizeof( char ), strlen(pCN->status), hConf );AddKomma(); 1067 fwrite( pCN->ESSID, sizeof( char ), strlen(pCN->ESSID), hConf );AddKomma(); 1068 fwrite( pCd->configname, sizeof( char ), strlen(pCd->configname), hConf );AddKomma(); 1069 fwrite( pCd->sprintfname, sizeof( char ), strlen(pCd->sprintfname), hConf );AddKomma(); 1070 fwrite( pCd->type, sizeof( char ), strlen(pCd->type), hConf );AddKomma(); 1071 fwrite( pCd->ip, sizeof( char ), strlen(pCd->ip), hConf );AddKomma(); 1072 fwrite( pCd->desc, sizeof( char ), strlen(pCd->desc), hConf );AddKomma(); 1073 fwrite( pCd->sdesc, sizeof( char ), strlen(pCd->sdesc), hConf );AddKomma(); 1074 fwrite( pCd->pointtopoint, sizeof( char ), strlen(pCd->pointtopoint), hConf );AddKomma(); 1075 fwrite( pCd->ospfbroadcast, sizeof( char ), strlen(pCd->ospfbroadcast), hConf );AddKomma(); 1076 fwrite( pCd->ospfneighbors, sizeof( char ), strlen(pCd->ospfneighbors), hConf );AddKomma(); 1077 fwrite( pCd->dhcp, sizeof( char ), strlen(pCd->dhcp), hConf );AddKomma(); 1078 fwrite( pCd->mode, sizeof( char ), strlen(pCd->mode), hConf );AddKomma(); 1079 fwrite( pCd->essid, sizeof( char ), strlen(pCd->essid), hConf );AddKomma(); 1080 fwrite( pCd->channel, sizeof( char ), strlen(pCd->channel), hConf );AddKomma(); 1081 } 1082 } 980 1083 fwrite( "\n", sizeof( char ), 1, hConf ); 981 1084 }
Note:
See TracChangeset
for help on using the changeset viewer.