1 |
< |
/* |
1 |
> |
/* |
2 |
|
* i-scream central monitoring system |
3 |
|
* http://www.i-scream.org |
4 |
< |
* Copyright (C) 2000-2003 i-scream |
4 |
> |
* Copyright (C) 2000-2004 i-scream |
5 |
|
* |
6 |
< |
* This program is free software; you can redistribute it and/or |
7 |
< |
* modify it under the terms of the GNU General Public License |
8 |
< |
* as published by the Free Software Foundation; either version 2 |
9 |
< |
* of the License, or (at your option) any later version. |
6 |
> |
* This library is free software; you can redistribute it and/or |
7 |
> |
* modify it under the terms of the GNU Lesser General Public |
8 |
> |
* License as published by the Free Software Foundation; either |
9 |
> |
* version 2.1 of the License, or (at your option) any later version. |
10 |
|
* |
11 |
< |
* This program is distributed in the hope that it will be useful, |
11 |
> |
* This library 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. |
13 |
> |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
> |
* Lesser 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 |
18 |
< |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
16 |
> |
* You should have received a copy of the GNU Lesser General Public |
17 |
> |
* License along with this library; if not, write to the Free Software |
18 |
> |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
19 |
> |
* 02111-1307 USA |
20 |
> |
* |
21 |
> |
* $Id$ |
22 |
|
*/ |
23 |
|
|
24 |
|
#ifdef HAVE_CONFIG_H |
39 |
|
#include <regex.h> |
40 |
|
#include "tools.h" |
41 |
|
#endif |
42 |
< |
#ifdef FREEBSD |
42 |
> |
#ifdef ALLBSD |
43 |
|
#include <sys/types.h> |
44 |
|
#include <sys/socket.h> |
45 |
|
#include <ifaddrs.h> |
104 |
|
regex_t regex; |
105 |
|
regmatch_t line_match[4]; |
106 |
|
#endif |
107 |
< |
#ifdef FREEBSD |
107 |
> |
#ifdef ALLBSD |
108 |
|
struct ifaddrs *net, *net_ptr; |
109 |
|
struct if_data *net_data; |
110 |
|
#endif |
111 |
|
|
112 |
< |
#ifdef FREEBSD |
112 |
> |
#ifdef ALLBSD |
113 |
|
if(getifaddrs(&net) != 0){ |
114 |
|
return NULL; |
115 |
|
} |
227 |
|
regfree(®ex); |
228 |
|
|
229 |
|
#endif |
230 |
+ |
|
231 |
+ |
#ifdef CYGWIN |
232 |
+ |
return NULL; |
233 |
+ |
#endif |
234 |
+ |
|
235 |
|
*entries=interfaces; |
236 |
|
|
237 |
|
return network_stats; |
238 |
|
} |
239 |
|
|
240 |
|
long long transfer_diff(long long new, long long old){ |
241 |
< |
#ifdef SOL7 |
242 |
< |
#define MAXVAL 4294967296 |
241 |
> |
#if defined(SOL7) || defined(LINUX) || defined(FREEBSD) |
242 |
> |
#define MAXVAL 4294967296LL |
243 |
|
#else |
244 |
< |
#define MAXVAL 18446744073709551616 |
244 |
> |
#define MAXVAL 18446744073709551616LL |
245 |
|
#endif |
246 |
|
long long result; |
247 |
|
if(new>=old){ |
287 |
|
network_stats_diff_ptr++; |
288 |
|
} |
289 |
|
network_stats_ptr=get_network_stats(&ifaces); |
290 |
+ |
if (network_stats_ptr == NULL) { |
291 |
+ |
return NULL; |
292 |
+ |
} |
293 |
|
network_stats_diff_ptr=network_stats_diff; |
294 |
|
|
295 |
|
for(x=0;x<sizeof_net_stats_diff;x++){ |