File manager - Edit - /home/ferretapmx/public_html/collectd.zip
Back
PK !K�\���& & network_parse.hnu �[��� /** * Copyright 2017 Florian Forster * * 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. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_NETWORK_PARSE_H #define LIBCOLLECTD_NETWORK_PARSE_H 1 #include "collectd/lcc_features.h" #include "collectd/network.h" /* for lcc_security_level_t */ #include "collectd/types.h" #include <stdint.h> LCC_BEGIN_DECLS typedef struct { /* writer is the callback used to send incoming lcc_value_list_t to. */ lcc_value_list_writer_t writer; /* password_lookup is used to look up the password for a given username. */ lcc_password_lookup_t password_lookup; /* security_level is the minimal required security level. */ lcc_security_level_t security_level; } lcc_network_parse_options_t; /* lcc_network_parse parses data received from the network and calls "w" with * the parsed lcc_value_list_ts. */ int lcc_network_parse(void *buffer, size_t buffer_size, lcc_network_parse_options_t opts); LCC_END_DECLS #endif /* LIBCOLLECTD_NETWORK_PARSE_H */ PK !K�\�gd� � lcc_features.hnu �[��� /** * libcollectdclient - src/libcollectdclient/lcc_features.h * Copyright (C) 2009 Sebastian Harl * * 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. * * Authors: * Sebastian tokkee Harl <sh at tokkee.org> **/ #ifndef LIBCOLLECTD_LCC_FEATURES_H #define LIBCOLLECTD_LCC_FEATURES_H 1 #ifdef __cplusplus # define LCC_BEGIN_DECLS extern "C" { # define LCC_END_DECLS } #else # define LCC_BEGIN_DECLS # define LCC_END_DECLS #endif #define LCC_API_VERSION 0 #define LCC_VERSION_MAJOR 5 #define LCC_VERSION_MINOR 8 #define LCC_VERSION_PATCH 1 #define LCC_VERSION_EXTRA "" #define LCC_VERSION_STRING "5.8.1" #define LCC_VERSION_ENCODE(major, minor, patch) \ ((major) * 10000 + (minor) * 100 + (patch)) #define LCC_VERSION \ LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH) LCC_BEGIN_DECLS unsigned int lcc_version (void); const char *lcc_version_string (void); const char *lcc_version_extra (void); LCC_END_DECLS #endif /* ! LIBCOLLECTD_LCC_FEATURES_H */ PK !K�\�"SO� � network_buffer.hnu �[��� /** * collectd - src/libcollectdclient/collectd/network_buffer.h * Copyright (C) 2010-2012 Florian octo Forster * * 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. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTDCLIENT_NETWORK_BUFFER_H #define LIBCOLLECTDCLIENT_NETWORK_BUFFER_H 1 #include "config.h" #include "collectd/network.h" /* for lcc_security_level_t */ #include "collectd/types.h" /* Ethernet frame - (IPv6 header + UDP header) */ #define LCC_NETWORK_BUFFER_SIZE_DEFAULT 1452 struct lcc_network_buffer_s; typedef struct lcc_network_buffer_s lcc_network_buffer_t; lcc_network_buffer_t *lcc_network_buffer_create(size_t size); void lcc_network_buffer_destroy(lcc_network_buffer_t *nb); int lcc_network_buffer_set_security_level(lcc_network_buffer_t *nb, lcc_security_level_t level, const char *user, const char *password); int lcc_network_buffer_initialize(lcc_network_buffer_t *nb); int lcc_network_buffer_finalize(lcc_network_buffer_t *nb); int lcc_network_buffer_add_value(lcc_network_buffer_t *nb, const lcc_value_list_t *vl); int lcc_network_buffer_get(lcc_network_buffer_t *nb, void *buffer, size_t *buffer_size); #endif /* LIBCOLLECTDCLIENT_NETWORK_BUFFER_H */ PK !K�\fm^ ^ server.hnu �[��� /** * Copyright 2017 Florian Forster * * 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. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_SERVER_H #define LIBCOLLECTD_SERVER_H 1 #include "collectd/lcc_features.h" #include "collectd/network.h" /* for lcc_security_level_t */ #include "collectd/network_parse.h" /* for lcc_network_parse_options_t */ #include "collectd/types.h" #include <stdint.h> #ifndef LCC_NETWORK_BUFFER_SIZE #define LCC_NETWORK_BUFFER_SIZE 1452 #endif LCC_BEGIN_DECLS /* lcc_network_parser_t is a callback that parses received network packets. It * is expected to call lcc_network_parse_options_t.writer with each * lcc_value_list_t it parses that has the required security level. */ typedef int (*lcc_network_parser_t)(void *payload, size_t payload_size, lcc_network_parse_options_t opts); /* lcc_listener_t holds parameters for running a collectd server. */ typedef struct { /* conn is a UDP socket for the server to listen on. If set to <0 node and * service will be used to open a new UDP socket. If >=0, it is the caller's * job to clean up the socket. */ int conn; /* node is the local address to listen on if conn is <0. Defaults to "::" (any * address). */ char *node; /* service is the local address to listen on if conn is <0. Defaults to * LCC_DEFAULT_PORT. */ char *service; /* parser is the callback used to parse incoming network packets. Defaults to * lcc_network_parse() if set to NULL. */ lcc_network_parser_t parser; /* parse_options contains options for parser and is passed on verbatimely. */ lcc_network_parse_options_t parse_options; /* buffer_size determines the maximum packet size to accept. Defaults to * LCC_NETWORK_BUFFER_SIZE if set to zero. */ uint16_t buffer_size; /* interface is the name of the interface to use when subscribing to a * multicast group. Has no effect when using unicast. */ char *interface; } lcc_listener_t; /* lcc_listen_and_write listens on the provided UDP socket (or opens one using * srv.addr if srv.conn is less than zero), parses the received packets and * writes them to the provided lcc_value_list_writer_t. Returns non-zero on * failure and does not return otherwise. */ int lcc_listen_and_write(lcc_listener_t srv); LCC_END_DECLS #endif /* LIBCOLLECTD_SERVER_H */ PK !K�\���� � types.hnu �[��� /** * libcollectdclient - src/libcollectdclient/collectd/types.h * Copyright (C) 2008-2017 Florian octo Forster * * 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. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_COLLECTD_TYPES_H #define LIBCOLLECTD_COLLECTD_TYPES_H 1 #include "collectd/lcc_features.h" #include <stdint.h> /* for uint64_t */ #include <sys/types.h> /* for size_t */ /* * Defines */ #define LCC_NAME_LEN 64 #define LCC_DEFAULT_PORT "25826" /* * Types */ #define LCC_TYPE_COUNTER 0 #define LCC_TYPE_GAUGE 1 #define LCC_TYPE_DERIVE 2 #define LCC_TYPE_ABSOLUTE 3 LCC_BEGIN_DECLS typedef uint64_t counter_t; typedef double gauge_t; typedef uint64_t derive_t; typedef uint64_t absolute_t; union value_u { counter_t counter; gauge_t gauge; derive_t derive; absolute_t absolute; }; typedef union value_u value_t; struct lcc_identifier_s { char host[LCC_NAME_LEN]; char plugin[LCC_NAME_LEN]; char plugin_instance[LCC_NAME_LEN]; char type[LCC_NAME_LEN]; char type_instance[LCC_NAME_LEN]; }; typedef struct lcc_identifier_s lcc_identifier_t; #define LCC_IDENTIFIER_INIT \ { "localhost", "", "", "", "" } struct lcc_value_list_s { value_t *values; int *values_types; size_t values_len; double time; double interval; lcc_identifier_t identifier; }; typedef struct lcc_value_list_s lcc_value_list_t; #define LCC_VALUE_LIST_INIT \ { NULL, NULL, 0, 0, 0, LCC_IDENTIFIER_INIT } /* lcc_value_list_writer_t is a write callback to which value lists are * dispatched. */ typedef int (*lcc_value_list_writer_t)(lcc_value_list_t const *); /* lcc_password_lookup_t is a callback for looking up the password for a given * user. Must return NULL if the user is not known. */ typedef char const *(*lcc_password_lookup_t)(char const *); LCC_END_DECLS #endif /* LIBCOLLECTD_COLLECTD_TYPES_H */ PK !K�\b�ؐ^ ^ network.hnu �[��� /** * collectd - src/libcollectdclient/collectd/network.h * Copyright (C) 2005-2012 Florian octo Forster * * 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. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTDCLIENT_NETWORK_H #define LIBCOLLECTDCLIENT_NETWORK_H 1 #include "collectd/client.h" #include <inttypes.h> #include <stdint.h> #define NET_DEFAULT_V4_ADDR "239.192.74.66" #define NET_DEFAULT_V6_ADDR "ff18::efc0:4a42" #define NET_DEFAULT_PORT "25826" struct lcc_network_s; typedef struct lcc_network_s lcc_network_t; struct lcc_server_s; typedef struct lcc_server_s lcc_server_t; enum lcc_security_level_e { NONE, SIGN, ENCRYPT }; typedef enum lcc_security_level_e lcc_security_level_t; /* * Create / destroy object */ lcc_network_t *lcc_network_create(void); void lcc_network_destroy(lcc_network_t *net); /* * Add servers */ lcc_server_t *lcc_server_create(lcc_network_t *net, const char *node, const char *service); int lcc_server_destroy(lcc_network_t *net, lcc_server_t *srv); /* Configure servers */ int lcc_server_set_ttl(lcc_server_t *srv, uint8_t ttl); int lcc_server_set_interface(lcc_server_t *srv, char const *interface); int lcc_server_set_security_level(lcc_server_t *srv, lcc_security_level_t level, const char *username, const char *password); /* * Send data */ int lcc_network_values_send(lcc_network_t *net, const lcc_value_list_t *vl); #if 0 int lcc_network_notification_send (lcc_network_t *net, const lcc_notification_t *notif); #endif #endif /* LIBCOLLECTDCLIENT_NETWORK_H */ PK !K�\�oOe� � client.hnu �[��� /** * libcollectdclient - src/libcollectdclient/collectd/client.h * Copyright (C) 2008-2012 Florian octo Forster * * 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. * * Authors: * Florian octo Forster <octo at collectd.org> **/ #ifndef LIBCOLLECTD_COLLECTDCLIENT_H #define LIBCOLLECTD_COLLECTDCLIENT_H 1 #include "collectd/lcc_features.h" #include "collectd/types.h" /* COLLECTD_TRACE is the environment variable used to control trace output. When * set to something non-zero, all lines sent to / received from the daemon are * printed to STDOUT. */ #ifndef LCC_TRACE_ENV #define LCC_TRACE_ENV "COLLECTD_TRACE" #endif /* * Includes (for data types) */ #include <inttypes.h> #include <stdint.h> #include <time.h> LCC_BEGIN_DECLS struct lcc_connection_s; typedef struct lcc_connection_s lcc_connection_t; /* * Functions */ int lcc_connect(const char *address, lcc_connection_t **ret_con); int lcc_disconnect(lcc_connection_t *c); #define LCC_DESTROY(c) \ do { \ lcc_disconnect(c); \ (c) = NULL; \ } while (0) int lcc_getval(lcc_connection_t *c, lcc_identifier_t *ident, size_t *ret_values_num, gauge_t **ret_values, char ***ret_values_names); int lcc_putval(lcc_connection_t *c, const lcc_value_list_t *vl); int lcc_flush(lcc_connection_t *c, const char *plugin, lcc_identifier_t *ident, int timeout); int lcc_listval(lcc_connection_t *c, lcc_identifier_t **ret_ident, size_t *ret_ident_num); /* TODO: putnotif */ const char *lcc_strerror(lcc_connection_t *c); int lcc_identifier_to_string(lcc_connection_t *c, char *string, size_t string_size, const lcc_identifier_t *ident); int lcc_string_to_identifier(lcc_connection_t *c, lcc_identifier_t *ident, const char *string); /* Compares the identifiers "i0" and "i1" and returns less than zero or greater * than zero if "i0" is smaller than or greater than "i1", respectively. If * "i0" and "i1" are identical, zero is returned. */ int lcc_identifier_compare(const void *i0, const void *i1); int lcc_sort_identifiers(lcc_connection_t *c, lcc_identifier_t *idents, size_t idents_num); LCC_END_DECLS #endif /* LIBCOLLECTD_COLLECTDCLIENT_H */ PK |U�\���{ �{ aggregation.sonu ȯ�� ELF >