| 1 |
/* |
| 2 |
* util_funcs.h: utilitiy functions for extensible groups. |
| 3 |
*/ |
| 4 |
#ifndef _MIBGROUP_UTIL_FUNCS_H |
| 5 |
#define _MIBGROUP_UTIL_FUNCS_H |
| 6 |
|
| 7 |
config_require(util_funcs/header_generic); |
| 8 |
config_require(util_funcs/header_simple_table); |
| 9 |
|
| 10 |
#ifdef HAVE_SYS_TYPES_H |
| 11 |
#include <sys/types.h> |
| 12 |
#endif |
| 13 |
#include "util_funcs/header_generic.h" |
| 14 |
#include "util_funcs/header_simple_table.h" |
| 15 |
|
| 16 |
#ifdef __cplusplus |
| 17 |
extern "C" { |
| 18 |
#endif |
| 19 |
|
| 20 |
#include "struct.h" |
| 21 |
|
| 22 |
typedef struct prefix_info |
| 23 |
{ |
| 24 |
struct prefix_info *next_info; |
| 25 |
unsigned long ipAddressPrefixOnLinkFlag; |
| 26 |
unsigned long ipAddressPrefixAutonomousFlag; |
| 27 |
char in6p[40]; |
| 28 |
}prefix_cbx; |
| 29 |
#ifndef WIN32 |
| 30 |
typedef struct |
| 31 |
{ |
| 32 |
prefix_cbx **list_head; |
| 33 |
}netsnmp_prefix_listen_info; |
| 34 |
#endif |
| 35 |
int shell_command(struct extensible *); |
| 36 |
int exec_command(struct extensible *); |
| 37 |
struct extensible *get_exten_instance(struct extensible *, size_t); |
| 38 |
int get_exec_output(struct extensible *); |
| 39 |
#if defined(WIN32) && !defined(cygwin) |
| 40 |
int get_exec_pipes(const char *cmd, int *fdIn, int *fdOut, |
| 41 |
HANDLE *pid); |
| 42 |
#else |
| 43 |
int get_exec_pipes(const char *cmd, int *fdIn, int *fdOut, |
| 44 |
pid_t *pid); |
| 45 |
#endif |
| 46 |
WriteMethod clear_cache; |
| 47 |
void print_mib_oid(oid *, size_t); |
| 48 |
void sprint_mib_oid(char *, const oid *, size_t); |
| 49 |
int checkmib(struct variable *, oid *, size_t *, int, size_t *, |
| 50 |
WriteMethod ** write_method, int); |
| 51 |
char *find_field(char *, int); |
| 52 |
int parse_miboid(const char *, oid *); |
| 53 |
void string_append_int(char *, int); |
| 54 |
void wait_on_exec(struct extensible *); |
| 55 |
const char *make_tempfile(void); |
| 56 |
|
| 57 |
prefix_cbx *net_snmp_create_prefix_info(unsigned long OnLinkFlag, |
| 58 |
unsigned long AutonomousFlag, |
| 59 |
char *in6ptr); |
| 60 |
#ifndef WIN32 |
| 61 |
int net_snmp_find_prefix_info(prefix_cbx **head, |
| 62 |
char *address, |
| 63 |
prefix_cbx *node_to_find); |
| 64 |
int net_snmp_update_prefix_info(prefix_cbx **head, |
| 65 |
prefix_cbx *node_to_update); |
| 66 |
int net_snmp_search_update_prefix_info(prefix_cbx **head, |
| 67 |
prefix_cbx *node_to_use, |
| 68 |
int functionality); |
| 69 |
int net_snmp_delete_prefix_info(prefix_cbx **head, |
| 70 |
char *address); |
| 71 |
#endif |
| 72 |
|
| 73 |
struct netsnmp_linux_link_settings { |
| 74 |
uint32_t speed; |
| 75 |
uint8_t duplex; |
| 76 |
}; |
| 77 |
|
| 78 |
int netsnmp_get_link_settings(struct netsnmp_linux_link_settings *nlls, |
| 79 |
int fd, const char *name); |
| 80 |
|
| 81 |
#define NIP6(addr) \ |
| 82 |
ntohs((addr).s6_addr16[0]), \ |
| 83 |
ntohs((addr).s6_addr16[1]), \ |
| 84 |
ntohs((addr).s6_addr16[2]), \ |
| 85 |
ntohs((addr).s6_addr16[3]), \ |
| 86 |
ntohs((addr).s6_addr16[4]), \ |
| 87 |
ntohs((addr).s6_addr16[5]), \ |
| 88 |
ntohs((addr).s6_addr16[6]), \ |
| 89 |
ntohs((addr).s6_addr16[7]) |
| 90 |
|
| 91 |
#define satosin(x) ((struct sockaddr_in *) &(x)) |
| 92 |
#define SOCKADDR(x) (satosin(x)->sin_addr.s_addr) |
| 93 |
|
| 94 |
#include "util_funcs/MIB_STATS_CACHE_TIMEOUT.h" |
| 95 |
|
| 96 |
typedef void *mib_table_t; |
| 97 |
typedef int (RELOAD) (mib_table_t); |
| 98 |
typedef int (COMPARE) (const void *, const void *); |
| 99 |
mib_table_t Initialise_Table(int, int, RELOAD*, COMPARE*); |
| 100 |
int Search_Table(mib_table_t, void *, int); |
| 101 |
int Add_Entry(mib_table_t, void *); |
| 102 |
void *Retrieve_Table_Data(mib_table_t, int *); |
| 103 |
|
| 104 |
#ifdef __cplusplus |
| 105 |
} |
| 106 |
#endif |
| 107 |
|
| 108 |
#endif /* _MIBGROUP_UTIL_FUNCS_H */ |