diff options
author | Thomas Graf <tgraf@suug.ch> | 2013-07-05 15:11:46 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-07-05 15:11:46 +0200 |
commit | 3be703f67d34b761725a13b6e58ab22591824bbe (patch) | |
tree | e3126790b78f0f9268455d9aac9dfd0e6985b8da /include | |
parent | 924d1e1fb48eb0c1bf0abee3afba005e06368432 (diff) |
Initial import
Diffstat (limited to 'include')
-rw-r--r-- | include/bmon/.gitignore | 2 | ||||
-rw-r--r-- | include/bmon/attr.h | 138 | ||||
-rw-r--r-- | include/bmon/bmon.h | 82 | ||||
-rw-r--r-- | include/bmon/compile-fixes.h | 35 | ||||
-rw-r--r-- | include/bmon/conf.h | 91 | ||||
-rw-r--r-- | include/bmon/config.h | 158 | ||||
-rw-r--r-- | include/bmon/defs.h.in | 246 | ||||
-rw-r--r-- | include/bmon/element.h | 130 | ||||
-rw-r--r-- | include/bmon/element_cfg.h | 53 | ||||
-rw-r--r-- | include/bmon/graph.h | 72 | ||||
-rw-r--r-- | include/bmon/group.h | 100 | ||||
-rw-r--r-- | include/bmon/history.h | 93 | ||||
-rw-r--r-- | include/bmon/info.h | 42 | ||||
-rw-r--r-- | include/bmon/input.h | 52 | ||||
-rw-r--r-- | include/bmon/list.h | 93 | ||||
-rw-r--r-- | include/bmon/module.h | 75 | ||||
-rw-r--r-- | include/bmon/output.h | 39 | ||||
-rw-r--r-- | include/bmon/unit.h | 68 | ||||
-rw-r--r-- | include/bmon/utils.h | 102 |
19 files changed, 1671 insertions, 0 deletions
diff --git a/include/bmon/.gitignore b/include/bmon/.gitignore new file mode 100644 index 0000000..7ffac03 --- /dev/null +++ b/include/bmon/.gitignore @@ -0,0 +1,2 @@ +defs.h* +stamp-h1 diff --git a/include/bmon/attr.h b/include/bmon/attr.h new file mode 100644 index 0000000..224f151 --- /dev/null +++ b/include/bmon/attr.h @@ -0,0 +1,138 @@ +/* + * bmon/attr.h Attributes + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __BMON_ATTR_H_ +#define __BMON_ATTR_H_ + +#include <bmon/bmon.h> +#include <bmon/unit.h> + +struct element; + +struct rate +{ + /* Total value of attribute with eventual overflows accumulated. */ + uint64_t r_total; + + /* Current value of counter */ + uint64_t r_current; + + /* Value of r_current at last read */ + uint64_t r_prev; + + /* Rate per second calculated every `rate_interval' */ + float r_rate; + + /* Time of last calculation */ + timestamp_t r_last_calc; +}; + +enum { + ATTR_TYPE_UNSPEC, + ATTR_TYPE_COUNTER, + ATTR_TYPE_RATE, + ATTR_TYPE_PERCENT, +}; + +struct attr_def { + int ad_id; + char * ad_name; + char * ad_description; + int ad_type; + int ad_flags; + struct unit * ad_unit; + + struct list_head ad_list; +}; + +struct attr_map { + const char * name; + const char * description; + const char * unit; + int attrid, + type, + rxid, + txid, + flags; +}; + +extern int attr_def_add(const char *, const char *, + struct unit *, int, int); +extern struct attr_def * attr_def_lookup(const char *); +extern struct attr_def * attr_def_lookup_id(int); + +extern int attr_map_load(struct attr_map *map, size_t size); + +#define ATTR_FORCE_HISTORY 0x01 /* collect history */ +#define ATTR_IGNORE_OVERFLOWS 0x02 +#define ATTR_TRUE_64BIT 0x04 +#define ATTR_RX_ENABLED 0x08 /* has RX counter */ +#define ATTR_TX_ENABLED 0x10 /* has TX counter */ +#define ATTR_DOING_HISTORY 0x20 /* history collected */ + +struct attr +{ + struct rate a_rx_rate, + a_tx_rate; + + uint8_t a_flags; + struct attr_def * a_def; + timestamp_t a_last_update; + + struct list_head a_history_list; + + struct list_head a_list; + struct list_head a_sort_list; +}; + +extern struct attr * attr_lookup(const struct element *, int); +extern void attr_update(struct element *, int, + uint64_t, uint64_t , int ); +extern void attr_notify_update(struct attr *, + timestamp_t *); +extern void attr_free(struct attr *); + +extern void attr_rate2float(struct attr *, + double *, char **, int *, + double *, char **, int *); + +extern void attr_calc_usage(struct attr *, float *, float *, + uint64_t, uint64_t); + +#define ATTR_HASH_SIZE 32 + +#define UPDATE_FLAG_RX 0x01 +#define UPDATE_FLAG_TX 0x02 +#define UPDATE_FLAG_64BIT 0x04 + +extern struct attr * attr_select_first(void); +extern struct attr * attr_select_last(void); +extern struct attr * attr_select_next(void); +extern struct attr * attr_select_prev(void); +extern struct attr * attr_current(void); + +extern void attr_start_collecting_history(struct attr *); + +#endif diff --git a/include/bmon/bmon.h b/include/bmon/bmon.h new file mode 100644 index 0000000..e349110 --- /dev/null +++ b/include/bmon/bmon.h @@ -0,0 +1,82 @@ +/* + * bmon.h All-include Header + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __BMON_BMON_H_ +#define __BMON_BMON_H_ + +#include <bmon/config.h> +#include <bmon/list.h> + +extern int start_time; + +typedef struct timestamp_s +{ + int64_t tv_sec; + int64_t tv_usec; +} timestamp_t; + +typedef struct xdate_s +{ + struct tm d_tm; + unsigned int d_usec; +} xdate_t; + +enum { + EMPTY_LIST = 1, + END_OF_LIST = 2 +}; + +#define BUG() \ + do { \ + fprintf(stderr, "BUG: %s:%d\n", __FILE__, __LINE__); \ + assert(0); \ + exit(EINVAL); \ + } while (0); + +#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0])) + +#if defined __GNUC__ +#define __init __attribute__ ((constructor)) +#define __exit __attribute__ ((destructor)) +#else +#define __init +#define __exit +#endif + +#ifdef DEBUG +#define DBG(FMT, ARG...) \ + do { \ + fprintf(stderr, \ + "[DBG] %20s:%-4u %s: " FMT "\n", \ + __FILE__, __LINE__, \ + __PRETTY_FUNCTION__, ##ARG); \ + } while (0) +#else +#define DBG(FMT, ARG...) \ + do { \ + } while (0) +#endif + +#endif diff --git a/include/bmon/compile-fixes.h b/include/bmon/compile-fixes.h new file mode 100644 index 0000000..c3e5b00 --- /dev/null +++ b/include/bmon/compile-fixes.h @@ -0,0 +1,35 @@ +/* + * compile_fixes.h + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __BMON_COMPILE_FIXES_H_ +#define __BMON_COMPILE_FIXES_H_ + +#include <bmon/defs.h> + +#ifndef HAVE_SUSECONDS_T +typedef long suseconds_t; +#endif + +#endif diff --git a/include/bmon/conf.h b/include/bmon/conf.h new file mode 100644 index 0000000..f95d48f --- /dev/null +++ b/include/bmon/conf.h @@ -0,0 +1,91 @@ +/* + * conf.h Config Crap + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __BMON_CONF_H_ +#define __BMON_CONF_H_ + +#include <bmon/bmon.h> + +extern cfg_t *cfg; + +extern float cfg_read_interval; +extern float cfg_rate_interval; +extern float cfg_rate_variance; +extern float cfg_history_variance; +extern int cfg_show_all; +extern int cfg_unit_exp; + +extern void conf_init_pre(void); +extern void conf_init_post(void); +extern void configfile_read(void); +extern void set_configfile(const char *); + +extern unsigned int get_lifecycles(void); + +extern void conf_set_float(const char *, double); +extern double conf_get_float(const char *); +extern void conf_set_int(const char *, long); +extern long conf_get_int(const char *); +extern void conf_set_string(const char *, const char *); +extern const char * conf_get_string(const char *); + +typedef struct tv_s +{ + char * tv_type; + char * tv_value; + struct list_head tv_list; +} tv_t; + +typedef struct module_conf_s +{ + char * m_name; + struct list_head m_attrs; + struct list_head m_list; +} module_conf_t; + +extern int parse_module_param(const char *, struct list_head *); + +enum { + LAYOUT_UNSPEC, + LAYOUT_DEFAULT, + LAYOUT_STATUSBAR, + LAYOUT_HEADER, + LAYOUT_LIST, + LAYOUT_SELECTED, + __LAYOUT_MAX +}; + +#define LAYOUT_MAX (__LAYOUT_MAX - 1) + +struct layout +{ + int l_fg, + l_bg, + l_attr; +}; + +extern struct layout cfg_layout[]; + +#endif diff --git a/include/bmon/config.h b/include/bmon/config.h new file mode 100644 index 0000000..e717245 --- /dev/null +++ b/include/bmon/config.h @@ -0,0 +1,158 @@ +/* + * config.h Global Config + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __BMON_CONFIG_H_ +#define __BMON_CONFIG_H_ + +#include <bmon/defs.h> +#include <bmon/compile-fixes.h> + +#if STDC_HEADERS != 1 +#error "*** ERROR: ANSI C headers required for compilation ***" +#endif + +#include <stdio.h> +#include <ctype.h> +#include <stdarg.h> +#include <signal.h> +#include <limits.h> +#include <stdlib.h> +#include <math.h> +#include <inttypes.h> +#include <sys/file.h> +#include <assert.h> +#include <syslog.h> +#include <sys/wait.h> +#include <dirent.h> +#include <values.h> + +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +#ifdef HAVE_VFORK_H +#include <vfork.h> +#endif + +#if !HAVE_WORKING_VFORK +#define vfork fork +#endif + +#if defined HAVE_STRING_H +#include <string.h> +#elif defined HAVE_STRINGS_H +#include <strings.h> +#else +#error "*** ERROR: No string header file found ***" +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif + +#ifdef HAVE_INITTYPES_H +#include <inittypes.h> +#endif + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#if defined HAVE_GETOPT_H +#include <getopt.h> +#endif + +#include <sys/stat.h> +#include <grp.h> +#include <pwd.h> +#include <errno.h> + +#if defined HAVE_SYS_UTSNAME_H +#include <sys/utsname.h> +#endif + +#if defined HAVE_NCURSESW_CURSES_H +# include <ncursesw/curses.h> +#elif defined HAVE_NCURSESW_H +# include <ncursesw.h> +#elif defined HAVE_NCURSES_CURSES_H +# include <ncurses/curses.h> +#elif defined HAVE_NCURSES_H +# include <ncurses.h> +#elif defined HAVE_CURSES_H +# include <curses.h> +#else +# error "SysV or X/Open-compatible Curses header file required" +#endif + +#include <netinet/in.h> + +#if defined HAVE_NETINET6_IN6_H +#include <netinet6/in6.h> +#endif + +#include <sys/socket.h> +#include <arpa/inet.h> + +#include <confuse.h> + +#ifndef IFNAMSIZ +#define IFNAMSIZ 16 +#endif + +#ifndef SCNu64 +#define SCNu64 "llu" +#endif + +#ifndef PRIu64 +#define PRIu64 "llu" +#endif + +#ifndef PRId64 +#define PRId64 "lld" +#endif + +#ifndef PRIX64 +#define PRIX64 "X" +#endif + +#define DEFAULT_GROUP "intf" + +#endif diff --git a/include/bmon/defs.h.in b/include/bmon/defs.h.in new file mode 100644 index 0000000..d176c30 --- /dev/null +++ b/include/bmon/defs.h.in @@ -0,0 +1,246 @@ +/* include/bmon/defs.h.in. Generated from configure.ac by autoheader. */ + +/* enable debugging */ +#undef DEBUG + +/* no overflow workaround */ +#undef DISABLE_OVERFLOW_WORKAROUND + +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT + +/* have curses */ +#undef HAVE_CURSES + +/* Define to 1 if library supports color (enhanced functions) */ +#undef HAVE_CURSES_COLOR + +/* Define to 1 if library supports X/Open Enhanced functions */ +#undef HAVE_CURSES_ENHANCED + +/* Define to 1 if <curses.h> is present */ +#undef HAVE_CURSES_H + +/* Define to 1 if library supports certain obsolete features */ +#undef HAVE_CURSES_OBSOLETE + +/* Define to 1 if you have the <dirent.h> header file. */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `getdate' function. */ +#undef HAVE_GETDATE + +/* Define to 1 if you have the <getopt.h> header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* have ncurses */ +#undef HAVE_NCURSES + +/* Define to 1 if the NcursesW library is present */ +#undef HAVE_NCURSESW + +/* Define to 1 if <ncursesw/curses.h> is present */ +#undef HAVE_NCURSESW_CURSES_H + +/* Define to 1 if <ncursesw.h> is present */ +#undef HAVE_NCURSESW_H + +/* Define to 1 if <ncurses/curses.h> is present */ +#undef HAVE_NCURSES_CURSES_H + +/* Define to 1 if <ncurses.h> is present */ +#undef HAVE_NCURSES_H + +/* Define to 1 if you have the <ncurses/ncurses.h> header file. */ +#undef HAVE_NCURSES_NCURSES_H + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the <netdb.h> header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the <netinet6/in6.h> header file. */ +#undef HAVE_NETINET6_IN6_H + +/* Define to 1 if you have the <netinet/in.h> header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the `pow' function. */ +#undef HAVE_POW + +/* have redrawwin */ +#undef HAVE_REDRAWWIN + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if the system has the type `suseconds_t'. */ +#undef HAVE_SUSECONDS_T + +/* Define to 1 if you have the <sysctl/ioctl.h> header file. */ +#undef HAVE_SYSCTL_IOCTL_H + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the <sys/sockio.h> header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <sys/utsname.h> header file. */ +#undef HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* have udc */ +#undef HAVE_USE_DEFAULT_COLORS + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the <vfork.h> header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* operating system */ +#undef SYS_BSD + +/* operating system */ +#undef SYS_LINUX + +/* operating system */ +#undef SYS_OTHER + +/* operating system */ +#undef SYS_SUNOS + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `int' if <sys/types.h> does not define. */ +#undef pid_t + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef size_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/include/bmon/element.h b/include/bmon/element.h new file mode 100644 index 0000000..6c68250 --- /dev/null +++ b/include/bmon/element.h @@ -0,0 +1,130 @@ +/* + * bmon/element.h Elements + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __BMON_ELEMENT_H_ +#define __BMON_ELEMENT_H_ + +#include <bmon/bmon.h> +#include <bmon/group.h> +#include <bmon/attr.h> + +#define MAX_GRAPHS 32 +#define IFNAME_MAX 32 + +struct policy +{ + char * p_rule; + struct list_head p_list; +}; + +struct element_cfg; + +struct info +{ + char * i_name; + char * i_value; + struct list_head i_list; +}; + +struct element +{ + char * e_name; + char * e_description; + uint32_t e_id; + uint32_t e_flags; + unsigned int e_lifecycles; + unsigned int e_level; /* recursion level */ + + struct element * e_parent; + struct element_group * e_group; + + struct list_head e_list; + struct list_head e_childs; + + unsigned int e_nattrs; + struct list_head e_attrhash[ATTR_HASH_SIZE]; + struct list_head e_attr_sorted; + + unsigned int e_ninfo; + struct list_head e_info_list; + + struct attr_def * e_key_attr[__GT_MAX]; + struct attr_def * e_usage_attr; + + float e_rx_usage, + e_tx_usage; + + struct element_cfg * e_cfg; + + struct attr * e_current_attr; +}; + +#define ELEMENT_CREAT (1 << 0) + +extern struct element * element_lookup(struct element_group *, + const char *, uint32_t, + struct element *, int); + +extern void element_free(struct element *); + +extern void element_reset_update_flag(struct element_group *, + struct element *, + void *); +extern void element_notify_update(struct element *, + timestamp_t *); +extern void element_lifesign(struct element *, int); +extern void element_check_if_dead(struct element_group *, + struct element *, void *); + +extern int element_set_key_attr(struct element *, const char *, const char *); +extern int element_set_usage_attr(struct element *, const char *); + +#define ELEMENT_FLAG_FOLDED (1 << 0) +#define ELEMENT_FLAG_UPDATED (1 << 1) +#define ELEMENT_FLAG_EXCLUDE (1 << 2) +#define ELEMENT_FLAG_CREATED (1 << 3) + +extern void element_foreach_attr(struct element *, + void (*cb)(struct element *, + struct attr *, void *), + void *); + +extern struct element * element_current(void); +extern struct element * element_select_first(void); +extern struct element * element_select_last(void); +extern struct element * element_select_next(void); +extern struct element * element_select_prev(void); + +extern int element_allowed(const char *, struct element_cfg *); +extern void element_parse_policy(const char *); + +extern void element_update_info(struct element *, + const char *, + const char *); + +extern void element_set_txmax(struct element *, uint64_t); +extern void element_set_rxmax(struct element *, uint64_t); + +#endif diff --git a/include/bmon/element_cfg.h b/include/bmon/element_cfg.h new file mode 100644 index 0000000..3131841 --- /dev/null +++ b/include/bmon/element_cfg.h @@ -0,0 +1,53 @@ +/* + * element_cfg.h Element Configuration + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef __BMON_ELEMENT_CFG_H_ +#define __BMON_ELEMENT_CFG_H_ + +#include <bmon/bmon.h> +#include <bmon/conf.h> + +#define ELEMENT_CFG_SHOW (1 << 0) +#define ELEMENT_CFG_HIDE (1 << 1) + +struct element_cfg +{ + char * ec_name; /* Name of element config */ + char * ec_parent; /* Name of parent */ + char * ec_description; /* Human readable description */ + uint64_t ec_rxmax; /* Maximum RX value expected */ + uint64_t ec_txmax; /* Minimum TX value expected */ + unsigned int ec_flags; /* Flags */ + + struct list_head ec_list; /* Internal, do not modify */ + int ec_refcnt; /* Internal, do not modify */ +}; + +extern struct element_cfg * element_cfg_alloc(const char *); +extern struct element_cfg * element_cfg_create(const char *); +extern void element_cfg_free(struct element_cfg *); +extern struct element_cfg * element_cfg_lookup(const char *); + +#endif diff --git a/include/bmon/graph.h b/include/bmon/graph.h new file mode 100644 index 0000000..bdfac72 --- /dev/null +++ b/include/bmon/graph.h @@ -0,0 +1,72 @@ +/* + * bmon/graph.h Graph creation utility + * + * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2013 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. < |