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_STA_COUNTERS_HH_
00023 # define WIFI_STATS_STA_COUNTERS_HH_
00024
00025 # include <wipal/wifi/stats/on_off_data.hh>
00026
00027 namespace wpl
00028 {
00029
00030 namespace wifi
00031 {
00032
00033 namespace stats
00034 {
00035
00036 struct sta_counters: public module
00037 {
00038 sta_counters(const on_off_data* ood);
00039
00040 template <class Frame>
00041 void
00042 account_frame(const Frame& frame,
00043 const size_t& len80211,
00044 const type::frame_type& type,
00045 const unsigned& subtype,
00046 const bool& retx,
00047 const addr* const& receiver,
00048 const addr* const& transmitter,
00049 const bool& from_ap);
00050 std::ostream& print(std::ostream& o) const;
00051
00052 private:
00053 struct counters
00054 {
00055 counters();
00056
00057 unsigned count;
00058 uint64_t size;
00059 };
00060
00061 typedef std::map<addr, counters> states;
00062
00063 struct size_less
00064 {
00065 bool operator () (const states::const_iterator& lhs,
00066 const states::const_iterator& rhs) const;
00067 };
00068
00069 struct avg_rate_less
00070 {
00071 avg_rate_less(const on_off_data* ood);
00072
00073 bool operator () (const states::const_iterator& lhs,
00074 const states::const_iterator& rhs) const;
00075
00076 private:
00077 const on_off_data* ood_;
00078 };
00079
00080 struct time_on_less
00081 {
00082 time_on_less(const on_off_data* ood);
00083
00084 bool operator () (const states::const_iterator& lhs,
00085 const states::const_iterator& rhs) const;
00086
00087 private:
00088 const on_off_data* ood_;
00089 };
00090
00091 template <class Set>
00092 std::ostream&
00093 print(std::ostream& os,
00094 const std::string& name,
00095 const Set& set) const;
00096
00097 template <class Less>
00098 std::set<states::const_iterator, Less>
00099 sorted_states(const Less& less = Less ()) const;
00100
00101 states states_;
00102 const on_off_data* ood_;
00103 };
00104
00105 }
00106
00107 }
00108
00109 }
00110
00111 # include "sta_counters.hxx"
00112
00113 #endif // ! WIFI_STATS_STA_COUNTERS_HH_