From c92e8d9597bf2c453a7c586439f5e8ebb8aee803 Mon Sep 17 00:00:00 2001 From: PHO <pho@cielonegro.org> Date: Wed, 21 Apr 2010 01:08:59 +0900 Subject: [PATCH] added Bindings.Librrd.Client --- Bindings/Librrd/Client.hsc | 39 ++++++++++++++++++++++++++++++++++++++ bindings-librrd.cabal | 1 + cbits/inlines.c | 5 +++++ 3 files changed, 45 insertions(+) create mode 100644 Bindings/Librrd/Client.hsc diff --git a/Bindings/Librrd/Client.hsc b/Bindings/Librrd/Client.hsc new file mode 100644 index 0000000..e1fb6e2 --- /dev/null +++ b/Bindings/Librrd/Client.hsc @@ -0,0 +1,39 @@ +#include <bindings.dsl.h> +#include <HsBaseConfig.h> +#include <rrd_client.h> + +-- |<http://oss.oetiker.ch/rrdtool/doc/librrd.en.html> +-- +-- <http://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html> + +module Bindings.Librrd.Client where +#strict_import + +#cinline RRDCACHED_DEFAULT_ADDRESS, CString +#cinline RRDCACHED_DEFAULT_PORT , CString +#cinline ENV_RRDCACHED_ADDRESS , CString + +#ccall rrdc_connect , CString -> IO CInt +#ccall rrdc_is_connected, CString -> IO CInt +#ccall rrdc_disconnect , IO CInt + +#ccall rrdc_update, CString -> CInt -> Ptr CString -> IO CInt + +#ccall rrdc_flush , CString -> IO CInt +#ccall rrdc_flush_if_daemon, CString -> CString -> IO CInt + +-- Helper definitions for rrdc_stats_t +#num RRDC_STATS_TYPE_GAUGE +#num RRDC_STATS_TYPE_COUNTER + +#starttype struct rrdc_stats_s +#field name , CString +#field type , Word16 +#union_field value.counter, Word64 +#union_field value.gauge , CDouble +#field next , Ptr <rrdc_stats_s> +#stoptype +#synonym_t rrdc_stats_t, <rrdc_stats_s> + +#ccall rrdc_stats_get , Ptr (Ptr <rrdc_stats_t>) -> IO CInt +#ccall rrdc_stats_free, Ptr <rrdc_stats_t> -> IO () diff --git a/bindings-librrd.cabal b/bindings-librrd.cabal index d7d2660..e139368 100644 --- a/bindings-librrd.cabal +++ b/bindings-librrd.cabal @@ -34,6 +34,7 @@ Library Exposed-Modules: Bindings.Librrd + Bindings.Librrd.Client Bindings.Posix.Time C-Sources: diff --git a/cbits/inlines.c b/cbits/inlines.c index 7f44248..59857f6 100644 --- a/cbits/inlines.c +++ b/cbits/inlines.c @@ -1,5 +1,7 @@ #include <bindings.cmacros.h> +#include <HsBaseConfig.h> #include <rrd.h> +#include <rrd_client.h> BC_INLINE_(DNAN, double) BC_INLINE_(DINF, double) @@ -10,3 +12,6 @@ inline_rrd_info_push(rrd_info_t * info, return rrd_info_push(info, key, type, *value); } +BC_INLINE_(RRDCACHED_DEFAULT_ADDRESS, const char*) +BC_INLINE_(RRDCACHED_DEFAULT_PORT , const char*) +BC_INLINE_(ENV_RRDCACHED_ADDRESS , const char*) -- 2.40.0