diff --git a/Bindings/Librrd.hsc b/Bindings/Librrd.hsc
new file mode 100644
--- /dev/null
+++ b/Bindings/Librrd.hsc
@@ -0,0 +1,158 @@
+#include <bindings.dsl.h>
+#include <rrd.h>
+
+-- |<http://oss.oetiker.ch/rrdtool/doc/librrd.en.html>
+
+module Bindings.Librrd where
+import Bindings.Posix.Time
+import System.Posix.Types
+#strict_import
+
+-- Formerly rrd_nan_inf.h
+#cinline DNAN, IO CDouble
+#cinline DINF, IO CDouble
+#ccall rrd_set_to_DNAN, IO CDouble
+#ccall rrd_set_to_DINF, IO CDouble
+
+-- Transplanted from rrd_format.h
+#synonym_t rrd_value_t, CDouble
+
+-- Information about an rrd file
+#starttype struct rrd_file_t
+#field header_len, COff
+#field file_len  , COff
+#field pos       , COff
+#field pvt       , Ptr ()
+#stoptype
+
+-- information used for the conventional file access methods
+#starttype struct rrd_simple_file_t
+#field fd        , CInt
+#if HAVE_MMAP
+#field file_start, Ptr CChar
+#field mm_prot   , CInt
+#field mm_flags  , CInt
+#endif
+#stoptype
+
+-- rrd info interface
+#starttype struct rrd_blob_t
+#field size, CULong
+#field ptr , Ptr CUChar
+#stoptype
+
+#integral_t rrd_info_type_t
+#num RD_I_VAL
+#num RD_I_CNT
+#num RD_I_STR
+#num RD_I_INT
+#num RD_I_BLO
+
+#starttype union rrd_infoval
+#union_field u_cnt, CULong
+#union_field u_val, <rrd_value_t>
+#union_field u_str, CString
+#union_field u_int, CInt
+#union_field u_blo, <rrd_blob_t>
+#stoptype
+#synonym_t rrd_infoval_t, <rrd_infoval>
+
+#starttype struct rrd_info_t
+#field key  , CString
+#field type , <rrd_info_type_t>
+#field value, <rrd_infoval_t>
+#field next , Ptr <rrd_info_t>
+#stoptype
+
+{-|The correct type for this callback should be @'Ptr' a -> 'CSize'
+  -> 'Ptr' b -> 'IO' 'CSize'@ but that's impossible because of
+  bindings-DSL restriction.
+ -}
+#callback rrd_output_callback_t, Ptr () -> CSize -> Ptr () -> IO CSize
+
+-- main function blocks
+#ccall   rrd_create      , CInt -> Ptr CString -> IO CInt
+#ccall   rrd_info        , CInt -> Ptr CString -> IO (Ptr <rrd_info_t>)
+#cinline rrd_info_push   , Ptr <rrd_info_t> -> CString -> <rrd_info_type_t> -> Ptr <rrd_infoval_t> -> IO (Ptr <rrd_info_t>)
+#ccall   rrd_info_print  , Ptr <rrd_info_t> -> IO ()
+#ccall   rrd_info_free   , Ptr <rrd_info_t> -> IO ()
+#ccall   rrd_update      , CInt -> Ptr CString -> IO CInt
+#ccall   rrd_update_v    , CInt -> Ptr CString -> IO (Ptr <rrd_info_t>)
+#ccall   rrd_graph       , CInt -> Ptr CString -> Ptr (Ptr CString) -> Ptr CInt -> Ptr CInt -> Ptr CFile -> Ptr CDouble -> Ptr CDouble -> IO CInt
+#ccall   rrd_graph_v     , CInt -> Ptr CString -> IO (Ptr <rrd_info_t>)
+#ccall   rrd_fetch       , CInt -> Ptr CString -> Ptr CTime -> Ptr CTime -> Ptr CULong -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr <rrd_value_t>) -> IO CInt
+#ccall   rrd_restore     , CInt -> Ptr CString -> IO CInt
+#ccall   rrd_dump        , CInt -> Ptr CString -> IO CInt
+#ccall   rrd_tune        , CInt -> Ptr CString -> IO CInt
+#ccall   rrd_last        , CInt -> Ptr CString -> IO CTime
+#ccall   rrd_lastupdate  , CInt -> Ptr CString -> Ptr CTime -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr CString) -> IO CInt
+#ccall   rrd_first       , CInt -> Ptr CString -> IO CTime
+#ccall   rrd_resize      , CInt -> Ptr CString -> IO CInt
+#ccall   rrd_strversion  , IO CString
+#ccall   rrd_version     , IO CDouble
+#ccall   rrd_xport       , CInt -> Ptr CString -> Ptr CInt -> Ptr CTime -> Ptr CTime -> Ptr CULong -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr <rrd_value_t>) -> IO CInt
+#ccall   rrd_flushcached , CInt -> Ptr CString -> IO CInt
+#ccall   rrd_freemem     , Ptr a -> IO ()
+
+-- thread-safe (hopefully)
+#ccall   rrd_create_r    , CString -> CULong -> CTime -> CInt -> Ptr CString -> IO CInt
+-- NOTE: rrd_update_r are only thread-safe if no at-style time
+-- specifications get used!!!
+#ccall   rrd_info_r      , CString -> IO (Ptr <rrd_info_t>)
+#ccall   rrd_update_r    , CString -> CString -> CInt -> Ptr CString -> IO CInt
+#ccall   rrd_fetch_r     , CString -> CString -> Ptr CTime -> Ptr CTime -> Ptr CULong -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr <rrd_value_t>) -> IO CInt
+#ccall   rrd_dump_r      , CString -> CString -> IO CInt
+#ccall   rrd_last_r      , CString -> IO CTime
+#ccall   rrd_lastupdate_r, CString -> Ptr CTime -> Ptr CULong -> Ptr (Ptr CString) -> Ptr (Ptr CString) -> IO CInt
+#ccall   rrd_first_r     , CString -> CInt -> IO CTime
+
+#ccall   rrd_dump_cb_r   , CString -> CInt -> <rrd_output_callback_t> -> Ptr b -> IO CInt
+
+-- Transplanted from rrd_parsetime.h
+#integral_t rrd_timetype_t
+#num ABSOLUTE_TIME
+#num RELATIVE_TO_START_TIME
+#num RELATIVE_TO_END_TIME
+
+#pointer TIME_OK
+
+#starttype struct rrd_time_value
+#field type  , <rrd_timetype_t>
+#field offset, CLong
+#field tm    , <tm>
+#stoptype
+#synonym_t rrd_time_value_t, <rrd_time_value>
+
+#ccall rrd_parsetime, CString -> Ptr <rrd_time_value_t> -> IO CString
+
+#starttype struct rrd_context
+#array_field lib_errstr, CChar
+#array_field rrd_error , CChar
+#stoptype
+#synonym_t rrd_context_t, <rrd_context>
+
+-- returns the current per-thread rrd_context
+#ccall rrd_get_context, IO (Ptr <rrd_context_t>)
+
+#ccall rrd_proc_start_end, Ptr <rrd_time_value_t> -> Ptr <rrd_time_value_t> -> Ptr CTime -> Ptr CTime -> IO CInt
+
+-- HELPER FUNCTIONS
+-- rrd_set_error() is unavailable as it uses C varargs.
+#ccall rrd_clear_error, IO ()
+#ccall rrd_test_error , IO CInt
+#ccall rrd_get_error  , IO CString
+-- rrd_strerror is thread safe, but still it uses a global buffer (but
+-- one per thread), thus subsequent calls within a single thread
+-- overwrite the same buffer
+#ccall rrd_strerror   , CInt -> IO CString
+
+-- MULTITHREADED HELPER FUNCTIONS
+#ccall rrd_new_context , IO (Ptr <rrd_context_t>)
+#ccall rrd_free_context, Ptr <rrd_context_t> -> IO ()
+
+-- UTILITY FUNCTIONS
+#ccall rrd_random     , IO CLong
+#ccall rrd_add_ptr    , Ptr (Ptr (Ptr a)) -> Ptr CSize -> Ptr a -> IO CInt
+#ccall rrd_add_strdump, Ptr (Ptr CString) -> Ptr CSize -> CString -> IO CInt
+#ccall rrd_free_ptrs  , Ptr (Ptr (Ptr a)) -> CSize -> IO ()
+#ccall rrd_mkdir_p    , CString -> CMode -> IO CInt
diff --git a/Bindings/Librrd/Client.hsc b/Bindings/Librrd/Client.hsc
new file mode 100644
--- /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/Posix/Time.hsc b/Bindings/Posix/Time.hsc
new file mode 100644
--- /dev/null
+++ b/Bindings/Posix/Time.hsc
@@ -0,0 +1,30 @@
+#include <bindings.dsl.h>
+#include <time.h>
+
+-- |This module temporarily exists here, only because bindings-posix
+-- currently doesn't have struct tm.
+
+module Bindings.Posix.Time where
+#strict_import
+
+#starttype struct tm
+#field tm_sec , CInt
+#field tm_min , CInt
+#field tm_hour , CInt
+#field tm_mday , CInt
+#field tm_mon , CInt
+#field tm_year , CInt
+#field tm_wday , CInt
+#field tm_yday , CInt
+#field tm_isdst , CInt
+#stoptype
+
+#num CLOCKS_PER_SEC
+
+#ccall clock , IO CClock
+#ccall difftime , CTime -> CTime -> IO CDouble
+#ccall gmtime , Ptr CTime -> IO (Ptr <tm>)
+#ccall localtime , Ptr CTime -> IO (Ptr <tm>)
+#ccall mktime , Ptr <tm> -> IO CTime
+#ccall strftime , CString -> CSize -> CString -> Ptr <tm> -> IO CSize
+#ccall time , Ptr CTime -> IO CTime
diff --git a/COPYING b/COPYING
new file mode 100644
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,29 @@
+<!-- -*- xml -*-
+
+bindings-librrd はパブリックドメインに在ります。
+bindings-librrd is in the public domain.
+
+See http://creativecommons.org/licenses/publicdomain/
+
+-->
+
+<rdf:RDF xmlns="http://web.resource.org/cc/"
+	     xmlns:dc="http://purl.org/dc/elements/1.1/"
+	     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <Work rdf:about="http://cielonegro.org/Bindings-librrd.html">
+	<dc:title>bindings-librrd</dc:title>
+	<dc:rights>
+      <Agent>
+	    <dc:title>PHO</dc:title>
+	  </Agent>
+    </dc:rights>
+	<license rdf:resource="http://web.resource.org/cc/PublicDomain" />
+  </Work>
+      
+  <License rdf:about="http://web.resource.org/cc/PublicDomain">
+	<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
+	<permits rdf:resource="http://web.resource.org/cc/Distribution" />
+	<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+  </License>
+
+</rdf:RDF>
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,4 @@
+#!/usr/bin/env runhaskell
+
+import Distribution.Simple
+main = defaultMain
diff --git a/bindings-librrd.cabal b/bindings-librrd.cabal
new file mode 100644
--- /dev/null
+++ b/bindings-librrd.cabal
@@ -0,0 +1,41 @@
+Name:           bindings-librrd
+Synopsis:       Low level bindings to RRDtool
+Description:
+    RRDtool is a high performance data logging and graphing system for
+    time series data.
+
+    This package provides low-level bindings to librrd, which contains
+    most of the functionality in RRDtool.
+Version:        0.1
+License:        PublicDomain
+License-File:   COPYING
+Author:         PHO <pho at cielonegro dot org>
+Maintainer:     PHO <pho at cielonegro dot org>
+Homepage:       http://cielonegro.org/Bindings-librrd.html
+Category:       FFI
+Tested-With:    GHC == 6.12.1
+Cabal-Version:  >= 1.6
+Build-Type:     Simple
+
+Source-Repository head
+    Type:       git
+    Location:   git://git.cielonegro.org/bindings-librrd.git
+
+Library
+    Build-Depends:
+        base         == 4.2.*,
+        bindings-DSL == 1.0.*
+
+    PkgConfig-Depends:
+        librrd >= 1.4.3
+
+    Extensions:
+        ForeignFunctionInterface
+
+    Exposed-Modules:
+        Bindings.Librrd
+        Bindings.Librrd.Client
+        Bindings.Posix.Time
+
+    C-Sources:
+        cbits/inlines.c
diff --git a/cbits/inlines.c b/cbits/inlines.c
new file mode 100644
--- /dev/null
+++ b/cbits/inlines.c
@@ -0,0 +1,17 @@
+#include <bindings.cmacros.h>
+#include <HsBaseConfig.h>
+#include <rrd.h>
+#include <rrd_client.h>
+
+BC_INLINE_(DNAN, double)
+BC_INLINE_(DINF, double)
+
+rrd_info_t*
+inline_rrd_info_push(rrd_info_t * info,
+                     char *key, rrd_info_type_t type, rrd_infoval_t* value) {
+    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*)
