Coverage Report

Created: 2024-02-25 06:37

/src/ntopng/include/VirtualHost.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *
3
 * (C) 2013-24 - ntop.org
4
 *
5
 *
6
 * This program is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software Foundation,
18
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
 *
20
 */
21
22
#ifndef _VIRTUAL_HOST_H_
23
#define _VIRTUAL_HOST_H_
24
25
#include "ntop_includes.h"
26
27
class Flow;
28
class HostHash;
29
30
class VirtualHost : public GenericHashEntry {
31
  HostHash *h;
32
  char *name;
33
  TrafficStats sent_stats, rcvd_stats, num_requests;
34
  u_int64_t last_num_requests;
35
  u_int32_t last_diff;
36
  u_int32_t vhost_key;
37
  ValueTrend trend;
38
39
 public:
40
  VirtualHost(HostHash *_h, char *_name);
41
  ~VirtualHost();
42
43
0
  u_int32_t key() { return vhost_key; };
44
0
  inline char *get_name() { return name; };
45
  inline void incStats(time_t t, u_int32_t num_req, u_int32_t bytes_sent,
46
0
                       u_int32_t bytes_rcvd) {
47
0
    updateSeen(t);
48
0
    sent_stats.incStats(t, 1, bytes_sent),
49
0
        rcvd_stats.incStats(t, 1, bytes_rcvd),
50
0
        num_requests.incStats(t, 1, num_req);
51
0
  }
52
0
  inline u_int64_t get_sent_bytes() { return (sent_stats.getNumBytes()); };
53
0
  inline u_int64_t get_rcvd_bytes() { return (rcvd_stats.getNumBytes()); };
54
0
  inline u_int64_t get_num_requests() { return (num_requests.getNumBytes()); };
55
0
  inline u_int64_t get_diff_num_requests() { return (last_diff); };
56
0
  inline ValueTrend get_trend() { return (trend); };
57
  void update_stats();
58
};
59
60
#endif /* _VIRTUAL_HOST_H_ */