00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WIFI_STATS_GROWTH_HH_
00023 # define WIFI_STATS_GROWTH_HH_
00024
00025 # include <wipal/wifi/stats/epoch_tracker.hh>
00026 # include <wipal/wifi/stats/module.hh>
00027
00028 namespace wpl
00029 {
00030
00031 namespace wifi
00032 {
00033
00034 namespace stats
00035 {
00036
00037 template <class T, unsigned EpochLength>
00038 struct growth: public abstract_stats
00039 {
00040 void restart();
00041 void update(const tool::microseconds& timestamp);
00042 void update(const T& elt);
00043 std::ostream& print(std::ostream& o) const;
00044
00045 private:
00046 struct epoch_data
00047 {
00048 epoch_data();
00049
00050 unsigned total_count;
00051 unsigned current_count;
00052 };
00053
00054 std::set<T> elements_;
00055 std::set<T> current_elements_;
00056 epoch_tracker<epoch_data, EpochLength> tracker_;
00057 };
00058
00059 template <unsigned Epoch, bool OnlyAccountTxer = false>
00060 struct addr_growth: public module
00061 {
00062 addr_growth(const void* other_modules = 0);
00063
00064 void account_addr(unsigned, const addr& a);
00065
00066 template <class Frame>
00067 void
00068 account_frame(const Frame& frame,
00069 const size_t& len80211,
00070 const type::frame_type& type,
00071 const unsigned& subtype,
00072 const bool& retx,
00073 const addr* const& receiver,
00074 const addr* const& transmitter,
00075 const bool& from_ap);
00076
00077 std::ostream& print(std::ostream& os) const;
00078 void restart();
00079
00080 protected:
00081 typedef growth<addr, Epoch> growth_type;
00082
00083 growth_type growth_;
00084 bool ignore_;
00085 };
00086
00087 template <unsigned Epoch>
00088 struct beacon_items_growth: public module
00089 {
00090 beacon_items_growth(const void* other_modules = 0);
00091
00092 template <class Frame>
00093 void
00094 account_beacon(const Frame& frame,
00095 const addr* const& ap,
00096 const addr* const& bss,
00097 const optional_string& ssid,
00098 const bool& ibss);
00099
00100 template <class Frame>
00101 void
00102 account_frame(const Frame& frame,
00103 const size_t& len80211,
00104 const type::frame_type& type,
00105 const unsigned& subtype,
00106 const bool& retx,
00107 const addr* const& receiver,
00108 const addr* const& transmitter,
00109 const bool& from_ap);
00110
00111 std::ostream& print(std::ostream& os) const;
00112 void restart();
00113
00114 private:
00115 typedef growth<addr, Epoch> bssid_growth;
00116 typedef growth<addr, Epoch> ibssid_growth;
00117 typedef growth<std::string, Epoch> ssid_growth;
00118 typedef growth<addr, Epoch> ap_growth;
00119
00120 ap_growth ap_;
00121 bssid_growth bssid_;
00122 ibssid_growth ibssid_;
00123 ssid_growth ssid_;
00124 bool ignore_;
00125 };
00126
00127 }
00128
00129 }
00130
00131 }
00132
00133 # include "growth.hxx"
00134
00135 #endif // ! WIFI_STATS_GROWTH_HH_