Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120493918
countbytes.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
Fri, Jul 4, 19:03
Size
2 KB
Mime Type
text/x-c++
Expires
Sun, Jul 6, 19:03 (2 d)
Engine
blob
Format
Raw Data
Handle
27185336
Attached To
R6591 HyMAB
countbytes.hh
View Options
#ifndef CLICK_COUNTBYTES_HH
#define CLICK_COUNTBYTES_HH
#include <click/element.hh>
#include <click/notifier.hh>
#include <click/router.hh>
#include <click/confparse.hh>
#include <click/error.hh>
#include <click/config.h>
#include <click/args.hh>
#include "util.hh"
#include "routingpaths.hh"
#ifdef CLICK_USERLEVEL
# include <stdarg.h>
#endif
CLICK_DECLS
class RoutingPaths;
class CountBytes : public Element {
public:
CountBytes();
~CountBytes();
const char *class_name() const { return "CountBytes"; }
const char *port_count() const { return "1/1-2"; }
const char *processing() const { return AGNOSTIC; }
int configure(Vector<String> &, ErrorHandler *);
int initialize(ErrorHandler *);
void push(int, Packet*);
Packet* pull(int);
void count_packet(Packet*);
void run_timer(Timer *timer);
void reset();
void reset_flow(IPAddress);
HashTable<IPAddress, Timestamp> get_time_table() {return _time_table;}
// handlers
void add_handlers();
static int bool_handler(const String &, Element *, void *,ErrorHandler *);
static int integer_handler(const String &, Element *, void *,ErrorHandler *);
static int objective_handler(const String &, Element *, void *,ErrorHandler *);
static int reset_flow_handler(const String &, Element *, void *,ErrorHandler *);
void set_active(bool b) {_active = b;}
void set_send_stop_ack(bool b) {_send_stop_ack = b;}
void set_objective(uint64_t n) {if(n!=_bytes_objective) reset(); _bytes_objective = n;}
void set_freq_print(int a) {_freq_print = a;_timer.schedule_after_sec(_freq_print);}
protected:
bool _active;
bool _debug;
bool _send_stop_ack;
uint64_t _bytes_objective;
int _freq_print;
Timer _timer;
IPAddress _my_ip;
RoutingPaths *_rtp;
HashTable<IPAddress, uint64_t> _bytes_flow;
HashTable<IPAddress, Timestamp> _first_packet;
HashTable<IPAddress, Timestamp> _last_active;
HashTable<IPAddress, Timestamp> _time_table;
};
CLICK_ENDDECLS
#endif
Event Timeline
Log In to Comment