Remove concept of multiple timer managers

- All timers are now handled by a single global timer manager, which simplifies how they handled by the IOSource manager.
- This change flows down a number of changes to other parts of the code. The timer manager tag field is removed, which means that matching connections to a timer manager is also removed. This removes the ability to tag a connection as internal or external, since that's how the connections where differentiated. This in turn removes the `current_conns_extern` field from the `ConnStats` record type in the script layer.
This commit is contained in:
Tim Wojtulewicz 2019-12-02 17:10:57 -07:00
parent 2dcc936787
commit be42608b51
15 changed files with 28 additions and 284 deletions

View file

@ -44,20 +44,6 @@ struct SessionStats {
uint64_t num_packets;
};
// Drains and deletes a timer manager if it hasn't seen any advances
// for an interval timer_mgr_inactivity_timeout.
class TimerMgrExpireTimer : public Timer {
public:
TimerMgrExpireTimer(double t, TimerMgr* arg_mgr)
: Timer(t, TIMER_TIMERMGR_EXPIRE), mgr(arg_mgr)
{ }
void Dispatch(double t, int is_expire) override;
protected:
TimerMgr* mgr;
};
class NetSessions {
public:
NetSessions();
@ -101,13 +87,6 @@ public:
return packet_filter;
}
// Looks up timer manager associated with tag. If tag is unknown and
// "create" is true, creates new timer manager and stores it. Returns
// global timer manager if tag is nil.
TimerMgr* LookupTimerMgr(const std::string* tag, bool create = true);
void ExpireTimerMgrs();
analyzer::stepping_stone::SteppingStoneManager* GetSTPManager() { return stp_manager; }
unsigned int CurrentConnections()
@ -168,7 +147,6 @@ public:
protected:
friend class ConnCompressor;
friend class TimerMgrExpireTimer;
friend class IPTunnelTimer;
using ConnectionMap = std::map<ConnIDKey, Connection*>;
@ -180,13 +158,6 @@ protected:
Connection* LookupConn(const ConnectionMap& conns, const ConnIDKey& key);
// Check whether the tag of the current packet is consistent with
// the given connection. Returns:
// -1 if current packet is to be completely ignored.
// 0 if tag is not consistent and new conn should be instantiated.
// 1 if tag is consistent, i.e., packet is part of connection.
int CheckConnectionTag(Connection* conn);
// Returns true if the port corresonds to an application
// for which there's a Bro analyzer (even if it might not
// be used by the present policy script), or it's more
@ -243,11 +214,6 @@ protected:
int dump_this_packet; // if true, current packet should be recorded
uint64_t num_packets_processed;
PacketProfiler* pkt_profiler;
// We may use independent timer managers for different sets of related
// activity. The managers are identified by a unique tag.
typedef std::map<std::string, TimerMgr*> TimerMgrMap;
TimerMgrMap timer_mgrs;
};