/** * $Id: fp_conf.cpp,v 1.6 2002/10/29 18:29:09 plasmahh Exp $ * $Revision: 1.6 $ * $Author: plasmahh $ * $Date: 2002/10/29 18:29:09 $ */ #include "fp_conf.h" unsigned long fp_conf::gen_error( fp_conf & ofp)/*{{{*/ { dlliterator it(*this); dlliterator vit(ofp); signed long dif; error = 0; if ( size() != ofp.size() ) { throw x_size ( "size does not match during generation of fingerprints", __FLF__); } // ok, size does match, so go on and iterator through fps... vit.first(); for (it.first();it.valid();it.next()) { if ( it.item() == 0 || vit.item() == 0) { vit.next(); continue; } dif = it.item() - vit.item(); if ( dif > 0) { error += dif; } else { error -= dif; } vit.next(); } return error; }/*}}}*/ bool operator < ( const fp_conf& a , const fp_conf& b)/*{{{*/ { return (a.error < b.error ); }/*}}}*/ bool operator > ( const fp_conf& a , const fp_conf& b)/*{{{*/ { return (a.error > b.error ); }/*}}}*/ ostream& operator << ( ostream & o , fp_conf & v)/*{{{*/ { o << "VERSION=" << v.version << endl; dlliterator it(v); o << "FP_CONF="; bool anf=false; for(it.first();it.valid();it.next()) { if (anf) { o << ","; } anf = true; o << it.item(); } o << endl; return o; }/*}}}*/ void fp_conf::add ( const mstring& ret )/*{{{*/ { dllist::add(strtoul(ret,NULL,10)); // just convert it to an integer }/*}}}*/ /** *$Log: fp_conf.cpp,v $ *Revision 1.6 2002/10/29 18:29:09 plasmahh *fix no-compile for gcc 3.2 * *Revision 1.5 2002/10/21 08:38:29 plasmahh *begin cleanup and structure changes for smtpmap 0.8-stable * *Revision 1.4 2002/06/20 20:37:01 plasmahh *new fingerprints *fixed correct fingerprinting on multiple hosts * *Revision 1.3 2002/06/17 21:32:37 plasmahh *Fixed, so it compiles on g++3.1 and later * *Revision 1.2 2002/06/09 21:22:39 plasmahh *lots of changes *some slight fingerprint changes, also in constructor *scanner changes and fixes in constructor *read fixes *test programs fixes, no more segfaults *new TODO * *Revision 1.1 2002/05/23 22:37:55 plasmahh *fixed small things in scanner *split fps into .cpp files, because of linker errors in operators * */