{down,up}speedgraph: convert to match common signature
[monky] / src / net_stat.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
2  * vim: ts=4 sw=4 noet ai cindent syntax=c
3  *
4  * Conky, a system monitor, based on torsmo
5  *
6  * Any original torsmo code is licensed under the BSD license
7  *
8  * All code written since the fork of torsmo is licensed under the GPL
9  *
10  * Please see COPYING for details
11  *
12  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
13  * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
14  *      (see AUTHORS)
15  * All rights reserved.
16  *
17  * This program is free software: you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation, either version 3 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  * You should have received a copy of the GNU General Public License
27  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
28  *
29  */
30
31 #ifndef _NET_STAT_H
32 #define _NET_STAT_H
33
34 #include <sys/socket.h> /* struct sockaddr */
35
36 struct net_stat {
37         char *dev;
38         int up;
39         long long last_read_recv, last_read_trans;
40         long long recv, trans;
41         double recv_speed, trans_speed;
42         struct sockaddr addr;
43 #if defined(__linux__)
44         char addrs[273];
45 #endif /* __linux__ */
46         double net_rec[15], net_trans[15];
47         // wireless extensions
48         char essid[32];
49         char bitrate[16];
50         char mode[16];
51         int link_qual;
52         int link_qual_max;
53         char ap[18];
54 };
55
56 extern struct net_stat netstats[];
57
58 struct net_stat *get_net_stat(const char *, void *, void *);
59
60 void parse_net_stat_arg(struct text_object *, const char *, void *);
61 void parse_net_stat_bar_arg(struct text_object *, const char *, void *);
62 void print_downspeed(struct text_object *, char *, int);
63 void print_downspeedf(struct text_object *, char *, int);
64 void print_upspeed(struct text_object *, char *, int);
65 void print_upspeedf(struct text_object *, char *, int);
66 void print_totaldown(struct text_object *, char *, int);
67 void print_totalup(struct text_object *, char *, int);
68 void print_addr(struct text_object *, char *, int);
69 #ifdef __linux__
70 void print_addrs(struct text_object *, char *, int);
71 #endif /* __linux__ */
72 #ifdef X11
73 void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
74 void print_downspeedgraph(struct text_object *, char *, int);
75 void print_upspeedgraph(struct text_object *, char *, int);
76 #endif /* X11 */
77 #ifdef __linux__
78 #ifdef HAVE_IWLIB
79 void print_wireless_essid(struct text_object *, char *, int);
80 void print_wireless_mode(struct text_object *, char *, int);
81 void print_wireless_bitrate(struct text_object *, char *, int);
82 void print_wireless_ap(struct text_object *, char *, int);
83 void print_wireless_link_qual(struct text_object *, char *, int);
84 void print_wireless_link_qual_max(struct text_object *, char *, int);
85 void print_wireless_link_qual_perc(struct text_object *, char *, int);
86 void print_wireless_link_bar(struct text_object *, char *, int);
87 #endif /* HAVE_IWLIB */
88 #endif /* __linux__ */
89
90 void clear_net_stats(void);
91
92 void parse_if_up_arg(struct text_object *, const char *);
93 int interface_up(struct text_object *);
94 void free_if_up(struct text_object *);
95
96 void free_dns_data(void);
97 void update_dns_data(void);
98 void parse_nameserver_arg(struct text_object *, const char *);
99 void print_nameserver(struct text_object *, char *, int);
100
101 #endif /* _NET_STAT_H */