Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122220733
mfleakybucket-standalone.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 16, 18:24
Size
2 KB
Mime Type
text/x-c++
Expires
Fri, Jul 18, 18:24 (2 d)
Engine
blob
Format
Raw Data
Handle
27452503
Attached To
R1252 EMPoWER
mfleakybucket-standalone.hh
View Options
#ifndef CLICK_MFLEAKYBUCKETSA_HH
#define CLICK_MFLEAKYBUCKETSA_HH
#include <click/config.h>
#include <click/args.hh>
#include <click/element.hh>
#include <click/confparse.hh>
#include <click/error.hh>
#include <click/glue.hh>
#include <click/timer.hh>
#include <click/hashtable.hh>
//#include <click/ipflowid.hh>
#include <click/straccum.hh>
#include "util.hh"
#include "cc.hh"
CLICK_DECLS
/*
* Per-flow rate limiting with push processing
* This implementation of per-flow leaky bucket does not need multiflowdispatcher
*/
class Cc;
class MFLeakyBucketSA : public Element {
public:
MFLeakyBucketSA();
~MFLeakyBucketSA();
//void *cast(const char *);
const char *class_name() const { return "MFLeakyBucketSA"; }
const char *port_count() const { return "1/1"; }
//push input 0 : packets not rate-limited
//push output 0 : rate-limited packets (excess packets are silently discarded)
const char *processing() const { return "h/h"; }
int configure(Vector<String> &, ErrorHandler *);
int initialize(ErrorHandler *);
void push(int, Packet*);
//int set_rate(IPFlowID id, uint32_t rate);
//uint32_t get_rate(IPFlowID id);
int set_rate(FormatedRoute id, uint32_t rate);
uint32_t get_rate(FormatedRoute route);
bool remove_route(FormatedRoute froute);
void reset_pktTosend(int ms_elapsed);
String print_info();
void set_debug(bool debug) {_debug=debug;if(debug) _timer.schedule_now();}
void set_limit_rate(bool b) {if(b&&!_bool_limit_rate) reset(); _bool_limit_rate=b;}
void set_period_print(int a) {_period_print = a;_timer.schedule_now();}
void set_max_count_packets(int arg) {_max_count_packets=arg;}
static int debug_handler(const String &, Element *, void *,ErrorHandler *);
static int period_print_handler(const String &, Element *, void *,ErrorHandler *);
static int limit_rate_handler(const String &, Element *, void *,ErrorHandler *);
static int set_max_count_packets_handler(const String &, Element *, void *,ErrorHandler *);
void set_cc_elmt(Cc *);
void add_handlers();
private:
bool _debug;
bool _verb_debug;
Timer _active_timer;
Cc *_cc_elmt;
bool _print_warning_cc;
bool _print_info;
uint64_t _received_bytes;
uint64_t _killed_bytes;
int _max_count_packets;
int _count;
FlowInfoLB *_info;
FlowInfoLB _default_flow_info;
HashTable<FormatedRoute, FlowInfoLB> _route2info;
bool _bool_limit_rate;
Timer _timer;
Timestamp _now; //to keep track of elapsed time
uint32_t _period_print;
Timestamp _last_print;
uint64_t _count_print;
HashTable<IPAddress,uint16_t> _seqNumTable;
HashTable<FormatedRoute,bool> _print_error;
void reset();
void run_timer(Timer *timer);
};
CLICK_ENDDECLS
#endif
Event Timeline
Log In to Comment