diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,29 @@
+Copyright (c) <2009>, <Maurício C. Antunes>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the author nor the names of contributors
+    may be used to endorse or promote products derived from this
+    software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,6 @@
+#!/usr/bin/env runhaskell
+
+module Main (main) where
+import Distribution.Simple
+
+main = defaultMain
diff --git a/bindings-common.cabal b/bindings-common.cabal
new file mode 100644
--- /dev/null
+++ b/bindings-common.cabal
@@ -0,0 +1,33 @@
+cabal-version: >= 1.2.3
+name: bindings-common
+homepage: http://bitbucket.org/mauricio/bindings
+synopsis:
+  Common functionality for bindings-* set of packages.
+description: 
+  The @bindings-*@ set of packages contain low level bindings
+  for established libraries, and is aimed at developers of higher
+  level modules that can use it as foundation. They all mimic the
+  exact names and functionality of the original libraries. For
+  a specific library, look for package @bindings-library_name@.
+version: 0.1
+license: BSD3
+license-file: LICENSE
+maintainer: Maurício C. Antunes
+author: Maurício C. Antunes
+build-type: Simple
+category: FFI
+library
+  hs-source-dirs: src
+  c-sources:
+    src/Bindings/c.c
+  extensions:
+    ForeignFunctionInterface
+    TypeSynonymInstances
+    ScopedTypeVariables
+    MultiParamTypeClasses
+    TypeFamilies
+  build-depends: base
+  exposed-modules:
+    Bindings
+    Bindings.Utilities
+    Bindings.C
diff --git a/src/Bindings.hs b/src/Bindings.hs
new file mode 100644
--- /dev/null
+++ b/src/Bindings.hs
@@ -0,0 +1,29 @@
+{-|
+
+    -- | Modules under "Bindings" are supposed to be low level
+    -- links to well-known libraries. All of them follow the
+    -- same style for consistency and predictability. Here are
+    -- a few rules that have been followed:
+
+    -- * All packages use cabal. Checking of dependencies is
+    -- delegated to @pkg-config@ by listing such dependencies
+    -- in cabal file.
+
+    -- * All names are as close as possible to the names in the
+    -- original library language. To agree with Haskell case
+    -- conventions they may be prefixed with an underscore or
+    -- have their first letter capitalized.
+
+    -- * Documentation is provided as links to the official
+    -- homepage for a library. Due to the policy of preserving
+    -- names and functionality, such documentation can be used
+    -- as it is.
+
+    -- These modules are supposed to be used by developers of
+    -- higher level modules, who should have a good understanding
+    -- of the undeline libraries they decide to use. Of course,
+    -- you can use them directly if you know what you are doing.
+
+-}
+
+module Bindings where {}
diff --git a/src/Bindings/C.hs b/src/Bindings/C.hs
new file mode 100644
--- /dev/null
+++ b/src/Bindings/C.hs
@@ -0,0 +1,40 @@
+
+module Bindings.C (
+
+    Timeval
+
+  ) where
+
+import Foreign.C
+import Foreign
+import Data.Int
+
+data Timeval = Timeval {timeval'tv_sec, timeval'tv_usec :: CLong}
+
+instance Storable Timeval where
+
+    sizeOf _ = fromIntegral size_of_timeval
+
+    alignment = sizeOf
+
+    peek p =
+        with 0 $ \p1 ->
+        with 0 $ \p2 ->
+
+        c2hs_timeval p p1 p2 >>
+
+        peek p1 >>= \v1 ->
+        peek p2 >>= \v2 ->
+
+        return $ Timeval {timeval'tv_sec = v1, timeval'tv_usec = v2}
+
+    poke p v = hs2c_timeval p (timeval'tv_sec v) (timeval'tv_usec v)
+
+foreign import ccall "size_of_timeval" size_of_timeval
+    :: CInt
+
+foreign import ccall "hs2c_timeval" hs2c_timeval
+    :: Ptr Timeval -> CLong -> CLong -> IO ()
+
+foreign import ccall "c2hs_timeval" c2hs_timeval
+    :: Ptr Timeval -> Ptr CLong -> Ptr CLong -> IO ()
diff --git a/src/Bindings/Utilities.hs b/src/Bindings/Utilities.hs
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Utilities.hs
@@ -0,0 +1,32 @@
+
+module Bindings.Utilities (
+
+    GlobalVariable, setGlobalVariable, getGlobalVariable,
+    Callback(..)
+
+  ) where
+
+import Foreign
+import Foreign.C
+import Data.Int
+
+newtype (Storable a) => GlobalVariable a = GlobalVariable (Ptr a)
+
+setGlobalVariable :: (Storable a) => GlobalVariable a -> a -> IO ()
+setGlobalVariable (GlobalVariable p) v = poke p v
+
+getGlobalVariable :: (Storable a) => GlobalVariable a -> IO a
+getGlobalVariable (GlobalVariable p) = peek p
+
+class (Storable cb) => Callback cb where
+    type F cb :: *
+    nullCallback :: cb
+    makeCallback :: F cb -> IO cb
+    freeCallback :: cb -> IO ()
+    withCallback :: F cb -> (cb -> IO a) -> IO a
+    withCallback f c = do
+        made <- makeCallback f
+        result <- c made
+        freeCallback made
+        return result
+
diff --git a/src/Bindings/c.c b/src/Bindings/c.c
new file mode 100644
--- /dev/null
+++ b/src/Bindings/c.c
@@ -0,0 +1,19 @@
+#include <sys/time.h>
+#include <time.h>
+
+int size_of_timeval (void)
+{
+    return sizeof (struct timeval);
+}
+
+void hs2c_timeval (struct timeval *p, long p1, long p2)
+{
+    p->tv_sec = p1;
+    p->tv_usec = p2;
+}
+
+void c2hs_timeval (struct timeval *p, long *p1, long *p2)
+{
+    *p1 = p->tv_sec;
+    *p2 = p->tv_usec;
+}
