File: net_stat.h

package info (click to toggle)
conky 1.9.0-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,556 kB
  • sloc: ansic: 27,018; sh: 11,594; xml: 6,001; makefile: 259; python: 16
file content (101 lines) | stat: -rw-r--r-- 3,693 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
 * vim: ts=4 sw=4 noet ai cindent syntax=c
 *
 * Conky, a system monitor, based on torsmo
 *
 * Any original torsmo code is licensed under the BSD license
 *
 * All code written since the fork of torsmo is licensed under the GPL
 *
 * Please see COPYING for details
 *
 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
 * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
 *	(see AUTHORS)
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef _NET_STAT_H
#define _NET_STAT_H

#include <sys/socket.h>	/* struct sockaddr */

struct net_stat {
        char *dev;
        int up;
        long long last_read_recv, last_read_trans;
        long long recv, trans;
        double recv_speed, trans_speed;
        struct sockaddr addr;
#if defined(__linux__)
        char addrs[17 * MAX_NET_INTERFACES + 1];
#endif /* __linux__ */
        double net_rec[15], net_trans[15];
        // wireless extensions
        char essid[32];
        char bitrate[16];
        char mode[16];
        int link_qual;
        int link_qual_max;
        char ap[18];
};

extern struct net_stat netstats[];

struct net_stat *get_net_stat(const char *, void *, void *);

void parse_net_stat_arg(struct text_object *, const char *, void *);
void parse_net_stat_bar_arg(struct text_object *, const char *, void *);
void print_downspeed(struct text_object *, char *, int);
void print_downspeedf(struct text_object *, char *, int);
void print_upspeed(struct text_object *, char *, int);
void print_upspeedf(struct text_object *, char *, int);
void print_totaldown(struct text_object *, char *, int);
void print_totalup(struct text_object *, char *, int);
void print_addr(struct text_object *, char *, int);
#ifdef __linux__
void print_addrs(struct text_object *, char *, int);
#endif /* __linux__ */
#ifdef X11
void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
void print_downspeedgraph(struct text_object *, char *, int);
void print_upspeedgraph(struct text_object *, char *, int);
#endif /* X11 */
#ifdef __linux__
#ifdef HAVE_IWLIB
void print_wireless_essid(struct text_object *, char *, int);
void print_wireless_mode(struct text_object *, char *, int);
void print_wireless_bitrate(struct text_object *, char *, int);
void print_wireless_ap(struct text_object *, char *, int);
void print_wireless_link_qual(struct text_object *, char *, int);
void print_wireless_link_qual_max(struct text_object *, char *, int);
void print_wireless_link_qual_perc(struct text_object *, char *, int);
void print_wireless_link_bar(struct text_object *, char *, int);
#endif /* HAVE_IWLIB */
#endif /* __linux__ */

void clear_net_stats(void);

void parse_if_up_arg(struct text_object *, const char *);
int interface_up(struct text_object *);
void free_if_up(struct text_object *);

void free_dns_data(void);
int update_dns_data(void);
void parse_nameserver_arg(struct text_object *, const char *);
void print_nameserver(struct text_object *, char *, int);

#endif /* _NET_STAT_H */