//******************************************** // AE_PCSA.h // ------------------------------------------- // The header file of the AE specialized PCSA // module // // Author: Leiwen Deng // Date: 12/10/2005 //******************************************** #ifndef AE_PCSA_H #define AE_PCSA_H #include "Hash.h" #include "Hash_PCSA.h" #define INITIAL_TABLE_SIZE 30 #define SHOW_TABLE 1 #define SHOW_TABLE_STRUCTURE 2 #define TABLE_DUMP_FILE_NAME "/usr/local/squid/var/logs/hash_table" class PCSA_MAIN { protected: HASH_TABLE pcsa_table; // a hash table that stores PCSA records public: u_short refcount_threshold; // the threshold of the "refcount" provided by SQUID, above which PCSA starts to keep track of the entry int m_bit; // the bit length used for bitmap index number, number of bitmaps(m) = 2 ** m_bit. ( default value: 5, i.e., m = 32 ) int max_ac_set_size; // the max size of the AC set in a PCSA record, above which accurate counting will be transitted to probabilistic counting double positive_threshold; // if number_of_unique_ip / reference_count exceeds this threshold, the entry is judged as "positive" protected: // Transit a record from accurate counting to probabilistic counting void ACtoPC( PCSA_RECORD * pcsa_record ); public: // The constructor PCSA_MAIN( void ); // The destructor ~PCSA_MAIN( void ); // Denote a new reference to an entry. PCSA_RECORD * ReferenceEntry( const MD5_KEY &md5key, uint32 client_ip, u_short refcount ); // Check whether a record is "positive" according to the detection rule bool Positive( const PCSA_RECORD * pcsa_record ) const; // Delete an entry from the hash table bool DeleteEntry( const MD5_KEY &key ); // Dump the content of the hash table to a file void DumpTable( int operation ) const; }; #endif