1919
2020namespace ipxp {
2121
22- int RecordExtBSTATS::REGISTERED_ID = ProcessPluginIDGenerator::instance().generatePluginID();
23-
2422static const PluginManifest bstatsPluginManifest = {
2523 .name = " bstats" ,
2624 .description = " Bstats process plugin for computing packet bursts stats." ,
@@ -32,7 +30,8 @@ static const PluginManifest bstatsPluginManifest = {
3230const struct timeval BSTATSPlugin::min_packet_in_burst
3331 = {MAXIMAL_INTERPKT_TIME / 1000 , (MAXIMAL_INTERPKT_TIME % 1000 ) * 1000 };
3432
35- BSTATSPlugin::BSTATSPlugin (const std::string& params)
33+ BSTATSPlugin::BSTATSPlugin (const std::string& params, int pluginID)
34+ : ProcessPlugin(pluginID)
3635{
3736 init (params.c_str ());
3837}
@@ -132,7 +131,7 @@ void BSTATSPlugin::update_record(RecordExtBSTATS* bstats_record, const Packet& p
132131
133132int BSTATSPlugin::post_create (Flow& rec, const Packet& pkt)
134133{
135- RecordExtBSTATS* bstats_record = new RecordExtBSTATS ();
134+ RecordExtBSTATS* bstats_record = new RecordExtBSTATS (m_pluginID );
136135
137136 rec.add_extension (bstats_record);
138137 update_record (bstats_record, pkt);
@@ -141,8 +140,7 @@ int BSTATSPlugin::post_create(Flow& rec, const Packet& pkt)
141140
142141int BSTATSPlugin::pre_update (Flow& rec, Packet& pkt)
143142{
144- RecordExtBSTATS* bstats_record
145- = static_cast <RecordExtBSTATS*>(rec.get_extension (RecordExtBSTATS::REGISTERED_ID));
143+ RecordExtBSTATS* bstats_record = static_cast <RecordExtBSTATS*>(rec.get_extension (m_pluginID));
146144
147145 update_record (bstats_record, pkt);
148146 return 0 ;
@@ -159,12 +157,11 @@ void BSTATSPlugin::pre_export(Flow& rec)
159157{
160158 uint32_t packets = rec.src_packets + rec.dst_packets ;
161159 if (packets <= MINIMAL_PACKETS_IN_BURST) {
162- rec.remove_extension (RecordExtBSTATS::REGISTERED_ID );
160+ rec.remove_extension (m_pluginID );
163161 return ;
164162 }
165163
166- RecordExtBSTATS* bstats_record
167- = static_cast <RecordExtBSTATS*>(rec.get_extension (RecordExtBSTATS::REGISTERED_ID));
164+ RecordExtBSTATS* bstats_record = static_cast <RecordExtBSTATS*>(rec.get_extension (m_pluginID));
168165
169166 for (int direction = 0 ; direction < 2 ; direction++) {
170167 if (bstats_record->BCOUNT < BSTATS_MAXELENCOUNT
0 commit comments