+// each policy corresponds to a specific X2 subscriber profile ID
+// and applies sliding window logic to UEs in that class (if enforce)
+class protector_policy {
+public:
+ protector_policy(bool enforce=true, int window_size=60, int threshold=10, double block_rate=10): _enforce(enforce), _window_size(window_size), _threshold(threshold), _block_rate(block_rate){
+ _counter = 0;
+ _req = 0;
+ _rej = 0;
+ _window_ref = std::make_unique<sliding_window>(_window_size);
+ };
+
+ bool _enforce; // do we enforce policy ?
+ int _counter; // count the # of attaching access
+ int _window_size; // time in seconds window for the # of counts
+ int _threshold; // count above which we start enforcing if enforce set
+ double _block_rate; // % of rejecting rate for counter > threshold
+ std::unique_ptr<sliding_window> _window_ref;
+ unsigned long int _req; // number of requests
+ unsigned long int _rej; // number of rejects
+
+};
+
+