From 8d84ccac5fcd1ba1746b039b870393373a15eb20 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 12 Aug 2010 15:17:27 +0200 Subject: [PATCH] libcollectdclient: Move the header files to a subdirectory. This makes it easier since the header files depend on one another. (At least they will in the future.) --- configure.in | 2 +- src/collectd-nagios.c | 2 +- src/collectdctl.c | 2 +- src/libcollectdclient/Makefile.am | 4 +- src/libcollectdclient/client.c | 4 +- src/libcollectdclient/{ => collectd}/client.h | 0 .../{ => collectd}/lcc_features.h.in | 0 src/libcollectdclient/collectd/network.h | 80 +++++++++++++++++++ .../{ => collectd}/network_buffer.h | 0 src/libcollectdclient/network_buffer.c | 2 +- 10 files changed, 88 insertions(+), 8 deletions(-) rename src/libcollectdclient/{ => collectd}/client.h (100%) rename src/libcollectdclient/{ => collectd}/lcc_features.h.in (100%) create mode 100644 src/libcollectdclient/collectd/network.h rename src/libcollectdclient/{ => collectd}/network_buffer.h (100%) diff --git a/configure.in b/configure.in index fc12c088..3ddfee12 100644 --- a/configure.in +++ b/configure.in @@ -4637,7 +4637,7 @@ AC_SUBST(LCC_VERSION_PATCH) AC_SUBST(LCC_VERSION_EXTRA) AC_SUBST(LCC_VERSION_STRING) -AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h) +AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h) AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile) diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c index b190d6ee..b805c762 100644 --- a/src/collectd-nagios.c +++ b/src/collectd-nagios.c @@ -38,7 +38,7 @@ #include #include -#include "libcollectdclient/client.h" +#include "libcollectdclient/collectd/client.h" /* * This is copied directly from collectd.h. Make changes there! diff --git a/src/collectdctl.c b/src/collectdctl.c index 53bd6184..81ed7b19 100644 --- a/src/collectdctl.c +++ b/src/collectdctl.c @@ -25,7 +25,7 @@ # include "config.h" #endif -#include "libcollectdclient/client.h" +#include "libcollectdclient/collectd/client.h" #include diff --git a/src/libcollectdclient/Makefile.am b/src/libcollectdclient/Makefile.am index bf2f3833..da76f7c7 100644 --- a/src/libcollectdclient/Makefile.am +++ b/src/libcollectdclient/Makefile.am @@ -4,11 +4,11 @@ if COMPILER_IS_GCC AM_CFLAGS = -Wall -Werror endif -pkginclude_HEADERS = client.h network_buffer.h lcc_features.h +pkginclude_HEADERS = collectd/client.h collectd/network_buffer.h collectd/lcc_features.h lib_LTLIBRARIES = libcollectdclient.la nodist_pkgconfig_DATA = libcollectdclient.pc -BUILT_SOURCES = lcc_features.h +BUILT_SOURCES = collectd/lcc_features.h libcollectdclient_la_SOURCES = client.c network_buffer.c libcollectdclient_la_LDFLAGS = -version-info 0:0:0 diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index 75ac7b6d..09975774 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -27,7 +27,7 @@ # define __attribute__(x) /**/ #endif -#include "lcc_features.h" +#include "collectd/lcc_features.h" #include #include @@ -41,7 +41,7 @@ #include #include -#include "client.h" +#include "collectd/client.h" /* NI_MAXHOST has been obsoleted by RFC 3493 which is a reason for SunOS 5.11 * to no longer define it. We'll use the old, RFC 2553 value here. */ diff --git a/src/libcollectdclient/client.h b/src/libcollectdclient/collectd/client.h similarity index 100% rename from src/libcollectdclient/client.h rename to src/libcollectdclient/collectd/client.h diff --git a/src/libcollectdclient/lcc_features.h.in b/src/libcollectdclient/collectd/lcc_features.h.in similarity index 100% rename from src/libcollectdclient/lcc_features.h.in rename to src/libcollectdclient/collectd/lcc_features.h.in diff --git a/src/libcollectdclient/collectd/network.h b/src/libcollectdclient/collectd/network.h new file mode 100644 index 00000000..2afc706d --- /dev/null +++ b/src/libcollectdclient/collectd/network.h @@ -0,0 +1,80 @@ +/** + * collectd - src/libcollectdclient/network.h + * Copyright (C) 2005-2010 Florian octo Forster + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; only version 2.1 of the License is + * applicable. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Florian octo Forster + **/ + +#ifndef LIBCOLLECTDCLIENT_NETWORK_H +#define LIBCOLLECTDCLIENT_NETWORK_H 1 + +#include +#include + +#include "collectd/client.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_security_level (lcc_server_t *srv, + lcc_security_level_t level); +int lcc_server_set_credentials (lcc_server_t *srv, + 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 + +/* vim: set sw=2 sts=2 et : */ +#endif /* LIBCOLLECTDCLIENT_NETWORK_H */ diff --git a/src/libcollectdclient/network_buffer.h b/src/libcollectdclient/collectd/network_buffer.h similarity index 100% rename from src/libcollectdclient/network_buffer.h rename to src/libcollectdclient/collectd/network_buffer.h diff --git a/src/libcollectdclient/network_buffer.c b/src/libcollectdclient/network_buffer.c index 9cff2e2f..8627ef08 100644 --- a/src/libcollectdclient/network_buffer.c +++ b/src/libcollectdclient/network_buffer.c @@ -27,7 +27,7 @@ #include #include /* htons */ -#include "network_buffer.h" +#include "collectd/network_buffer.h" #define TYPE_HOST 0x0000 #define TYPE_TIME 0x0001 -- 2.30.2