1 //
2 //   Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 //   Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 //
19 
20 #ifndef __STATISTICS_H__
21 #define __STATISTICS_H__
22 
23 #include <vector>
24 #include <sys/time.h>
25 #include <network.h>
26 #include <list>
27 
28 #include "netstats.h"
29 
30 namespace gnash
31 {
32 
33 class Statistics : public NetStats {
34 public:
35     Statistics();
36     ~Statistics();
37     typedef enum {
38         NO_BROWSER,
39         MOZILLA,
40         FIREFOX,
41         OPERA,
42         KONQUEROR,
43         GALEON,
44         EPIPHANY,
45         SAFARI,
46         IE
47     } browser_e;
48     typedef enum {
49         OSTYPE_NONE,
50         OSTYPE_LINUX,
51         OSTYPE_BSD,
52         OSTYPE_DARWIN,
53         OSTYPE_WIN32,
54         OSTYPE_SOLARIS
55     } ostype_e;
56 
57     // Add a sample
58     int addStats();
59 
60     // these make calculations on the collected network data.
61     float getFPS();
62     int getBitRate();
63 
64     // Accessors
setIPaddr(in_addr_t x)65     void setIPaddr(in_addr_t x) { _ipaddr = x; };
setBrowser(browser_e x)66     void setBrowser(browser_e x) { _browser = x; } ;
setOS(ostype_e x)67     void setOS(ostype_e x) { _os = x; } ;
getIPaddr()68     in_addr_t getIPaddr() { return _ipaddr; };
getBrowser()69     browser_e getBrowser() { return _browser; };
getOS()70     ostype_e getOS() { return _os; };
71 
72 //    void setFilespec(std::string &x) { _filespec = x; } ;
73 //    std::string &getFilespec() { return _filespec; };
74     // Dump the collected network statistics in a human readable form.
75     void dump();
76     void clear();
77 private:
78     in_addr_t           _ipaddr;
79     browser_e           _browser;
80     ostype_e            _os;
81     std::list<NetStats *> _netstats;
82     std::uint32_t     _msg_count;
83     std::vector<std::string> _filespec;
84 };
85 
86 } // end of gnash namespace
87 
88 #endif // __STATISTICS_H__
89 
90 // local Variables:
91 // mode: C++
92 // indent-tabs-mode: t
93 // End:
94