#include "descript.h" void filename(char [], char [], char [], char[], int, char[]); void FindRoute(int[], int*); short int CRC(int []); int restrict(int [], long long int[], int); void read(char fni[], char fno[], char INF[], char protocol[], char path[], char name[], char nnnnn_TMP[], float quality[], int real_route[], int &Rcount) { FILE *fo, *fo1, *fout, *foRout, *foMiss, *fo_log_kadr, *fo_route; ifstream fin; ofstream fo_cln1, fokadr_cln1; char buf[1024]; // char stop1; char ch1,ch2,ch3, ch, file_name_prot[80]; char file_route[80]; /*protocol binary filesm mmm_counter_nnnnn_cln1Er.log*/ char miss_file[80]; /*protocol files mmm_counter_nnnnn_mis_cln1.dat*/ char cln1_file[80]; /*route binary data files mmm_counter_nnnnn_cln1.pam*/ char cln1_kadr[80]; /*route binary data files mmm_counter_nnnnn_cln1.bin*/ char log_kadr[80]; /*log binary data files mmm_counter_nnnnn_cln1.log*/ char log_route[80]; /*log binary file for number of routes*/ char Short_Buf[8], Name_Buf[4]; short int CalcCheckSum; int LenthBuf=1015, flag_help=0; int i, j, k, file_length=0, Hex[3]; int N_er=0; /*Number of kadr with name error*/ int CRC0_er=0; /*Number of kadr with CRC0 error*/ int P_er=0; /*Number of kadr with packet error number*/ int M_er=0; /*Number of kadr with rout error number*/ int end=0; /*End of last pamela packet*/ // Buffers for Kadr analysis int buffer1[1024], buffer2[1024], buffer3[1024]; int rr=0; int header1, header2, header3, CRC_0[3], CRC_1[3]; long long int icount_int; long long int icount_frac, tmpP, numP[3]; long int N1=0; /* Number of identified kadrs*/ long long int icount=0; /* Number of bytes in identified kadrs*/ long long int icount_total=0; /* Total number of bytes*/ long long int packet_first[100];/*First kadr number for each route*/ long long int packet_last[100]; /*Second kadr number for each route*/ long int count_missed[100]; /* Number of missed kadrs in each route*/ long int count_sec_missed[100]; unsigned long long int count_ident[100]; /* Number of good bytes in each rout*/ unsigned long long int count_tot[100]; /* Total number of bytes in each rout*/ int NumRout[1000]; /* Number of Route*/ long long int Num_kadrs[1000]; /* Number of identified kadrs in each rout*/ long int Num_good_kadrs[1000]; /* Number of normal kadrs in each rout*/ long long int Num_bad_kadrs[1000]; /* Bad kadrs number in each rout*/ // float quality[100]; /* File quality pointer*/ int counter=0; /* Last byte position in truncated kadr*/ int adr1=0; /* Initial byte of kadr in cln1.bin*/ int adr2=0; /* Last byte of kadr in cln2.bin*/ int tmp=0; int numPack[4]; /* Number of kadr in given route*/ int adress[4]; int R_er[100]; /* Rout errors number in given rout*/ int R_er_interf1[100]; /* Interface Rout error at begin of rout*/ int R_er_interf2[100]; /* Interface Rout error at end of rout*/ int Mis_group[1000]; /* Number of missed kadrs group for each rout*/ int Pack_Er[1000]; /* Number of packets with packet number error for each rout*/ int CRC_bad_kadr[3]; /* Current CRC bad kadr number*/ int flag_pack[3]; /* Flag for error in packet number*/ int flag_rout[3]; /* Flag for error in rout number*/ int flag_name[3]; /* Flag for name error*/ int flag_CRC0[3]; /* Flag for CRC0 error*/ int flag_CRC[3]; /* Flag for CRC error*/ int flag_CRC_cor[3]; /* Flag for CRC error correction*/ int flag_tr[3]; /* Truncate flag*/ short int flags; /* Number for all errors*/ for (j=0; j<4; j++) {adress[j]=0; numPack[j]=0;} for (j=0; j<1024; j++) {buffer1[j]=0; buffer2[j]=0; buffer3[j]=0;} for (i=0; i<100; i++) {Num_kadrs[i]=0; NumRout[i]=0; packet_first[i]=0; packet_last[i]=0; count_missed[i]=0; count_sec_missed[i]=0; count_ident[i]=0; count_tot[i]=0; R_er[i]=0; R_er_interf1[i]=0; Num_bad_kadrs[i]=0; Num_good_kadrs[i]=0; quality[i]=0; Mis_group[i]=0; Pack_Er[i]=0; R_er_interf2[i]=0;} for (i=0; i<3; i++) {numP[i]=0; CRC_bad_kadr[i]=0; Hex[i]=0; flag_pack[i]=0; flag_rout[i]=0; flag_name[i]=0; flag_CRC0[i]=0; flag_tr[i]=0; flag_CRC[i]=0; flag_CRC_cor[i]=0;} // open input file "nnnnnmmm.pam" fin.open(fni, ifstream::binary); if(fin.good()==0) {cerr<<"can not open input file"; exit(0);} //open output file "nnnnnmmm_work.dat" fout=fopen(fno, "wb"); if(fout==0) {cerr<<"can not open outputfile"; exit(0);} //open output file "nnnnnmmm_protocol.txt" fo=fopen(protocol, "wb"); if(fo==0) {cerr<<"can not open protocol file"; exit(0);} //open output file "nnnnnmmm_cln1.inf" fo1=fopen(INF, "wb"); if(fo1==0) {cerr<<"can not open inf file"; exit(0);} //open output file "nnnnnmmm_route.log" strncpy(log_route,INF,strlen(INF)-9); log_route[strlen(INF)-9]='\0'; strcat(log_route,"_route.log"); fo_route=fopen(log_route, "wb"); if(fo_route==0) {cerr<<"can not open file for routes number"; exit(0);} ///////////////////////////////////////////////////////////////// // cin>>stop1; k=0; while(fin.eof()==0) { counter=0; //pounter for position of kadr truncation N_er=0; M_er=0; P_er=0; CRC0_er=0; if (N1==0) Rcount=1; /**********************data reading********************************/ fin.read(Name_Buf,3); if (fin.eof()) break; fin.read(Short_Buf,5); if (fin.eof()) break; ch1=Name_Buf[0]; ch2=Name_Buf[1]; ch3=Name_Buf[2]; tmpP=(long int)(unsigned char)(Short_Buf[1])+ 256*(long int)(unsigned char)(Short_Buf[2])+ 256*256*(long int)(unsigned char)(Short_Buf[3]); icount+=8; icount_total+=8; count_ident[Rcount-1]+=8; count_tot[Rcount-1]+=8; while((ch1!=(char)(CODE1)&&ch2!=(char)(CODE2)&& (N1==0||buffer3[1023]!=(int)(unsigned char)(Short_Buf[4])||buffer3[3]!=(int)(unsigned char)(Short_Buf[0]))) || (ch2!=(char)(CODE2)&&ch3!=(char)(CODE3)&&(buffer3[1023]!=(int)(unsigned char)(Short_Buf[4])||(numP[2]+1)!=tmpP)) || (ch3!=(char)(CODE3)&&ch1!=(char)(CODE1)&&((numP[2]+1)!=tmpP||buffer3[1023]!=(int)(unsigned char)(Short_Buf[4]))) || (ch1!=(char)(CODE1)&& (buffer3[1023]!=(int)(unsigned char)(Short_Buf[4])||buffer3[3]!=(int)(unsigned char)(Short_Buf[0])||(numP[2]+1)!=tmpP)) || (ch2!=(char)(CODE2)&& (buffer3[1023]!=(int)(unsigned char)(Short_Buf[4])||buffer3[3]!=(int)(unsigned char)(Short_Buf[0])||(numP[2]+1)!=tmpP)) || (ch3!=(char)(CODE3)&& (buffer3[1023]!=(int)(unsigned char)(Short_Buf[4])||buffer3[3]!=(int)(unsigned char)(Short_Buf[0])||(numP[2]+1)!=tmpP)) || (ch1!=(char)(CODE1)&&ch2!=(char)(CODE2)&&ch3!=(char)(CODE3))) {fin.get(ch); if (fin.eof()) {/*cerr<<"\n"<<"gopa";*/ break;} ch1=ch2; ch2=ch3; ch3=Short_Buf[0]; for (i=0;i<4;i++) Short_Buf[i]=Short_Buf[i+1]; Short_Buf[4]=ch; icount_total+=1; count_tot[Rcount-1]+=1; tmpP=(long int)(unsigned char)(Short_Buf[1])+ 256*(long int)(unsigned char)(Short_Buf[2])+ 256*256*(long int)(unsigned char)(Short_Buf[3]); } if ((fin.eof())&&(N1==0)) { fclose(fout); remove(fno); fclose(fo); remove(protocol); fclose(fo1); remove(INF); exit(0); } // cout<<"icount_total="<0) cout<>i;}*/ fprintf(fout,"CRC = %x (%x) error in kadr %i\n", buffer3[1023],CalcCheckSum,numP[2]); //write in file nnnnn_work.dat // cerr<<"checksum error "<2)) {flag_CRC0[1]=1; CRC0_er=N1-1;} /****************************************************************/ /******************KADR NUMBER ANALYSIS**************************/ if ((numP[1]!=(numP[0]+1))&&(numP[1]!=(numP[2]-1))&&(N1!=1)&&(CRC_bad_kadr[1]==numP[1])&&(numP[1]!=0)) {P_er=N1-1; flag_pack[1]=1; //Correct error packet number// tmpP=numP[0]+1; for (i=0;i<3;i++) Hex[i]=0; for (i=0;i<3;i++) {if (tmpP/(long int)(pow(256.,2-i))>=1) {Hex[2-i]=(int)(tmpP/(long int)(pow(256.,2-i))); tmpP=tmpP-(long int)pow(256.,2-i)*(int)(tmpP/(long int)(pow(256.,2-i)));}} for (i=4;i<7;i++) (buffer2[i]=Hex[i-4]); if (buffer2[1023]==(int)(CRC(buffer2))) flag_CRC_cor[1]=1; tmpP=numP[2]-1; for (i=0;i<3;i++) Hex[i]=0; for (i=0;i<3;i++) {if (tmpP/(long int)(pow(256.,2-i))>=1) {Hex[2-i]=(int)(tmpP/(long int)(pow(256.,2-i))); tmpP=tmpP-(long int)pow(256.,2-i)*(int)(tmpP/(long int)(pow(256.,2-i)));}} for (i=4;i<7;i++) (buffer2[i]=Hex[i-4]); if (buffer2[1023]==(int)(CRC(buffer2))) flag_CRC_cor[1]=1; } ///////////////////////////////////////////////////////////////////// if ((numP[2]!=(numP[1]+1))&&(N1!=1)&&(buffer3[3]==buffer2[3])&&(CRC_bad_kadr[2]==numP[2])&&(numP[2]!=0)) flag_pack[2]=1; if (flag_pack[2]!=1) packet_last[Rcount-1]=numP[2]; ////////Missing kadr analysis//////////////////////////////////// /**route number: 10 (10 19 10) 10 ******************************/ /**kadr number: 21 (22 17 18) 19 ******************************/ /**missed kadrs: 21 20 19 18 17 ******************************/ if ((numP[1]numP[0]+1)&&(numP[1]=numP[0]+1)&&(numP[1]numP[2]-1))&&(numP[2]-numP[0]>2)&& (buffer1[3]==buffer3[3])&&(buffer1[3]==buffer2[3])&&(flag_tr[1]==0)&& (flag_pack[2]==0)&&(flag_pack[1]==1)&&(flag_pack[0]==0)) {Mis_group[Rcount-1]+=1; fprintf(foMiss,"%9i%9i -1\n",numP[0]+1,numP[2]-1); count_missed[Rcount-1]+=numP[2]-numP[0]-1-1;} //truncate kadr /**route number: 10 (10 10 10) 10 ******************************/ /**kadr number: 11 (12 13 14) 15 ******************************/ /**missed truncate kadr:13 ******************************/ else if ((numP[0]>stop1; if ((CRC_bad_kadr[1]==numP[1])&&(numP[1]!=0)) { //Correct error route number////////////////////////////////////////// buffer2[3]=buffer1[3]; if (buffer2[1023]==(int)(CRC(buffer2))) flag_CRC_cor[1]=1; //////////////////////////////////////////////////////////////////// flags=(short int)(pow((float)(2*flag_name[1]),4)+ pow((float)(2*flag_rout[1]),1)+ pow((float)(2*flag_pack[1]),2)+ pow((float)(2*flag_CRC0[1]),3)+ pow((float)(2*flag_CRC[1]),5)+ pow((float)(2*flag_CRC_cor[1]),6)); fprintf(foRout,"%1c%1c%1c%1c",(char)(buffer2[4]), (char)(buffer2[5]),(char)(buffer2[6]),(char)(flags)); fprintf(fout,"%i Interface route error 1 %i\n",CRC_bad_kadr[1],flags); CRC_bad_kadr[1]=0; } // CREATE FILE NAMES filename(file_route, miss_file, cln1_file, path, NumRout[Rcount-1], name); strncpy(cln1_kadr,cln1_file,strlen(cln1_file)-3); cln1_kadr[strlen(cln1_file)-3]='\0'; strcat(cln1_kadr,"bin"); strncpy(log_kadr,file_route,strlen(file_route)-6); log_kadr[strlen(file_route)-6]='\0'; strcat(log_kadr,"_bin.log"); fclose(foRout); //Close files fo_cln1.close(); //for old fclose(foMiss); //route fokadr_cln1.close(); fclose(fo_log_kadr); //Open files for new route foRout=fopen(file_route, "wb"); //mmm_nnnnn_cln1Er.log foMiss=fopen(miss_file, "wb"); //mmm_nnnnn_mis_cln1.dat fo_cln1.open(cln1_file, ios::binary); //mmm_nnnnn_cln1.pam fokadr_cln1.open(cln1_kadr,ios::binary); //mmm_nnnnn_cln1.bin fo_log_kadr=fopen(log_kadr,"wb"); //mmm_nnnnn_cln1_bin.log }*/ /******************Interface route error 2***********************/ /**route number:7 7 ( 7 4 8) 8 ******************************/ /**kadr number:198 199 (200 1 2) 3 ******************************/ /*if ((numP[1]==numP[2]-1)&&(numP[1]>stop1; // CREATE FILE NAMES filename(file_route, miss_file, cln1_file, path, NumRout[Rcount-1], name); strncpy(cln1_kadr,cln1_file,strlen(cln1_file)-3); cln1_kadr[strlen(cln1_file)-3]='\0'; strcat(cln1_kadr,"bin"); strncpy(log_kadr,file_route,strlen(file_route)-6); log_kadr[strlen(file_route)-6]='\0'; strcat(log_kadr,"_bin.log"); fclose(foRout); //Close files fo_cln1.close(); //for old fclose(foMiss); //route fokadr_cln1.close(); fclose(fo_log_kadr); //Open files for new route foRout=fopen(file_route, "wb"); //mmm_nnnnn_cln1Er.log foMiss=fopen(miss_file, "wb"); //mmm_nnnnn_mis_cln1.dat fo_cln1.open(cln1_file, ios::binary); //mmm_nnnnn_cln1.pam fokadr_cln1.open(cln1_kadr,ios::binary); //mmm_nnnnn_cln1.bin fo_log_kadr=fopen(log_kadr,"wb"); //mmm_nnnnn_cln1_bin.log if ((CRC_bad_kadr[1]==numP[1])&&(numP[1]!=0)) {Num_bad_kadrs[Rcount-1]+=1; Num_bad_kadrs[Rcount-2]-=1; //Correct error rout number////////////////////////////////////////// buffer2[3]=buffer3[3]; if (buffer2[1023]==(int)(CRC(buffer2))) flag_CRC_cor[1]=1; //////////////////////////////////////////////////////////////////// flags=(short int)(pow((float)(2*flag_name[1]),4)+ pow((float)(2*flag_rout[1]),1)+ pow((float)(2*flag_pack[1]),2)+ pow((float)(2*flag_CRC0[1]),3)+ pow((float)(2*flag_CRC[1]),5)+ pow((float)(2*flag_CRC_cor[1]),6)); fprintf(foRout,"%1c%1c%1c%1c",(char)(buffer2[4]),(char)(buffer2[5]),(char)(buffer2[6]),(char)(flags)); fprintf(fout,"%i Interface route error 2 %i\n",CRC_bad_kadr[1],flags); CRC_bad_kadr[1]=0;} }*/ /******************Interface route error 3************************/ /**route number:7 7 ( 7 8 4) 8 8******************************/ /**kadr number:198 199 (200 1 2) 3 4******************************/ /* if ((numP[1]==numP[2]-1)&&(flag_CRC[1]==0)&&(flag_CRC[2]==1)) {Rcount+=1; packet_last[Rcount-2]=numP[0]; packet_first[Rcount-1]=numP[1]; NumRout[Rcount-1]=Rcount; Num_kadrs[Rcount-2]-=2; Num_kadrs[Rcount-1]+=2; count_ident[Rcount-1]+=2048; count_ident[Rcount-2]-=2048; count_tot[Rcount-1]+=2048; count_tot[Rcount-2]-=2048; Num_bad_kadrs[Rcount-1]+=1; Num_bad_kadrs[Rcount-2]-=1; cout<<"\n interface3 "<>stop1; // CREATE FILE NAMES filename(file_route, miss_file, cln1_file, path, NumRout[Rcount-1], name); strncpy(cln1_kadr,cln1_file,strlen(cln1_file)-3); cln1_kadr[strlen(cln1_file)-3]='\0'; strcat(cln1_kadr,"bin"); strncpy(log_kadr,file_route,strlen(file_route)-6); log_kadr[strlen(file_route)-6]='\0'; strcat(log_kadr,"_bin.log"); fclose(foRout); //Close files fo_cln1.close(); //for old fclose(foMiss); //route fokadr_cln1.close(); fclose(fo_log_kadr); //Open files for new route foRout=fopen(file_route, "wb"); //mmm_nnnnn_cln1Er.log foMiss=fopen(miss_file, "wb"); //mmm_nnnnn_mis_cln1.dat fo_cln1.open(cln1_file, ios::binary); //mmm_nnnnn_cln1.pam fokadr_cln1.open(cln1_kadr,ios::binary); //mmm_nnnnn_cln1.bin fo_log_kadr=fopen(log_kadr,"wb"); //mmm_nnnnn_cln1_bin.log flags=(short int)(pow((float)(2*flag_name[1]),4)+ pow((float)(2*flag_rout[1]),1)+ pow((float)(2*flag_pack[1]),2)+ pow((float)(2*flag_CRC0[1]),3)+ pow((float)(2*flag_CRC[1]),5)+ pow((float)(2*flag_CRC_cor[1]),6)); fprintf(foRout,"%1c%1c%1c%1c",(char)(buffer2[4]),(char)(buffer2[5]),(char)(buffer2[6]),(char)(flags)); fprintf(fout,"%i Interface route error 3 %i\n",CRC_bad_kadr[1],flags); CRC_bad_kadr[1]=0; }*/ } /**************Return to old route*******************************/ /**route number: 7 (8 4 8) 8*************************************/ /*if ((buffer2[3]!=buffer1[3])&&(buffer2[3]!=buffer3[3])&& (buffer1[3]==buffer3[3])&&(buffer2[3]!=0)&&(N1>2)) { R_er[Rcount-1]+=1; flag_rout[1]=1; M_er=N1-1; if ((CRC_bad_kadr[1]==numP[1])&&(numP[1]!=0)) { //Correct error route number////////////////////////////////////////// buffer2[3]=buffer1[3]; if (buffer2[1023]==(int)(CRC(buffer2))) flag_CRC_cor[1]=1; //////////////////////////////////////////////////////////////////// flags=(short int)(pow((float)(2*flag_name[1]),4)+ pow((float)(2*flag_rout[1]),1)+ pow((float)(2*flag_pack[1]),2)+ pow((float)(2*flag_CRC0[1]),3)+ pow((float)(2*flag_CRC[1]),5)+ pow((float)(2*flag_CRC_cor[1]),6)); fprintf(foRout,"%1c%1c%1c%1c",(char)(buffer2[4]),(char)(buffer2[5]),(char)(buffer2[6]),(char)(flags)); fprintf(fout,"%i Old route error %i\n",CRC_bad_kadr[1],flags); CRC_bad_kadr[1]=0;} cout<<"\n"<>i; if (flag_tr[1]==0) {Num_kadrs[Rcount-2]-=2; Num_kadrs[Rcount-1]+=2; count_ident[Rcount-1]+=2048; count_ident[Rcount-2]-=2048; count_tot[Rcount-1]+=2048; count_tot[Rcount-2]-=2048;} else {Num_kadrs[Rcount-2]-=1; Num_kadrs[Rcount-1]+=1; count_ident[Rcount-1]+=1024; count_ident[Rcount-2]-=1024; count_tot[Rcount-1]+=1024; count_tot[Rcount-2]-=1024;} // CREATE FILE NAMES filename(file_route, miss_file, cln1_file, path, NumRout[Rcount-1], name); strncpy(cln1_kadr,cln1_file,strlen(cln1_file)-3); cln1_kadr[strlen(cln1_file)-3]='\0'; strcat(cln1_kadr,"bin"); strncpy(log_kadr,file_route,strlen(file_route)-6); log_kadr[strlen(file_route)-6]='\0'; strcat(log_kadr,"_bin.log"); fclose(foRout); //Close files fo_cln1.close(); //for old fclose(foMiss); //route fokadr_cln1.close(); fclose(fo_log_kadr); //Open files for new route foRout=fopen(file_route, "wb"); //mmm_nnnnn_cln1Er.log foMiss=fopen(miss_file, "wb"); //mmm_nnnnn_mis_cln1.dat fo_cln1.open(cln1_file, ios::binary); //mmm_nnnnn_cln1.pam fokadr_cln1.open(cln1_kadr,ios::binary); //mmm_nnnnn_cln1.bin fo_log_kadr=fopen(log_kadr,"wb"); //mmm_nnnnn_cln1_bin.log if ((CRC_bad_kadr[2]==numP[2])&&(numP[2]!=0)) {Num_bad_kadrs[Rcount-1]+=1; Num_bad_kadrs[Rcount-2]-=1;} if ((CRC_bad_kadr[1]==numP[1])&&(numP[1]!=0)) {Num_bad_kadrs[Rcount-1]+=1; Num_bad_kadrs[Rcount-2]-=1; flags=(short int)(pow((float)(2*flag_name[1]),4)+ pow((float)(2*flag_rout[1]),1)+ pow((float)(2*flag_pack[1]),2)+ pow((float)(2*flag_CRC0[1]),3)+ pow((float)(2*flag_CRC[1]),5)+ pow((float)(2*flag_CRC_cor[1]),6)); fprintf(foRout,"%1c%1c%1c%1c",(char)(buffer2[4]),(char)(buffer2[5]),(char)(buffer2[6]),(char)(flags)); fprintf(fout,"%i New route %i\n",CRC_bad_kadr[1],flags); CRC_bad_kadr[1]=-1;} // cout<1)) {rr=0; FindRoute(buffer2, &rr); if (rr>0) { real_route[Rcount]=rr; } else { real_route[Rcount]=0; } } /***************************************************************/ if (CRC_bad_kadr[1]==numP[1]) { //Correct CRC0 error///////////////////////////////////////////////// buffer2[7]=buffer1[1023]; if (buffer2[1023]==(int)(CRC(buffer2))) flag_CRC_cor[1]=1; //Correct name error///////////////////////////////////////////////// buffer2[0]=(int)(CODE1); buffer2[1]=(int)(CODE2); buffer2[2]=(int)(CODE3); if (buffer2[1023]==(int)(CRC(buffer2))) flag_CRC_cor[1]=1; } //////////////////////////////////////////////////////////////////// /*******************************************************************/ if ((CRC_bad_kadr[1]==numP[1])&&(numP[1]!=0)&&(N1>1)) { flags=(short int)(pow((float)(2*flag_name[1]),4)+ pow((float)(2*flag_rout[1]),1)+ pow((float)(2*flag_pack[1]),2)+ pow((float)(2*flag_CRC0[1]),3)+ pow((float)(2*flag_CRC[1]),5)+ pow((float)(2*flag_CRC_cor[1]),6)); fprintf(foRout,"%1c%1c%1c%1c",(char)(buffer2[4]), (char)(buffer2[5]),(char)(buffer2[6]),(char)(flags)); fprintf(fout,"%i flags=%i\n",CRC_bad_kadr[1],flags);} /***************************************************************/ // cout <<"\nCalcChekSum="<=1) {numPack[3-k]=(int)(tmp/(long int)(pow(256.,3-k))); tmp=tmp-(long int)pow(256.,3-k)*(int)(tmp/(long int)(pow(256.,3-k)));}} for (i=0;i<4;i++) fputc((int)(unsigned char)(numPack[i]),fo_log_kadr); adr1=icount-1024*2; for (k=0;k<4;k++) adress[k]=0; for (k=0;k<4;k++) {if (adr1/(long int)(pow(256.,3-k))>=1) {adress[3-k]=(int)(adr1/(long int)(pow(256.,3-k))); adr1=adr1-(long int)pow(256.,3-k)* (int)(adr1/(long int)(pow(256.,3-k)));}} for (i=0;i<4;i++) fputc((int)(unsigned char)(adress[i]),fo_log_kadr); adr2=icount-1024; for (k=0;k<4;k++) adress[k]=0; for (k=0;k<4;k++) {if (adr2/(long int)(pow(256.,3-k))>=1) {adress[3-k]=(int)(adr2/(long int)(pow(256.,3-k))); adr2=adr2-(long int)pow(256.,3-k)* (int)(adr2/(long int)(pow(256.,3-k)));}} for (i=0;i<4;i++) fputc((int)(unsigned char)(adress[i]),fo_log_kadr); fputc(flags,fo_log_kadr); } } /***************************************************************/ /***************************************************************/ if (flag_CRC[2]==0||(flag_rout[2]==0&&flag_pack[2]==0)|| (flag_CRC[2]!=0&&flag_CRC_cor[2]==1)) {end=0; for (i=0;i<1024;i++) fokadr_cln1<<(unsigned char)buffer3[i]; //Write in file mmm_counter_nnnnn_cln1_bin.log tmp=numP[2]; for (k=0;k<4;k++) numPack[k]=0; for (k=0;k<4;k++) {if (tmp/(long int)(pow(256.,3-k))>=1) {numPack[3-k]=(int)(tmp/(long int)(pow(256.,3-k))); tmp=tmp-(long int)pow(256.,3-k)* (int)(tmp/(long int)(pow(256.,3-k)));}} for (i=0;i<4;i++) fputc((int)(unsigned char)(numPack[i]),fo_log_kadr); adr1=icount-1024; for (k=0;k<4;k++) adress[k]=0; for (k=0;k<4;k++) {if (adr1/(long int)(pow(256.,3-k))>=1) {adress[3-k]=(int)(adr1/(long int)(pow(256.,3-k))); adr1=adr1-(long int)pow(256.,3-k)* (int)(adr1/(long int)(pow(256.,3-k)));}} for (i=0;i<4;i++) fputc((int)(unsigned char)(adress[i]),fo_log_kadr); adr2=icount; for (k=0;k<4;k++) adress[k]=0; for (k=0;k<4;k++) {if (adr2/(long int)(pow(256.,3-k))>=1) {adress[3-k]=(int)(adr2/(long int)(pow(256.,3-k))); adr2=adr2-(long int)pow(256.,3-k)* (int)(adr2/(long int)(pow(256.,3-k)));}} for (i=0;i<4;i++) fputc((int)(unsigned char)(adress[i]),fo_log_kadr); fputc(flags,fo_log_kadr); for (i=8;i<1019;i++) { // if (fmodf(float((Num_kadrs[Rcount-1]-1)*1015+i-8), // float(64))==0.&&buffer3[i]==0&&buffer3[i+1]==0&& // buffer3[i+2]==0&&buffer3[i+3]==0&&buffer3[i+4]==0) end=1; if (end!=1) fo_cln1<<(unsigned char)buffer3[i]; } if (end!=1) {for(i=1019;i<1023;i++) {fo_cln1<<(unsigned char)buffer3[i];}} } icount_int = (int)(icount/1024); icount_frac= icount%1024; // cout<<"\nfile size="<