From 99526a6ad07c02e40e0831fd952974c5b7446f31 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 19 Aug 2016 19:15:39 +0200 Subject: server: Add global and per client counters and begin to count Add the basics for getting a picture what a client and the server is doing. We need to create unique descriptions as the code is working with names and not numbers for clients. Change-Id: I4a9be5bdd815d280cccf0199efc2ca79fc77d393 --- include/osmo-pcap/osmo_pcap_server.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/osmo-pcap/osmo_pcap_server.h b/include/osmo-pcap/osmo_pcap_server.h index 5af0838..a386a2a 100644 --- a/include/osmo-pcap/osmo_pcap_server.h +++ b/include/osmo-pcap/osmo_pcap_server.h @@ -1,7 +1,7 @@ /* * osmo-pcap-server code * - * (C) 2011 by Holger Hans Peter Freyther + * (C) 2011-2016 by Holger Hans Peter Freyther * (C) 2011 by On-Waves * All Rights Reserved * @@ -36,6 +36,9 @@ #include +struct rate_ctr_group; +struct rate_ctr_group_desc; + struct osmo_pcap_server; @@ -44,6 +47,21 @@ struct osmo_pcap_server; #define SERVER_MAX_DATA_SIZE 10000 +enum { + PEER_CTR_CONNECT, + PEER_CTR_BYTES, + PEER_CTR_PKTS, + PEER_CTR_PROTATE, +}; + +enum { + SERVER_CTR_CONNECT, + SERVER_CTR_BYTES, + SERVER_CTR_PKTS, + SERVER_CTR_PROTATE, + SERVER_CTR_NOCLIENT, +}; + struct osmo_pcap_conn { /* list of connections */ struct llist_head entry; @@ -72,6 +90,9 @@ struct osmo_pcap_conn { int reopen; char buf[SERVER_MAX_DATA_SIZE + sizeof(struct osmo_pcap_data)]; struct osmo_pcap_data *data; + + /* statistics */ + struct rate_ctr_group *ctrg; }; struct osmo_pcap_server { @@ -89,9 +110,13 @@ struct osmo_pcap_server { char *base_path; off_t max_size; + + /* statistics */ + struct rate_ctr_group *ctrg; }; extern struct osmo_pcap_server *pcap_server; +extern const struct rate_ctr_group_desc pcap_peer_group_desc; void osmo_pcap_server_reopen(struct osmo_pcap_server *server); int osmo_pcap_server_listen(struct osmo_pcap_server *server); -- cgit v1.2.3