mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Sort FingerPrints to remove the need for random access into them.
Random access into FingerPrints and FingerTests using gettestbyname and getattrbyname was taking non-negligible time when multiplied by the number of fingerprints in the database. Instead, sort the tests by name and sort the attributes within each test. We may then compare two lists by walking both of them in order, not having to look up the same element twice.
This commit is contained in:
8
osscan.h
8
osscan.h
@@ -139,8 +139,8 @@ void free_fingerprint_file(FingerPrintDB *DB);
|
||||
verbose is nonzero, differences will be printed. The comparison
|
||||
accuracy (between 0 and 1) is returned). If MatchPoints is not NULL, it is
|
||||
a special "fingerprints" which tells how many points each test is worth. */
|
||||
double compare_fingerprints(FingerPrint *referenceFP, FingerPrint *observedFP,
|
||||
FingerPrint *MatchPoints, int verbose);
|
||||
double compare_fingerprints(const FingerPrint *referenceFP, const FingerPrint *observedFP,
|
||||
const FingerPrint *MatchPoints, int verbose);
|
||||
|
||||
/* Takes a fingerprint and looks for matches inside the passed in
|
||||
reference fingerprint DB. The results are stored in in FPR (which
|
||||
@@ -148,8 +148,8 @@ double compare_fingerprints(FingerPrint *referenceFP, FingerPrint *observedFP,
|
||||
will be reverse-sorted by accuracy. No results below
|
||||
accuracy_threshhold will be included. The max matches returned is
|
||||
the maximum that fits in a FingerPrintResultsIPv4 class. */
|
||||
void match_fingerprint(FingerPrint *FP, FingerPrintResultsIPv4 *FPR,
|
||||
FingerPrintDB *DB, double accuracy_threshold);
|
||||
void match_fingerprint(const FingerPrint *FP, FingerPrintResultsIPv4 *FPR,
|
||||
const FingerPrintDB *DB, double accuracy_threshold);
|
||||
|
||||
/* Returns true if perfect match -- if num_subtests & num_subtests_succeeded are non_null it updates them. if shortcircuit is zero, it does all the tests, otherwise it returns when the first one fails */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user