diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Krzysztof Kardzis
+Copyright (c) 2012-2014 Krzysztof Kardzis
 
 Permission to use, copy, modify, and/or distribute this software for any
 purpose with or without fee is hereby granted, provided that the above
diff --git a/Network/CURL000/LibC0.c b/Network/CURL000/LibC0.c
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/LibC0.c
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------------- */
+/* |                                                                         */
+/* Module      :  Network.CURL000.LibC0                                      */
+/* Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis                    */
+/* License     :  ISC License (MIT/BSD-style, see LICENSE file for details)  */
+/*                                                                           */
+/* Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>                     */
+/* Stability   :  experimental                                               */
+/* Portability :  non-portable                                               */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+#include "curl-7.30.0/curl.h"
+
+#include "RTLD.h"
+
+
+/* ------------------------------------------------------------------------- */
+/* global symbol table (for run-time linking)                                */
+/* ------------------------------------------------------------------------- */
+enum { CURL720, CURL730 };
+
+#define CURLXXX CURL730
+#define SYMTAB curlSYMTAB
+
+SYMTABENTRY curlSYMTAB[] =
+  { {CURL720, CURLXXX, "curl_easy_cleanup"}
+  , {CURL720, CURLXXX, "curl_easy_duphandle"}
+  , {CURL720, CURLXXX, "curl_easy_escape"}
+  , {CURL720, CURLXXX, "curl_easy_getinfo"}
+  , {CURL720, CURLXXX, "curl_easy_init"}
+  , {CURL720, CURLXXX, "curl_easy_pause"}
+  , {CURL720, CURLXXX, "curl_easy_perform"}
+  , {CURL720, CURLXXX, "curl_easy_recv"}
+  , {CURL720, CURLXXX, "curl_easy_reset"}
+  , {CURL720, CURLXXX, "curl_easy_send"}
+  , {CURL720, CURLXXX, "curl_easy_setopt"}
+  , {CURL720, CURLXXX, "curl_easy_strerror"}
+  , {CURL720, CURLXXX, "curl_easy_unescape"}
+  , {CURL720, CURLXXX, "curl_escape"}
+  , {CURL720, CURLXXX, "curl_formadd"}
+  , {CURL720, CURLXXX, "curl_formfree"}
+  , {CURL720, CURLXXX, "curl_formget"}
+  , {CURL720, CURLXXX, "curl_free"}
+  , {CURL720, CURLXXX, "curl_getdate"}
+  , {CURL720, CURLXXX, "curl_getenv"}
+  , {CURL720, CURLXXX, "curl_global_cleanup"}
+  , {CURL720, CURLXXX, "curl_global_init"}
+  , {CURL720, CURLXXX, "curl_global_init_mem"}
+  , {CURL720, CURLXXX, "curl_maprintf"}
+  , {CURL720, CURLXXX, "curl_mfprintf"}
+  , {CURL720, CURLXXX, "curl_mprintf"}
+  , {CURL720, CURLXXX, "curl_msnprintf"}
+  , {CURL720, CURLXXX, "curl_msprintf"}
+  , {CURL720, CURLXXX, "curl_multi_add_handle"}
+  , {CURL720, CURLXXX, "curl_multi_assign"}
+  , {CURL720, CURLXXX, "curl_multi_cleanup"}
+  , {CURL720, CURLXXX, "curl_multi_fdset"}
+  , {CURL720, CURLXXX, "curl_multi_info_read"}
+  , {CURL720, CURLXXX, "curl_multi_init"}
+  , {CURL720, CURLXXX, "curl_multi_perform"}
+  , {CURL720, CURLXXX, "curl_multi_remove_handle"}
+  , {CURL720, CURLXXX, "curl_multi_setopt"}
+  , {CURL720, CURLXXX, "curl_multi_socket"}
+  , {CURL720, CURLXXX, "curl_multi_socket_action"}
+  , {CURL720, CURLXXX, "curl_multi_socket_all"}
+  , {CURL720, CURLXXX, "curl_multi_strerror"}
+  , {CURL720, CURLXXX, "curl_multi_timeout"}
+ // {CURL728, CURLXXX, "curl_multi_wait"}
+  , {CURL730, CURLXXX, "curl_multi_wait"}
+  , {CURL720, CURLXXX, "curl_mvaprintf"}
+  , {CURL720, CURLXXX, "curl_mvfprintf"}
+  , {CURL720, CURLXXX, "curl_mvprintf"}
+  , {CURL720, CURLXXX, "curl_mvsnprintf"}
+  , {CURL720, CURLXXX, "curl_mvsprintf"}
+  , {CURL720, CURLXXX, "curl_share_cleanup"}
+  , {CURL720, CURLXXX, "curl_share_init"}
+  , {CURL720, CURLXXX, "curl_share_setopt"}
+  , {CURL720, CURLXXX, "curl_share_strerror"}
+  , {CURL720, CURLXXX, "curl_slist_append"}
+  , {CURL720, CURLXXX, "curl_slist_free_all"}
+  , {CURL720, CURLXXX, "curl_strequal"}
+  , {CURL720, CURLXXX, "curl_strnequal"}
+  , {CURL720, CURLXXX, "curl_unescape"}
+  , {CURL720, CURLXXX, "curl_version"}
+  , {CURL720, CURLXXX, "curl_version_info"}
+  };
+
+/* Force section .data instead of default .bss, because with .bss something  */
+/* wrong happens during linking in ghci/runghc (at least on FreeBSD).        */
+void* __attribute__((section(".data"))) curlADRTAB[TABLEN] = {};
+
+
+/* ------------------------------------------------------------------------- */
+/* wrappers for variadic functions                                           */
+/* ------------------------------------------------------------------------- */
+typedef int (*setoptFP)(void *, int, ...);
+
+int curlOptLong(setoptFP setopt, void *handle, int opt, long val) {
+  return setopt(handle, opt, val);
+};
+
+int curlOptCOff(setoptFP setopt, void *handle, int opt, curl_off_t val) {
+  return setopt(handle, opt, val);
+};
+
+int curlOptDPtr(setoptFP setopt, void *handle, int opt, void *val) {
+  return setopt(handle, opt, val);
+};
+
+int curlOptFPtr(setoptFP setopt, void *handle, int opt, void (*val)()) {
+  return setopt(handle, opt, val);
+};
+
diff --git a/Network/CURL000/LibCC.hsc b/Network/CURL000/LibCC.hsc
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/LibCC.hsc
@@ -0,0 +1,503 @@
+-------------------------------------------------------------------------------
+-- |
+-- Module      :  Network.CURL000.LibCC
+-- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis
+-- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
+-- 
+-- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-------------------------------------------------------------------------------
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE EmptyDataDecls           #-}
+
+module Network.CURL000.LibCC
+  ( curlADRTAB
+  , curlSYMTAB
+  , curlTABLEN
+
+  , curl_easy_cleanup
+  , curl_easy_duphandle
+  , curl_easy_escape
+  , curl_easy_getinfo
+  , curl_easy_init
+  , curl_easy_pause
+  , curl_easy_perform
+  , curl_easy_recv
+  , curl_easy_reset
+  , curl_easy_send
+  , curl_easy_setopt'Long
+  , curl_easy_setopt'COff
+  , curl_easy_setopt'DPtr
+  , curl_easy_setopt'FPtr
+  , curl_easy_strerror
+  , curl_easy_unescape
+ -- curl_escape
+  , curl_formadd
+  , curl_formfree
+  , curl_formget
+  , curl_free
+  , curl_getdate
+ -- curl_getenv
+  , curl_global_cleanup
+  , curl_global_init
+  , curl_global_init_mem
+ -- curl_maprintf
+ -- curl_mfprintf
+ -- curl_mprintf
+ -- curl_msnprintf
+ -- curl_msprintf
+  , curl_multi_add_handle
+  , curl_multi_assign
+  , curl_multi_cleanup
+  , curl_multi_fdset
+  , curl_multi_info_read
+  , curl_multi_init
+  , curl_multi_perform
+  , curl_multi_remove_handle
+  , curl_multi_setopt
+  , curl_multi_socket
+  , curl_multi_socket_action
+  , curl_multi_socket_all
+  , curl_multi_strerror
+  , curl_multi_timeout
+  , curl_multi_wait
+ -- curl_mvaprintf
+ -- curl_mvfprintf
+ -- curl_mvprintf
+ -- curl_mvsnprintf
+ -- curl_mvsprintf
+  , curl_share_cleanup
+  , curl_share_init
+  , curl_share_setopt'Long
+  , curl_share_setopt'FPtr
+  , curl_share_strerror
+  , curl_slist_append
+  , curl_slist_free_all
+ -- curl_strequal
+ -- curl_strnequal
+ -- curl_unescape
+  , curl_version
+  , curl_version_info
+
+  , CURL_write_callback, wrapCURL_write_callback
+  , CURL_read_callback , wrapCURL_read_callback
+
+  , CURL_lock_function  , wrapCURL_lock_function
+  , CURL_unlock_function, wrapCURL_unlock_function
+
+  , CURL, CURLM, CURLSH
+
+  , CURLslist (..)
+  , CURLcerts (..)
+
+  , CURL_off_t
+
+  ) where
+
+import Foreign.Storable
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr
+
+import Control.Applicative ((<$>), (<*>))
+import Control.Monad       (when)
+
+import System.IO.Unsafe (unsafePerformIO)
+import System.RTLD
+
+#include "LibC0.c"
+
+
+-------------------------------------------------------------------------------
+foreign import ccall "&curlADRTAB" curlADRTAB :: Ptr (FunPtr ())
+foreign import ccall "&curlSYMTAB" curlSYMTAB :: Ptr SYMTABENTRY
+
+curlTABLEN :: Int
+curlTABLEN = #{const TABLEN}
+
+peekFP :: Int -> IO (FunPtr a)
+peekFP fid = do
+  fp <- peekElemOff curlADRTAB fid
+  when (fp==nullFunPtr) (nullFP fid)
+  return (castFunPtr fp)
+
+nullFP :: Int -> IO ()
+nullFP fid =
+  let name = unsafePerformIO $
+        peekElemOff curlSYMTAB fid >>= \(RTSYM (_,_,cs)) -> peekCString cs
+  in  error $ concat ["<curlhs> failed to call '", name, "' (NULL)"]
+
+
+
+-------------------------------------------------------------------------------
+data CURL
+data CURLM
+data CURLSH
+
+data CURLhttppost
+data CURLvinfo
+data CURLwaitfd
+data CURLmsg
+
+type CURLcode   = CInt
+type CURLMcode  = CInt
+type CURLSHcode = CInt
+
+type CURLoption   = CInt
+type CURLMoption  = CInt
+type CURLSHopt = CInt
+
+type CURL_lock_data   = CInt
+type CURL_lock_access = CInt
+
+type CURLinfo    = CInt
+type CURLversion = CInt
+
+type CURLformcode   = CInt
+type CURLformoption = CInt
+
+type CURLsocket = CInt
+
+type CURL_off_t = CLLong  -- ??
+
+type CURL_formget_callback = IO ()
+type CURL_malloc_callback = IO ()
+type CURL_free_callback = IO ()
+type CURL_realloc_callback = IO ()
+type CURL_calloc_callback = IO ()
+type CURL_strdup_callback = IO ()
+
+
+data CURLslist = CURLslist (Ptr CChar) (Ptr CURLslist)
+
+instance Storable CURLslist where
+  sizeOf _    = #{size    struct curl_slist}
+  alignment _ = #{alignof struct curl_slist}
+  poke _ _    = undefined
+  peek ptr    = CURLslist
+    <$> #{peek struct curl_slist, data} ptr
+    <*> #{peek struct curl_slist, next} ptr
+
+
+data CURLcerts = CURLcerts CInt (Ptr (Ptr CURLslist))
+
+instance Storable CURLcerts where
+  sizeOf _    = #{size    struct curl_certinfo}
+  alignment _ = #{alignof struct curl_certinfo}
+  poke _ _    = undefined
+  peek ptr    = CURLcerts
+    <$> #{peek struct curl_certinfo, num_of_certs} ptr
+    <*> #{peek struct curl_certinfo, certinfo    } ptr
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_easy_cleanup \
+, Ptr CURL {- ^ handle -}    \
+, IO ()                      }
+
+#{SAFECALL curl_easy_duphandle \
+, Ptr CURL      {- ^ handle -} \
+, IO (Ptr CURL) {- ^ handle -} }
+
+#{SAFECALL curl_easy_escape                 \
+, Ptr CURL       {- ^ handle             -} \
+, Ptr CChar      {- ^ const string (url) -} \
+, CInt           {- ^ length             -} \
+, IO (Ptr CChar) {- ^ URL encoded string -} }
+
+-- #{SAFECALL curl_easy_getinfo \
+-- , Ptr CURL    {- ^ handle -} \
+-- , CURLinfo    {- ^ info   -} \
+-- , Ptr ()      {- ^ param  -} \
+-- , IO CURLcode {- ^ status -} }
+
+#{SAFECALL curl_easy_init      \
+, IO (Ptr CURL) {- ^ handle -} }
+
+#{SAFECALL curl_easy_pause    \
+, Ptr CURL    {- ^ handle  -} \
+, CInt        {- ^ bitmask -} \
+, IO CURLcode {- ^ status  -} }
+
+#{SAFECALL curl_easy_perform \
+, Ptr CURL    {- ^ handle -} \
+, IO CURLcode {- ^ status -} }
+
+#{SAFECALL curl_easy_recv    \
+, Ptr CURL    {- ^ handle -} \
+, Ptr ()      {- ^ buffer -} \
+, CSize       {- ^ buflen -} \
+, Ptr CSize   {- ^ n      -} \
+, IO CURLcode {- ^ status -} }
+
+#{SAFECALL curl_easy_reset \
+, Ptr CURL  {- ^ handle -} \
+, IO ()                    }
+
+#{SAFECALL curl_easy_send          \
+, Ptr CURL    {- ^ handle       -} \
+, Ptr ()      {- ^ const buffer -} \
+, CSize       {- ^ buflen       -} \
+, Ptr CSize   {- ^ n            -} \
+, IO CURLcode {- ^ status       -} }
+
+-- #{SAFECALL curl_easy_setopt  \
+-- , Ptr CURL    {- ^ handle -} \
+-- , CURLoption  {- ^ option -} \
+-- , Ptr ()      {- ^ param  -} \
+-- , IO CURLcode {- ^ status -} }
+
+#{SAFECALL curl_easy_strerror         \
+, CURLcode       {- ^ errornum     -} \
+, IO (Ptr CChar) {- ^ const string -} }
+
+#{SAFECALL curl_easy_unescape           \
+, Ptr CURL       {- ^ handle         -} \
+, Ptr CChar      {- ^ const string   -} \
+, CInt           {- ^ inlength       -} \
+, Ptr CInt       {- ^ outlength      -} \
+, IO (Ptr CChar) {- ^ decoded string -} }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_formadd                   \
+, Ptr (Ptr CURLhttppost) {- ^ httppost -} \
+, Ptr (Ptr CURLhttppost) {- ^ lastpost -} \
+, CURLformoption         {- ^ option   -} \
+, Ptr ()                 {- ^ value    -} \
+, IO CURLformcode        {- ^ status   -} }
+
+#{SAFECALL curl_formfree        \
+, Ptr CURLhttppost {- ^ form -} \
+, IO ()                         }
+
+#{SAFECALL curl_formget                       \
+, Ptr CURLhttppost             {- ^ form   -} \
+, Ptr ()                       {- ^ userp  -} \
+, FunPtr CURL_formget_callback {- ^ append -} \
+, IO CInt                      {- ^ status -} }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_free \
+, Ptr () {- ^ ptr -} \
+, IO ()              }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_getdate                \
+, Ptr CChar {- ^ const datestring   -} \
+, Ptr CTime {- ^ const now (unused) -} \
+, IO CTime  {- ^ time               -} }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_global_cleanup \
+, IO ()                        }
+
+#{SAFECALL curl_global_init  \
+, CLong       {- ^ flags  -} \
+, IO CURLcode {- ^ status -} }
+
+#{SAFECALL curl_global_init_mem               \
+, CLong                        {- ^ flags  -} \
+, FunPtr CURL_malloc_callback  {- ^ m      -} \
+, FunPtr CURL_free_callback    {- ^ f      -} \
+, FunPtr CURL_realloc_callback {- ^ r      -} \
+, FunPtr CURL_strdup_callback  {- ^ s      -} \
+, FunPtr CURL_calloc_callback  {- ^ c      -} \
+, IO CURLcode                  {- ^ status -} }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_multi_add_handle    \
+, Ptr CURLM    {- ^ multi handle -} \
+, Ptr CURL     {- ^ easy handle  -} \
+, IO CURLMcode {- ^ multi status -} }
+
+#{SAFECALL curl_multi_assign        \
+, Ptr CURLM    {- ^ multi handle -} \
+, CURLsocket   {- ^ sockfd       -} \
+, Ptr ()       {- ^ sockptr      -} \
+, IO CURLMcode {- ^ multi status -} }
+
+#{SAFECALL curl_multi_cleanup       \
+, Ptr CURLM    {- ^ multi handle -} \
+, IO CURLMcode {- ^ multi status -} }
+
+#{SAFECALL curl_multi_fdset         \
+, Ptr CURLM    {- ^ multi handle -} \
+, Ptr ()       {- ^ read_fd_set  -} \
+, Ptr ()       {- ^ write_fd_set -} \
+, Ptr ()       {- ^ exc_fd_set   -} \
+, Ptr CInt     {- ^ max_fd       -} \
+, IO CURLMcode {- ^ multi status -} }
+
+#{SAFECALL curl_multi_info_read          \
+, Ptr CURLM        {- ^ multi handle  -} \
+, Ptr CInt         {- ^ msgs_in_queue -} \
+, IO (Ptr CURLmsg) {- ^ message       -} }
+
+#{SAFECALL curl_multi_init            \
+, IO (Ptr CURLM) {- ^ multi handle -} }
+
+#{SAFECALL curl_multi_perform          \
+, Ptr CURLM    {- ^ multi handle    -} \
+, Ptr CInt     {- ^ running handles -} \
+, IO CURLMcode {- ^ multi status    -} }
+
+#{SAFECALL curl_multi_remove_handle \
+, Ptr CURLM    {- ^ multi handle -} \
+, Ptr CURL     {- ^ easy handle  -} \
+, IO CURLMcode {- ^ multi status -} }
+
+#{SAFECALL curl_multi_setopt        \
+, Ptr CURLM    {- ^ multi handle -} \
+, CURLMoption  {- ^ option       -} \
+, Ptr ()       {- ^ value        -} \
+, IO CURLMcode {- ^ multi status -} }
+
+#{SAFECALL curl_multi_socket           \
+, Ptr CURLM    {- ^ multi handle    -} \
+, CURLsocket   {- ^ sockfd          -} \
+, Ptr CInt     {- ^ running handles -} \
+, IO CURLMcode {- ^ multi status    -} }
+
+#{SAFECALL curl_multi_socket_action    \
+, Ptr CURLM    {- ^ multi handle    -} \
+, CURLsocket   {- ^ sockfd          -} \
+, CInt         {- ^ ev_bitmask      -} \
+, Ptr CInt     {- ^ running handles -} \
+, IO CURLMcode {- ^ multi status    -} }
+
+#{SAFECALL curl_multi_socket_all       \
+, Ptr CURLM    {- ^ multi handle    -} \
+, Ptr CInt     {- ^ running handles -} \
+, IO CURLMcode {- ^ multi status    -} }
+
+#{SAFECALL curl_multi_strerror        \
+, CURLMcode      {- ^ errornum     -} \
+, IO (Ptr CChar) {- ^ const string -} }
+
+#{SAFECALL curl_multi_timeout       \
+, Ptr CURLM    {- ^ multi handle -} \
+, Ptr CLong    {- ^ timeout      -} \
+, IO CURLMcode {- ^ multi status -} }
+
+#{SAFECALL curl_multi_wait            \
+, Ptr CURLM      {- ^ multi handle -} \
+, Ptr CURLwaitfd {- ^ extra_fds[]  -} \
+, CUInt          {- ^ extra_nfds   -} \
+, CInt           {- ^ timeout_ms   -} \
+, Ptr CInt       {- ^ numfds       -} \
+, IO CURLMcode   {- ^ multi status -} }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_share_cleanup        \
+, Ptr CURLSH    {- ^ share handle -} \
+, IO CURLSHcode {- ^ share status -} }
+
+#{SAFECALL curl_share_init             \
+, IO (Ptr CURLSH) {- ^ share handle -} }
+
+-- #{SAFECALL curl_share_setopt         \
+-- , Ptr CURLSH    {- ^ share handle -} \
+-- , CURLSHopt  {- ^ option       -} \
+-- , Ptr ()        {- ^ value        -} \
+-- , IO CURLSHcode {- ^ share status -} }
+
+#{SAFECALL curl_share_strerror        \
+, CURLSHcode     {- ^ errornum     -} \
+, IO (Ptr CChar) {- ^ const string -} }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_slist_append              \
+, Ptr CURLslist      {- ^ list         -} \
+, Ptr CChar          {- ^ const string -} \
+, IO (Ptr CURLslist) {- ^ list         -} }
+
+#{SAFECALL curl_slist_free_all \
+, Ptr CURLslist {- ^ list -}   \
+, IO ()                        }
+
+
+-------------------------------------------------------------------------------
+#{SAFECALL curl_version         \
+, IO (Ptr CChar) {- ^ string -} }
+
+#{SAFECALL curl_version_info   \
+, CURLversion {- ^ type/age -} \
+, IO (Ptr CURLvinfo)           }
+
+
+-------------------------------------------------------------------------------
+-- Callbacks
+-------------------------------------------------------------------------------
+#{WRAP CURL_write_callback, Ptr CChar -> CSize -> CSize -> Ptr () -> IO CSize}
+#{WRAP CURL_read_callback , Ptr CChar -> CSize -> CSize -> Ptr () -> IO CSize}
+
+
+#{WRAP CURL_lock_function                                          \
+, Ptr CURL -> CURL_lock_data -> CURL_lock_access -> Ptr () -> IO ()}
+
+#{WRAP CURL_unlock_function                    \
+, Ptr CURL -> CURL_lock_data -> Ptr () -> IO ()}
+
+
+-------------------------------------------------------------------------------
+-- Wrappers for variadic functions
+-------------------------------------------------------------------------------
+{-# NOINLINE curl_easy_getinfo #-}
+curl_easy_getinfo :: Ptr CURL -> CURLinfo -> Ptr () -> IO CURLcode
+curl_easy_getinfo a b c =
+  peekFP #{FPID curl_easy_getinfo} >>= \fp -> curlOptDPtr fp (castPtr a) b c
+
+
+{-# NOINLINE curl_easy_setopt'Long #-}
+curl_easy_setopt'Long :: Ptr CURL -> CURLoption -> CLong -> IO CURLcode
+curl_easy_setopt'Long a b c =
+  peekFP #{FPID curl_easy_setopt} >>= \fp -> curlOptLong fp (castPtr a) b c
+
+{-# NOINLINE curl_easy_setopt'COff #-}
+curl_easy_setopt'COff :: Ptr CURL -> CURLoption -> CURL_off_t -> IO CURLcode
+curl_easy_setopt'COff a b c =
+  peekFP #{FPID curl_easy_setopt} >>= \fp -> curlOptCOff fp (castPtr a) b c
+
+{-# NOINLINE curl_easy_setopt'DPtr #-}
+curl_easy_setopt'DPtr :: Ptr CURL -> CURLoption -> Ptr () -> IO CURLcode
+curl_easy_setopt'DPtr a b c =
+  peekFP #{FPID curl_easy_setopt} >>= \fp -> curlOptDPtr fp (castPtr a) b c
+
+{-# NOINLINE curl_easy_setopt'FPtr #-}
+curl_easy_setopt'FPtr :: Ptr CURL -> CURLoption -> FunPtr () -> IO CURLcode
+curl_easy_setopt'FPtr a b c =
+  peekFP #{FPID curl_easy_setopt} >>= \fp -> curlOptFPtr fp (castPtr a) b c
+
+
+{-# NOINLINE curl_share_setopt'Long #-}
+curl_share_setopt'Long :: Ptr CURLSH -> CURLSHopt -> CLong -> IO CURLSHcode
+curl_share_setopt'Long a b c =
+  peekFP #{FPID curl_share_setopt} >>= \fp -> curlOptLong fp (castPtr a) b c
+
+{-# NOINLINE curl_share_setopt'FPtr #-}
+curl_share_setopt'FPtr :: Ptr CURLSH -> CURLSHopt -> FunPtr () -> IO CURLSHcode
+curl_share_setopt'FPtr a b c =
+  peekFP #{FPID curl_share_setopt} >>= \fp -> curlOptFPtr fp (castPtr a) b c
+
+
+foreign import ccall safe curlOptLong
+  :: FunPtr () -> Ptr () -> CInt -> CLong -> IO CInt
+
+foreign import ccall safe curlOptCOff
+  :: FunPtr () -> Ptr () -> CInt -> CURL_off_t -> IO CInt
+
+foreign import ccall safe curlOptDPtr
+  :: FunPtr () -> Ptr () -> CInt -> Ptr () -> IO CInt
+
+foreign import ccall safe curlOptFPtr
+  :: FunPtr () -> Ptr () -> CInt -> FunPtr () -> IO CInt
+
diff --git a/Network/CURL000/LibHS.hsc b/Network/CURL000/LibHS.hsc
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/LibHS.hsc
@@ -0,0 +1,776 @@
+-------------------------------------------------------------------------------
+-- |
+-- Module      :  Network.CURL000.LibHS
+-- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis
+-- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
+-- 
+-- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-------------------------------------------------------------------------------
+{-# LANGUAGE GADTs #-}
+
+module Network.CURL000.LibHS
+  ( curl_easy_cleanup
+ -- curl_easy_duphandle
+ -- curl_easy_escape
+  , curl_easy_getinfo
+  , curl_easy_init
+ -- curl_easy_pause
+  , curl_easy_perform
+  , curl_easy_recv
+  , curl_easy_reset
+  , curl_easy_send
+  , curl_easy_setopt
+ -- curl_easy_strerror
+ -- curl_easy_unescape
+ -- curl_escape
+ -- curl_formadd
+ -- curl_formfree
+ -- curl_formget
+ -- curl_free
+ -- curl_getdate
+ -- curl_getenv
+  , curl_global_cleanup
+  , curl_global_init
+ -- curl_global_init_mem
+ -- curl_maprintf
+ -- curl_mfprintf
+ -- curl_mprintf
+ -- curl_msnprintf
+ -- curl_msprintf
+ -- curl_multi_add_handle
+ -- curl_multi_assign
+ -- curl_multi_cleanup
+ -- curl_multi_fdset
+ -- curl_multi_info_read
+ -- curl_multi_init
+ -- curl_multi_perform
+ -- curl_multi_remove_handle
+ -- curl_multi_setopt
+ -- curl_multi_socket
+ -- curl_multi_socket_action
+ -- curl_multi_socket_all
+ -- curl_multi_strerror
+ -- curl_multi_timeout
+ -- curl_multi_wait
+ -- curl_mvaprintf
+ -- curl_mvfprintf
+ -- curl_mvprintf
+ -- curl_mvsnprintf
+ -- curl_mvsprintf
+  , curl_share_cleanup
+  , curl_share_init
+  , curl_share_setopt
+ -- curl_share_strerror
+ -- curl_slist_append
+ -- curl_slist_free_all
+ -- curl_strequal
+ -- curl_strnequal
+ -- curl_unescape
+  , curl_version
+  , curl_version_info
+
+  ) where
+
+import qualified Network.CURL000.LibCC as C
+
+import Network.CURL000.Types
+
+import qualified Data.ByteString as BS
+import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
+import Data.ByteString        (ByteString, packCStringLen)
+import Data.IORef             (IORef, newIORef, atomicModifyIORef)
+import Data.Time.Clock        (UTCTime)
+import Data.Time.Clock.POSIX  (utcTimeToPOSIXSeconds, posixSecondsToUTCTime)
+import Data.List              (partition)
+import Data.Unique            (newUnique)
+
+import Control.Applicative ((<$>), (<*>))
+import Control.Concurrent  (MVar, newMVar, takeMVar, tryPutMVar, modifyMVar)
+import Control.Concurrent  (withMVar, modifyMVar_)
+import Control.Exception   (throwIO, bracketOnError)
+import Control.Monad       (when, forM_, foldM)
+
+import Foreign.Marshal.Alloc
+import Foreign.Marshal.Array
+import Foreign.Marshal.Utils
+import Foreign.Storable
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr
+
+#include "LibC0.c"
+
+
+-------------------------------------------------------------------------------
+-- | Global libcurl initialisation
+--   (<http://curl.haxx.se/libcurl/c/curl_global_init.html>).
+-------------------------------------------------------------------------------
+curl_global_init :: IO ()
+curl_global_init = do
+  code <- C.curl_global_init #{const CURL_GLOBAL_ALL}
+  when (code/=0) (error "<curlhs> curl_global_init failed")
+
+
+-------------------------------------------------------------------------------
+-- | Global libcurl cleanup
+--   (<http://curl.haxx.se/libcurl/c/curl_global_cleanup.html>).
+-------------------------------------------------------------------------------
+curl_global_cleanup :: IO ()
+curl_global_cleanup = C.curl_global_cleanup
+
+
+-------------------------------------------------------------------------------
+-- | Returns the libcurl version string
+--   (<http://curl.haxx.se/libcurl/c/curl_version.html>).
+-------------------------------------------------------------------------------
+curl_version :: IO String
+curl_version = C.curl_version >>= peekCAString
+
+
+-------------------------------------------------------------------------------
+-- | Returns run-time libcurl version info
+--   (<http://curl.haxx.se/libcurl/c/curl_version_info.html>).
+-------------------------------------------------------------------------------
+curl_version_info :: IO CURL_version_info
+curl_version_info =
+  C.curl_version_info #{const CURLVERSION_NOW} >>= \ptr -> CURL_version_info
+    <$> (#{peek curl_version_info_data, version        } ptr >>= peekCAString)
+    <*> (#{peek curl_version_info_data, version_num    } ptr >>= peekCUInt)
+    <*> (#{peek curl_version_info_data, host           } ptr >>= peekCAString)
+    <*> (#{peek curl_version_info_data, features       } ptr >>= peekCFeatures)
+    <*> (#{peek curl_version_info_data, ssl_version    } ptr >>= peekCString0)
+    <*> (#{peek curl_version_info_data, ssl_version_num} ptr >>= peekCLong)
+    <*> (#{peek curl_version_info_data, libz_version   } ptr >>= peekCString0)
+    <*> (#{peek curl_version_info_data, protocols      } ptr >>= peekCStringL)
+    <*> (#{peek curl_version_info_data, ares           } ptr >>= peekCString0)
+    <*> (#{peek curl_version_info_data, ares_num       } ptr >>= peekCInt)
+    <*> (#{peek curl_version_info_data, libidn         } ptr >>= peekCString0)
+    <*> (#{peek curl_version_info_data, iconv_ver_num  } ptr >>= peekCInt)
+    <*> (#{peek curl_version_info_data, libssh_version } ptr >>= peekCString0)
+
+peekCString0 :: Ptr CChar -> IO String
+peekCString0 ptr = if (ptr==nullPtr) then return [] else peekCAString ptr
+
+peekCStringL :: Ptr (Ptr CChar) -> IO [String]
+peekCStringL ptr = peekArray0 nullPtr ptr >>= mapM peekCAString
+
+peekCFeatures :: CInt -> IO [CURLfeature]
+peekCFeatures = return . fromCIntMask
+
+peekCUInt :: CUInt -> IO Int
+peekCUInt = return . fromIntegral
+
+peekCInt :: CInt -> IO Int
+peekCInt = return . fromIntegral
+
+peekCLong :: CLong -> IO Int
+peekCLong = return . fromIntegral
+
+
+
+-------------------------------------------------------------------------------
+-- | Start a libcurl easy session
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_init.html>).
+-------------------------------------------------------------------------------
+curl_easy_init :: IO CURL
+curl_easy_init = do
+  ccurl <- C.curl_easy_init; curlmvar <- newMVar ccurl
+  uid <- newUnique; cbref <- newIORef []; slref <- newIORef []
+  let curl = CURL uid curlmvar cbref slref
+  if (ccurl/=nullPtr) then return curl else do
+    desc <- C.curl_easy_strerror #{const CURLE_FAILED_INIT} >>= peekCString0
+    throwCURLE curl "curl_easy_init" desc CURLE_FAILED_INIT
+
+
+-------------------------------------------------------------------------------
+throwCURLE :: CURL -> String -> String -> CURLC -> IO a
+throwCURLE curl func desc code = throwIO (CURLE curl func desc code)
+
+checkCURLE :: CURL -> String -> (IO CInt) -> IO ()
+checkCURLE curl func action =
+  action >>= \code -> when (code/=0) $ do
+    desc <- C.curl_easy_strerror code >>= peekCString0
+    throwCURLE curl func desc (toCURLC code)
+
+withCCURL :: CURL -> (Ptr C.CURL -> IO a) -> IO a
+withCCURL (CURL _ curlmvar _ _) = withMVar curlmvar
+
+
+-------------------------------------------------------------------------------
+-- | Reset all options of a libcurl session handle
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_reset.html>).
+-------------------------------------------------------------------------------
+curl_easy_reset :: CURL -> IO ()
+curl_easy_reset (CURL _ curlmvar cbref slref) =
+  modifyMVar_ curlmvar $ \ccurl -> do
+    when (ccurl/=nullPtr) (C.curl_easy_reset ccurl)
+    freeCURL cbref slref >> return ccurl
+
+
+-------------------------------------------------------------------------------
+-- | End a libcurl easy session
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html>).
+-------------------------------------------------------------------------------
+curl_easy_cleanup :: CURL -> IO ()
+curl_easy_cleanup (CURL _ curlmvar cbref slref) =
+  modifyMVar_ curlmvar $ \ccurl -> do
+    when (ccurl/=nullPtr) (C.curl_easy_cleanup ccurl)
+    freeCURL cbref slref >> return nullPtr
+
+freeCURL :: IORef [CURLCB] -> IORef [CURLSL] -> IO ()
+freeCURL cbref slref = do
+  atomicModifyIORef cbref (\cbs -> ([],cbs)) >>= mapM_ freeCB
+  atomicModifyIORef slref (\sls -> ([],sls)) >>= mapM_ freeSL
+
+
+-------------------------------------------------------------------------------
+-- | Perform a file transfer
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_perform.html>).
+-------------------------------------------------------------------------------
+curl_easy_perform :: CURL -> IO ()
+curl_easy_perform curl =
+  withCCURL curl (checkCURLE curl "curl_easy_perform" . C.curl_easy_perform)
+
+
+-------------------------------------------------------------------------------
+-- | Receives raw data on an @easy@ connection
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_recv.html>).
+-------------------------------------------------------------------------------
+curl_easy_recv :: CURL -> Int -> IO ByteString
+curl_easy_recv curl len =
+  withCCURL curl $ \ccurl -> alloca $ \nptr -> allocaBytes len $ \buff -> do
+    let check = checkCURLE curl "curl_easy_recv"
+    check $ C.curl_easy_recv ccurl buff (fromIntegral len) nptr
+    n <- fmap fromIntegral (peek nptr)
+    packCStringLen (castPtr buff, n)
+
+
+-------------------------------------------------------------------------------
+-- | Sends raw data over an @easy@ connection
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_send.html>).
+-------------------------------------------------------------------------------
+curl_easy_send :: CURL -> ByteString -> IO Int
+curl_easy_send curl bs =
+  withCCURL curl $ \ccurl -> alloca $ \nptr -> do
+    let check = checkCURLE curl "curl_easy_send"
+    check $ unsafeUseAsCStringLen bs $ \(cs, cl) ->
+      C.curl_easy_send ccurl (castPtr cs) (fromIntegral cl) nptr
+    fmap fromIntegral (peek nptr)
+
+
+-------------------------------------------------------------------------------
+-- | Extract information from a curl handle
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html>).
+-------------------------------------------------------------------------------
+#define hsc_getopt(opt, foo) printf(#opt " -> getopt %d " #foo, opt)
+curl_easy_getinfo :: CURL -> CURLinfo a -> IO a
+curl_easy_getinfo curl opt = withCCURL curl $ \ccurl ->
+  let getopt :: Storable x => CInt -> (Ptr x -> IO a) -> IO a
+      getopt x fpeek = alloca $ \ptr -> getptr x (castPtr ptr) >> fpeek ptr
+      getptr x ptr = check $ C.curl_easy_getinfo ccurl x ptr
+      check = checkCURLE curl "curl_easy_getinfo"
+  in case opt of
+    #{getopt CURLINFO_EFFECTIVE_URL          , getString}
+    #{getopt CURLINFO_RESPONSE_CODE          , getCLong }
+    #{getopt CURLINFO_HTTP_CONNECTCODE       , getCLong }
+    #{getopt CURLINFO_FILETIME               , getTime  }
+    #{getopt CURLINFO_TOTAL_TIME             , getDouble}
+    #{getopt CURLINFO_NAMELOOKUP_TIME        , getDouble}
+    #{getopt CURLINFO_CONNECT_TIME           , getDouble}
+    #{getopt CURLINFO_APPCONNECT_TIME        , getDouble}
+    #{getopt CURLINFO_PRETRANSFER_TIME       , getDouble}
+    #{getopt CURLINFO_STARTTRANSFER_TIME     , getDouble}
+    #{getopt CURLINFO_REDIRECT_TIME          , getDouble}
+    #{getopt CURLINFO_REDIRECT_COUNT         , getCLong }
+    #{getopt CURLINFO_REDIRECT_URL           , getString}
+    #{getopt CURLINFO_SIZE_UPLOAD            , getDouble}
+    #{getopt CURLINFO_SIZE_DOWNLOAD          , getDouble}
+    #{getopt CURLINFO_SPEED_DOWNLOAD         , getDouble}
+    #{getopt CURLINFO_SPEED_UPLOAD           , getDouble}
+    #{getopt CURLINFO_HEADER_SIZE            , getCLong }
+    #{getopt CURLINFO_REQUEST_SIZE           , getCLong }
+    #{getopt CURLINFO_SSL_VERIFYRESULT       , getCLong }
+    #{getopt CURLINFO_SSL_ENGINES            , getSList }
+    #{getopt CURLINFO_CONTENT_LENGTH_DOWNLOAD, getDouble}
+    #{getopt CURLINFO_CONTENT_LENGTH_UPLOAD  , getDouble}
+    #{getopt CURLINFO_CONTENT_TYPE           , getString}
+    #{getopt CURLINFO_HTTPAUTH_AVAIL         , getAuth  }
+    #{getopt CURLINFO_PROXYAUTH_AVAIL        , getAuth  }
+    #{getopt CURLINFO_OS_ERRNO               , getCLong }
+    #{getopt CURLINFO_NUM_CONNECTS           , getCLong }
+    #{getopt CURLINFO_PRIMARY_IP             , getString}
+    #{getopt CURLINFO_PRIMARY_PORT           , getCLong }
+    #{getopt CURLINFO_LOCAL_IP               , getString}
+    #{getopt CURLINFO_LOCAL_PORT             , getCLong }
+    #{getopt CURLINFO_COOKIELIST             , getSList }
+    #{getopt CURLINFO_LASTSOCKET             , getCLong }
+    #{getopt CURLINFO_FTP_ENTRY_PATH         , getString}
+    #{getopt CURLINFO_CERTINFO               , getCerts }
+    #{getopt CURLINFO_CONDITION_UNMET        , getBool  }
+    #{getopt CURLINFO_RTSP_SESSION_ID        , getString}
+    #{getopt CURLINFO_RTSP_CLIENT_CSEQ       , getCLong }
+    #{getopt CURLINFO_RTSP_SERVER_CSEQ       , getCLong }
+    #{getopt CURLINFO_RTSP_CSEQ_RECV         , getCLong }
+
+getString :: Ptr (Ptr CChar) -> IO String
+getString ptr = peek ptr >>= peekCString0
+
+getDouble :: Ptr CDouble -> IO Double
+getDouble = fmap realToFrac . peek
+
+getCLong :: Ptr CLong -> IO CLong
+getCLong = peek
+
+getBool :: Ptr CLong -> IO Bool
+getBool = fmap toBool . peek
+
+getAuth :: Ptr CLong -> IO [CURLauth]
+getAuth = fmap fromCLongMask . peek
+
+getTime :: Ptr CLong -> IO (Maybe UTCTime)
+getTime =
+  let mconv f x = if (x==(-1) || x==0) then Nothing else Just (f x)
+  in  fmap (mconv (posixSecondsToUTCTime . realToFrac)) . peek
+
+getCerts :: Ptr (Ptr C.CURLcerts) -> IO [[String]]
+getCerts ptr =
+  peek ptr >>= \certs -> if (certs==nullPtr) then return [] else
+    peek certs >>= \(C.CURLcerts len tab) ->
+      peekArray (fromIntegral len) tab >>= mapM peekCURLslist
+
+getSList :: Ptr (Ptr C.CURLslist) -> IO [String]
+getSList ptr =
+  peek ptr >>= \slist -> do
+    strings <- peekCURLslist slist
+    C.curl_slist_free_all slist
+    return strings
+
+peekCURLslist :: Ptr C.CURLslist -> IO [String]
+peekCURLslist ptr =
+  if (ptr==nullPtr) then return [] else
+    peek ptr >>= \(C.CURLslist cs csl) -> do
+      slist_head <- peekCAString cs
+      slist_tail <- peekCURLslist csl
+      return (slist_head : slist_tail)
+
+
+-------------------------------------------------------------------------------
+-- | Set options for a curl easy handle
+--   (<http://curl.haxx.se/libcurl/c/curl_easy_setopt.html>).
+-------------------------------------------------------------------------------
+curl_easy_setopt :: CURL -> [CURLoption] -> IO ()
+curl_easy_setopt curl@(CURL _ _ cbref slref) opts =
+  withCCURL curl $ \ccurl -> forM_ opts $ \opt ->
+    checkCURLE curl "curl_easy_setopt" $ case opt of
+
+  #define hsc_setopt(opt, foo) printf(#opt " x -> " #foo " ccurl %d x", opt)
+
+  ---- CALLBACK OPTIONS -------------------------------------------------------
+  #{setopt CURLOPT_WRITEFUNCTION          , curlcb FWRITE}
+  #{setopt CURLOPT_READFUNCTION           , curlcb FREAD }
+
+  ---- BEHAVIOR OPTIONS -------------------------------------------------------
+  #{setopt CURLOPT_VERBOSE                , bool     }
+  #{setopt CURLOPT_HEADER                 , bool     }
+  #{setopt CURLOPT_NOPROGRESS             , bool     }
+  #{setopt CURLOPT_NOSIGNAL               , bool     }
+  #{setopt CURLOPT_WILDCARDMATCH          , bool     }
+
+  ---- ERROR OPTIONS ----------------------------------------------------------
+  -- CURLOPT_ERRORBUFFER
+  -- CURLOPT_STDERR
+  #{setopt CURLOPT_FAILONERROR            , bool     }
+
+  ---- NETWORK OPTIONS --------------------------------------------------------
+  #{setopt CURLOPT_URL                    , string   }
+  #{setopt CURLOPT_PROTOCOLS              , enum     }
+  #{setopt CURLOPT_REDIR_PROTOCOLS        , enum     }
+  #{setopt CURLOPT_PROXY                  , string   }
+  #{setopt CURLOPT_PROXYPORT              , clong    }
+  #{setopt CURLOPT_PROXYTYPE              , enum     }
+  #{setopt CURLOPT_NOPROXY                , string   }
+  #{setopt CURLOPT_HTTPPROXYTUNNEL        , bool     }
+  #{setopt CURLOPT_SOCKS5_GSSAPI_SERVICE  , string   }
+  #{setopt CURLOPT_SOCKS5_GSSAPI_NEC      , bool     }
+  #{setopt CURLOPT_INTERFACE              , string   }
+  #{setopt CURLOPT_LOCALPORT              , clong    }
+  #{setopt CURLOPT_LOCALPORTRANGE         , clong    }
+  #{setopt CURLOPT_DNS_CACHE_TIMEOUT      , clong    }
+  -- #{setopt CURLOPT_DNS_USE_GLOBAL_CACHE   , bool     }
+  #{setopt CURLOPT_BUFFERSIZE             , clong    }
+  #{setopt CURLOPT_PORT                   , clong    }
+  #{setopt CURLOPT_TCP_NODELAY            , bool     }
+  #{setopt CURLOPT_ADDRESS_SCOPE          , clong    }
+  #{setopt CURLOPT_TCP_KEEPALIVE          , bool     }
+  #{setopt CURLOPT_TCP_KEEPIDLE           , clong    }
+  #{setopt CURLOPT_TCP_KEEPINTVL          , clong    }
+
+  ---- NAMES and PASSWORDS OPTIONS (Authentication) ---------------------------
+  #{setopt CURLOPT_NETRC                  , enum     }
+  #{setopt CURLOPT_NETRC_FILE             , string   }
+  #{setopt CURLOPT_USERPWD                , string   }
+  #{setopt CURLOPT_PROXYUSERPWD           , string   }
+  #{setopt CURLOPT_USERNAME               , string   }
+  #{setopt CURLOPT_PASSWORD               , string   }
+  #{setopt CURLOPT_PROXYUSERNAME          , string   }
+  #{setopt CURLOPT_PROXYPASSWORD          , string   }
+  #{setopt CURLOPT_HTTPAUTH               , enum     }
+  #{setopt CURLOPT_TLSAUTH_TYPE           , string   }
+  #{setopt CURLOPT_TLSAUTH_USERNAME       , string   }
+  #{setopt CURLOPT_TLSAUTH_PASSWORD       , string   }
+  #{setopt CURLOPT_PROXYAUTH              , enum     }
+
+  ---- HTTP OPTIONS -----------------------------------------------------------
+  #{setopt CURLOPT_AUTOREFERER            , bool     }
+  #{setopt CURLOPT_ACCEPT_ENCODING        , string   }
+  #{setopt CURLOPT_TRANSFER_ENCODING      , bool     }
+  #{setopt CURLOPT_FOLLOWLOCATION         , bool     }
+  #{setopt CURLOPT_UNRESTRICTED_AUTH      , bool     }
+  #{setopt CURLOPT_MAXREDIRS              , clong    }
+  #{setopt CURLOPT_POSTREDIR              , enum     }
+  #{setopt CURLOPT_PUT                    , bool     }
+  #{setopt CURLOPT_POST                   , bool     }
+  -- #{setopt CURLOPT_POSTFIELDS             , buffer   }
+  #{setopt CURLOPT_POSTFIELDSIZE          , clong    }
+  #{setopt CURLOPT_POSTFIELDSIZE_LARGE    , int64    }
+  #{setopt CURLOPT_COPYPOSTFIELDS         , string   }
+  -- CURLOPT_HTTPPOST
+  #{setopt CURLOPT_REFERER                , string   }
+  #{setopt CURLOPT_USERAGENT              , string   }
+  #{setopt CURLOPT_HTTPHEADER             , slist    }
+  #{setopt CURLOPT_HTTP200ALIASES         , slist    }
+  #{setopt CURLOPT_COOKIE                 , string   }
+  #{setopt CURLOPT_COOKIEFILE             , string   }
+  #{setopt CURLOPT_COOKIEJAR              , string   }
+  #{setopt CURLOPT_COOKIESESSION          , bool     }
+  #{setopt CURLOPT_COOKIELIST             , string   }
+  #{setopt CURLOPT_HTTPGET                , bool     }
+  #{setopt CURLOPT_HTTP_VERSION           , enum     }
+  #{setopt CURLOPT_IGNORE_CONTENT_LENGTH  , bool     }
+  #{setopt CURLOPT_HTTP_CONTENT_DECODING  , bool     }
+  #{setopt CURLOPT_HTTP_TRANSFER_DECODING , bool     }
+
+  ---- SMTP OPTIONS -----------------------------------------------------------
+  #{setopt CURLOPT_MAIL_FROM              , string   }
+  #{setopt CURLOPT_MAIL_RCPT              , slist    }
+  #{setopt CURLOPT_MAIL_AUTH              , string   }
+
+  ---- TFTP OPTIONS -----------------------------------------------------------
+  #{setopt CURLOPT_TFTP_BLKSIZE           , clong    }
+
+  ---- FTP OPTIONS ------------------------------------------------------------
+  #{setopt CURLOPT_FTPPORT                , string   }
+  #{setopt CURLOPT_QUOTE                  , slist    }
+  #{setopt CURLOPT_POSTQUOTE              , slist    }
+  #{setopt CURLOPT_PREQUOTE               , slist    }
+  #{setopt CURLOPT_DIRLISTONLY            , bool     }
+  #{setopt CURLOPT_APPEND                 , bool     }
+  #{setopt CURLOPT_FTP_USE_EPRT           , bool     }
+  #{setopt CURLOPT_FTP_USE_EPSV           , bool     }
+  #{setopt CURLOPT_FTP_USE_PRET           , bool     }
+  #{setopt CURLOPT_FTP_CREATE_MISSING_DIRS, enum     }
+  #{setopt CURLOPT_FTP_RESPONSE_TIMEOUT   , clong    }
+  #{setopt CURLOPT_FTP_ALTERNATIVE_TO_USER, string   }
+  #{setopt CURLOPT_FTP_SKIP_PASV_IP       , bool     }
+  #{setopt CURLOPT_FTPSSLAUTH             , enum     }
+  #{setopt CURLOPT_FTP_SSL_CCC            , enum     }
+  #{setopt CURLOPT_FTP_ACCOUNT            , string   }
+  #{setopt CURLOPT_FTP_FILEMETHOD         , enum     }
+
+  ---- RTSP OPTIONS -----------------------------------------------------------
+  #define CURLOPT_RTSP_HEADER CURLOPT_RTSPHEADER
+  #{setopt CURLOPT_RTSP_REQUEST           , enum     }
+  #{setopt CURLOPT_RTSP_SESSION_ID        , string   }
+  #{setopt CURLOPT_RTSP_STREAM_URI        , string   }
+  #{setopt CURLOPT_RTSP_TRANSPORT         , string   }
+  #{setopt CURLOPT_RTSP_HEADER            , slist    }
+  #{setopt CURLOPT_RTSP_CLIENT_CSEQ       , clong    }
+  #{setopt CURLOPT_RTSP_SERVER_CSEQ       , clong    }
+
+  ---- PROTOCOL OPTIONS -------------------------------------------------------
+  #{setopt CURLOPT_TRANSFERTEXT           , bool     }
+  #{setopt CURLOPT_PROXY_TRANSFER_MODE    , bool     }
+  #{setopt CURLOPT_CRLF                   , bool     }
+  #{setopt CURLOPT_RANGE                  , string   }
+  #{setopt CURLOPT_RESUME_FROM            , clong    }
+  #{setopt CURLOPT_RESUME_FROM_LARGE      , int64    }
+  #{setopt CURLOPT_CUSTOMREQUEST          , string   }
+  #{setopt CURLOPT_FILETIME               , bool     }
+  #{setopt CURLOPT_NOBODY                 , bool     }
+  #{setopt CURLOPT_INFILESIZE             , clong    }
+  #{setopt CURLOPT_INFILESIZE_LARGE       , int64    }
+  #{setopt CURLOPT_UPLOAD                 , bool     }
+  #{setopt CURLOPT_MAXFILESIZE            , clong    }
+  #{setopt CURLOPT_MAXFILESIZE_LARGE      , int64    }
+  #{setopt CURLOPT_TIMECONDITION          , enum     }
+  #{setopt CURLOPT_TIMEVALUE              , time     }
+
+  ---- CONNECTION OPTIONS -----------------------------------------------------
+  #{setopt CURLOPT_TIMEOUT                , clong    }
+  #{setopt CURLOPT_TIMEOUT_MS             , clong    }
+  #{setopt CURLOPT_LOW_SPEED_LIMIT        , clong    }
+  #{setopt CURLOPT_LOW_SPEED_TIME         , clong    }
+  #{setopt CURLOPT_MAX_SEND_SPEED_LARGE   , int64    }
+  #{setopt CURLOPT_MAX_RECV_SPEED_LARGE   , int64    }
+  #{setopt CURLOPT_MAXCONNECTS            , clong    }
+  -- #{setopt CURLOPT_CLOSEPOLICY            , enum     }
+  #{setopt CURLOPT_FRESH_CONNECT          , bool     }
+  #{setopt CURLOPT_FORBID_REUSE           , bool     }
+  #{setopt CURLOPT_CONNECTTIMEOUT         , clong    }
+  #{setopt CURLOPT_CONNECTTIMEOUT_MS      , clong    }
+  #{setopt CURLOPT_IPRESOLVE              , enum     }
+  #{setopt CURLOPT_CONNECT_ONLY           , bool     }
+  #{setopt CURLOPT_USE_SSL                , enum     }
+  #{setopt CURLOPT_RESOLVE                , slist    }
+  #{setopt CURLOPT_DNS_SERVERS            , string   }
+  #{setopt CURLOPT_ACCEPTTIMEOUT_MS       , clong    }
+
+  ---- SSL and SECURITY OPTIONS -----------------------------------------------
+  #{setopt CURLOPT_SSLCERT                , string   }
+  #{setopt CURLOPT_SSLCERTTYPE            , string   }
+  #{setopt CURLOPT_SSLKEY                 , string   }
+  #{setopt CURLOPT_SSLKEYTYPE             , string   }
+  #{setopt CURLOPT_KEYPASSWD              , string   }
+  #{setopt CURLOPT_SSLENGINE              , string   }
+  #{setopt CURLOPT_SSLENGINE_DEFAULT      , bool     }
+  #{setopt CURLOPT_SSLVERSION             , enum     }
+  #{setopt CURLOPT_SSL_VERIFYPEER         , bool     }
+  #{setopt CURLOPT_CAINFO                 , string   }
+  #{setopt CURLOPT_ISSUERCERT             , string   }
+  #{setopt CURLOPT_CAPATH                 , string   }
+  #{setopt CURLOPT_CRLFILE                , string   }
+  #{setopt CURLOPT_SSL_VERIFYHOST         , clong    }
+  #{setopt CURLOPT_CERTINFO               , bool     }
+  #{setopt CURLOPT_RANDOM_FILE            , string   }
+  #{setopt CURLOPT_EGDSOCKET              , string   }
+  #{setopt CURLOPT_SSL_CIPHER_LIST        , string   }
+  #{setopt CURLOPT_SSL_SESSIONID_CACHE    , bool     }
+  #{setopt CURLOPT_SSL_OPTIONS            , enum     }
+  #{setopt CURLOPT_KRBLEVEL               , string   }
+  #{setopt CURLOPT_GSSAPI_DELEGATION      , enum     }
+
+  ---- SSH OPTIONS ------------------------------------------------------------
+  #{setopt CURLOPT_SSH_AUTH_TYPES         , enum     }
+  #{setopt CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, string   }
+  #{setopt CURLOPT_SSH_PUBLIC_KEYFILE     , string   }
+  #{setopt CURLOPT_SSH_PRIVATE_KEYFILE    , string   }
+  #{setopt CURLOPT_SSH_KNOWNHOSTS         , string   }
+  -- CURLOPT_SSH_KEYFUNCTION
+  -- CURLOPT_SSH_KEYDATA
+
+  ---- OTHER OPTIONS ----------------------------------------------------------
+  -- CURLOPT_PRIVATE
+  #{setopt CURLOPT_SHARE                  , curlsh   }
+  #{setopt CURLOPT_NEW_FILE_PERMS         , clong    }
+  #{setopt CURLOPT_NEW_DIRECTORY_PERMS    , clong    }
+
+  ---- TELNET OPTIONS ---------------------------------------------------------
+  #{setopt CURLOPT_TELNETOPTIONS          , slist    }
+
+  where
+    ---------------------------------------------------------------------------
+    enum  ccurl copt x = C.curl_easy_setopt'Long ccurl copt (toCLong      x)
+    bool  ccurl copt x = C.curl_easy_setopt'Long ccurl copt (fromBool     x)
+    time  ccurl copt x = C.curl_easy_setopt'Long ccurl copt (fromUTCTime  x)
+    clong ccurl copt x = C.curl_easy_setopt'Long ccurl copt (fromIntegral x)
+    int64 ccurl copt x = C.curl_easy_setopt'COff ccurl copt (fromIntegral x)
+    fromUTCTime = truncate . utcTimeToPOSIXSeconds
+    ---------------------------------------------------------------------------
+    string ccurl copt x = withCAString x $ \p ->
+      C.curl_easy_setopt'DPtr ccurl copt (castPtr p)
+    ---------------------------------------------------------------------------
+    slist ccurl copt x = makeSL slref ccurl copt x
+    ---------------------------------------------------------------------------
+    curlcb :: CURLCBT a -> Ptr C.CURL -> CInt -> Maybe a -> IO CInt
+    curlcb cbt ccurl copt x = makeCB cbref cbt ccurl copt x
+    ---------------------------------------------------------------------------
+    curlsh ccurl copt Nothing = C.curl_easy_setopt'DPtr ccurl copt nullPtr
+    curlsh ccurl copt (Just (CURLSH _ mvar)) =
+      withMVar mvar $ \(ccurlsh,_,_) ->
+        C.curl_easy_setopt'DPtr ccurl copt (castPtr ccurlsh)
+
+
+-------------------------------------------------------------------------------
+wrapSL :: [String] -> IO (Maybe (Ptr C.CURLslist))
+wrapSL = foldM wrap (Just nullPtr)
+  where
+  wrap Nothing _ = return Nothing
+  wrap (Just sl) xs =
+    withCAString xs (C.curl_slist_append sl) >>= \nsl ->
+      if (nsl/=nullPtr) then return (Just nsl) else do
+         when (sl/=nullPtr) (C.curl_slist_free_all sl)
+         return Nothing
+
+freeSL :: CURLSL -> IO ()
+freeSL (_,sl) = when (sl/=nullPtr) (C.curl_slist_free_all sl)
+
+makeSL :: IORef [CURLSL] -> Ptr C.CURL -> CInt -> [String] -> IO CInt
+makeSL slref ccurl copt xs =
+  let cons sl (tokeep, tofree) = ((copt,sl):tokeep, tofree)
+      keep 0 sl sls = cons sl $ partition ((==copt) . fst) sls
+      keep _ sl sls = cons sl $ (sls,[])
+  in  wrapSL xs >>= \msl -> case msl of
+        Nothing -> return #{const CURLE_OUT_OF_MEMORY}
+        Just sl -> do
+          code <- C.curl_easy_setopt'DPtr ccurl copt (castPtr sl)
+          atomicModifyIORef slref (keep code sl) >>= mapM_ freeSL
+          return code
+
+
+-------------------------------------------------------------------------------
+wrapCB :: CURLCBT a -> a -> IO (FunPtr ())
+wrapCB cbt = case cbt of
+  FWRITE -> fmap castFunPtr . C.wrapCURL_write_callback . write_callback
+  FREAD  -> fmap castFunPtr . C.wrapCURL_read_callback  . read_callback
+
+freeCB :: CURLCB -> IO ()
+freeCB (CURLCB _ fp) = when (fp/=nullFunPtr) (freeHaskellFunPtr fp)
+
+makeCB
+  :: IORef [CURLCB] -> CURLCBT a -> Ptr C.CURL -> CInt -> Maybe a -> IO CInt
+makeCB cbref cbt ccurl copt mcb =
+  let comp :: CURLCBT a -> CURLCB -> Bool
+      comp FWRITE (CURLCB FWRITE _) = True; comp FWRITE _ = False
+      comp FREAD  (CURLCB FREAD  _) = True; comp FREAD  _ = False
+      cons fp (tokeep, tofree) = ((CURLCB cbt fp):tokeep, tofree)
+      keep 0 fp cbs = cons fp $ partition (comp cbt) cbs
+      keep _ fp cbs = cons fp $ (cbs,[])
+  in  maybe (return nullFunPtr) (wrapCB cbt) mcb >>= \fp -> do
+        code <- C.curl_easy_setopt'FPtr ccurl copt fp
+        atomicModifyIORef cbref (keep code fp) >>= mapM_ freeCB
+        return code
+
+
+-------------------------------------------------------------------------------
+write_callback :: CURL_write_callback -> C.CURL_write_callback
+write_callback fwrite ptr size nmemb _ = do
+  stat <- packCStringLen (ptr, fromIntegral (size * nmemb)) >>= fwrite
+  return $ case stat of
+    CURL_WRITEFUNC_OK    -> (size * nmemb)
+    CURL_WRITEFUNC_FAIL  -> 0
+    CURL_WRITEFUNC_PAUSE -> #{const CURL_WRITEFUNC_PAUSE}
+
+
+-------------------------------------------------------------------------------
+read_callback :: CURL_read_callback -> C.CURL_read_callback
+read_callback fread buff size nmemb _ = do
+  let buffLen = fromIntegral (size * nmemb)
+  stat <- fread buffLen
+  case stat of
+    CURL_READFUNC_PAUSE -> return #{const CURL_READFUNC_PAUSE}
+    CURL_READFUNC_ABORT -> return #{const CURL_READFUNC_ABORT}
+    CURL_READFUNC_OK bs -> unsafeUseAsCStringLen (BS.take buffLen bs)
+      (\(cs, cl) -> copyBytes buff cs cl >> return (fromIntegral cl))
+
+
+-------------------------------------------------------------------------------
+-- | Create a shared object
+--   (<http://curl.haxx.se/libcurl/c/curl_share_init.html>).
+-------------------------------------------------------------------------------
+curl_share_init :: IO CURLSH
+curl_share_init = bracketOnError createcurlsh curl_share_cleanup setupcurlsh
+  where
+  -----------------
+  createcurlsh = do
+    ccurlsh <- C.curl_share_init
+    (f1,f2) <- if (ccurlsh == nullPtr)
+      then return (nullFunPtr, nullFunPtr)
+      else do
+        shlocks <- newSHLocks
+        f1 <- C.wrapCURL_lock_function   (lock_function   shlocks)
+        f2 <- C.wrapCURL_unlock_function (unlock_function shlocks)
+        return (castFunPtr f1, castFunPtr f2)
+    uid <- newUnique; mvar <- newMVar (ccurlsh,f1,f2)
+    return (CURLSH uid mvar)
+  ------------------------------------
+  setupcurlsh curlsh@(CURLSH _ mvar) =
+    withMVar mvar $ \(ccurlsh,f1,f2) -> do
+      let func = "curl_share_init"
+      if (ccurlsh == nullPtr)
+        then do
+          let getstrerror x = C.curl_easy_strerror x >>= peekCString0
+          desc <- getstrerror #{const CURLE_FAILED_INIT}
+          throwCURLSHE curlsh func desc CURLSHE_FAILED_INIT
+        else do
+          let withCHECK = checkCURLSHE curlsh func
+          let setshopt = C.curl_share_setopt'FPtr ccurlsh
+          withCHECK $ setshopt #{const CURLSHOPT_LOCKFUNC  } f1
+          withCHECK $ setshopt #{const CURLSHOPT_UNLOCKFUNC} f2
+          return curlsh
+
+
+-------------------------------------------------------------------------------
+-- | Clean up a shared object
+--   (<http://curl.haxx.se/libcurl/c/curl_share_cleanup.html>).
+-------------------------------------------------------------------------------
+curl_share_cleanup :: CURLSH -> IO ()
+curl_share_cleanup curlsh@(CURLSH _ mvar) =
+  let withCHECK = checkCURLSHE curlsh "curl_share_cleanup"
+  in  modifyMVar_ mvar $ \(ccurlsh,f1,f2) -> do
+        when (ccurlsh/=nullPtr) (withCHECK $ C.curl_share_cleanup ccurlsh)
+        when (f1/=nullFunPtr) (freeHaskellFunPtr f1)
+        when (f2/=nullFunPtr) (freeHaskellFunPtr f2)
+        return (nullPtr,nullFunPtr,nullFunPtr)
+
+
+-------------------------------------------------------------------------------
+-- | Set options for a shared object
+--   (<http://curl.haxx.se/libcurl/c/curl_share_setopt.html>).
+-------------------------------------------------------------------------------
+#define hsc_curlshopt(opt, foo) printf(#opt " x -> " #foo " %d x", opt)
+curl_share_setopt :: CURLSH -> [CURLSHoption] -> IO ()
+curl_share_setopt curlsh@(CURLSH _ mvar) opts =
+  withMVar mvar $ \(ccurlsh,_,_) -> do
+    let func = "curl_share_setopt"
+    when (ccurlsh==nullPtr) $ do
+      desc <- C.curl_share_strerror #{const CURLSHE_INVALID} >>= peekCString0
+      throwCURLSHE curlsh func desc CURLSHE_INVALID
+    let enum copt x = C.curl_share_setopt'Long ccurlsh copt (toCLong x)
+    flip mapM_ opts $ \opt -> checkCURLSHE curlsh func $ case opt of
+      #{curlshopt CURLSHOPT_SHARE  , enum}
+      #{curlshopt CURLSHOPT_UNSHARE, enum}
+
+
+-------------------------------------------------------------------------------
+throwCURLSHE :: CURLSH -> String -> String -> CURLSHC -> IO a
+throwCURLSHE curlsh func desc code = throwIO (CURLSHE curlsh func desc code)
+
+checkCURLSHE :: CURLSH -> String -> (IO CInt) -> IO ()
+checkCURLSHE curlsh func action =
+  action >>= \code -> when (code/=0) $ do
+    desc <- C.curl_share_strerror code >>= peekCString0
+    throwCURLSHE curlsh func desc (toCURLSHC code)
+
+
+-------------------------------------------------------------------------------
+type SHLocks  = MVar [(SHLockID, SHLock)]
+type SHLock   = MVar ()
+type SHLockID = CInt
+
+newSHLocks :: IO SHLocks
+newSHLocks = newMVar []
+
+getSHLock :: SHLock -> IO ()
+getSHLock shlock = takeMVar shlock
+
+putSHLock :: SHLock -> IO ()
+putSHLock shlock = tryPutMVar shlock () >> return ()
+
+lookupSHLock :: SHLocks -> SHLockID -> IO SHLock
+lookupSHLock mvar shlockid =
+  modifyMVar mvar $ \shlocks ->
+    case (lookup shlockid shlocks) of
+      Just shlock -> return (shlocks, shlock)
+      Nothing     -> newMVar () >>= \nl -> return ((shlockid, nl):shlocks, nl)
+
+lock_function :: SHLocks -> C.CURL_lock_function
+lock_function shlocks _ccurl lockdata _lockaccess _usrptr =
+  lookupSHLock shlocks lockdata >>= getSHLock
+
+unlock_function :: SHLocks -> C.CURL_unlock_function
+unlock_function shlocks _ccurl lockdata _usrptr =
+  lookupSHLock shlocks lockdata >>= putSHLock
+
diff --git a/Network/CURL000/LibLD.hs b/Network/CURL000/LibLD.hs
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/LibLD.hs
@@ -0,0 +1,96 @@
+-------------------------------------------------------------------------------
+-- |
+-- Module      :  Network.CURL000.LibLD
+-- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis
+-- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
+-- 
+-- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-------------------------------------------------------------------------------
+
+module Network.CURL000.LibLD
+  ( RTLD(..), LIBCURL(..)
+  ) where
+
+import Network.CURL000.LibCC (curlADRTAB, curlSYMTAB, curlTABLEN)
+import Network.CURL000.LibHS (curl_global_init, curl_global_cleanup)
+import Network.CURL000.LibHS (curl_version)
+
+import Text.ParserCombinators.ReadP (ReadP, readP_to_S, string)
+import Text.Read.Lex (readDecP)
+
+import Control.Concurrent (MVar, newMVar)
+import System.IO.Unsafe (unsafePerformIO)
+
+import System.Info (os)
+import System.RTLD
+
+
+-------------------------------------------------------------------------------
+data LIBCURL = CURL720 | CURL730
+  deriving (Eq, Ord, Enum, Bounded)
+
+instance RTLD LIBCURL where
+  loadlib x = rtload curlRTSO x
+  freelib _ = rtfree curlRTSO
+
+
+-------------------------------------------------------------------------------
+curlGlobalState :: MVar (Maybe (LIBCURL, LIBH, Int))
+curlGlobalState = unsafePerformIO (newMVar Nothing)
+{-# NOINLINE curlGlobalState #-}
+
+curlRTSO :: RTSO LIBCURL
+curlRTSO = RTSO
+  { rtPKGMVAR = curlGlobalState
+  , rtPKGNAME = "<curlhs>"
+  , rtLIBNAME = libname
+  , rtSONAMES = sonames
+  , rtONLOAD  = const curl_global_init
+  , rtONFREE  = const curl_global_cleanup
+  , rtGETAPI  = const (fmap readapi curl_version)
+  , rtSYMTAB  = curlSYMTAB
+  , rtADRTAB  = curlADRTAB
+  , rtTABLEN  = curlTABLEN
+  }
+
+
+-------------------------------------------------------------------------------
+libname :: LIBCURL -> String
+libname CURL720 = "libcurl/7.20"
+libname CURL730 = "libcurl/7.30"
+
+readapi :: String -> Maybe LIBCURL
+readapi xs = parse >>= check
+  where
+  readP = readP_to_S (string "libcurl/7." >> (readDecP :: ReadP Int))
+  parse = case (readP xs) of [(v,_)] -> Just v; _ -> Nothing
+  check v
+    | v>=20 && v<30 = Just CURL720
+    | v>=30         = Just CURL730
+    | otherwise     = Nothing
+
+
+-------------------------------------------------------------------------------
+sonames :: LIBCURL -> [String]
+sonames
+  | os == "mingw32" = winsonames
+  | os == "darwin"  = osxsonames
+  | os == "linux"   = gnusonames
+  | os == "freebsd" = bsdsonames
+  | otherwise = const []
+
+winsonames :: LIBCURL -> [String]
+winsonames _ = ["libcurl.dll"]
+
+osxsonames :: LIBCURL -> [String]
+osxsonames _ = ["libcurl.dylib"]
+
+gnusonames :: LIBCURL -> [String]
+gnusonames _ = ["libcurl.so.4", "libcurl.so"]
+
+bsdsonames :: LIBCURL -> [String]
+bsdsonames _ = ["libcurl.so"]
+
diff --git a/Network/CURL000/Types.hsc b/Network/CURL000/Types.hsc
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/Types.hsc
@@ -0,0 +1,879 @@
+-------------------------------------------------------------------------------
+-- |
+-- Module      :  Network.CURL000.Types
+-- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis
+-- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
+-- 
+-- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-------------------------------------------------------------------------------
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE EmptyDataDecls     #-}
+{-# LANGUAGE GADTs              #-}
+
+module Network.CURL000.Types where
+
+import qualified Network.CURL000.LibCC as C
+
+import Control.Exception  (Exception)
+import Control.Concurrent (MVar)
+
+import Data.Time.Clock (UTCTime)
+import Data.ByteString (ByteString)
+import Data.Typeable   (Typeable, typeOf)
+import Data.Maybe      (mapMaybe)
+import Data.List       (foldl')
+import Data.Bits       ((.|.), (.&.))
+import Data.Int        (Int64)
+import Data.Unique     (Unique, hashUnique)
+import Data.IORef      (IORef)
+
+import Foreign.C.Types
+import Foreign.Ptr
+
+#include "LibC0.c"
+
+
+-------------------------------------------------------------------------------
+class ENUM a where
+  toENUM :: a -> Int
+  enumlist :: [a]
+
+instance ENUM a => ENUM [a] where
+  toENUM = foldl' (.|.) 0 . map toENUM
+  enumlist = []
+
+toCInt :: ENUM a => a -> CInt
+toCInt = fromIntegral . toENUM
+
+toCLong :: ENUM a => a -> CLong
+toCLong = fromIntegral . toENUM
+
+fromCIntMask :: ENUM a => CInt -> [a]
+fromCIntMask mask =
+  let checkBit x = if ((mask .&. (toCInt x)) == 0) then Nothing else Just x
+  in  mapMaybe checkBit enumlist
+
+fromCLongMask :: ENUM a => CLong -> [a]
+fromCLongMask mask =
+  let checkBit x = if ((mask .&. (toCLong x)) == 0) then Nothing else Just x
+  in  mapMaybe checkBit enumlist
+
+fromCInt :: (ENUM a, Typeable a) => CInt -> a
+fromCInt cval =
+  let enums = map (\enum -> (toCInt enum, enum)) enumlist
+      enumE = error $ concat ["<curlhs> unknown constant (", v, ") -> ", t]
+      (v,t) = (show cval, show $ typeOf $ snd $ head enums)
+  in  maybe enumE id $ lookup cval enums
+
+
+
+{-
+-------------------------------------------------------------------------------
+deriving instance Typeable CURLMcode
+deriving instance Show CURLMcode
+instance Exception CURLMcode
+
+#{ENUM CURLMcode           \
+, CURLM_CALL_MULTI_PERFORM \
+, CURLM_BAD_HANDLE         \
+, CURLM_BAD_EASY_HANDLE    \
+, CURLM_OUT_OF_MEMORY      \
+, CURLM_INTERNAL_ERROR     \
+, CURLM_BAD_SOCKET         \
+, CURLM_UNKNOWN_OPTION     }
+-}
+
+
+-------------------------------------------------------------------------------
+deriving instance Show CURLfeature
+
+#{ENUM CURLfeature          \
+, CURL_VERSION_IPV6         \
+, CURL_VERSION_KERBEROS4    \
+, CURL_VERSION_SSL          \
+, CURL_VERSION_LIBZ         \
+, CURL_VERSION_NTLM         \
+, CURL_VERSION_GSSNEGOTIATE \
+, CURL_VERSION_DEBUG        \
+, CURL_VERSION_CURLDEBUG    \
+, CURL_VERSION_ASYNCHDNS    \
+, CURL_VERSION_SPNEGO       \
+, CURL_VERSION_LARGEFILE    \
+, CURL_VERSION_IDN          \
+, CURL_VERSION_SSPI         \
+, CURL_VERSION_CONV         \
+, CURL_VERSION_TLSAUTH_SRP  \
+, CURL_VERSION_NTLM_WB      }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLproto   \
+, CURLPROTO_ALL    \
+, CURLPROTO_HTTP   \
+, CURLPROTO_HTTPS  \
+, CURLPROTO_FTP    \
+, CURLPROTO_FTPS   \
+, CURLPROTO_SCP    \
+, CURLPROTO_SFTP   \
+, CURLPROTO_TELNET \
+, CURLPROTO_LDAP   \
+, CURLPROTO_LDAPS  \
+, CURLPROTO_DICT   \
+, CURLPROTO_FILE   \
+, CURLPROTO_TFTP   \
+, CURLPROTO_IMAP   \
+, CURLPROTO_IMAPS  \
+, CURLPROTO_POP3   \
+, CURLPROTO_POP3S  \
+, CURLPROTO_SMTP   \
+, CURLPROTO_SMTPS  \
+, CURLPROTO_RTSP   \
+, CURLPROTO_RTMP   \
+, CURLPROTO_RTMPT  \
+, CURLPROTO_RTMPE  \
+, CURLPROTO_RTMPTE \
+, CURLPROTO_RTMPS  \
+, CURLPROTO_RTMPTS \
+, CURLPROTO_GOPHER }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLproxy            \
+, CURLPROXY_HTTP            \
+, CURLPROXY_HTTP_1_0        \
+, CURLPROXY_SOCKS4          \
+, CURLPROXY_SOCKS5          \
+, CURLPROXY_SOCKS4A         \
+, CURLPROXY_SOCKS5_HOSTNAME }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLnetrc      \
+, CURL_NETRC_IGNORED  \
+, CURL_NETRC_OPTIONAL \
+, CURL_NETRC_REQUIRED }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLauth         \
+, CURLAUTH_BASIC        \
+, CURLAUTH_DIGEST       \
+, CURLAUTH_DIGEST_IE    \
+, CURLAUTH_GSSNEGOTIATE \
+, CURLAUTH_NTLM         \
+, CURLAUTH_NTLM_WB      \
+, CURLAUTH_ONLY         \
+, CURLAUTH_ANY          \
+, CURLAUTH_ANYSAFE      }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLtlsauth \
+, CURL_TLSAUTH_SRP }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLredir      \
+, CURL_REDIR_GET_ALL  \
+, CURL_REDIR_POST_301 \
+, CURL_REDIR_POST_302 \
+, CURL_REDIR_POST_303 \
+, CURL_REDIR_POST_ALL }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLhttpver       \
+, CURL_HTTP_VERSION_NONE \
+, CURL_HTTP_VERSION_1_0  \
+, CURL_HTTP_VERSION_1_1  }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLftpcreate       \
+, CURLFTP_CREATE_DIR_NONE  \
+, CURLFTP_CREATE_DIR       \
+, CURLFTP_CREATE_DIR_RETRY }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLftpauth    \
+, CURLFTPAUTH_DEFAULT \
+, CURLFTPAUTH_SSL     \
+, CURLFTPAUTH_TLS     }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLftpssl        \
+, CURLFTPSSL_CCC_NONE    \
+, CURLFTPSSL_CCC_PASSIVE \
+, CURLFTPSSL_CCC_ACTIVE  }
+ 
+
+-------------------------------------------------------------------------------
+#{ENUM CURLftpmethod      \
+, CURLFTPMETHOD_DEFAULT   \
+, CURLFTPMETHOD_MULTICWD  \
+, CURLFTPMETHOD_NOCWD     \
+, CURLFTPMETHOD_SINGLECWD }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLrtspreq           \
+, CURL_RTSPREQ_OPTIONS       \
+, CURL_RTSPREQ_DESCRIBE      \
+, CURL_RTSPREQ_ANNOUNCE      \
+, CURL_RTSPREQ_SETUP         \
+, CURL_RTSPREQ_PLAY          \
+, CURL_RTSPREQ_PAUSE         \
+, CURL_RTSPREQ_TEARDOWN      \
+, CURL_RTSPREQ_GET_PARAMETER \
+, CURL_RTSPREQ_SET_PARAMETER \
+, CURL_RTSPREQ_RECORD        \
+, CURL_RTSPREQ_RECEIVE       }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLtimecond          \
+, CURL_TIMECOND_NONE         \
+, CURL_TIMECOND_IFMODSINCE   \
+, CURL_TIMECOND_IFUNMODSINCE \
+, CURL_TIMECOND_LASTMOD      }
+
+
+{-
+-------------------------------------------------------------------------------
+#{ENUM CURLclosepol                   \
+, CURLCLOSEPOLICY_NONE                \
+, CURLCLOSEPOLICY_OLDEST              \
+, CURLCLOSEPOLICY_LEAST_RECENTLY_USED \
+, CURLCLOSEPOLICY_LEAST_TRAFFIC       \
+, CURLCLOSEPOLICY_SLOWEST             \
+, CURLCLOSEPOLICY_CALLBACK            }
+-}
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLipresolve      \
+, CURL_IPRESOLVE_WHATEVER \
+, CURL_IPRESOLVE_V4       \
+, CURL_IPRESOLVE_V6       }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLusessl    \
+, CURLUSESSL_NONE    \
+, CURLUSESSL_TRY     \
+, CURLUSESSL_CONTROL \
+, CURLUSESSL_ALL     }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLsslver         \
+, CURL_SSLVERSION_DEFAULT \
+, CURL_SSLVERSION_TLSv1   \
+, CURL_SSLVERSION_SSLv2   \
+, CURL_SSLVERSION_SSLv3   }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLsslopt        \
+, CURLSSLOPT_ALLOW_BEAST }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLgssapi                   \
+, CURLGSSAPI_DELEGATION_NONE        \
+, CURLGSSAPI_DELEGATION_POLICY_FLAG \
+, CURLGSSAPI_DELEGATION_FLAG        }
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLsshauth       \
+, CURLSSH_AUTH_ANY       \
+, CURLSSH_AUTH_NONE      \
+, CURLSSH_AUTH_PUBLICKEY \
+, CURLSSH_AUTH_PASSWORD  \
+, CURLSSH_AUTH_HOST      \
+, CURLSSH_AUTH_KEYBOARD  \
+, CURLSSH_AUTH_AGENT     \
+, CURLSSH_AUTH_DEFAULT   }
+
+
+-------------------------------------------------------------------------------
+data CURLSH = CURLSH Unique (MVar ((Ptr C.CURLSH),(FunPtr ()),(FunPtr ())))
+
+instance Show CURLSH where
+  showsPrec p (CURLSH u _) = showString "CURLSH#" . showsPrec p (hashUnique u)
+
+instance Eq CURLSH where
+  (CURLSH u1 _) == (CURLSH u2 _) = u1 == u2
+
+
+-------------------------------------------------------------------------------
+data CURLSHE = CURLSHE CURLSH String String CURLSHC
+  deriving (Eq, Typeable)
+
+instance Exception CURLSHE
+
+instance Show CURLSHE where
+  showsPrec p (CURLSHE curlsh func desc code) =
+    showsPrec p code . showString " (" . showString func . showString " "
+    . showsPrec p curlsh . showString ") " . showString desc
+
+
+-------------------------------------------------------------------------------
+data CURLSHC
+  = CURLSHE_FAILED_INIT
+  | CURLSHE_BAD_OPTION
+  | CURLSHE_IN_USE
+  | CURLSHE_INVALID
+  | CURLSHE_NOMEM
+  | CURLSHE_NOT_BUILT_IN
+  | CURLSHE_UNKNOWN_ERROR
+  deriving (Show, Eq)
+
+toCURLSHC :: CInt -> CURLSHC
+toCURLSHC x = case x of
+  #{const CURLSHE_BAD_OPTION  } -> CURLSHE_BAD_OPTION
+  #{const CURLSHE_IN_USE      } -> CURLSHE_IN_USE
+  #{const CURLSHE_INVALID     } -> CURLSHE_INVALID
+  #{const CURLSHE_NOMEM       } -> CURLSHE_NOMEM
+  #{const CURLSHE_NOT_BUILT_IN} -> CURLSHE_NOT_BUILT_IN
+  _                             -> CURLSHE_UNKNOWN_ERROR
+
+
+-------------------------------------------------------------------------------
+data CURLSHoption
+  = CURLSHOPT_SHARE   CURLSHlockdata
+  | CURLSHOPT_UNSHARE CURLSHlockdata
+
+
+-------------------------------------------------------------------------------
+#{ENUM CURLSHlockdata        \
+, CURL_LOCK_DATA_COOKIE      \
+, CURL_LOCK_DATA_DNS         \
+, CURL_LOCK_DATA_SSL_SESSION }
+
+
+-------------------------------------------------------------------------------
+data CURL_version_info = CURL_version_info
+  { curl_version_info_version         :: String
+  , curl_version_info_version_num     :: Int
+  , curl_version_info_host            :: String
+  , curl_version_info_features        :: [CURLfeature]
+  , curl_version_info_ssl_version     :: String
+  , curl_version_info_ssl_version_num :: Int
+  , curl_version_info_libz_version    :: String
+  , curl_version_info_protocols       :: [String]
+  , curl_version_info_ares            :: String
+  , curl_version_info_ares_num        :: Int
+  , curl_version_info_libidn          :: String
+  , curl_version_info_iconv_ver_num   :: Int
+  , curl_version_info_libssh_version  :: String
+  } deriving (Show)
+
+
+-------------------------------------------------------------------------------
+data CURLinfo a where
+  CURLINFO_EFFECTIVE_URL           :: CURLinfo String     -- Ptr CChar
+  CURLINFO_RESPONSE_CODE           :: CURLinfo CLong      -- CLong
+  CURLINFO_HTTP_CONNECTCODE        :: CURLinfo CLong      -- CLong
+  CURLINFO_FILETIME                :: CURLinfo (Maybe UTCTime) -- CLong
+  CURLINFO_TOTAL_TIME              :: CURLinfo Double     -- CDouble
+  CURLINFO_NAMELOOKUP_TIME         :: CURLinfo Double     -- CDouble
+  CURLINFO_CONNECT_TIME            :: CURLinfo Double     -- CDouble
+  CURLINFO_APPCONNECT_TIME         :: CURLinfo Double     -- CDouble
+  CURLINFO_PRETRANSFER_TIME        :: CURLinfo Double     -- CDouble
+  CURLINFO_STARTTRANSFER_TIME      :: CURLinfo Double     -- CDouble
+  CURLINFO_REDIRECT_TIME           :: CURLinfo Double     -- CDouble
+  CURLINFO_REDIRECT_COUNT          :: CURLinfo CLong      -- CLong
+  CURLINFO_REDIRECT_URL            :: CURLinfo String     -- Ptr CChar
+  CURLINFO_SIZE_UPLOAD             :: CURLinfo Double     -- CDouble
+  CURLINFO_SIZE_DOWNLOAD           :: CURLinfo Double     -- CDouble
+  CURLINFO_SPEED_DOWNLOAD          :: CURLinfo Double     -- CDouble
+  CURLINFO_SPEED_UPLOAD            :: CURLinfo Double     -- CDouble
+  CURLINFO_HEADER_SIZE             :: CURLinfo CLong      -- CLong
+  CURLINFO_REQUEST_SIZE            :: CURLinfo CLong      -- CLong
+  CURLINFO_SSL_VERIFYRESULT        :: CURLinfo CLong      -- CLong
+  CURLINFO_SSL_ENGINES             :: CURLinfo [String]   -- Ptr CURLslist
+  CURLINFO_CONTENT_LENGTH_DOWNLOAD :: CURLinfo Double     -- CDouble
+  CURLINFO_CONTENT_LENGTH_UPLOAD   :: CURLinfo Double     -- CDouble
+  CURLINFO_CONTENT_TYPE            :: CURLinfo String     -- Ptr CChar
+  -- CURLINFO_PRIVATE
+  CURLINFO_HTTPAUTH_AVAIL          :: CURLinfo [CURLauth] -- CLong
+  CURLINFO_PROXYAUTH_AVAIL         :: CURLinfo [CURLauth] -- CLong
+  CURLINFO_OS_ERRNO                :: CURLinfo CLong      -- CLong
+  CURLINFO_NUM_CONNECTS            :: CURLinfo CLong      -- CLong
+  CURLINFO_PRIMARY_IP              :: CURLinfo String     -- Ptr CChar
+  CURLINFO_PRIMARY_PORT            :: CURLinfo CLong      -- CLong
+  CURLINFO_LOCAL_IP                :: CURLinfo String     -- Ptr CChar
+  CURLINFO_LOCAL_PORT              :: CURLinfo CLong      -- CLong
+  CURLINFO_COOKIELIST              :: CURLinfo [String]   -- Ptr CURLslist
+  CURLINFO_LASTSOCKET              :: CURLinfo CLong      -- CLong
+  CURLINFO_FTP_ENTRY_PATH          :: CURLinfo String     -- Ptr CChar
+  CURLINFO_CERTINFO                :: CURLinfo [[String]] -- Ptr CURLcertinfo
+  CURLINFO_CONDITION_UNMET         :: CURLinfo Bool       -- CLong
+  CURLINFO_RTSP_SESSION_ID         :: CURLinfo String     -- Ptr CChar
+  CURLINFO_RTSP_CLIENT_CSEQ        :: CURLinfo CLong      -- CLong
+  CURLINFO_RTSP_SERVER_CSEQ        :: CURLinfo CLong      -- CLong
+  CURLINFO_RTSP_CSEQ_RECV          :: CURLinfo CLong      -- CLong
+
+
+-------------------------------------------------------------------------------
+data CURLoption
+  ---- BEHAVIOR OPTIONS -------------------------------------------------------
+  = CURLOPT_VERBOSE                 Bool
+  | CURLOPT_HEADER                  Bool
+  | CURLOPT_NOPROGRESS              Bool
+  | CURLOPT_NOSIGNAL                Bool
+  | CURLOPT_WILDCARDMATCH           Bool
+
+  ---- CALLBACK OPTIONS -------------------------------------------------------
+  | CURLOPT_WRITEFUNCTION           (Maybe CURL_write_callback)
+ -- CURLOPT_WRITEDATA
+  | CURLOPT_READFUNCTION            (Maybe CURL_read_callback)
+ -- CURLOPT_READDATA
+ -- CURLOPT_IOCTLFUNCTION
+ -- CURLOPT_IOCTLDATA
+ -- CURLOPT_SEEKFUNCTION
+ -- CURLOPT_SEEKDATA
+ -- CURLOPT_SOCKOPTFUNCTION
+ -- CURLOPT_SOCKOPTDATA
+ -- CURLOPT_OPENSOCKETFUNCTION
+ -- CURLOPT_OPENSOCKETDATA
+ -- CURLOPT_CLOSESOCKETFUNCTION
+ -- CURLOPT_CLOSESOCKETDATA
+ -- CURLOPT_PROGRESSFUNCTION
+ -- CURLOPT_PROGRESSDATA
+ -- CURLOPT_HEADERFUNCTION
+ -- CURLOPT_HEADERDATA
+ -- CURLOPT_DEBUGFUNCTION
+ -- CURLOPT_DEBUGDATA
+ -- CURLOPT_SSL_CTX_FUNCTION
+ -- CURLOPT_SSL_CTX_DATA
+ -- CURLOPT_CONV_TO_NETWORK_FUNCTION
+ -- CURLOPT_CONV_FROM_NETWORK_FUNCTION
+ -- CURLOPT_CONV_FROM_UTF8_FUNCTION
+ -- CURLOPT_INTERLEAVEFUNCTION
+ -- CURLOPT_INTERLEAVEDATA
+ -- CURLOPT_CHUNK_BGN_FUNCTION
+ -- CURLOPT_CHUNK_END_FUNCTION
+ -- CURLOPT_CHUNK_DATA
+ -- CURLOPT_FNMATCH_FUNCTION
+ -- CURLOPT_FNMATCH_DATA
+
+  ---- ERROR OPTIONS ----------------------------------------------------------
+ -- CURLOPT_ERRORBUFFER             ?
+ -- CURLOPT_STDERR                  ?
+  | CURLOPT_FAILONERROR             Bool
+
+  ---- NETWORK OPTIONS --------------------------------------------------------
+  | CURLOPT_URL                     String
+  | CURLOPT_PROTOCOLS               [CURLproto]
+  | CURLOPT_REDIR_PROTOCOLS         [CURLproto]
+  | CURLOPT_PROXY                   String
+  | CURLOPT_PROXYPORT               CLong
+  | CURLOPT_PROXYTYPE               CURLproxy
+  | CURLOPT_NOPROXY                 String -- or better [String]
+  | CURLOPT_HTTPPROXYTUNNEL         Bool
+  | CURLOPT_SOCKS5_GSSAPI_SERVICE   String
+  | CURLOPT_SOCKS5_GSSAPI_NEC       Bool
+  | CURLOPT_INTERFACE               String
+  | CURLOPT_LOCALPORT               CLong
+  | CURLOPT_LOCALPORTRANGE          CLong
+  | CURLOPT_DNS_CACHE_TIMEOUT       CLong
+ -- CURLOPT_DNS_USE_GLOBAL_CACHE    Bool
+  | CURLOPT_BUFFERSIZE              CLong
+  | CURLOPT_PORT                    CLong
+  | CURLOPT_TCP_NODELAY             Bool
+  | CURLOPT_ADDRESS_SCOPE           CLong
+  | CURLOPT_TCP_KEEPALIVE           Bool
+  | CURLOPT_TCP_KEEPIDLE            CLong
+  | CURLOPT_TCP_KEEPINTVL           CLong
+
+  ---- NAMES and PASSWORDS OPTIONS (Authentication) ---------------------------
+  | CURLOPT_NETRC                   CURLnetrc
+  | CURLOPT_NETRC_FILE              FilePath
+  | CURLOPT_USERPWD                 String
+  | CURLOPT_PROXYUSERPWD            String
+  | CURLOPT_USERNAME                String
+  | CURLOPT_PASSWORD                String
+  | CURLOPT_PROXYUSERNAME           String
+  | CURLOPT_PROXYPASSWORD           String
+  | CURLOPT_HTTPAUTH                [CURLauth]
+  | CURLOPT_TLSAUTH_TYPE            String -- should be [CURLtlsauth]
+  | CURLOPT_TLSAUTH_USERNAME        String
+  | CURLOPT_TLSAUTH_PASSWORD        String
+  | CURLOPT_PROXYAUTH               [CURLauth]
+
+  ---- HTTP OPTIONS -----------------------------------------------------------
+  | CURLOPT_AUTOREFERER             Bool
+  | CURLOPT_ACCEPT_ENCODING         String
+  | CURLOPT_TRANSFER_ENCODING       Bool
+  | CURLOPT_FOLLOWLOCATION          Bool
+  | CURLOPT_UNRESTRICTED_AUTH       Bool
+  | CURLOPT_MAXREDIRS               CLong
+  | CURLOPT_POSTREDIR               [CURLredir]
+  | CURLOPT_PUT                     Bool
+  | CURLOPT_POST                    Bool
+ -- CURLOPT_POSTFIELDS              String -- not copied
+  | CURLOPT_POSTFIELDSIZE           CLong
+  | CURLOPT_POSTFIELDSIZE_LARGE     Int64
+  | CURLOPT_COPYPOSTFIELDS          String
+ -- CURLOPT_HTTPPOST                [CURL_httppost]
+  | CURLOPT_REFERER                 String
+  | CURLOPT_USERAGENT               String
+  | CURLOPT_HTTPHEADER              [String]
+  | CURLOPT_HTTP200ALIASES          [String]
+  | CURLOPT_COOKIE                  String -- or better [String]
+  | CURLOPT_COOKIEFILE              FilePath
+  | CURLOPT_COOKIEJAR               FilePath
+  | CURLOPT_COOKIESESSION           Bool
+  | CURLOPT_COOKIELIST              String
+  | CURLOPT_HTTPGET                 Bool
+  | CURLOPT_HTTP_VERSION            CURLhttpver
+  | CURLOPT_IGNORE_CONTENT_LENGTH   Bool
+  | CURLOPT_HTTP_CONTENT_DECODING   Bool
+  | CURLOPT_HTTP_TRANSFER_DECODING  Bool
+
+  ---- SMTP OPTIONS -----------------------------------------------------------
+  | CURLOPT_MAIL_FROM               String
+  | CURLOPT_MAIL_RCPT               [String]
+  | CURLOPT_MAIL_AUTH               String
+
+  ---- TFTP OPTIONS -----------------------------------------------------------
+  | CURLOPT_TFTP_BLKSIZE            CLong
+
+  ---- FTP OPTIONS ------------------------------------------------------------
+  | CURLOPT_FTPPORT                 String
+  | CURLOPT_QUOTE                   [String]
+  | CURLOPT_POSTQUOTE               [String]
+  | CURLOPT_PREQUOTE                [String]
+  | CURLOPT_DIRLISTONLY             Bool
+  | CURLOPT_APPEND                  Bool
+  | CURLOPT_FTP_USE_EPRT            Bool
+  | CURLOPT_FTP_USE_EPSV            Bool
+  | CURLOPT_FTP_USE_PRET            Bool
+  | CURLOPT_FTP_CREATE_MISSING_DIRS CURLftpcreate
+  | CURLOPT_FTP_RESPONSE_TIMEOUT    CLong
+  | CURLOPT_FTP_ALTERNATIVE_TO_USER String
+  | CURLOPT_FTP_SKIP_PASV_IP        Bool
+  | CURLOPT_FTPSSLAUTH              CURLftpauth
+  | CURLOPT_FTP_SSL_CCC             CURLftpssl
+  | CURLOPT_FTP_ACCOUNT             String
+  | CURLOPT_FTP_FILEMETHOD          CURLftpmethod
+
+  ---- RTSP OPTIONS -----------------------------------------------------------
+  | CURLOPT_RTSP_REQUEST            CURLrtspreq
+  | CURLOPT_RTSP_SESSION_ID         String
+  | CURLOPT_RTSP_STREAM_URI         String
+  | CURLOPT_RTSP_TRANSPORT          String
+  | CURLOPT_RTSP_HEADER             [String]
+  | CURLOPT_RTSP_CLIENT_CSEQ        CLong
+  | CURLOPT_RTSP_SERVER_CSEQ        CLong
+
+  ---- PROTOCOL OPTIONS -------------------------------------------------------
+  | CURLOPT_TRANSFERTEXT            Bool
+  | CURLOPT_PROXY_TRANSFER_MODE     Bool
+  | CURLOPT_CRLF                    Bool
+  | CURLOPT_RANGE                   String
+  | CURLOPT_RESUME_FROM             CLong
+  | CURLOPT_RESUME_FROM_LARGE       Int64
+  | CURLOPT_CUSTOMREQUEST           String
+  | CURLOPT_FILETIME                Bool
+  | CURLOPT_NOBODY                  Bool
+  | CURLOPT_INFILESIZE              CLong
+  | CURLOPT_INFILESIZE_LARGE        Int64
+  | CURLOPT_UPLOAD                  Bool
+  | CURLOPT_MAXFILESIZE             CLong
+  | CURLOPT_MAXFILESIZE_LARGE       Int64
+  | CURLOPT_TIMECONDITION           CURLtimecond
+  | CURLOPT_TIMEVALUE               UTCTime
+
+  ---- CONNECTION OPTIONS -----------------------------------------------------
+  | CURLOPT_TIMEOUT                 CLong
+  | CURLOPT_TIMEOUT_MS              CLong
+  | CURLOPT_LOW_SPEED_LIMIT         CLong
+  | CURLOPT_LOW_SPEED_TIME          CLong
+  | CURLOPT_MAX_SEND_SPEED_LARGE    Int64
+  | CURLOPT_MAX_RECV_SPEED_LARGE    Int64
+  | CURLOPT_MAXCONNECTS             CLong
+ -- CURLOPT_CLOSEPOLICY             CURLclosepol
+  | CURLOPT_FRESH_CONNECT           Bool
+  | CURLOPT_FORBID_REUSE            Bool
+  | CURLOPT_CONNECTTIMEOUT          CLong
+  | CURLOPT_CONNECTTIMEOUT_MS       CLong
+  | CURLOPT_IPRESOLVE               CURLipresolve
+  | CURLOPT_CONNECT_ONLY            Bool
+  | CURLOPT_USE_SSL                 CURLusessl
+  | CURLOPT_RESOLVE                 [String]
+  | CURLOPT_DNS_SERVERS             String -- or better [String]
+  | CURLOPT_ACCEPTTIMEOUT_MS        CLong
+
+  ---- SSL and SECURITY OPTIONS -----------------------------------------------
+  | CURLOPT_SSLCERT                 FilePath
+  | CURLOPT_SSLCERTTYPE             String
+  | CURLOPT_SSLKEY                  FilePath
+  | CURLOPT_SSLKEYTYPE              String
+  | CURLOPT_KEYPASSWD               String
+  | CURLOPT_SSLENGINE               String
+  | CURLOPT_SSLENGINE_DEFAULT       Bool
+  | CURLOPT_SSLVERSION              CURLsslver
+  | CURLOPT_SSL_VERIFYPEER          Bool
+  | CURLOPT_CAINFO                  FilePath
+  | CURLOPT_ISSUERCERT              FilePath
+  | CURLOPT_CAPATH                  FilePath
+  | CURLOPT_CRLFILE                 FilePath
+  | CURLOPT_SSL_VERIFYHOST          CLong
+  | CURLOPT_CERTINFO                Bool
+  | CURLOPT_RANDOM_FILE             FilePath
+  | CURLOPT_EGDSOCKET               String
+  | CURLOPT_SSL_CIPHER_LIST         String -- or better [String]
+  | CURLOPT_SSL_SESSIONID_CACHE     Bool
+  | CURLOPT_SSL_OPTIONS             [CURLsslopt]
+  | CURLOPT_KRBLEVEL                String
+  | CURLOPT_GSSAPI_DELEGATION       CURLgssapi
+
+  ---- SSH OPTIONS ------------------------------------------------------------
+  | CURLOPT_SSH_AUTH_TYPES          [CURLsshauth]
+  | CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 String
+  | CURLOPT_SSH_PUBLIC_KEYFILE      FilePath
+  | CURLOPT_SSH_PRIVATE_KEYFILE     FilePath
+  | CURLOPT_SSH_KNOWNHOSTS          FilePath
+ -- CURLOPT_SSH_KEYFUNCTION         (Maybe CURL_sshkey_callback)
+ -- CURLOPT_SSH_KEYDATA             -- ?
+
+  ---- OTHER OPTIONS ----------------------------------------------------------
+ -- CURLOPT_PRIVATE                 -- ?
+  | CURLOPT_SHARE                   (Maybe CURLSH)
+  | CURLOPT_NEW_FILE_PERMS          CLong
+  | CURLOPT_NEW_DIRECTORY_PERMS     CLong
+
+  ---- TELNET OPTIONS ---------------------------------------------------------
+  | CURLOPT_TELNETOPTIONS           [String]
+
+
+-------------------------------------------------------------------------------
+type CURL_write_callback = ByteString -> IO CURL_write_response
+
+data CURL_write_response
+  = CURL_WRITEFUNC_OK
+  | CURL_WRITEFUNC_FAIL
+  | CURL_WRITEFUNC_PAUSE
+  deriving (Eq)
+
+
+type CURL_read_callback = Int -> IO CURL_read_response
+
+data CURL_read_response
+  = CURL_READFUNC_OK ByteString
+  | CURL_READFUNC_ABORT
+  | CURL_READFUNC_PAUSE
+  deriving (Eq)
+
+
+
+-------------------------------------------------------------------------------
+data CURLC
+  = CURLE_UNSUPPORTED_PROTOCOL
+  | CURLE_FAILED_INIT
+  | CURLE_URL_MALFORMAT
+  | CURLE_NOT_BUILT_IN
+  | CURLE_COULDNT_RESOLVE_PROXY
+  | CURLE_COULDNT_RESOLVE_HOST
+  | CURLE_COULDNT_CONNECT
+  | CURLE_FTP_WEIRD_SERVER_REPLY
+  | CURLE_REMOTE_ACCESS_DENIED
+  | CURLE_FTP_ACCEPT_FAILED
+  | CURLE_FTP_WEIRD_PASS_REPLY
+  | CURLE_FTP_ACCEPT_TIMEOUT
+  | CURLE_FTP_WEIRD_PASV_REPLY
+  | CURLE_FTP_WEIRD_227_FORMAT
+  | CURLE_FTP_CANT_GET_HOST
+  | CURLE_FTP_COULDNT_SET_TYPE
+  | CURLE_PARTIAL_FILE
+  | CURLE_FTP_COULDNT_RETR_FILE
+  | CURLE_QUOTE_ERROR
+  | CURLE_HTTP_RETURNED_ERROR
+  | CURLE_WRITE_ERROR
+  | CURLE_UPLOAD_FAILED
+  | CURLE_READ_ERROR
+  | CURLE_OUT_OF_MEMORY
+  | CURLE_OPERATION_TIMEDOUT
+  | CURLE_FTP_PORT_FAILED
+  | CURLE_FTP_COULDNT_USE_REST
+  | CURLE_RANGE_ERROR
+  | CURLE_HTTP_POST_ERROR
+  | CURLE_SSL_CONNECT_ERROR
+  | CURLE_BAD_DOWNLOAD_RESUME
+  | CURLE_FILE_COULDNT_READ_FILE
+  | CURLE_LDAP_CANNOT_BIND
+  | CURLE_LDAP_SEARCH_FAILED
+  | CURLE_FUNCTION_NOT_FOUND
+  | CURLE_ABORTED_BY_CALLBACK
+  | CURLE_BAD_FUNCTION_ARGUMENT
+  | CURLE_INTERFACE_FAILED
+  | CURLE_TOO_MANY_REDIRECTS
+  | CURLE_UNKNOWN_OPTION
+  | CURLE_TELNET_OPTION_SYNTAX
+  | CURLE_PEER_FAILED_VERIFICATION
+  | CURLE_GOT_NOTHING
+  | CURLE_SSL_ENGINE_NOTFOUND
+  | CURLE_SSL_ENGINE_SETFAILED
+  | CURLE_SEND_ERROR
+  | CURLE_RECV_ERROR
+  | CURLE_SSL_CERTPROBLEM
+  | CURLE_SSL_CIPHER
+  | CURLE_SSL_CACERT
+  | CURLE_BAD_CONTENT_ENCODING
+  | CURLE_LDAP_INVALID_URL
+  | CURLE_FILESIZE_EXCEEDED
+  | CURLE_USE_SSL_FAILED
+  | CURLE_SEND_FAIL_REWIND
+  | CURLE_SSL_ENGINE_INITFAILED
+  | CURLE_LOGIN_DENIED
+  | CURLE_TFTP_NOTFOUND
+  | CURLE_TFTP_PERM
+  | CURLE_REMOTE_DISK_FULL
+  | CURLE_TFTP_ILLEGAL
+  | CURLE_TFTP_UNKNOWNID
+  | CURLE_REMOTE_FILE_EXISTS
+  | CURLE_TFTP_NOSUCHUSER
+  | CURLE_CONV_FAILED
+  | CURLE_CONV_REQD
+  | CURLE_SSL_CACERT_BADFILE
+  | CURLE_REMOTE_FILE_NOT_FOUND
+  | CURLE_SSH
+  | CURLE_SSL_SHUTDOWN_FAILED
+  | CURLE_AGAIN
+  | CURLE_SSL_CRL_BADFILE
+  | CURLE_SSL_ISSUER_ERROR
+  | CURLE_FTP_PRET_FAILED
+  | CURLE_RTSP_CSEQ_ERROR
+  | CURLE_RTSP_SESSION_ERROR
+  | CURLE_FTP_BAD_FILE_LIST
+  | CURLE_CHUNK_FAILED
+  | CURLE_UNKNOWN_ERROR
+  deriving (Show, Eq)
+
+toCURLC :: CInt -> CURLC
+toCURLC x = case x of
+  #{const CURLE_UNSUPPORTED_PROTOCOL    } -> CURLE_UNSUPPORTED_PROTOCOL
+  #{const CURLE_FAILED_INIT             } -> CURLE_FAILED_INIT
+  #{const CURLE_URL_MALFORMAT           } -> CURLE_URL_MALFORMAT
+  #{const CURLE_NOT_BUILT_IN            } -> CURLE_NOT_BUILT_IN
+  #{const CURLE_COULDNT_RESOLVE_PROXY   } -> CURLE_COULDNT_RESOLVE_PROXY
+  #{const CURLE_COULDNT_RESOLVE_HOST    } -> CURLE_COULDNT_RESOLVE_HOST
+  #{const CURLE_COULDNT_CONNECT         } -> CURLE_COULDNT_CONNECT
+  #{const CURLE_FTP_WEIRD_SERVER_REPLY  } -> CURLE_FTP_WEIRD_SERVER_REPLY
+  #{const CURLE_REMOTE_ACCESS_DENIED    } -> CURLE_REMOTE_ACCESS_DENIED
+  #{const CURLE_FTP_ACCEPT_FAILED       } -> CURLE_FTP_ACCEPT_FAILED
+  #{const CURLE_FTP_WEIRD_PASS_REPLY    } -> CURLE_FTP_WEIRD_PASS_REPLY
+  #{const CURLE_FTP_ACCEPT_TIMEOUT      } -> CURLE_FTP_ACCEPT_TIMEOUT
+  #{const CURLE_FTP_WEIRD_PASV_REPLY    } -> CURLE_FTP_WEIRD_PASV_REPLY
+  #{const CURLE_FTP_WEIRD_227_FORMAT    } -> CURLE_FTP_WEIRD_227_FORMAT
+  #{const CURLE_FTP_CANT_GET_HOST       } -> CURLE_FTP_CANT_GET_HOST
+  #{const CURLE_FTP_COULDNT_SET_TYPE    } -> CURLE_FTP_COULDNT_SET_TYPE
+  #{const CURLE_PARTIAL_FILE            } -> CURLE_PARTIAL_FILE
+  #{const CURLE_FTP_COULDNT_RETR_FILE   } -> CURLE_FTP_COULDNT_RETR_FILE
+  #{const CURLE_QUOTE_ERROR             } -> CURLE_QUOTE_ERROR
+  #{const CURLE_HTTP_RETURNED_ERROR     } -> CURLE_HTTP_RETURNED_ERROR
+  #{const CURLE_WRITE_ERROR             } -> CURLE_WRITE_ERROR
+  #{const CURLE_UPLOAD_FAILED           } -> CURLE_UPLOAD_FAILED
+  #{const CURLE_READ_ERROR              } -> CURLE_READ_ERROR
+  #{const CURLE_OUT_OF_MEMORY           } -> CURLE_OUT_OF_MEMORY
+  #{const CURLE_OPERATION_TIMEDOUT      } -> CURLE_OPERATION_TIMEDOUT
+  #{const CURLE_FTP_PORT_FAILED         } -> CURLE_FTP_PORT_FAILED
+  #{const CURLE_FTP_COULDNT_USE_REST    } -> CURLE_FTP_COULDNT_USE_REST
+  #{const CURLE_RANGE_ERROR             } -> CURLE_RANGE_ERROR
+  #{const CURLE_HTTP_POST_ERROR         } -> CURLE_HTTP_POST_ERROR
+  #{const CURLE_SSL_CONNECT_ERROR       } -> CURLE_SSL_CONNECT_ERROR
+  #{const CURLE_BAD_DOWNLOAD_RESUME     } -> CURLE_BAD_DOWNLOAD_RESUME
+  #{const CURLE_FILE_COULDNT_READ_FILE  } -> CURLE_FILE_COULDNT_READ_FILE
+  #{const CURLE_LDAP_CANNOT_BIND        } -> CURLE_LDAP_CANNOT_BIND
+  #{const CURLE_LDAP_SEARCH_FAILED      } -> CURLE_LDAP_SEARCH_FAILED
+  #{const CURLE_FUNCTION_NOT_FOUND      } -> CURLE_FUNCTION_NOT_FOUND
+  #{const CURLE_ABORTED_BY_CALLBACK     } -> CURLE_ABORTED_BY_CALLBACK
+  #{const CURLE_BAD_FUNCTION_ARGUMENT   } -> CURLE_BAD_FUNCTION_ARGUMENT
+  #{const CURLE_INTERFACE_FAILED        } -> CURLE_INTERFACE_FAILED
+  #{const CURLE_TOO_MANY_REDIRECTS      } -> CURLE_TOO_MANY_REDIRECTS
+  #{const CURLE_UNKNOWN_OPTION          } -> CURLE_UNKNOWN_OPTION
+  #{const CURLE_TELNET_OPTION_SYNTAX    } -> CURLE_TELNET_OPTION_SYNTAX
+  #{const CURLE_PEER_FAILED_VERIFICATION} -> CURLE_PEER_FAILED_VERIFICATION
+  #{const CURLE_GOT_NOTHING             } -> CURLE_GOT_NOTHING
+  #{const CURLE_SSL_ENGINE_NOTFOUND     } -> CURLE_SSL_ENGINE_NOTFOUND
+  #{const CURLE_SSL_ENGINE_SETFAILED    } -> CURLE_SSL_ENGINE_SETFAILED
+  #{const CURLE_SEND_ERROR              } -> CURLE_SEND_ERROR
+  #{const CURLE_RECV_ERROR              } -> CURLE_RECV_ERROR
+  #{const CURLE_SSL_CERTPROBLEM         } -> CURLE_SSL_CERTPROBLEM
+  #{const CURLE_SSL_CIPHER              } -> CURLE_SSL_CIPHER
+  #{const CURLE_SSL_CACERT              } -> CURLE_SSL_CACERT
+  #{const CURLE_BAD_CONTENT_ENCODING    } -> CURLE_BAD_CONTENT_ENCODING
+  #{const CURLE_LDAP_INVALID_URL        } -> CURLE_LDAP_INVALID_URL
+  #{const CURLE_FILESIZE_EXCEEDED       } -> CURLE_FILESIZE_EXCEEDED
+  #{const CURLE_USE_SSL_FAILED          } -> CURLE_USE_SSL_FAILED
+  #{const CURLE_SEND_FAIL_REWIND        } -> CURLE_SEND_FAIL_REWIND
+  #{const CURLE_SSL_ENGINE_INITFAILED   } -> CURLE_SSL_ENGINE_INITFAILED
+  #{const CURLE_LOGIN_DENIED            } -> CURLE_LOGIN_DENIED
+  #{const CURLE_TFTP_NOTFOUND           } -> CURLE_TFTP_NOTFOUND
+  #{const CURLE_TFTP_PERM               } -> CURLE_TFTP_PERM
+  #{const CURLE_REMOTE_DISK_FULL        } -> CURLE_REMOTE_DISK_FULL
+  #{const CURLE_TFTP_ILLEGAL            } -> CURLE_TFTP_ILLEGAL
+  #{const CURLE_TFTP_UNKNOWNID          } -> CURLE_TFTP_UNKNOWNID
+  #{const CURLE_REMOTE_FILE_EXISTS      } -> CURLE_REMOTE_FILE_EXISTS
+  #{const CURLE_TFTP_NOSUCHUSER         } -> CURLE_TFTP_NOSUCHUSER
+  #{const CURLE_CONV_FAILED             } -> CURLE_CONV_FAILED
+  #{const CURLE_CONV_REQD               } -> CURLE_CONV_REQD
+  #{const CURLE_SSL_CACERT_BADFILE      } -> CURLE_SSL_CACERT_BADFILE
+  #{const CURLE_REMOTE_FILE_NOT_FOUND   } -> CURLE_REMOTE_FILE_NOT_FOUND
+  #{const CURLE_SSH                     } -> CURLE_SSH
+  #{const CURLE_SSL_SHUTDOWN_FAILED     } -> CURLE_SSL_SHUTDOWN_FAILED
+  #{const CURLE_AGAIN                   } -> CURLE_AGAIN
+  #{const CURLE_SSL_CRL_BADFILE         } -> CURLE_SSL_CRL_BADFILE
+  #{const CURLE_SSL_ISSUER_ERROR        } -> CURLE_SSL_ISSUER_ERROR
+  #{const CURLE_FTP_PRET_FAILED         } -> CURLE_FTP_PRET_FAILED
+  #{const CURLE_RTSP_CSEQ_ERROR         } -> CURLE_RTSP_CSEQ_ERROR
+  #{const CURLE_RTSP_SESSION_ERROR      } -> CURLE_RTSP_SESSION_ERROR
+  #{const CURLE_FTP_BAD_FILE_LIST       } -> CURLE_FTP_BAD_FILE_LIST
+  #{const CURLE_CHUNK_FAILED            } -> CURLE_CHUNK_FAILED
+  _                                       -> CURLE_UNKNOWN_ERROR
+
+
+-------------------------------------------------------------------------------
+data CURLCB where
+  CURLCB :: CURLCBT a -> FunPtr () -> CURLCB
+
+data CURLCBT a where
+  FWRITE :: CURLCBT CURL_write_callback
+  FREAD  :: CURLCBT CURL_read_callback
+
+type CURLSL = (CInt, Ptr C.CURLslist)
+
+
+-------------------------------------------------------------------------------
+data CURL = CURL Unique (MVar (Ptr C.CURL)) (IORef [CURLCB]) (IORef [CURLSL])
+
+instance Show CURL where
+  showsPrec p (CURL u _ _ _) = showString "CURL#" . showsPrec p (hashUnique u)
+
+instance Eq CURL where
+  (CURL u1 _ _ _) == (CURL u2 _ _ _) = u1 == u2
+
+
+-------------------------------------------------------------------------------
+data CURLE = CURLE CURL String String CURLC
+  deriving (Eq, Typeable)
+
+instance Exception CURLE
+
+instance Show CURLE where
+  showsPrec p (CURLE curl func desc code) =
+    showString "\n<curlhs> " . showString desc
+    . showString "\n<curlhs> " . showsPrec p code . showString " ("
+    . showString func . showString " <" . showsPrec p curl . showString ">)"
+
+
diff --git a/Network/CURL000/curl-7.30.0/COPYING b/Network/CURL000/curl-7.30.0/COPYING
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/COPYING
@@ -0,0 +1,21 @@
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1996 - 2013, Daniel Stenberg, <daniel@haxx.se>.
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+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 OF THIRD PARTY RIGHTS. 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.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
diff --git a/Network/CURL000/curl-7.30.0/curl.h b/Network/CURL000/curl-7.30.0/curl.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/curl.h
@@ -0,0 +1,2227 @@
+#ifndef __CURL_CURL_H
+#define __CURL_CURL_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/*
+ * If you have libcurl problems, all docs and details are found here:
+ *   http://curl.haxx.se/libcurl/
+ *
+ * curl-library mailing list subscription and unsubscription web interface:
+ *   http://cool.haxx.se/mailman/listinfo/curl-library/
+ */
+
+#include "curlver.h"         /* libcurl version defines   */
+#include "curlbuild.h"       /* libcurl build definitions */
+#include "curlrules.h"       /* libcurl rules enforcement */
+
+/*
+ * Define WIN32 when build target is Win32 API
+ */
+
+#if (defined(_WIN32) || defined(__WIN32__)) && \
+     !defined(WIN32) && !defined(__SYMBIAN32__)
+#define WIN32
+#endif
+
+#include <stdio.h>
+#include <limits.h>
+
+#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)
+/* Needed for __FreeBSD_version symbol definition */
+#include <osreldate.h>
+#endif
+
+/* The include stuff here below is mainly for time_t! */
+#include <sys/types.h>
+#include <time.h>
+
+#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
+#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))
+/* The check above prevents the winsock2 inclusion if winsock.h already was
+   included, since they can't co-exist without problems */
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+#endif
+
+/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
+   libc5-based Linux systems. Only include it on systems that are known to
+   require it! */
+#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
+    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
+    defined(ANDROID) || defined(__ANDROID__) || \
+   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
+#include <sys/select.h>
+#endif
+
+#if !defined(WIN32) && !defined(_WIN32_WCE)
+#include <sys/socket.h>
+#endif
+
+#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
+#include <sys/time.h>
+#endif
+
+#ifdef __BEOS__
+#include <support/SupportDefs.h>
+#endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef void CURL;
+
+/*
+ * libcurl external API function linkage decorations.
+ */
+
+#ifdef CURL_STATICLIB
+#  define CURL_EXTERN
+#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
+#  if defined(BUILDING_LIBCURL)
+#    define CURL_EXTERN  __declspec(dllexport)
+#  else
+#    define CURL_EXTERN  __declspec(dllimport)
+#  endif
+#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
+#  define CURL_EXTERN CURL_EXTERN_SYMBOL
+#else
+#  define CURL_EXTERN
+#endif
+
+#ifndef curl_socket_typedef
+/* socket typedef */
+#if defined(WIN32) && !defined(__LWIP_OPT_H__)
+typedef SOCKET curl_socket_t;
+#define CURL_SOCKET_BAD INVALID_SOCKET
+#else
+typedef int curl_socket_t;
+#define CURL_SOCKET_BAD -1
+#endif
+#define curl_socket_typedef
+#endif /* curl_socket_typedef */
+
+struct curl_httppost {
+  struct curl_httppost *next;       /* next entry in the list */
+  char *name;                       /* pointer to allocated name */
+  long namelength;                  /* length of name length */
+  char *contents;                   /* pointer to allocated data contents */
+  long contentslength;              /* length of contents field */
+  char *buffer;                     /* pointer to allocated buffer contents */
+  long bufferlength;                /* length of buffer field */
+  char *contenttype;                /* Content-Type */
+  struct curl_slist* contentheader; /* list of extra headers for this form */
+  struct curl_httppost *more;       /* if one field name has more than one
+                                       file, this link should link to following
+                                       files */
+  long flags;                       /* as defined below */
+#define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */
+#define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */
+#define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer
+                                       do not free in formfree */
+#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
+                                       do not free in formfree */
+#define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */
+#define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */
+#define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the
+                                       regular read callback to get the data
+                                       and pass the given pointer as custom
+                                       pointer */
+
+  char *showfilename;               /* The file name to show. If not set, the
+                                       actual file name will be used (if this
+                                       is a file part) */
+  void *userp;                      /* custom pointer used for
+                                       HTTPPOST_CALLBACK posts */
+};
+
+typedef int (*curl_progress_callback)(void *clientp,
+                                      double dltotal,
+                                      double dlnow,
+                                      double ultotal,
+                                      double ulnow);
+
+#ifndef CURL_MAX_WRITE_SIZE
+  /* Tests have proven that 20K is a very bad buffer size for uploads on
+     Windows, while 16K for some odd reason performed a lot better.
+     We do the ifndef check to allow this value to easier be changed at build
+     time for those who feel adventurous. The practical minimum is about
+     400 bytes since libcurl uses a buffer of this size as a scratch area
+     (unrelated to network send operations). */
+#define CURL_MAX_WRITE_SIZE 16384
+#endif
+
+#ifndef CURL_MAX_HTTP_HEADER
+/* The only reason to have a max limit for this is to avoid the risk of a bad
+   server feeding libcurl with a never-ending header that will cause reallocs
+   infinitely */
+#define CURL_MAX_HTTP_HEADER (100*1024)
+#endif
+
+/* This is a magic return code for the write callback that, when returned,
+   will signal libcurl to pause receiving on the current transfer. */
+#define CURL_WRITEFUNC_PAUSE 0x10000001
+
+typedef size_t (*curl_write_callback)(char *buffer,
+                                      size_t size,
+                                      size_t nitems,
+                                      void *outstream);
+
+
+
+/* enumeration of file types */
+typedef enum {
+  CURLFILETYPE_FILE = 0,
+  CURLFILETYPE_DIRECTORY,
+  CURLFILETYPE_SYMLINK,
+  CURLFILETYPE_DEVICE_BLOCK,
+  CURLFILETYPE_DEVICE_CHAR,
+  CURLFILETYPE_NAMEDPIPE,
+  CURLFILETYPE_SOCKET,
+  CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */
+
+  CURLFILETYPE_UNKNOWN /* should never occur */
+} curlfiletype;
+
+#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)
+#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)
+#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)
+#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)
+#define CURLFINFOFLAG_KNOWN_UID         (1<<4)
+#define CURLFINFOFLAG_KNOWN_GID         (1<<5)
+#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)
+#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)
+
+/* Content of this structure depends on information which is known and is
+   achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
+   page for callbacks returning this structure -- some fields are mandatory,
+   some others are optional. The FLAG field has special meaning. */
+struct curl_fileinfo {
+  char *filename;
+  curlfiletype filetype;
+  time_t time;
+  unsigned int perm;
+  int uid;
+  int gid;
+  curl_off_t size;
+  long int hardlinks;
+
+  struct {
+    /* If some of these fields is not NULL, it is a pointer to b_data. */
+    char *time;
+    char *perm;
+    char *user;
+    char *group;
+    char *target; /* pointer to the target filename of a symlink */
+  } strings;
+
+  unsigned int flags;
+
+  /* used internally */
+  char * b_data;
+  size_t b_size;
+  size_t b_used;
+};
+
+/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */
+#define CURL_CHUNK_BGN_FUNC_OK      0
+#define CURL_CHUNK_BGN_FUNC_FAIL    1 /* tell the lib to end the task */
+#define CURL_CHUNK_BGN_FUNC_SKIP    2 /* skip this chunk over */
+
+/* if splitting of data transfer is enabled, this callback is called before
+   download of an individual chunk started. Note that parameter "remains" works
+   only for FTP wildcard downloading (for now), otherwise is not used */
+typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
+                                        void *ptr,
+                                        int remains);
+
+/* return codes for CURLOPT_CHUNK_END_FUNCTION */
+#define CURL_CHUNK_END_FUNC_OK      0
+#define CURL_CHUNK_END_FUNC_FAIL    1 /* tell the lib to end the task */
+
+/* If splitting of data transfer is enabled this callback is called after
+   download of an individual chunk finished.
+   Note! After this callback was set then it have to be called FOR ALL chunks.
+   Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
+   This is the reason why we don't need "transfer_info" parameter in this
+   callback and we are not interested in "remains" parameter too. */
+typedef long (*curl_chunk_end_callback)(void *ptr);
+
+/* return codes for FNMATCHFUNCTION */
+#define CURL_FNMATCHFUNC_MATCH    0 /* string corresponds to the pattern */
+#define CURL_FNMATCHFUNC_NOMATCH  1 /* pattern doesn't match the string */
+#define CURL_FNMATCHFUNC_FAIL     2 /* an error occurred */
+
+/* callback type for wildcard downloading pattern matching. If the
+   string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
+typedef int (*curl_fnmatch_callback)(void *ptr,
+                                     const char *pattern,
+                                     const char *string);
+
+/* These are the return codes for the seek callbacks */
+#define CURL_SEEKFUNC_OK       0
+#define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */
+#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
+                                    libcurl might try other means instead */
+typedef int (*curl_seek_callback)(void *instream,
+                                  curl_off_t offset,
+                                  int origin); /* 'whence' */
+
+/* This is a return code for the read callback that, when returned, will
+   signal libcurl to immediately abort the current transfer. */
+#define CURL_READFUNC_ABORT 0x10000000
+/* This is a return code for the read callback that, when returned, will
+   signal libcurl to pause sending data on the current transfer. */
+#define CURL_READFUNC_PAUSE 0x10000001
+
+typedef size_t (*curl_read_callback)(char *buffer,
+                                      size_t size,
+                                      size_t nitems,
+                                      void *instream);
+
+typedef enum  {
+  CURLSOCKTYPE_IPCXN,  /* socket created for a specific IP connection */
+  CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
+  CURLSOCKTYPE_LAST    /* never use */
+} curlsocktype;
+
+/* The return code from the sockopt_callback can signal information back
+   to libcurl: */
+#define CURL_SOCKOPT_OK 0
+#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
+                                CURLE_ABORTED_BY_CALLBACK */
+#define CURL_SOCKOPT_ALREADY_CONNECTED 2
+
+typedef int (*curl_sockopt_callback)(void *clientp,
+                                     curl_socket_t curlfd,
+                                     curlsocktype purpose);
+
+struct curl_sockaddr {
+  int family;
+  int socktype;
+  int protocol;
+  unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
+                           turned really ugly and painful on the systems that
+                           lack this type */
+  struct sockaddr addr;
+};
+
+typedef curl_socket_t
+(*curl_opensocket_callback)(void *clientp,
+                            curlsocktype purpose,
+                            struct curl_sockaddr *address);
+
+typedef int
+(*curl_closesocket_callback)(void *clientp, curl_socket_t item);
+
+typedef enum {
+  CURLIOE_OK,            /* I/O operation successful */
+  CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */
+  CURLIOE_FAILRESTART,   /* failed to restart the read */
+  CURLIOE_LAST           /* never use */
+} curlioerr;
+
+typedef enum  {
+  CURLIOCMD_NOP,         /* no operation */
+  CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
+  CURLIOCMD_LAST         /* never use */
+} curliocmd;
+
+typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
+                                         int cmd,
+                                         void *clientp);
+
+/*
+ * The following typedef's are signatures of malloc, free, realloc, strdup and
+ * calloc respectively.  Function pointers of these types can be passed to the
+ * curl_global_init_mem() function to set user defined memory management
+ * callback routines.
+ */
+typedef void *(*curl_malloc_callback)(size_t size);
+typedef void (*curl_free_callback)(void *ptr);
+typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
+typedef char *(*curl_strdup_callback)(const char *str);
+typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
+
+/* the kind of data that is passed to information_callback*/
+typedef enum {
+  CURLINFO_TEXT = 0,
+  CURLINFO_HEADER_IN,    /* 1 */
+  CURLINFO_HEADER_OUT,   /* 2 */
+  CURLINFO_DATA_IN,      /* 3 */
+  CURLINFO_DATA_OUT,     /* 4 */
+  CURLINFO_SSL_DATA_IN,  /* 5 */
+  CURLINFO_SSL_DATA_OUT, /* 6 */
+  CURLINFO_END
+} curl_infotype;
+
+typedef int (*curl_debug_callback)
+       (CURL *handle,      /* the handle/transfer this concerns */
+        curl_infotype type, /* what kind of data */
+        char *data,        /* points to the data */
+        size_t size,       /* size of the data pointed to */
+        void *userptr);    /* whatever the user please */
+
+/* All possible error codes from all sorts of curl functions. Future versions
+   may return other values, stay prepared.
+
+   Always add new return codes last. Never *EVER* remove any. The return
+   codes must remain the same!
+ */
+
+typedef enum {
+  CURLE_OK = 0,
+  CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */
+  CURLE_FAILED_INIT,             /* 2 */
+  CURLE_URL_MALFORMAT,           /* 3 */
+  CURLE_NOT_BUILT_IN,            /* 4 - [was obsoleted in August 2007 for
+                                    7.17.0, reused in April 2011 for 7.21.5] */
+  CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */
+  CURLE_COULDNT_RESOLVE_HOST,    /* 6 */
+  CURLE_COULDNT_CONNECT,         /* 7 */
+  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */
+  CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server
+                                    due to lack of access - when login fails
+                                    this is not returned. */
+  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [was obsoleted in April 2006 for
+                                    7.15.4, reused in Dec 2011 for 7.24.0]*/
+  CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */
+  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 - timeout occurred accepting server
+                                    [was obsoleted in August 2007 for 7.17.0,
+                                    reused in Dec 2011 for 7.24.0]*/
+  CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */
+  CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */
+  CURLE_FTP_CANT_GET_HOST,       /* 15 */
+  CURLE_OBSOLETE16,              /* 16 - NOT USED */
+  CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */
+  CURLE_PARTIAL_FILE,            /* 18 */
+  CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */
+  CURLE_OBSOLETE20,              /* 20 - NOT USED */
+  CURLE_QUOTE_ERROR,             /* 21 - quote command failure */
+  CURLE_HTTP_RETURNED_ERROR,     /* 22 */
+  CURLE_WRITE_ERROR,             /* 23 */
+  CURLE_OBSOLETE24,              /* 24 - NOT USED */
+  CURLE_UPLOAD_FAILED,           /* 25 - failed upload "command" */
+  CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */
+  CURLE_OUT_OF_MEMORY,           /* 27 */
+  /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
+           instead of a memory allocation error if CURL_DOES_CONVERSIONS
+           is defined
+  */
+  CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */
+  CURLE_OBSOLETE29,              /* 29 - NOT USED */
+  CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */
+  CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */
+  CURLE_OBSOLETE32,              /* 32 - NOT USED */
+  CURLE_RANGE_ERROR,             /* 33 - RANGE "command" didn't work */
+  CURLE_HTTP_POST_ERROR,         /* 34 */
+  CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */
+  CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */
+  CURLE_FILE_COULDNT_READ_FILE,  /* 37 */
+  CURLE_LDAP_CANNOT_BIND,        /* 38 */
+  CURLE_LDAP_SEARCH_FAILED,      /* 39 */
+  CURLE_OBSOLETE40,              /* 40 - NOT USED */
+  CURLE_FUNCTION_NOT_FOUND,      /* 41 */
+  CURLE_ABORTED_BY_CALLBACK,     /* 42 */
+  CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */
+  CURLE_OBSOLETE44,              /* 44 - NOT USED */
+  CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */
+  CURLE_OBSOLETE46,              /* 46 - NOT USED */
+  CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */
+  CURLE_UNKNOWN_OPTION,          /* 48 - User specified an unknown option */
+  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */
+  CURLE_OBSOLETE50,              /* 50 - NOT USED */
+  CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
+                                     wasn't verified fine */
+  CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */
+  CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */
+  CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as
+                                    default */
+  CURLE_SEND_ERROR,              /* 55 - failed sending network data */
+  CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */
+  CURLE_OBSOLETE57,              /* 57 - NOT IN USE */
+  CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */
+  CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */
+  CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */
+  CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized/bad encoding */
+  CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */
+  CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */
+  CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */
+  CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind
+                                    that failed */
+  CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */
+  CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not
+                                    accepted and we failed to login */
+  CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */
+  CURLE_TFTP_PERM,               /* 69 - permission problem on server */
+  CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */
+  CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */
+  CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */
+  CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */
+  CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */
+  CURLE_CONV_FAILED,             /* 75 - conversion failed */
+  CURLE_CONV_REQD,               /* 76 - caller must register conversion
+                                    callbacks using curl_easy_setopt options
+                                    CURLOPT_CONV_FROM_NETWORK_FUNCTION,
+                                    CURLOPT_CONV_TO_NETWORK_FUNCTION, and
+                                    CURLOPT_CONV_FROM_UTF8_FUNCTION */
+  CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing
+                                    or wrong format */
+  CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */
+  CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat
+                                    generic so the error message will be of
+                                    interest when this has happened */
+
+  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL
+                                    connection */
+  CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,
+                                    wait till it's ready and try again (Added
+                                    in 7.18.2) */
+  CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or
+                                    wrong format (Added in 7.19.0) */
+  CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in
+                                    7.19.0) */
+  CURLE_FTP_PRET_FAILED,         /* 84 - a PRET command failed */
+  CURLE_RTSP_CSEQ_ERROR,         /* 85 - mismatch of RTSP CSeq numbers */
+  CURLE_RTSP_SESSION_ERROR,      /* 86 - mismatch of RTSP Session Ids */
+  CURLE_FTP_BAD_FILE_LIST,       /* 87 - unable to parse FTP file list */
+  CURLE_CHUNK_FAILED,            /* 88 - chunk callback reported error */
+  CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
+                                    session will be queued */
+  CURL_LAST /* never use! */
+} CURLcode;
+
+#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
+                          the obsolete stuff removed! */
+
+/* Previously obsoletes error codes re-used in 7.24.0 */
+#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
+#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT
+
+/*  compatibility with older names */
+#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
+
+/* The following were added in 7.21.5, April 2011 */
+#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
+
+/* The following were added in 7.17.1 */
+/* These are scheduled to disappear by 2009 */
+#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
+
+/* The following were added in 7.17.0 */
+/* These are scheduled to disappear by 2009 */
+#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
+#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
+#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
+#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
+#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
+#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
+#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
+#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
+#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
+#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
+#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
+#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
+#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
+
+#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
+#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
+#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
+#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
+#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
+#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
+#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
+
+/* The following were added earlier */
+
+#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
+
+#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
+#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
+#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
+
+#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
+#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
+
+/* This was the error code 50 in 7.7.3 and a few earlier versions, this
+   is no longer used by libcurl but is instead #defined here only to not
+   make programs break */
+#define CURLE_ALREADY_COMPLETE 99999
+
+#endif /*!CURL_NO_OLDIES*/
+
+/* This prototype applies to all conversion callbacks */
+typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
+
+typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */
+                                          void *ssl_ctx, /* actually an
+                                                            OpenSSL SSL_CTX */
+                                          void *userptr);
+
+typedef enum {
+  CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use
+                           CONNECT HTTP/1.1 */
+  CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT
+                               HTTP/1.0  */
+  CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
+                           in 7.10 */
+  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
+  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
+  CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
+                                   host name rather than the IP address. added
+                                   in 7.18.0 */
+} curl_proxytype;  /* this enum was added in 7.10 */
+
+/*
+ * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:
+ *
+ * CURLAUTH_NONE         - No HTTP authentication
+ * CURLAUTH_BASIC        - HTTP Basic authentication (default)
+ * CURLAUTH_DIGEST       - HTTP Digest authentication
+ * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication
+ * CURLAUTH_NTLM         - HTTP NTLM authentication
+ * CURLAUTH_DIGEST_IE    - HTTP Digest authentication with IE flavour
+ * CURLAUTH_NTLM_WB      - HTTP NTLM authentication delegated to winbind helper
+ * CURLAUTH_ONLY         - Use together with a single other type to force no
+ *                         authentication or just that single type
+ * CURLAUTH_ANY          - All fine types set
+ * CURLAUTH_ANYSAFE      - All fine types except Basic
+ */
+
+#define CURLAUTH_NONE         ((unsigned long)0)
+#define CURLAUTH_BASIC        (((unsigned long)1)<<0)
+#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)
+#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)
+#define CURLAUTH_NTLM         (((unsigned long)1)<<3)
+#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)
+#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)
+#define CURLAUTH_ONLY         (((unsigned long)1)<<31)
+#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)
+#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
+
+#define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */
+#define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */
+#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
+#define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */
+#define CURLSSH_AUTH_HOST      (1<<2) /* host key files */
+#define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */
+#define CURLSSH_AUTH_AGENT     (1<<4) /* agent (ssh-agent, pageant...) */
+#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
+
+#define CURLGSSAPI_DELEGATION_NONE        0      /* no delegation (default) */
+#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
+#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /* delegate always */
+
+#define CURL_ERROR_SIZE 256
+
+struct curl_khkey {
+  const char *key; /* points to a zero-terminated string encoded with base64
+                      if len is zero, otherwise to the "raw" data */
+  size_t len;
+  enum type {
+    CURLKHTYPE_UNKNOWN,
+    CURLKHTYPE_RSA1,
+    CURLKHTYPE_RSA,
+    CURLKHTYPE_DSS
+  } keytype;
+};
+
+/* this is the set of return values expected from the curl_sshkeycallback
+   callback */
+enum curl_khstat {
+  CURLKHSTAT_FINE_ADD_TO_FILE,
+  CURLKHSTAT_FINE,
+  CURLKHSTAT_REJECT, /* reject the connection, return an error */
+  CURLKHSTAT_DEFER,  /* do not accept it, but we can't answer right now so
+                        this causes a CURLE_DEFER error but otherwise the
+                        connection will be left intact etc */
+  CURLKHSTAT_LAST    /* not for use, only a marker for last-in-list */
+};
+
+/* this is the set of status codes pass in to the callback */
+enum curl_khmatch {
+  CURLKHMATCH_OK,       /* match */
+  CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
+  CURLKHMATCH_MISSING,  /* no matching host/key found */
+  CURLKHMATCH_LAST      /* not for use, only a marker for last-in-list */
+};
+
+typedef int
+  (*curl_sshkeycallback) (CURL *easy,     /* easy handle */
+                          const struct curl_khkey *knownkey, /* known */
+                          const struct curl_khkey *foundkey, /* found */
+                          enum curl_khmatch, /* libcurl's view on the keys */
+                          void *clientp); /* custom pointer passed from app */
+
+/* parameter for the CURLOPT_USE_SSL option */
+typedef enum {
+  CURLUSESSL_NONE,    /* do not attempt to use SSL */
+  CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */
+  CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
+  CURLUSESSL_ALL,     /* SSL for all communication or fail */
+  CURLUSESSL_LAST     /* not an option, never use */
+} curl_usessl;
+
+/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */
+
+/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the
+   name of improving interoperability with older servers. Some SSL libraries
+   have introduced work-arounds for this flaw but those work-arounds sometimes
+   make the SSL communication fail. To regain functionality with those broken
+   servers, a user can this way allow the vulnerability back. */
+#define CURLSSLOPT_ALLOW_BEAST (1<<0)
+
+#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
+                          the obsolete stuff removed! */
+
+/* Backwards compatibility with older names */
+/* These are scheduled to disappear by 2009 */
+
+#define CURLFTPSSL_NONE CURLUSESSL_NONE
+#define CURLFTPSSL_TRY CURLUSESSL_TRY
+#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
+#define CURLFTPSSL_ALL CURLUSESSL_ALL
+#define CURLFTPSSL_LAST CURLUSESSL_LAST
+#define curl_ftpssl curl_usessl
+#endif /*!CURL_NO_OLDIES*/
+
+/* parameter for the CURLOPT_FTP_SSL_CCC option */
+typedef enum {
+  CURLFTPSSL_CCC_NONE,    /* do not send CCC */
+  CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
+  CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */
+  CURLFTPSSL_CCC_LAST     /* not an option, never use */
+} curl_ftpccc;
+
+/* parameter for the CURLOPT_FTPSSLAUTH option */
+typedef enum {
+  CURLFTPAUTH_DEFAULT, /* let libcurl decide */
+  CURLFTPAUTH_SSL,     /* use "AUTH SSL" */
+  CURLFTPAUTH_TLS,     /* use "AUTH TLS" */
+  CURLFTPAUTH_LAST /* not an option, never use */
+} curl_ftpauth;
+
+/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
+typedef enum {
+  CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */
+  CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD
+                               again if MKD succeeded, for SFTP this does
+                               similar magic */
+  CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
+                               again even if MKD failed! */
+  CURLFTP_CREATE_DIR_LAST   /* not an option, never use */
+} curl_ftpcreatedir;
+
+/* parameter for the CURLOPT_FTP_FILEMETHOD option */
+typedef enum {
+  CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */
+  CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */
+  CURLFTPMETHOD_NOCWD,     /* no CWD at all */
+  CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
+  CURLFTPMETHOD_LAST       /* not an option, never use */
+} curl_ftpmethod;
+
+/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
+#define CURLPROTO_HTTP   (1<<0)
+#define CURLPROTO_HTTPS  (1<<1)
+#define CURLPROTO_FTP    (1<<2)
+#define CURLPROTO_FTPS   (1<<3)
+#define CURLPROTO_SCP    (1<<4)
+#define CURLPROTO_SFTP   (1<<5)
+#define CURLPROTO_TELNET (1<<6)
+#define CURLPROTO_LDAP   (1<<7)
+#define CURLPROTO_LDAPS  (1<<8)
+#define CURLPROTO_DICT   (1<<9)
+#define CURLPROTO_FILE   (1<<10)
+#define CURLPROTO_TFTP   (1<<11)
+#define CURLPROTO_IMAP   (1<<12)
+#define CURLPROTO_IMAPS  (1<<13)
+#define CURLPROTO_POP3   (1<<14)
+#define CURLPROTO_POP3S  (1<<15)
+#define CURLPROTO_SMTP   (1<<16)
+#define CURLPROTO_SMTPS  (1<<17)
+#define CURLPROTO_RTSP   (1<<18)
+#define CURLPROTO_RTMP   (1<<19)
+#define CURLPROTO_RTMPT  (1<<20)
+#define CURLPROTO_RTMPE  (1<<21)
+#define CURLPROTO_RTMPTE (1<<22)
+#define CURLPROTO_RTMPS  (1<<23)
+#define CURLPROTO_RTMPTS (1<<24)
+#define CURLPROTO_GOPHER (1<<25)
+#define CURLPROTO_ALL    (~0) /* enable everything */
+
+/* long may be 32 or 64 bits, but we should never depend on anything else
+   but 32 */
+#define CURLOPTTYPE_LONG          0
+#define CURLOPTTYPE_OBJECTPOINT   10000
+#define CURLOPTTYPE_FUNCTIONPOINT 20000
+#define CURLOPTTYPE_OFF_T         30000
+
+/* name is uppercase CURLOPT_<name>,
+   type is one of the defined CURLOPTTYPE_<type>
+   number is unique identifier */
+#ifdef CINIT
+#undef CINIT
+#endif
+
+#ifdef CURL_ISOCPP
+#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
+#else
+/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
+#define LONG          CURLOPTTYPE_LONG
+#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
+#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
+#define OFF_T         CURLOPTTYPE_OFF_T
+#define CINIT(name,type,number) CURLOPT_/**/name = type + number
+#endif
+
+/*
+ * This macro-mania below setups the CURLOPT_[what] enum, to be used with
+ * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
+ * word.
+ */
+
+typedef enum {
+  /* This is the FILE * or void * the regular output should be written to. */
+  CINIT(FILE, OBJECTPOINT, 1),
+
+  /* The full URL to get/put */
+  CINIT(URL,  OBJECTPOINT, 2),
+
+  /* Port number to connect to, if other than default. */
+  CINIT(PORT, LONG, 3),
+
+  /* Name of proxy to use. */
+  CINIT(PROXY, OBJECTPOINT, 4),
+
+  /* "name:password" to use when fetching. */
+  CINIT(USERPWD, OBJECTPOINT, 5),
+
+  /* "name:password" to use with proxy. */
+  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
+
+  /* Range to get, specified as an ASCII string. */
+  CINIT(RANGE, OBJECTPOINT, 7),
+
+  /* not used */
+
+  /* Specified file stream to upload from (use as input): */
+  CINIT(INFILE, OBJECTPOINT, 9),
+
+  /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
+   * bytes big. If this is not used, error messages go to stderr instead: */
+  CINIT(ERRORBUFFER, OBJECTPOINT, 10),
+
+  /* Function that will be called to store the output (instead of fwrite). The
+   * parameters will use fwrite() syntax, make sure to follow them. */
+  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
+
+  /* Function that will be called to read the input (instead of fread). The
+   * parameters will use fread() syntax, make sure to follow them. */
+  CINIT(READFUNCTION, FUNCTIONPOINT, 12),
+
+  /* Time-out the read operation after this amount of seconds */
+  CINIT(TIMEOUT, LONG, 13),
+
+  /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
+   * how large the file being sent really is. That allows better error
+   * checking and better verifies that the upload was successful. -1 means
+   * unknown size.
+   *
+   * For large file support, there is also a _LARGE version of the key
+   * which takes an off_t type, allowing platforms with larger off_t
+   * sizes to handle larger files.  See below for INFILESIZE_LARGE.
+   */
+  CINIT(INFILESIZE, LONG, 14),
+
+  /* POST static input fields. */
+  CINIT(POSTFIELDS, OBJECTPOINT, 15),
+
+  /* Set the referrer page (needed by some CGIs) */
+  CINIT(REFERER, OBJECTPOINT, 16),
+
+  /* Set the FTP PORT string (interface name, named or numerical IP address)
+     Use i.e '-' to use default address. */
+  CINIT(FTPPORT, OBJECTPOINT, 17),
+
+  /* Set the User-Agent string (examined by some CGIs) */
+  CINIT(USERAGENT, OBJECTPOINT, 18),
+
+  /* If the download receives less than "low speed limit" bytes/second
+   * during "low speed time" seconds, the operations is aborted.
+   * You could i.e if you have a pretty high speed connection, abort if
+   * it is less than 2000 bytes/sec during 20 seconds.
+   */
+
+  /* Set the "low speed limit" */
+  CINIT(LOW_SPEED_LIMIT, LONG, 19),
+
+  /* Set the "low speed time" */
+  CINIT(LOW_SPEED_TIME, LONG, 20),
+
+  /* Set the continuation offset.
+   *
+   * Note there is also a _LARGE version of this key which uses
+   * off_t types, allowing for large file offsets on platforms which
+   * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.
+   */
+  CINIT(RESUME_FROM, LONG, 21),
+
+  /* Set cookie in request: */
+  CINIT(COOKIE, OBJECTPOINT, 22),
+
+  /* This points to a linked list of headers, struct curl_slist kind */
+  CINIT(HTTPHEADER, OBJECTPOINT, 23),
+
+  /* This points to a linked list of post entries, struct curl_httppost */
+  CINIT(HTTPPOST, OBJECTPOINT, 24),
+
+  /* name of the file keeping your private SSL-certificate */
+  CINIT(SSLCERT, OBJECTPOINT, 25),
+
+  /* password for the SSL or SSH private key */
+  CINIT(KEYPASSWD, OBJECTPOINT, 26),
+
+  /* send TYPE parameter? */
+  CINIT(CRLF, LONG, 27),
+
+  /* send linked-list of QUOTE commands */
+  CINIT(QUOTE, OBJECTPOINT, 28),
+
+  /* send FILE * or void * to store headers to, if you use a callback it
+     is simply passed to the callback unmodified */
+  CINIT(WRITEHEADER, OBJECTPOINT, 29),
+
+  /* point to a file to read the initial cookies from, also enables
+     "cookie awareness" */
+  CINIT(COOKIEFILE, OBJECTPOINT, 31),
+
+  /* What version to specifically try to use.
+     See CURL_SSLVERSION defines below. */
+  CINIT(SSLVERSION, LONG, 32),
+
+  /* What kind of HTTP time condition to use, see defines */
+  CINIT(TIMECONDITION, LONG, 33),
+
+  /* Time to use with the above condition. Specified in number of seconds
+     since 1 Jan 1970 */
+  CINIT(TIMEVALUE, LONG, 34),
+
+  /* 35 = OBSOLETE */
+
+  /* Custom request, for customizing the get command like
+     HTTP: DELETE, TRACE and others
+     FTP: to use a different list command
+     */
+  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
+
+  /* HTTP request, for odd commands like DELETE, TRACE and others */
+  CINIT(STDERR, OBJECTPOINT, 37),
+
+  /* 38 is not used */
+
+  /* send linked-list of post-transfer QUOTE commands */
+  CINIT(POSTQUOTE, OBJECTPOINT, 39),
+
+  CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */
+
+  CINIT(VERBOSE, LONG, 41),      /* talk a lot */
+  CINIT(HEADER, LONG, 42),       /* throw the header out too */
+  CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */
+  CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */
+  CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */
+  CINIT(UPLOAD, LONG, 46),       /* this is an upload */
+  CINIT(POST, LONG, 47),         /* HTTP POST method */
+  CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */
+
+  CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */
+
+  /* Specify whether to read the user+password from the .netrc or the URL.
+   * This must be one of the CURL_NETRC_* enums below. */
+  CINIT(NETRC, LONG, 51),
+
+  CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */
+
+  CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
+  CINIT(PUT, LONG, 54),          /* HTTP PUT */
+
+  /* 55 = OBSOLETE */
+
+  /* Function that will be called instead of the internal progress display
+   * function. This function should be defined as the curl_progress_callback
+   * prototype defines. */
+  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
+
+  /* Data passed to the progress callback */
+  CINIT(PROGRESSDATA, OBJECTPOINT, 57),
+
+  /* We want the referrer field set automatically when following locations */
+  CINIT(AUTOREFERER, LONG, 58),
+
+  /* Port of the proxy, can be set in the proxy string as well with:
+     "[host]:[port]" */
+  CINIT(PROXYPORT, LONG, 59),
+
+  /* size of the POST input data, if strlen() is not good to use */
+  CINIT(POSTFIELDSIZE, LONG, 60),
+
+  /* tunnel non-http operations through a HTTP proxy */
+  CINIT(HTTPPROXYTUNNEL, LONG, 61),
+
+  /* Set the interface string to use as outgoing network interface */
+  CINIT(INTERFACE, OBJECTPOINT, 62),
+
+  /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This
+   * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string
+   * is set but doesn't match one of these, 'private' will be used.  */
+  CINIT(KRBLEVEL, OBJECTPOINT, 63),
+
+  /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
+  CINIT(SSL_VERIFYPEER, LONG, 64),
+
+  /* The CApath or CAfile used to validate the peer certificate
+     this option is used only if SSL_VERIFYPEER is true */
+  CINIT(CAINFO, OBJECTPOINT, 65),
+
+  /* 66 = OBSOLETE */
+  /* 67 = OBSOLETE */
+
+  /* Maximum number of http redirects to follow */
+  CINIT(MAXREDIRS, LONG, 68),
+
+  /* Pass a long set to 1 to get the date of the requested document (if
+     possible)! Pass a zero to shut it off. */
+  CINIT(FILETIME, LONG, 69),
+
+  /* This points to a linked list of telnet options */
+  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
+
+  /* Max amount of cached alive connections */
+  CINIT(MAXCONNECTS, LONG, 71),
+
+  CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */
+
+  /* 73 = OBSOLETE */
+
+  /* Set to explicitly use a new connection for the upcoming transfer.
+     Do not use this unless you're absolutely sure of this, as it makes the
+     operation slower and is less friendly for the network. */
+  CINIT(FRESH_CONNECT, LONG, 74),
+
+  /* Set to explicitly forbid the upcoming transfer's connection to be re-used
+     when done. Do not use this unless you're absolutely sure of this, as it
+     makes the operation slower and is less friendly for the network. */
+  CINIT(FORBID_REUSE, LONG, 75),
+
+  /* Set to a file name that contains random data for libcurl to use to
+     seed the random engine when doing SSL connects. */
+  CINIT(RANDOM_FILE, OBJECTPOINT, 76),
+
+  /* Set to the Entropy Gathering Daemon socket pathname */
+  CINIT(EGDSOCKET, OBJECTPOINT, 77),
+
+  /* Time-out connect operations after this amount of seconds, if connects are
+     OK within this time, then fine... This only aborts the connect phase. */
+  CINIT(CONNECTTIMEOUT, LONG, 78),
+
+  /* Function that will be called to store headers (instead of fwrite). The
+   * parameters will use fwrite() syntax, make sure to follow them. */
+  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
+
+  /* Set this to force the HTTP request to get back to GET. Only really usable
+     if POST, PUT or a custom request have been used first.
+   */
+  CINIT(HTTPGET, LONG, 80),
+
+  /* Set if we should verify the Common name from the peer certificate in ssl
+   * handshake, set 1 to check existence, 2 to ensure that it matches the
+   * provided hostname. */
+  CINIT(SSL_VERIFYHOST, LONG, 81),
+
+  /* Specify which file name to write all known cookies in after completed
+     operation. Set file name to "-" (dash) to make it go to stdout. */
+  CINIT(COOKIEJAR, OBJECTPOINT, 82),
+
+  /* Specify which SSL ciphers to use */
+  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
+
+  /* Specify which HTTP version to use! This must be set to one of the
+     CURL_HTTP_VERSION* enums set below. */
+  CINIT(HTTP_VERSION, LONG, 84),
+
+  /* Specifically switch on or off the FTP engine's use of the EPSV command. By
+     default, that one will always be attempted before the more traditional
+     PASV command. */
+  CINIT(FTP_USE_EPSV, LONG, 85),
+
+  /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
+  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
+
+  /* name of the file keeping your private SSL-key */
+  CINIT(SSLKEY, OBJECTPOINT, 87),
+
+  /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
+  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
+
+  /* crypto engine for the SSL-sub system */
+  CINIT(SSLENGINE, OBJECTPOINT, 89),
+
+  /* set the crypto engine for the SSL-sub system as default
+     the param has no meaning...
+   */
+  CINIT(SSLENGINE_DEFAULT, LONG, 90),
+
+  /* Non-zero value means to use the global dns cache */
+  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
+
+  /* DNS cache timeout */
+  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
+
+  /* send linked-list of pre-transfer QUOTE commands */
+  CINIT(PREQUOTE, OBJECTPOINT, 93),
+
+  /* set the debug function */
+  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
+
+  /* set the data for the debug function */
+  CINIT(DEBUGDATA, OBJECTPOINT, 95),
+
+  /* mark this as start of a cookie session */
+  CINIT(COOKIESESSION, LONG, 96),
+
+  /* The CApath directory used to validate the peer certificate
+     this option is used only if SSL_VERIFYPEER is true */
+  CINIT(CAPATH, OBJECTPOINT, 97),
+
+  /* Instruct libcurl to use a smaller receive buffer */
+  CINIT(BUFFERSIZE, LONG, 98),
+
+  /* Instruct libcurl to not use any signal/alarm handlers, even when using
+     timeouts. This option is useful for multi-threaded applications.
+     See libcurl-the-guide for more background information. */
+  CINIT(NOSIGNAL, LONG, 99),
+
+  /* Provide a CURLShare for mutexing non-ts data */
+  CINIT(SHARE, OBJECTPOINT, 100),
+
+  /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
+     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
+  CINIT(PROXYTYPE, LONG, 101),
+
+  /* Set the Accept-Encoding string. Use this to tell a server you would like
+     the response to be compressed. Before 7.21.6, this was known as
+     CURLOPT_ENCODING */
+  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),
+
+  /* Set pointer to private data */
+  CINIT(PRIVATE, OBJECTPOINT, 103),
+
+  /* Set aliases for HTTP 200 in the HTTP Response header */
+  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
+
+  /* Continue to send authentication (user+password) when following locations,
+     even when hostname changed. This can potentially send off the name
+     and password to whatever host the server decides. */
+  CINIT(UNRESTRICTED_AUTH, LONG, 105),
+
+  /* Specifically switch on or off the FTP engine's use of the EPRT command (
+     it also disables the LPRT attempt). By default, those ones will always be
+     attempted before the good old traditional PORT command. */
+  CINIT(FTP_USE_EPRT, LONG, 106),
+
+  /* Set this to a bitmask value to enable the particular authentications
+     methods you like. Use this in combination with CURLOPT_USERPWD.
+     Note that setting multiple bits may cause extra network round-trips. */
+  CINIT(HTTPAUTH, LONG, 107),
+
+  /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
+     in second argument. The function must be matching the
+     curl_ssl_ctx_callback proto. */
+  CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
+
+  /* Set the userdata for the ssl context callback function's third
+     argument */
+  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
+
+  /* FTP Option that causes missing dirs to be created on the remote server.
+     In 7.19.4 we introduced the convenience enums for this option using the
+     CURLFTP_CREATE_DIR prefix.
+  */
+  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
+
+  /* Set this to a bitmask value to enable the particular authentications
+     methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
+     Note that setting multiple bits may cause extra network round-trips. */
+  CINIT(PROXYAUTH, LONG, 111),
+
+  /* FTP option that changes the timeout, in seconds, associated with
+     getting a response.  This is different from transfer timeout time and
+     essentially places a demand on the FTP server to acknowledge commands
+     in a timely manner. */
+  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
+#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
+
+  /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
+     tell libcurl to resolve names to those IP versions only. This only has
+     affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
+  CINIT(IPRESOLVE, LONG, 113),
+
+  /* Set this option to limit the size of a file that will be downloaded from
+     an HTTP or FTP server.
+
+     Note there is also _LARGE version which adds large file support for
+     platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */
+  CINIT(MAXFILESIZE, LONG, 114),
+
+  /* See the comment for INFILESIZE above, but in short, specifies
+   * the size of the file being uploaded.  -1 means unknown.
+   */
+  CINIT(INFILESIZE_LARGE, OFF_T, 115),
+
+  /* Sets the continuation offset.  There is also a LONG version of this;
+   * look above for RESUME_FROM.
+   */
+  CINIT(RESUME_FROM_LARGE, OFF_T, 116),
+
+  /* Sets the maximum size of data that will be downloaded from
+   * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.
+   */
+  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
+
+  /* Set this option to the file name of your .netrc file you want libcurl
+     to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
+     a poor attempt to find the user's home directory and check for a .netrc
+     file in there. */
+  CINIT(NETRC_FILE, OBJECTPOINT, 118),
+
+  /* Enable SSL/TLS for FTP, pick one of:
+     CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise
+     CURLUSESSL_CONTROL - SSL for the control connection or fail
+     CURLUSESSL_ALL     - SSL for all communication or fail
+  */
+  CINIT(USE_SSL, LONG, 119),
+
+  /* The _LARGE version of the standard POSTFIELDSIZE option */
+  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
+
+  /* Enable/disable the TCP Nagle algorithm */
+  CINIT(TCP_NODELAY, LONG, 121),
+
+  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
+  /* 123 OBSOLETE. Gone in 7.16.0 */
+  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
+  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
+  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
+  /* 127 OBSOLETE. Gone in 7.16.0 */
+  /* 128 OBSOLETE. Gone in 7.16.0 */
+
+  /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
+     can be used to change libcurl's default action which is to first try
+     "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
+     response has been received.
+
+     Available parameters are:
+     CURLFTPAUTH_DEFAULT - let libcurl decide
+     CURLFTPAUTH_SSL     - try "AUTH SSL" first, then TLS
+     CURLFTPAUTH_TLS     - try "AUTH TLS" first, then SSL
+  */
+  CINIT(FTPSSLAUTH, LONG, 129),
+
+  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
+  CINIT(IOCTLDATA, OBJECTPOINT, 131),
+
+  /* 132 OBSOLETE. Gone in 7.16.0 */
+  /* 133 OBSOLETE. Gone in 7.16.0 */
+
+  /* zero terminated string for pass on to the FTP server when asked for
+     "account" info */
+  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
+
+  /* feed cookies into cookie engine */
+  CINIT(COOKIELIST, OBJECTPOINT, 135),
+
+  /* ignore Content-Length */
+  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
+
+  /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
+     response. Typically used for FTP-SSL purposes but is not restricted to
+     that. libcurl will then instead use the same IP address it used for the
+     control connection. */
+  CINIT(FTP_SKIP_PASV_IP, LONG, 137),
+
+  /* Select "file method" to use when doing FTP, see the curl_ftpmethod
+     above. */
+  CINIT(FTP_FILEMETHOD, LONG, 138),
+
+  /* Local port number to bind the socket to */
+  CINIT(LOCALPORT, LONG, 139),
+
+  /* Number of ports to try, including the first one set with LOCALPORT.
+     Thus, setting it to 1 will make no additional attempts but the first.
+  */
+  CINIT(LOCALPORTRANGE, LONG, 140),
+
+  /* no transfer, set up connection and let application use the socket by
+     extracting it with CURLINFO_LASTSOCKET */
+  CINIT(CONNECT_ONLY, LONG, 141),
+
+  /* Function that will be called to convert from the
+     network encoding (instead of using the iconv calls in libcurl) */
+  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
+
+  /* Function that will be called to convert to the
+     network encoding (instead of using the iconv calls in libcurl) */
+  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
+
+  /* Function that will be called to convert from UTF8
+     (instead of using the iconv calls in libcurl)
+     Note that this is used only for SSL certificate processing */
+  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
+
+  /* if the connection proceeds too quickly then need to slow it down */
+  /* limit-rate: maximum number of bytes per second to send or receive */
+  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
+  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
+
+  /* Pointer to command string to send if USER/PASS fails. */
+  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
+
+  /* callback function for setting socket options */
+  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
+  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
+
+  /* set to 0 to disable session ID re-use for this transfer, default is
+     enabled (== 1) */
+  CINIT(SSL_SESSIONID_CACHE, LONG, 150),
+
+  /* allowed SSH authentication methods */
+  CINIT(SSH_AUTH_TYPES, LONG, 151),
+
+  /* Used by scp/sftp to do public/private key authentication */
+  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
+  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
+
+  /* Send CCC (Clear Command Channel) after authentication */
+  CINIT(FTP_SSL_CCC, LONG, 154),
+
+  /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
+  CINIT(TIMEOUT_MS, LONG, 155),
+  CINIT(CONNECTTIMEOUT_MS, LONG, 156),
+
+  /* set to zero to disable the libcurl's decoding and thus pass the raw body
+     data to the application even when it is encoded/compressed */
+  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
+  CINIT(HTTP_CONTENT_DECODING, LONG, 158),
+
+  /* Permission used when creating new files and directories on the remote
+     server for protocols that support it, SFTP/SCP/FILE */
+  CINIT(NEW_FILE_PERMS, LONG, 159),
+  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
+
+  /* Set the behaviour of POST when redirecting. Values must be set to one
+     of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
+  CINIT(POSTREDIR, LONG, 161),
+
+  /* used by scp/sftp to verify the host's public key */
+  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
+
+  /* Callback function for opening socket (instead of socket(2)). Optionally,
+     callback is able change the address or refuse to connect returning
+     CURL_SOCKET_BAD.  The callback should have type
+     curl_opensocket_callback */
+  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
+  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
+
+  /* POST volatile input fields. */
+  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
+
+  /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
+  CINIT(PROXY_TRANSFER_MODE, LONG, 166),
+
+  /* Callback function for seeking in the input stream */
+  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
+  CINIT(SEEKDATA, OBJECTPOINT, 168),
+
+  /* CRL file */
+  CINIT(CRLFILE, OBJECTPOINT, 169),
+
+  /* Issuer certificate */
+  CINIT(ISSUERCERT, OBJECTPOINT, 170),
+
+  /* (IPv6) Address scope */
+  CINIT(ADDRESS_SCOPE, LONG, 171),
+
+  /* Collect certificate chain info and allow it to get retrievable with
+     CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
+     working with OpenSSL-powered builds. */
+  CINIT(CERTINFO, LONG, 172),
+
+  /* "name" and "pwd" to use when fetching. */
+  CINIT(USERNAME, OBJECTPOINT, 173),
+  CINIT(PASSWORD, OBJECTPOINT, 174),
+
+    /* "name" and "pwd" to use with Proxy when fetching. */
+  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
+  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
+
+  /* Comma separated list of hostnames defining no-proxy zones. These should
+     match both hostnames directly, and hostnames within a domain. For
+     example, local.com will match local.com and www.local.com, but NOT
+     notlocal.com or www.notlocal.com. For compatibility with other
+     implementations of this, .local.com will be considered to be the same as
+     local.com. A single * is the only valid wildcard, and effectively
+     disables the use of proxy. */
+  CINIT(NOPROXY, OBJECTPOINT, 177),
+
+  /* block size for TFTP transfers */
+  CINIT(TFTP_BLKSIZE, LONG, 178),
+
+  /* Socks Service */
+  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),
+
+  /* Socks Service */
+  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
+
+  /* set the bitmask for the protocols that are allowed to be used for the
+     transfer, which thus helps the app which takes URLs from users or other
+     external inputs and want to restrict what protocol(s) to deal
+     with. Defaults to CURLPROTO_ALL. */
+  CINIT(PROTOCOLS, LONG, 181),
+
+  /* set the bitmask for the protocols that libcurl is allowed to follow to,
+     as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
+     to be set in both bitmasks to be allowed to get redirected to. Defaults
+     to all protocols except FILE and SCP. */
+  CINIT(REDIR_PROTOCOLS, LONG, 182),
+
+  /* set the SSH knownhost file name to use */
+  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),
+
+  /* set the SSH host key callback, must point to a curl_sshkeycallback
+     function */
+  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
+
+  /* set the SSH host key callback custom pointer */
+  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
+
+  /* set the SMTP mail originator */
+  CINIT(MAIL_FROM, OBJECTPOINT, 186),
+
+  /* set the SMTP mail receiver(s) */
+  CINIT(MAIL_RCPT, OBJECTPOINT, 187),
+
+  /* FTP: send PRET before PASV */
+  CINIT(FTP_USE_PRET, LONG, 188),
+
+  /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
+  CINIT(RTSP_REQUEST, LONG, 189),
+
+  /* The RTSP session identifier */
+  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),
+
+  /* The RTSP stream URI */
+  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),
+
+  /* The Transport: header to use in RTSP requests */
+  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),
+
+  /* Manually initialize the client RTSP CSeq for this handle */
+  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
+
+  /* Manually initialize the server RTSP CSeq for this handle */
+  CINIT(RTSP_SERVER_CSEQ, LONG, 194),
+
+  /* The stream to pass to INTERLEAVEFUNCTION. */
+  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
+
+  /* Let the application define a custom write method for RTP data */
+  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
+
+  /* Turn on wildcard matching */
+  CINIT(WILDCARDMATCH, LONG, 197),
+
+  /* Directory matching callback called before downloading of an
+     individual file (chunk) started */
+  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
+
+  /* Directory matching callback called after the file (chunk)
+     was downloaded, or skipped */
+  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
+
+  /* Change match (fnmatch-like) callback for wildcard matching */
+  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
+
+  /* Let the application define custom chunk data pointer */
+  CINIT(CHUNK_DATA, OBJECTPOINT, 201),
+
+  /* FNMATCH_FUNCTION user pointer */
+  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
+
+  /* send linked-list of name:port:address sets */
+  CINIT(RESOLVE, OBJECTPOINT, 203),
+
+  /* Set a username for authenticated TLS */
+  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),
+
+  /* Set a password for authenticated TLS */
+  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),
+
+  /* Set authentication type for authenticated TLS */
+  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),
+
+  /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
+     compressed transfer-encoded responses. Set to 0 to disable the use of TE:
+     in outgoing requests. The current default is 0, but it might change in a
+     future libcurl release.
+
+     libcurl will ask for the compressed methods it knows of, and if that
+     isn't any, it will not ask for transfer-encoding at all even if this
+     option is set to 1.
+
+  */
+  CINIT(TRANSFER_ENCODING, LONG, 207),
+
+  /* Callback function for closing socket (instead of close(2)). The callback
+     should have type curl_closesocket_callback */
+  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
+  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
+
+  /* allow GSSAPI credential delegation */
+  CINIT(GSSAPI_DELEGATION, LONG, 210),
+
+  /* Set the name servers to use for DNS resolution */
+  CINIT(DNS_SERVERS, OBJECTPOINT, 211),
+
+  /* Time-out accept operations (currently for FTP only) after this amount
+     of miliseconds. */
+  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
+
+  /* Set TCP keepalive */
+  CINIT(TCP_KEEPALIVE, LONG, 213),
+
+  /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
+  CINIT(TCP_KEEPIDLE, LONG, 214),
+  CINIT(TCP_KEEPINTVL, LONG, 215),
+
+  /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
+  CINIT(SSL_OPTIONS, LONG, 216),
+
+  /* set the SMTP auth originator */
+  CINIT(MAIL_AUTH, OBJECTPOINT, 217),
+
+  CURLOPT_LASTENTRY /* the last unused */
+} CURLoption;
+
+#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
+                          the obsolete stuff removed! */
+
+/* Backwards compatibility with older names */
+/* These are scheduled to disappear by 2011 */
+
+/* This was added in version 7.19.1 */
+#define CURLOPT_POST301 CURLOPT_POSTREDIR
+
+/* These are scheduled to disappear by 2009 */
+
+/* The following were added in 7.17.0 */
+#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
+#define CURLOPT_FTPAPPEND CURLOPT_APPEND
+#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
+#define CURLOPT_FTP_SSL CURLOPT_USE_SSL
+
+/* The following were added earlier */
+
+#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
+#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
+
+#else
+/* This is set if CURL_NO_OLDIES is defined at compile-time */
+#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
+#endif
+
+
+  /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
+     name resolves addresses using more than one IP protocol version, this
+     option might be handy to force libcurl to use a specific IP version. */
+#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
+                                     versions that your system allows */
+#define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */
+#define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */
+
+  /* three convenient "aliases" that follow the name scheme better */
+#define CURLOPT_WRITEDATA CURLOPT_FILE
+#define CURLOPT_READDATA  CURLOPT_INFILE
+#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
+#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
+
+  /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
+enum {
+  CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
+                             like the library to choose the best possible
+                             for us! */
+  CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */
+  CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */
+
+  CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
+};
+
+/*
+ * Public API enums for RTSP requests
+ */
+enum {
+    CURL_RTSPREQ_NONE, /* first in list */
+    CURL_RTSPREQ_OPTIONS,
+    CURL_RTSPREQ_DESCRIBE,
+    CURL_RTSPREQ_ANNOUNCE,
+    CURL_RTSPREQ_SETUP,
+    CURL_RTSPREQ_PLAY,
+    CURL_RTSPREQ_PAUSE,
+    CURL_RTSPREQ_TEARDOWN,
+    CURL_RTSPREQ_GET_PARAMETER,
+    CURL_RTSPREQ_SET_PARAMETER,
+    CURL_RTSPREQ_RECORD,
+    CURL_RTSPREQ_RECEIVE,
+    CURL_RTSPREQ_LAST /* last in list */
+};
+
+  /* These enums are for use with the CURLOPT_NETRC option. */
+enum CURL_NETRC_OPTION {
+  CURL_NETRC_IGNORED,     /* The .netrc will never be read.
+                           * This is the default. */
+  CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred
+                           * to one in the .netrc. */
+  CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.
+                           * Unless one is set programmatically, the .netrc
+                           * will be queried. */
+  CURL_NETRC_LAST
+};
+
+enum {
+  CURL_SSLVERSION_DEFAULT,
+  CURL_SSLVERSION_TLSv1,
+  CURL_SSLVERSION_SSLv2,
+  CURL_SSLVERSION_SSLv3,
+
+  CURL_SSLVERSION_LAST /* never use, keep last */
+};
+
+enum CURL_TLSAUTH {
+  CURL_TLSAUTH_NONE,
+  CURL_TLSAUTH_SRP,
+  CURL_TLSAUTH_LAST /* never use, keep last */
+};
+
+/* symbols to use with CURLOPT_POSTREDIR.
+   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
+   can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
+   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
+
+#define CURL_REDIR_GET_ALL  0
+#define CURL_REDIR_POST_301 1
+#define CURL_REDIR_POST_302 2
+#define CURL_REDIR_POST_303 4
+#define CURL_REDIR_POST_ALL \
+    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
+
+typedef enum {
+  CURL_TIMECOND_NONE,
+
+  CURL_TIMECOND_IFMODSINCE,
+  CURL_TIMECOND_IFUNMODSINCE,
+  CURL_TIMECOND_LASTMOD,
+
+  CURL_TIMECOND_LAST
+} curl_TimeCond;
+
+
+/* curl_strequal() and curl_strnequal() are subject for removal in a future
+   libcurl, see lib/README.curlx for details */
+CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
+CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
+
+/* name is uppercase CURLFORM_<name> */
+#ifdef CFINIT
+#undef CFINIT
+#endif
+
+#ifdef CURL_ISOCPP
+#define CFINIT(name) CURLFORM_ ## name
+#else
+/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
+#define CFINIT(name) CURLFORM_/**/name
+#endif
+
+typedef enum {
+  CFINIT(NOTHING),        /********* the first one is unused ************/
+
+  /*  */
+  CFINIT(COPYNAME),
+  CFINIT(PTRNAME),
+  CFINIT(NAMELENGTH),
+  CFINIT(COPYCONTENTS),
+  CFINIT(PTRCONTENTS),
+  CFINIT(CONTENTSLENGTH),
+  CFINIT(FILECONTENT),
+  CFINIT(ARRAY),
+  CFINIT(OBSOLETE),
+  CFINIT(FILE),
+
+  CFINIT(BUFFER),
+  CFINIT(BUFFERPTR),
+  CFINIT(BUFFERLENGTH),
+
+  CFINIT(CONTENTTYPE),
+  CFINIT(CONTENTHEADER),
+  CFINIT(FILENAME),
+  CFINIT(END),
+  CFINIT(OBSOLETE2),
+
+  CFINIT(STREAM),
+
+  CURLFORM_LASTENTRY /* the last unused */
+} CURLformoption;
+
+#undef CFINIT /* done */
+
+/* structure to be used as parameter for CURLFORM_ARRAY */
+struct curl_forms {
+  CURLformoption option;
+  const char     *value;
+};
+
+/* use this for multipart formpost building */
+/* Returns code for curl_formadd()
+ *
+ * Returns:
+ * CURL_FORMADD_OK             on success
+ * CURL_FORMADD_MEMORY         if the FormInfo allocation fails
+ * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form
+ * CURL_FORMADD_NULL           if a null pointer was given for a char
+ * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed
+ * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
+ * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)
+ * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated
+ * CURL_FORMADD_MEMORY         if some allocation for string copying failed.
+ * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array
+ *
+ ***************************************************************************/
+typedef enum {
+  CURL_FORMADD_OK, /* first, no error */
+
+  CURL_FORMADD_MEMORY,
+  CURL_FORMADD_OPTION_TWICE,
+  CURL_FORMADD_NULL,
+  CURL_FORMADD_UNKNOWN_OPTION,
+  CURL_FORMADD_INCOMPLETE,
+  CURL_FORMADD_ILLEGAL_ARRAY,
+  CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
+
+  CURL_FORMADD_LAST /* last */
+} CURLFORMcode;
+
+/*
+ * NAME curl_formadd()
+ *
+ * DESCRIPTION
+ *
+ * Pretty advanced function for building multi-part formposts. Each invoke
+ * adds one part that together construct a full post. Then use
+ * CURLOPT_HTTPPOST to send it off to libcurl.
+ */
+CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
+                                      struct curl_httppost **last_post,
+                                      ...);
+
+/*
+ * callback function for curl_formget()
+ * The void *arg pointer will be the one passed as second argument to
+ *   curl_formget().
+ * The character buffer passed to it must not be freed.
+ * Should return the buffer length passed to it as the argument "len" on
+ *   success.
+ */
+typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
+                                        size_t len);
+
+/*
+ * NAME curl_formget()
+ *
+ * DESCRIPTION
+ *
+ * Serialize a curl_httppost struct built with curl_formadd().
+ * Accepts a void pointer as second argument which will be passed to
+ * the curl_formget_callback function.
+ * Returns 0 on success.
+ */
+CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
+                             curl_formget_callback append);
+/*
+ * NAME curl_formfree()
+ *
+ * DESCRIPTION
+ *
+ * Free a multipart formpost previously built with curl_formadd().
+ */
+CURL_EXTERN void curl_formfree(struct curl_httppost *form);
+
+/*
+ * NAME curl_getenv()
+ *
+ * DESCRIPTION
+ *
+ * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
+ * complete. DEPRECATED - see lib/README.curlx
+ */
+CURL_EXTERN char *curl_getenv(const char *variable);
+
+/*
+ * NAME curl_version()
+ *
+ * DESCRIPTION
+ *
+ * Returns a static ascii string of the libcurl version.
+ */
+CURL_EXTERN char *curl_version(void);
+
+/*
+ * NAME curl_easy_escape()
+ *
+ * DESCRIPTION
+ *
+ * Escapes URL strings (converts all letters consider illegal in URLs to their
+ * %XX versions). This function returns a new allocated string or NULL if an
+ * error occurred.
+ */
+CURL_EXTERN char *curl_easy_escape(CURL *handle,
+                                   const char *string,
+                                   int length);
+
+/* the previous version: */
+CURL_EXTERN char *curl_escape(const char *string,
+                              int length);
+
+
+/*
+ * NAME curl_easy_unescape()
+ *
+ * DESCRIPTION
+ *
+ * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
+ * versions). This function returns a new allocated string or NULL if an error
+ * occurred.
+ * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
+ * converted into the host encoding.
+ */
+CURL_EXTERN char *curl_easy_unescape(CURL *handle,
+                                     const char *string,
+                                     int length,
+                                     int *outlength);
+
+/* the previous version */
+CURL_EXTERN char *curl_unescape(const char *string,
+                                int length);
+
+/*
+ * NAME curl_free()
+ *
+ * DESCRIPTION
+ *
+ * Provided for de-allocation in the same translation unit that did the
+ * allocation. Added in libcurl 7.10
+ */
+CURL_EXTERN void curl_free(void *p);
+
+/*
+ * NAME curl_global_init()
+ *
+ * DESCRIPTION
+ *
+ * curl_global_init() should be invoked exactly once for each application that
+ * uses libcurl and before any call of other libcurl functions.
+ *
+ * This function is not thread-safe!
+ */
+CURL_EXTERN CURLcode curl_global_init(long flags);
+
+/*
+ * NAME curl_global_init_mem()
+ *
+ * DESCRIPTION
+ *
+ * curl_global_init() or curl_global_init_mem() should be invoked exactly once
+ * for each application that uses libcurl.  This function can be used to
+ * initialize libcurl and set user defined memory management callback
+ * functions.  Users can implement memory management routines to check for
+ * memory leaks, check for mis-use of the curl library etc.  User registered
+ * callback routines with be invoked by this library instead of the system
+ * memory management routines like malloc, free etc.
+ */
+CURL_EXTERN CURLcode curl_global_init_mem(long flags,
+                                          curl_malloc_callback m,
+                                          curl_free_callback f,
+                                          curl_realloc_callback r,
+                                          curl_strdup_callback s,
+                                          curl_calloc_callback c);
+
+/*
+ * NAME curl_global_cleanup()
+ *
+ * DESCRIPTION
+ *
+ * curl_global_cleanup() should be invoked exactly once for each application
+ * that uses libcurl
+ */
+CURL_EXTERN void curl_global_cleanup(void);
+
+/* linked-list structure for the CURLOPT_QUOTE option (and other) */
+struct curl_slist {
+  char *data;
+  struct curl_slist *next;
+};
+
+/*
+ * NAME curl_slist_append()
+ *
+ * DESCRIPTION
+ *
+ * Appends a string to a linked list. If no list exists, it will be created
+ * first. Returns the new list, after appending.
+ */
+CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
+                                                 const char *);
+
+/*
+ * NAME curl_slist_free_all()
+ *
+ * DESCRIPTION
+ *
+ * free a previously built curl_slist.
+ */
+CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
+
+/*
+ * NAME curl_getdate()
+ *
+ * DESCRIPTION
+ *
+ * Returns the time, in seconds since 1 Jan 1970 of the time string given in
+ * the first argument. The time argument in the second parameter is unused
+ * and should be set to NULL.
+ */
+CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
+
+/* info about the certificate chain, only for OpenSSL builds. Asked
+   for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
+struct curl_certinfo {
+  int num_of_certs;             /* number of certificates with information */
+  struct curl_slist **certinfo; /* for each index in this array, there's a
+                                   linked list with textual information in the
+                                   format "name: value" */
+};
+
+#define CURLINFO_STRING   0x100000
+#define CURLINFO_LONG     0x200000
+#define CURLINFO_DOUBLE   0x300000
+#define CURLINFO_SLIST    0x400000
+#define CURLINFO_MASK     0x0fffff
+#define CURLINFO_TYPEMASK 0xf00000
+
+typedef enum {
+  CURLINFO_NONE, /* first, never use this */
+  CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,
+  CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,
+  CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,
+  CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,
+  CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,
+  CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
+  CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,
+  CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,
+  CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,
+  CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,
+  CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,
+  CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,
+  CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,
+  CURLINFO_FILETIME         = CURLINFO_LONG   + 14,
+  CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,
+  CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,
+  CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
+  CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,
+  CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,
+  CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,
+  CURLINFO_PRIVATE          = CURLINFO_STRING + 21,
+  CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,
+  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,
+  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
+  CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,
+  CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,
+  CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,
+  CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,
+  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,
+  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,
+  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,
+  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,
+  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
+  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
+  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
+  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,
+  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,
+  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,
+  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,
+  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,
+  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,
+  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,
+  /* Fill in new entries below here! */
+
+  CURLINFO_LASTONE          = 42
+} CURLINFO;
+
+/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
+   CURLINFO_HTTP_CODE */
+#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
+
+typedef enum {
+  CURLCLOSEPOLICY_NONE, /* first, never use this */
+
+  CURLCLOSEPOLICY_OLDEST,
+  CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
+  CURLCLOSEPOLICY_LEAST_TRAFFIC,
+  CURLCLOSEPOLICY_SLOWEST,
+  CURLCLOSEPOLICY_CALLBACK,
+
+  CURLCLOSEPOLICY_LAST /* last, never use this */
+} curl_closepolicy;
+
+#define CURL_GLOBAL_SSL (1<<0)
+#define CURL_GLOBAL_WIN32 (1<<1)
+#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
+#define CURL_GLOBAL_NOTHING 0
+#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
+#define CURL_GLOBAL_ACK_EINTR (1<<2)
+
+
+/*****************************************************************************
+ * Setup defines, protos etc for the sharing stuff.
+ */
+
+/* Different data locks for a single share */
+typedef enum {
+  CURL_LOCK_DATA_NONE = 0,
+  /*  CURL_LOCK_DATA_SHARE is used internally to say that
+   *  the locking is just made to change the internal state of the share
+   *  itself.
+   */
+  CURL_LOCK_DATA_SHARE,
+  CURL_LOCK_DATA_COOKIE,
+  CURL_LOCK_DATA_DNS,
+  CURL_LOCK_DATA_SSL_SESSION,
+  CURL_LOCK_DATA_CONNECT,
+  CURL_LOCK_DATA_LAST
+} curl_lock_data;
+
+/* Different lock access types */
+typedef enum {
+  CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */
+  CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
+  CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
+  CURL_LOCK_ACCESS_LAST        /* never use */
+} curl_lock_access;
+
+typedef void (*curl_lock_function)(CURL *handle,
+                                   curl_lock_data data,
+                                   curl_lock_access locktype,
+                                   void *userptr);
+typedef void (*curl_unlock_function)(CURL *handle,
+                                     curl_lock_data data,
+                                     void *userptr);
+
+typedef void CURLSH;
+
+typedef enum {
+  CURLSHE_OK,  /* all is fine */
+  CURLSHE_BAD_OPTION, /* 1 */
+  CURLSHE_IN_USE,     /* 2 */
+  CURLSHE_INVALID,    /* 3 */
+  CURLSHE_NOMEM,      /* 4 out of memory */
+  CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
+  CURLSHE_LAST        /* never use */
+} CURLSHcode;
+
+typedef enum {
+  CURLSHOPT_NONE,  /* don't use */
+  CURLSHOPT_SHARE,   /* specify a data type to share */
+  CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
+  CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */
+  CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
+  CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock
+                           callback functions */
+  CURLSHOPT_LAST  /* never use */
+} CURLSHoption;
+
+CURL_EXTERN CURLSH *curl_share_init(void);
+CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
+CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
+
+/****************************************************************************
+ * Structures for querying information about the curl library at runtime.
+ */
+
+typedef enum {
+  CURLVERSION_FIRST,
+  CURLVERSION_SECOND,
+  CURLVERSION_THIRD,
+  CURLVERSION_FOURTH,
+  CURLVERSION_LAST /* never actually use this */
+} CURLversion;
+
+/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
+   basically all programs ever that want to get version information. It is
+   meant to be a built-in version number for what kind of struct the caller
+   expects. If the struct ever changes, we redefine the NOW to another enum
+   from above. */
+#define CURLVERSION_NOW CURLVERSION_FOURTH
+
+typedef struct {
+  CURLversion age;          /* age of the returned struct */
+  const char *version;      /* LIBCURL_VERSION */
+  unsigned int version_num; /* LIBCURL_VERSION_NUM */
+  const char *host;         /* OS/host/cpu/machine when configured */
+  int features;             /* bitmask, see defines below */
+  const char *ssl_version;  /* human readable string */
+  long ssl_version_num;     /* not used anymore, always 0 */
+  const char *libz_version; /* human readable string */
+  /* protocols is terminated by an entry with a NULL protoname */
+  const char * const *protocols;
+
+  /* The fields below this were added in CURLVERSION_SECOND */
+  const char *ares;
+  int ares_num;
+
+  /* This field was added in CURLVERSION_THIRD */
+  const char *libidn;
+
+  /* These field were added in CURLVERSION_FOURTH */
+
+  /* Same as '_libiconv_version' if built with HAVE_ICONV */
+  int iconv_ver_num;
+
+  const char *libssh_version; /* human readable string */
+
+} curl_version_info_data;
+
+#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */
+#define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */
+#define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */
+#define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */
+#define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */
+#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
+#define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */
+#define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */
+#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */
+#define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */
+#define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */
+#define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */
+#define CURL_VERSION_CONV      (1<<12) /* character conversions supported */
+#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
+#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
+#define CURL_VERSION_NTLM_WB   (1<<15) /* NTLM delegating to winbind helper */
+
+ /*
+ * NAME curl_version_info()
+ *
+ * DESCRIPTION
+ *
+ * This function returns a pointer to a static copy of the version info
+ * struct. See above.
+ */
+CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
+
+/*
+ * NAME curl_easy_strerror()
+ *
+ * DESCRIPTION
+ *
+ * The curl_easy_strerror function may be used to turn a CURLcode value
+ * into the equivalent human readable error string.  This is useful
+ * for printing meaningful error messages.
+ */
+CURL_EXTERN const char *curl_easy_strerror(CURLcode);
+
+/*
+ * NAME curl_share_strerror()
+ *
+ * DESCRIPTION
+ *
+ * The curl_share_strerror function may be used to turn a CURLSHcode value
+ * into the equivalent human readable error string.  This is useful
+ * for printing meaningful error messages.
+ */
+CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
+
+/*
+ * NAME curl_easy_pause()
+ *
+ * DESCRIPTION
+ *
+ * The curl_easy_pause function pauses or unpauses transfers. Select the new
+ * state by setting the bitmask, use the convenience defines below.
+ *
+ */
+CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
+
+#define CURLPAUSE_RECV      (1<<0)
+#define CURLPAUSE_RECV_CONT (0)
+
+#define CURLPAUSE_SEND      (1<<2)
+#define CURLPAUSE_SEND_CONT (0)
+
+#define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)
+#define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
+
+#ifdef  __cplusplus
+}
+#endif
+
+/* unfortunately, the easy.h and multi.h include files need options and info
+  stuff before they can be included! */
+#include "easy.h" /* nothing in curl is fun without the easy stuff */
+#include "multi.h"
+
+/* the typechecker doesn't work in C++ (yet) */
+#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
+    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
+    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
+#include "typecheck-gcc.h"
+#else
+#if defined(__STDC__) && (__STDC__ >= 1)
+/* This preprocessor magic that replaces a call with the exact same call is
+   only done to make sure application authors pass exactly three arguments
+   to these functions. */
+#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
+#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
+#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
+#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
+#endif /* __STDC__ >= 1 */
+#endif /* gcc >= 4.3 && !__cplusplus */
+
+#endif /* __CURL_CURL_H */
diff --git a/Network/CURL000/curl-7.30.0/curlbuild.h b/Network/CURL000/curl-7.30.0/curlbuild.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/curlbuild.h
@@ -0,0 +1,585 @@
+#ifndef __CURL_CURLBUILD_H
+#define __CURL_CURLBUILD_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/* ================================================================ */
+/*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * See file include/curl/curlbuild.h.in, run configure, and forget
+ * that this file exists it is only used for non-configure systems.
+ * But you can keep reading if you want ;-)
+ *
+ */
+
+/* ================================================================ */
+/*                 NOTES FOR NON-CONFIGURE SYSTEMS                  */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * Nothing in this file is intended to be modified or adjusted by the
+ * curl library user nor by the curl library builder.
+ *
+ * If you think that something actually needs to be changed, adjusted
+ * or fixed in this file, then, report it on the libcurl development
+ * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
+ *
+ * Try to keep one section per platform, compiler and architecture,
+ * otherwise, if an existing section is reused for a different one and
+ * later on the original is adjusted, probably the piggybacking one can
+ * be adversely changed.
+ *
+ * In order to differentiate between platforms/compilers/architectures
+ * use only compiler built in predefined preprocessor symbols.
+ *
+ * This header file shall only export symbols which are 'curl' or 'CURL'
+ * prefixed, otherwise public name space would be polluted.
+ *
+ * NOTE 2:
+ * -------
+ *
+ * For any given platform/compiler curl_off_t must be typedef'ed to a
+ * 64-bit wide signed integral data type. The width of this data type
+ * must remain constant and independent of any possible large file
+ * support settings.
+ *
+ * As an exception to the above, curl_off_t shall be typedef'ed to a
+ * 32-bit wide signed integral data type if there is no 64-bit type.
+ *
+ * As a general rule, curl_off_t shall not be mapped to off_t. This
+ * rule shall only be violated if off_t is the only 64-bit data type
+ * available and the size of off_t is independent of large file support
+ * settings. Keep your build on the safe side avoiding an off_t gating.
+ * If you have a 64-bit off_t then take for sure that another 64-bit
+ * data type exists, dig deeper and you will find it.
+ *
+ * NOTE 3:
+ * -------
+ *
+ * Right now you might be staring at file include/curl/curlbuild.h.dist or
+ * at file include/curl/curlbuild.h, this is due to the following reason:
+ * file include/curl/curlbuild.h.dist is renamed to include/curl/curlbuild.h
+ * when the libcurl source code distribution archive file is created.
+ *
+ * File include/curl/curlbuild.h.dist is not included in the distribution
+ * archive. File include/curl/curlbuild.h is not present in the git tree.
+ *
+ * The distributed include/curl/curlbuild.h file is only intended to be used
+ * on systems which can not run the also distributed configure script.
+ *
+ * On systems capable of running the configure script, the configure process
+ * will overwrite the distributed include/curl/curlbuild.h file with one that
+ * is suitable and specific to the library being configured and built, which
+ * is generated from the include/curl/curlbuild.h.in template file.
+ *
+ * If you check out from git on a non-configure platform, you must run the
+ * appropriate buildconf* script to set up curlbuild.h and other local files.
+ *
+ */
+
+/* ================================================================ */
+/*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */
+/* ================================================================ */
+
+#ifdef CURL_SIZEOF_LONG
+#  error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
+#endif
+
+#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
+#  error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
+#endif
+
+#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
+#  error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
+#endif
+
+#ifdef CURL_TYPEOF_CURL_OFF_T
+#  error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
+#endif
+
+#ifdef CURL_FORMAT_CURL_OFF_T
+#  error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
+#endif
+
+#ifdef CURL_FORMAT_CURL_OFF_TU
+#  error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
+#endif
+
+#ifdef CURL_FORMAT_OFF_T
+#  error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
+#endif
+
+#ifdef CURL_SIZEOF_CURL_OFF_T
+#  error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
+#endif
+
+#ifdef CURL_SUFFIX_CURL_OFF_T
+#  error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
+#endif
+
+#ifdef CURL_SUFFIX_CURL_OFF_TU
+#  error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
+   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
+#endif
+
+/* ================================================================ */
+/*    EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY    */
+/* ================================================================ */
+
+#if defined(__DJGPP__) || defined(__GO32__)
+#  if defined(__DJGPP__) && (__DJGPP__ > 1)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long long
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  else
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_FORMAT_OFF_T          "%ld"
+#    define CURL_SIZEOF_CURL_OFF_T     4
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__SALFORDC__)
+#  define CURL_SIZEOF_LONG           4
+#  define CURL_TYPEOF_CURL_OFF_T     long
+#  define CURL_FORMAT_CURL_OFF_T     "ld"
+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
+#  define CURL_FORMAT_OFF_T          "%ld"
+#  define CURL_SIZEOF_CURL_OFF_T     4
+#  define CURL_SUFFIX_CURL_OFF_T     L
+#  define CURL_SUFFIX_CURL_OFF_TU    UL
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__BORLANDC__)
+#  if (__BORLANDC__ < 0x520)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_FORMAT_OFF_T          "%ld"
+#    define CURL_SIZEOF_CURL_OFF_T     4
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#  else
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     __int64
+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
+#    define CURL_FORMAT_OFF_T          "%I64d"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     i64
+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__TURBOC__)
+#  define CURL_SIZEOF_LONG           4
+#  define CURL_TYPEOF_CURL_OFF_T     long
+#  define CURL_FORMAT_CURL_OFF_T     "ld"
+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
+#  define CURL_FORMAT_OFF_T          "%ld"
+#  define CURL_SIZEOF_CURL_OFF_T     4
+#  define CURL_SUFFIX_CURL_OFF_T     L
+#  define CURL_SUFFIX_CURL_OFF_TU    UL
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__WATCOMC__)
+#  if defined(__386__)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     __int64
+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
+#    define CURL_FORMAT_OFF_T          "%I64d"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     i64
+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
+#  else
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_FORMAT_OFF_T          "%ld"
+#    define CURL_SIZEOF_CURL_OFF_T     4
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__POCC__)
+#  if (__POCC__ < 280)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_FORMAT_OFF_T          "%ld"
+#    define CURL_SIZEOF_CURL_OFF_T     4
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#  elif defined(_MSC_VER)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     __int64
+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
+#    define CURL_FORMAT_OFF_T          "%I64d"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     i64
+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
+#  else
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long long
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__LCC__)
+#  define CURL_SIZEOF_LONG           4
+#  define CURL_TYPEOF_CURL_OFF_T     long
+#  define CURL_FORMAT_CURL_OFF_T     "ld"
+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
+#  define CURL_FORMAT_OFF_T          "%ld"
+#  define CURL_SIZEOF_CURL_OFF_T     4
+#  define CURL_SUFFIX_CURL_OFF_T     L
+#  define CURL_SUFFIX_CURL_OFF_TU    UL
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__SYMBIAN32__)
+#  if defined(__EABI__)  /* Treat all ARM compilers equally */
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long long
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  elif defined(__CW32__)
+#    pragma longlong on
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long long
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  elif defined(__VC32__)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     __int64
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__MWERKS__)
+#  define CURL_SIZEOF_LONG           4
+#  define CURL_TYPEOF_CURL_OFF_T     long long
+#  define CURL_FORMAT_CURL_OFF_T     "lld"
+#  define CURL_FORMAT_CURL_OFF_TU    "llu"
+#  define CURL_FORMAT_OFF_T          "%lld"
+#  define CURL_SIZEOF_CURL_OFF_T     8
+#  define CURL_SUFFIX_CURL_OFF_T     LL
+#  define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(_WIN32_WCE)
+#  define CURL_SIZEOF_LONG           4
+#  define CURL_TYPEOF_CURL_OFF_T     __int64
+#  define CURL_FORMAT_CURL_OFF_T     "I64d"
+#  define CURL_FORMAT_CURL_OFF_TU    "I64u"
+#  define CURL_FORMAT_OFF_T          "%I64d"
+#  define CURL_SIZEOF_CURL_OFF_T     8
+#  define CURL_SUFFIX_CURL_OFF_T     i64
+#  define CURL_SUFFIX_CURL_OFF_TU    ui64
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__MINGW32__)
+#  define CURL_SIZEOF_LONG           4
+#  define CURL_TYPEOF_CURL_OFF_T     long long
+#  define CURL_FORMAT_CURL_OFF_T     "I64d"
+#  define CURL_FORMAT_CURL_OFF_TU    "I64u"
+#  define CURL_FORMAT_OFF_T          "%I64d"
+#  define CURL_SIZEOF_CURL_OFF_T     8
+#  define CURL_SUFFIX_CURL_OFF_T     LL
+#  define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__VMS)
+#  if defined(__VAX)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_FORMAT_OFF_T          "%ld"
+#    define CURL_SIZEOF_CURL_OFF_T     4
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#  else
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long long
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+#elif defined(__OS400__)
+#  if defined(__ILEC400__)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long long
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
+#    define CURL_SIZEOF_CURL_SOCKLEN_T 4
+#    define CURL_PULL_SYS_TYPES_H      1
+#    define CURL_PULL_SYS_SOCKET_H     1
+#  endif
+
+#elif defined(__MVS__)
+#  if defined(__IBMC__) || defined(__IBMCPP__)
+#    if defined(_ILP32)
+#      define CURL_SIZEOF_LONG           4
+#    elif defined(_LP64)
+#      define CURL_SIZEOF_LONG           8
+#    endif
+#    if defined(_LONG_LONG)
+#      define CURL_TYPEOF_CURL_OFF_T     long long
+#      define CURL_FORMAT_CURL_OFF_T     "lld"
+#      define CURL_FORMAT_CURL_OFF_TU    "llu"
+#      define CURL_FORMAT_OFF_T          "%lld"
+#      define CURL_SIZEOF_CURL_OFF_T     8
+#      define CURL_SUFFIX_CURL_OFF_T     LL
+#      define CURL_SUFFIX_CURL_OFF_TU    ULL
+#    elif defined(_LP64)
+#      define CURL_TYPEOF_CURL_OFF_T     long
+#      define CURL_FORMAT_CURL_OFF_T     "ld"
+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
+#      define CURL_FORMAT_OFF_T          "%ld"
+#      define CURL_SIZEOF_CURL_OFF_T     8
+#      define CURL_SUFFIX_CURL_OFF_T     L
+#      define CURL_SUFFIX_CURL_OFF_TU    UL
+#    else
+#      define CURL_TYPEOF_CURL_OFF_T     long
+#      define CURL_FORMAT_CURL_OFF_T     "ld"
+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
+#      define CURL_FORMAT_OFF_T          "%ld"
+#      define CURL_SIZEOF_CURL_OFF_T     4
+#      define CURL_SUFFIX_CURL_OFF_T     L
+#      define CURL_SUFFIX_CURL_OFF_TU    UL
+#    endif
+#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
+#    define CURL_SIZEOF_CURL_SOCKLEN_T 4
+#    define CURL_PULL_SYS_TYPES_H      1
+#    define CURL_PULL_SYS_SOCKET_H     1
+#  endif
+
+#elif defined(__370__)
+#  if defined(__IBMC__) || defined(__IBMCPP__)
+#    if defined(_ILP32)
+#      define CURL_SIZEOF_LONG           4
+#    elif defined(_LP64)
+#      define CURL_SIZEOF_LONG           8
+#    endif
+#    if defined(_LONG_LONG)
+#      define CURL_TYPEOF_CURL_OFF_T     long long
+#      define CURL_FORMAT_CURL_OFF_T     "lld"
+#      define CURL_FORMAT_CURL_OFF_TU    "llu"
+#      define CURL_FORMAT_OFF_T          "%lld"
+#      define CURL_SIZEOF_CURL_OFF_T     8
+#      define CURL_SUFFIX_CURL_OFF_T     LL
+#      define CURL_SUFFIX_CURL_OFF_TU    ULL
+#    elif defined(_LP64)
+#      define CURL_TYPEOF_CURL_OFF_T     long
+#      define CURL_FORMAT_CURL_OFF_T     "ld"
+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
+#      define CURL_FORMAT_OFF_T          "%ld"
+#      define CURL_SIZEOF_CURL_OFF_T     8
+#      define CURL_SUFFIX_CURL_OFF_T     L
+#      define CURL_SUFFIX_CURL_OFF_TU    UL
+#    else
+#      define CURL_TYPEOF_CURL_OFF_T     long
+#      define CURL_FORMAT_CURL_OFF_T     "ld"
+#      define CURL_FORMAT_CURL_OFF_TU    "lu"
+#      define CURL_FORMAT_OFF_T          "%ld"
+#      define CURL_SIZEOF_CURL_OFF_T     4
+#      define CURL_SUFFIX_CURL_OFF_T     L
+#      define CURL_SUFFIX_CURL_OFF_TU    UL
+#    endif
+#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
+#    define CURL_SIZEOF_CURL_SOCKLEN_T 4
+#    define CURL_PULL_SYS_TYPES_H      1
+#    define CURL_PULL_SYS_SOCKET_H     1
+#  endif
+
+#elif defined(TPF)
+#  define CURL_SIZEOF_LONG           8
+#  define CURL_TYPEOF_CURL_OFF_T     long
+#  define CURL_FORMAT_CURL_OFF_T     "ld"
+#  define CURL_FORMAT_CURL_OFF_TU    "lu"
+#  define CURL_FORMAT_OFF_T          "%ld"
+#  define CURL_SIZEOF_CURL_OFF_T     8
+#  define CURL_SUFFIX_CURL_OFF_T     L
+#  define CURL_SUFFIX_CURL_OFF_TU    UL
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+/* ===================================== */
+/*    KEEP MSVC THE PENULTIMATE ENTRY    */
+/* ===================================== */
+
+#elif defined(_MSC_VER)
+#  if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     __int64
+#    define CURL_FORMAT_CURL_OFF_T     "I64d"
+#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
+#    define CURL_FORMAT_OFF_T          "%I64d"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     i64
+#    define CURL_SUFFIX_CURL_OFF_TU    ui64
+#  else
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_FORMAT_OFF_T          "%ld"
+#    define CURL_SIZEOF_CURL_OFF_T     4
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+
+/* ===================================== */
+/*    KEEP GENERIC GCC THE LAST ENTRY    */
+/* ===================================== */
+
+#elif defined(__GNUC__)
+#  if defined(__ILP32__) || \
+      defined(__i386__) || defined(__ppc__) || defined(__arm__)
+#    define CURL_SIZEOF_LONG           4
+#    define CURL_TYPEOF_CURL_OFF_T     long long
+#    define CURL_FORMAT_CURL_OFF_T     "lld"
+#    define CURL_FORMAT_CURL_OFF_TU    "llu"
+#    define CURL_FORMAT_OFF_T          "%lld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     LL
+#    define CURL_SUFFIX_CURL_OFF_TU    ULL
+#  elif defined(__LP64__) || \
+        defined(__x86_64__) || defined(__ppc64__)
+#    define CURL_SIZEOF_LONG           8
+#    define CURL_TYPEOF_CURL_OFF_T     long
+#    define CURL_FORMAT_CURL_OFF_T     "ld"
+#    define CURL_FORMAT_CURL_OFF_TU    "lu"
+#    define CURL_FORMAT_OFF_T          "%ld"
+#    define CURL_SIZEOF_CURL_OFF_T     8
+#    define CURL_SUFFIX_CURL_OFF_T     L
+#    define CURL_SUFFIX_CURL_OFF_TU    UL
+#  endif
+#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
+#  define CURL_SIZEOF_CURL_SOCKLEN_T 4
+#  define CURL_PULL_SYS_TYPES_H      1
+#  define CURL_PULL_SYS_SOCKET_H     1
+
+#else
+#  error "Unknown non-configure build target!"
+   Error Compilation_aborted_Unknown_non_configure_build_target
+#endif
+
+/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
+/* sys/types.h is required here to properly make type definitions below. */
+#ifdef CURL_PULL_SYS_TYPES_H
+#  include <sys/types.h>
+#endif
+
+/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */
+/* sys/socket.h is required here to properly make type definitions below. */
+#ifdef CURL_PULL_SYS_SOCKET_H
+#  include <sys/socket.h>
+#endif
+
+/* Data type definition of curl_socklen_t. */
+
+#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
+  typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
+#endif
+
+/* Data type definition of curl_off_t. */
+
+#ifdef CURL_TYPEOF_CURL_OFF_T
+  typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
+#endif
+
+#endif /* __CURL_CURLBUILD_H */
diff --git a/Network/CURL000/curl-7.30.0/curlrules.h b/Network/CURL000/curl-7.30.0/curlrules.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/curlrules.h
@@ -0,0 +1,262 @@
+#ifndef __CURL_CURLRULES_H
+#define __CURL_CURLRULES_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/* ================================================================ */
+/*                    COMPILE TIME SANITY CHECKS                    */
+/* ================================================================ */
+
+/*
+ * NOTE 1:
+ * -------
+ *
+ * All checks done in this file are intentionally placed in a public
+ * header file which is pulled by curl/curl.h when an application is
+ * being built using an already built libcurl library. Additionally
+ * this file is also included and used when building the library.
+ *
+ * If compilation fails on this file it is certainly sure that the
+ * problem is elsewhere. It could be a problem in the curlbuild.h
+ * header file, or simply that you are using different compilation
+ * settings than those used to build the library.
+ *
+ * Nothing in this file is intended to be modified or adjusted by the
+ * curl library user nor by the curl library builder.
+ *
+ * Do not deactivate any check, these are done to make sure that the
+ * library is properly built and used.
+ *
+ * You can find further help on the libcurl development mailing list:
+ * http://cool.haxx.se/mailman/listinfo/curl-library/
+ *
+ * NOTE 2
+ * ------
+ *
+ * Some of the following compile time checks are based on the fact
+ * that the dimension of a constant array can not be a negative one.
+ * In this way if the compile time verification fails, the compilation
+ * will fail issuing an error. The error description wording is compiler
+ * dependent but it will be quite similar to one of the following:
+ *
+ *   "negative subscript or subscript is too large"
+ *   "array must have at least one element"
+ *   "-1 is an illegal array size"
+ *   "size of array is negative"
+ *
+ * If you are building an application which tries to use an already
+ * built libcurl library and you are getting this kind of errors on
+ * this file, it is a clear indication that there is a mismatch between
+ * how the library was built and how you are trying to use it for your
+ * application. Your already compiled or binary library provider is the
+ * only one who can give you the details you need to properly use it.
+ */
+
+/*
+ * Verify that some macros are actually defined.
+ */
+
+#ifndef CURL_SIZEOF_LONG
+#  error "CURL_SIZEOF_LONG definition is missing!"
+   Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing
+#endif
+
+#ifndef CURL_TYPEOF_CURL_SOCKLEN_T
+#  error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
+   Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing
+#endif
+
+#ifndef CURL_SIZEOF_CURL_SOCKLEN_T
+#  error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
+   Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing
+#endif
+
+#ifndef CURL_TYPEOF_CURL_OFF_T
+#  error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
+   Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing
+#endif
+
+#ifndef CURL_FORMAT_CURL_OFF_T
+#  error "CURL_FORMAT_CURL_OFF_T definition is missing!"
+   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing
+#endif
+
+#ifndef CURL_FORMAT_CURL_OFF_TU
+#  error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
+   Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
+#endif
+
+#ifndef CURL_FORMAT_OFF_T
+#  error "CURL_FORMAT_OFF_T definition is missing!"
+   Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
+#endif
+
+#ifndef CURL_SIZEOF_CURL_OFF_T
+#  error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
+   Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
+#endif
+
+#ifndef CURL_SUFFIX_CURL_OFF_T
+#  error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
+   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
+#endif
+
+#ifndef CURL_SUFFIX_CURL_OFF_TU
+#  error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
+   Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
+#endif
+
+/*
+ * Macros private to this header file.
+ */
+
+#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
+
+#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
+
+/*
+ * Verify that the size previously defined and expected for long
+ * is the same as the one reported by sizeof() at compile time.
+ */
+
+typedef char
+  __curl_rule_01__
+    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];
+
+/*
+ * Verify that the size previously defined and expected for
+ * curl_off_t is actually the the same as the one reported
+ * by sizeof() at compile time.
+ */
+
+typedef char
+  __curl_rule_02__
+    [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
+
+/*
+ * Verify at compile time that the size of curl_off_t as reported
+ * by sizeof() is greater or equal than the one reported for long
+ * for the current compilation.
+ */
+
+typedef char
+  __curl_rule_03__
+    [CurlchkszGE(curl_off_t, long)];
+
+/*
+ * Verify that the size previously defined and expected for
+ * curl_socklen_t is actually the the same as the one reported
+ * by sizeof() at compile time.
+ */
+
+typedef char
+  __curl_rule_04__
+    [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];
+
+/*
+ * Verify at compile time that the size of curl_socklen_t as reported
+ * by sizeof() is greater or equal than the one reported for int for
+ * the current compilation.
+ */
+
+typedef char
+  __curl_rule_05__
+    [CurlchkszGE(curl_socklen_t, int)];
+
+/* ================================================================ */
+/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */
+/* ================================================================ */
+
+/*
+ * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
+ * these to be visible and exported by the external libcurl interface API,
+ * while also making them visible to the library internals, simply including
+ * curl_setup.h, without actually needing to include curl.h internally.
+ * If some day this section would grow big enough, all this should be moved
+ * to its own header file.
+ */
+
+/*
+ * Figure out if we can use the ## preprocessor operator, which is supported
+ * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
+ * or  __cplusplus so we need to carefully check for them too.
+ */
+
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
+  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
+  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
+  defined(__ILEC400__)
+  /* This compiler is believed to have an ISO compatible preprocessor */
+#define CURL_ISOCPP
+#else
+  /* This compiler is believed NOT to have an ISO compatible preprocessor */
+#undef CURL_ISOCPP
+#endif
+
+/*
+ * Macros for minimum-width signed and unsigned curl_off_t integer constants.
+ */
+
+#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
+#  define __CURL_OFF_T_C_HLPR2(x) x
+#  define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
+#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val) ## \
+                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
+#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
+                             __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
+#else
+#  ifdef CURL_ISOCPP
+#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
+#  else
+#    define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
+#  endif
+#  define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
+#  define CURL_OFF_T_C(Val)  __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
+#  define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
+#endif
+
+/*
+ * Get rid of macros private to this header file.
+ */
+
+#undef CurlchkszEQ
+#undef CurlchkszGE
+
+/*
+ * Get rid of macros not intended to exist beyond this point.
+ */
+
+#undef CURL_PULL_WS2TCPIP_H
+#undef CURL_PULL_SYS_TYPES_H
+#undef CURL_PULL_SYS_SOCKET_H
+#undef CURL_PULL_SYS_POLL_H
+#undef CURL_PULL_STDINT_H
+#undef CURL_PULL_INTTYPES_H
+
+#undef CURL_TYPEOF_CURL_SOCKLEN_T
+#undef CURL_TYPEOF_CURL_OFF_T
+
+#ifdef CURL_NO_OLDIES
+#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */
+#endif
+
+#endif /* __CURL_CURLRULES_H */
diff --git a/Network/CURL000/curl-7.30.0/curlver.h b/Network/CURL000/curl-7.30.0/curlver.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/curlver.h
@@ -0,0 +1,69 @@
+#ifndef __CURL_CURLVER_H
+#define __CURL_CURLVER_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/* This header file contains nothing but libcurl version info, generated by
+   a script at release-time. This was made its own header file in 7.11.2 */
+
+/* This is the global package copyright */
+#define LIBCURL_COPYRIGHT "1996 - 2013 Daniel Stenberg, <daniel@haxx.se>."
+
+/* This is the version number of the libcurl package from which this header
+   file origins: */
+#define LIBCURL_VERSION "7.30.0"
+
+/* The numeric version number is also available "in parts" by using these
+   defines: */
+#define LIBCURL_VERSION_MAJOR 7
+#define LIBCURL_VERSION_MINOR 30
+#define LIBCURL_VERSION_PATCH 0
+
+/* This is the numeric version of the libcurl version number, meant for easier
+   parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
+   always follow this syntax:
+
+         0xXXYYZZ
+
+   Where XX, YY and ZZ are the main version, release and patch numbers in
+   hexadecimal (using 8 bits each). All three numbers are always represented
+   using two digits.  1.2 would appear as "0x010200" while version 9.11.7
+   appears as "0x090b07".
+
+   This 6-digit (24 bits) hexadecimal number does not show pre-release number,
+   and it is always a greater number in a more recent release. It makes
+   comparisons with greater than and less than work.
+*/
+#define LIBCURL_VERSION_NUM 0x071e00
+
+/*
+ * This is the date and time when the full source package was created. The
+ * timestamp is not stored in git, as the timestamp is properly set in the
+ * tarballs by the maketgz script.
+ *
+ * The format of the date should follow this template:
+ *
+ * "Mon Feb 12 11:35:33 UTC 2007"
+ */
+#define LIBCURL_TIMESTAMP "Fri Apr 12 07:12:20 UTC 2013"
+
+#endif /* __CURL_CURLVER_H */
diff --git a/Network/CURL000/curl-7.30.0/easy.h b/Network/CURL000/curl-7.30.0/easy.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/easy.h
@@ -0,0 +1,102 @@
+#ifndef __CURL_EASY_H
+#define __CURL_EASY_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+CURL_EXTERN CURL *curl_easy_init(void);
+CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
+CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
+CURL_EXTERN void curl_easy_cleanup(CURL *curl);
+
+/*
+ * NAME curl_easy_getinfo()
+ *
+ * DESCRIPTION
+ *
+ * Request internal information from the curl session with this function.  The
+ * third argument MUST be a pointer to a long, a pointer to a char * or a
+ * pointer to a double (as the documentation describes elsewhere).  The data
+ * pointed to will be filled in accordingly and can be relied upon only if the
+ * function returns CURLE_OK.  This function is intended to get used *AFTER* a
+ * performed transfer, all results from this function are undefined until the
+ * transfer is completed.
+ */
+CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
+
+
+/*
+ * NAME curl_easy_duphandle()
+ *
+ * DESCRIPTION
+ *
+ * Creates a new curl session handle with the same options set for the handle
+ * passed in. Duplicating a handle could only be a matter of cloning data and
+ * options, internal state info and things like persistent connections cannot
+ * be transferred. It is useful in multithreaded applications when you can run
+ * curl_easy_duphandle() for each new thread to avoid a series of identical
+ * curl_easy_setopt() invokes in every thread.
+ */
+CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
+
+/*
+ * NAME curl_easy_reset()
+ *
+ * DESCRIPTION
+ *
+ * Re-initializes a CURL handle to the default values. This puts back the
+ * handle to the same state as it was in when it was just created.
+ *
+ * It does keep: live connections, the Session ID cache, the DNS cache and the
+ * cookies.
+ */
+CURL_EXTERN void curl_easy_reset(CURL *curl);
+
+/*
+ * NAME curl_easy_recv()
+ *
+ * DESCRIPTION
+ *
+ * Receives data from the connected socket. Use after successful
+ * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
+ */
+CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
+                                    size_t *n);
+
+/*
+ * NAME curl_easy_send()
+ *
+ * DESCRIPTION
+ *
+ * Sends data over the connected socket. Use after successful
+ * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
+ */
+CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
+                                    size_t buflen, size_t *n);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
diff --git a/Network/CURL000/curl-7.30.0/multi.h b/Network/CURL000/curl-7.30.0/multi.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/multi.h
@@ -0,0 +1,397 @@
+#ifndef __CURL_MULTI_H
+#define __CURL_MULTI_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+/*
+  This is an "external" header file. Don't give away any internals here!
+
+  GOALS
+
+  o Enable a "pull" interface. The application that uses libcurl decides where
+    and when to ask libcurl to get/send data.
+
+  o Enable multiple simultaneous transfers in the same thread without making it
+    complicated for the application.
+
+  o Enable the application to select() on its own file descriptors and curl's
+    file descriptors simultaneous easily.
+
+*/
+
+/*
+ * This header file should not really need to include "curl.h" since curl.h
+ * itself includes this file and we expect user applications to do #include
+ * <curl/curl.h> without the need for especially including multi.h.
+ *
+ * For some reason we added this include here at one point, and rather than to
+ * break existing (wrongly written) libcurl applications, we leave it as-is
+ * but with this warning attached.
+ */
+#include "curl.h"
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef void CURLM;
+
+typedef enum {
+  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
+                                    curl_multi_socket*() soon */
+  CURLM_OK,
+  CURLM_BAD_HANDLE,      /* the passed-in handle is not a valid CURLM handle */
+  CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
+  CURLM_OUT_OF_MEMORY,   /* if you ever get this, you're in deep sh*t */
+  CURLM_INTERNAL_ERROR,  /* this is a libcurl bug */
+  CURLM_BAD_SOCKET,      /* the passed in socket argument did not match */
+  CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */
+  CURLM_LAST
+} CURLMcode;
+
+/* just to make code nicer when using curl_multi_socket() you can now check
+   for CURLM_CALL_MULTI_SOCKET too in the same style it works for
+   curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
+#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
+
+typedef enum {
+  CURLMSG_NONE, /* first, not used */
+  CURLMSG_DONE, /* This easy handle has completed. 'result' contains
+                   the CURLcode of the transfer */
+  CURLMSG_LAST /* last, not used */
+} CURLMSG;
+
+struct CURLMsg {
+  CURLMSG msg;       /* what this message means */
+  CURL *easy_handle; /* the handle it concerns */
+  union {
+    void *whatever;    /* message-specific data */
+    CURLcode result;   /* return code for transfer */
+  } data;
+};
+typedef struct CURLMsg CURLMsg;
+
+/* Based on poll(2) structure and values.
+ * We don't use pollfd and POLL* constants explicitly
+ * to cover platforms without poll(). */
+#define CURL_WAIT_POLLIN    0x0001
+#define CURL_WAIT_POLLPRI   0x0002
+#define CURL_WAIT_POLLOUT   0x0004
+
+struct curl_waitfd {
+  curl_socket_t fd;
+  short events;
+  short revents; /* not supported yet */
+};
+
+/*
+ * Name:    curl_multi_init()
+ *
+ * Desc:    inititalize multi-style curl usage
+ *
+ * Returns: a new CURLM handle to use in all 'curl_multi' functions.
+ */
+CURL_EXTERN CURLM *curl_multi_init(void);
+
+/*
+ * Name:    curl_multi_add_handle()
+ *
+ * Desc:    add a standard curl handle to the multi stack
+ *
+ * Returns: CURLMcode type, general multi error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
+                                            CURL *curl_handle);
+
+ /*
+  * Name:    curl_multi_remove_handle()
+  *
+  * Desc:    removes a curl handle from the multi stack again
+  *
+  * Returns: CURLMcode type, general multi error code.
+  */
+CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
+                                               CURL *curl_handle);
+
+ /*
+  * Name:    curl_multi_fdset()
+  *
+  * Desc:    Ask curl for its fd_set sets. The app can use these to select() or
+  *          poll() on. We want curl_multi_perform() called as soon as one of
+  *          them are ready.
+  *
+  * Returns: CURLMcode type, general multi error code.
+  */
+CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
+                                       fd_set *read_fd_set,
+                                       fd_set *write_fd_set,
+                                       fd_set *exc_fd_set,
+                                       int *max_fd);
+
+/*
+ * Name:     curl_multi_wait()
+ *
+ * Desc:     Poll on all fds within a CURLM set as well as any
+ *           additional fds passed to the function.
+ *
+ * Returns:  CURLMcode type, general multi error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
+                                      struct curl_waitfd extra_fds[],
+                                      unsigned int extra_nfds,
+                                      int timeout_ms,
+                                      int *ret);
+
+ /*
+  * Name:    curl_multi_perform()
+  *
+  * Desc:    When the app thinks there's data available for curl it calls this
+  *          function to read/write whatever there is right now. This returns
+  *          as soon as the reads and writes are done. This function does not
+  *          require that there actually is data available for reading or that
+  *          data can be written, it can be called just in case. It returns
+  *          the number of handles that still transfer data in the second
+  *          argument's integer-pointer.
+  *
+  * Returns: CURLMcode type, general multi error code. *NOTE* that this only
+  *          returns errors etc regarding the whole multi stack. There might
+  *          still have occurred problems on invidual transfers even when this
+  *          returns OK.
+  */
+CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
+                                         int *running_handles);
+
+ /*
+  * Name:    curl_multi_cleanup()
+  *
+  * Desc:    Cleans up and removes a whole multi stack. It does not free or
+  *          touch any individual easy handles in any way. We need to define
+  *          in what state those handles will be if this function is called
+  *          in the middle of a transfer.
+  *
+  * Returns: CURLMcode type, general multi error code.
+  */
+CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
+
+/*
+ * Name:    curl_multi_info_read()
+ *
+ * Desc:    Ask the multi handle if there's any messages/informationals from
+ *          the individual transfers. Messages include informationals such as
+ *          error code from the transfer or just the fact that a transfer is
+ *          completed. More details on these should be written down as well.
+ *
+ *          Repeated calls to this function will return a new struct each
+ *          time, until a special "end of msgs" struct is returned as a signal
+ *          that there is no more to get at this point.
+ *
+ *          The data the returned pointer points to will not survive calling
+ *          curl_multi_cleanup().
+ *
+ *          The 'CURLMsg' struct is meant to be very simple and only contain
+ *          very basic informations. If more involved information is wanted,
+ *          we will provide the particular "transfer handle" in that struct
+ *          and that should/could/would be used in subsequent
+ *          curl_easy_getinfo() calls (or similar). The point being that we
+ *          must never expose complex structs to applications, as then we'll
+ *          undoubtably get backwards compatibility problems in the future.
+ *
+ * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
+ *          of structs. It also writes the number of messages left in the
+ *          queue (after this read) in the integer the second argument points
+ *          to.
+ */
+CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
+                                          int *msgs_in_queue);
+
+/*
+ * Name:    curl_multi_strerror()
+ *
+ * Desc:    The curl_multi_strerror function may be used to turn a CURLMcode
+ *          value into the equivalent human readable error string.  This is
+ *          useful for printing meaningful error messages.
+ *
+ * Returns: A pointer to a zero-terminated error message.
+ */
+CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
+
+/*
+ * Name:    curl_multi_socket() and
+ *          curl_multi_socket_all()
+ *
+ * Desc:    An alternative version of curl_multi_perform() that allows the
+ *          application to pass in one of the file descriptors that have been
+ *          detected to have "action" on them and let libcurl perform.
+ *          See man page for details.
+ */
+#define CURL_POLL_NONE   0
+#define CURL_POLL_IN     1
+#define CURL_POLL_OUT    2
+#define CURL_POLL_INOUT  3
+#define CURL_POLL_REMOVE 4
+
+#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
+
+#define CURL_CSELECT_IN   0x01
+#define CURL_CSELECT_OUT  0x02
+#define CURL_CSELECT_ERR  0x04
+
+typedef int (*curl_socket_callback)(CURL *easy,      /* easy handle */
+                                    curl_socket_t s, /* socket */
+                                    int what,        /* see above */
+                                    void *userp,     /* private callback
+                                                        pointer */
+                                    void *socketp);  /* private socket
+                                                        pointer */
+/*
+ * Name:    curl_multi_timer_callback
+ *
+ * Desc:    Called by libcurl whenever the library detects a change in the
+ *          maximum number of milliseconds the app is allowed to wait before
+ *          curl_multi_socket() or curl_multi_perform() must be called
+ *          (to allow libcurl's timed events to take place).
+ *
+ * Returns: The callback should return zero.
+ */
+typedef int (*curl_multi_timer_callback)(CURLM *multi,    /* multi handle */
+                                         long timeout_ms, /* see above */
+                                         void *userp);    /* private callback
+                                                             pointer */
+
+CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
+                                        int *running_handles);
+
+CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
+                                               curl_socket_t s,
+                                               int ev_bitmask,
+                                               int *running_handles);
+
+CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
+                                            int *running_handles);
+
+#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
+/* This macro below was added in 7.16.3 to push users who recompile to use
+   the new curl_multi_socket_action() instead of the old curl_multi_socket()
+*/
+#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
+#endif
+
+/*
+ * Name:    curl_multi_timeout()
+ *
+ * Desc:    Returns the maximum number of milliseconds the app is allowed to
+ *          wait before curl_multi_socket() or curl_multi_perform() must be
+ *          called (to allow libcurl's timed events to take place).
+ *
+ * Returns: CURLM error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
+                                         long *milliseconds);
+
+#undef CINIT /* re-using the same name as in curl.h */
+
+#ifdef CURL_ISOCPP
+#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
+#else
+/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
+#define LONG          CURLOPTTYPE_LONG
+#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
+#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
+#define OFF_T         CURLOPTTYPE_OFF_T
+#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
+#endif
+
+typedef enum {
+  /* This is the socket callback function pointer */
+  CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
+
+  /* This is the argument passed to the socket callback */
+  CINIT(SOCKETDATA, OBJECTPOINT, 2),
+
+    /* set to 1 to enable pipelining for this multi handle */
+  CINIT(PIPELINING, LONG, 3),
+
+   /* This is the timer callback function pointer */
+  CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
+
+  /* This is the argument passed to the timer callback */
+  CINIT(TIMERDATA, OBJECTPOINT, 5),
+
+  /* maximum number of entries in the connection cache */
+  CINIT(MAXCONNECTS, LONG, 6),
+
+  /* maximum number of (pipelining) connections to one host */
+  CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
+
+  /* maximum number of requests in a pipeline */
+  CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
+
+  /* a connection with a content-length longer than this
+     will not be considered for pipelining */
+  CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
+
+  /* a connection with a chunk length longer than this
+     will not be considered for pipelining */
+  CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
+
+  /* a list of site names(+port) that are blacklisted from
+     pipelining */
+  CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
+
+  /* a list of server types that are blacklisted from
+     pipelining */
+  CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
+
+  /* maximum number of open connections in total */
+  CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
+
+  CURLMOPT_LASTENTRY /* the last unused */
+} CURLMoption;
+
+
+/*
+ * Name:    curl_multi_setopt()
+ *
+ * Desc:    Sets options for the multi handle.
+ *
+ * Returns: CURLM error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
+                                        CURLMoption option, ...);
+
+
+/*
+ * Name:    curl_multi_assign()
+ *
+ * Desc:    This function sets an association in the multi handle between the
+ *          given socket and a private pointer of the application. This is
+ *          (only) useful for curl_multi_socket uses.
+ *
+ * Returns: CURLM error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
+                                        curl_socket_t sockfd, void *sockp);
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
+#endif
diff --git a/Network/CURL000/curl-7.30.0/stdcheaders.h b/Network/CURL000/curl-7.30.0/stdcheaders.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/stdcheaders.h
@@ -0,0 +1,33 @@
+#ifndef __STDC_HEADERS_H
+#define __STDC_HEADERS_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include <sys/types.h>
+
+size_t fread (void *, size_t, size_t, FILE *);
+size_t fwrite (const void *, size_t, size_t, FILE *);
+
+int strcasecmp(const char *, const char *);
+int strncasecmp(const char *, const char *, size_t);
+
+#endif /* __STDC_HEADERS_H */
diff --git a/Network/CURL000/curl-7.30.0/typecheck-gcc.h b/Network/CURL000/curl-7.30.0/typecheck-gcc.h
new file mode 100644
--- /dev/null
+++ b/Network/CURL000/curl-7.30.0/typecheck-gcc.h
@@ -0,0 +1,604 @@
+#ifndef __CURL_TYPECHECK_GCC_H
+#define __CURL_TYPECHECK_GCC_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/* wraps curl_easy_setopt() with typechecking */
+
+/* To add a new kind of warning, add an
+ *   if(_curl_is_sometype_option(_curl_opt))
+ *     if(!_curl_is_sometype(value))
+ *       _curl_easy_setopt_err_sometype();
+ * block and define _curl_is_sometype_option, _curl_is_sometype and
+ * _curl_easy_setopt_err_sometype below
+ *
+ * NOTE: We use two nested 'if' statements here instead of the && operator, in
+ *       order to work around gcc bug #32061.  It affects only gcc 4.3.x/4.4.x
+ *       when compiling with -Wlogical-op.
+ *
+ * To add an option that uses the same type as an existing option, you'll just
+ * need to extend the appropriate _curl_*_option macro
+ */
+#define curl_easy_setopt(handle, option, value)                               \
+__extension__ ({                                                              \
+  __typeof__ (option) _curl_opt = option;                                     \
+  if(__builtin_constant_p(_curl_opt)) {                                       \
+    if(_curl_is_long_option(_curl_opt))                                       \
+      if(!_curl_is_long(value))                                               \
+        _curl_easy_setopt_err_long();                                         \
+    if(_curl_is_off_t_option(_curl_opt))                                      \
+      if(!_curl_is_off_t(value))                                              \
+        _curl_easy_setopt_err_curl_off_t();                                   \
+    if(_curl_is_string_option(_curl_opt))                                     \
+      if(!_curl_is_string(value))                                             \
+        _curl_easy_setopt_err_string();                                       \
+    if(_curl_is_write_cb_option(_curl_opt))                                   \
+      if(!_curl_is_write_cb(value))                                           \
+        _curl_easy_setopt_err_write_callback();                               \
+    if((_curl_opt) == CURLOPT_READFUNCTION)                                   \
+      if(!_curl_is_read_cb(value))                                            \
+        _curl_easy_setopt_err_read_cb();                                      \
+    if((_curl_opt) == CURLOPT_IOCTLFUNCTION)                                  \
+      if(!_curl_is_ioctl_cb(value))                                           \
+        _curl_easy_setopt_err_ioctl_cb();                                     \
+    if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION)                                \
+      if(!_curl_is_sockopt_cb(value))                                         \
+        _curl_easy_setopt_err_sockopt_cb();                                   \
+    if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION)                             \
+      if(!_curl_is_opensocket_cb(value))                                      \
+        _curl_easy_setopt_err_opensocket_cb();                                \
+    if((_curl_opt) == CURLOPT_PROGRESSFUNCTION)                               \
+      if(!_curl_is_progress_cb(value))                                        \
+        _curl_easy_setopt_err_progress_cb();                                  \
+    if((_curl_opt) == CURLOPT_DEBUGFUNCTION)                                  \
+      if(!_curl_is_debug_cb(value))                                           \
+        _curl_easy_setopt_err_debug_cb();                                     \
+    if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION)                               \
+      if(!_curl_is_ssl_ctx_cb(value))                                         \
+        _curl_easy_setopt_err_ssl_ctx_cb();                                   \
+    if(_curl_is_conv_cb_option(_curl_opt))                                    \
+      if(!_curl_is_conv_cb(value))                                            \
+        _curl_easy_setopt_err_conv_cb();                                      \
+    if((_curl_opt) == CURLOPT_SEEKFUNCTION)                                   \
+      if(!_curl_is_seek_cb(value))                                            \
+        _curl_easy_setopt_err_seek_cb();                                      \
+    if(_curl_is_cb_data_option(_curl_opt))                                    \
+      if(!_curl_is_cb_data(value))                                            \
+        _curl_easy_setopt_err_cb_data();                                      \
+    if((_curl_opt) == CURLOPT_ERRORBUFFER)                                    \
+      if(!_curl_is_error_buffer(value))                                       \
+        _curl_easy_setopt_err_error_buffer();                                 \
+    if((_curl_opt) == CURLOPT_STDERR)                                         \
+      if(!_curl_is_FILE(value))                                               \
+        _curl_easy_setopt_err_FILE();                                         \
+    if(_curl_is_postfields_option(_curl_opt))                                 \
+      if(!_curl_is_postfields(value))                                         \
+        _curl_easy_setopt_err_postfields();                                   \
+    if((_curl_opt) == CURLOPT_HTTPPOST)                                       \
+      if(!_curl_is_arr((value), struct curl_httppost))                        \
+        _curl_easy_setopt_err_curl_httpost();                                 \
+    if(_curl_is_slist_option(_curl_opt))                                      \
+      if(!_curl_is_arr((value), struct curl_slist))                           \
+        _curl_easy_setopt_err_curl_slist();                                   \
+    if((_curl_opt) == CURLOPT_SHARE)                                          \
+      if(!_curl_is_ptr((value), CURLSH))                                      \
+        _curl_easy_setopt_err_CURLSH();                                       \
+  }                                                                           \
+  curl_easy_setopt(handle, _curl_opt, value);                                 \
+})
+
+/* wraps curl_easy_getinfo() with typechecking */
+/* FIXME: don't allow const pointers */
+#define curl_easy_getinfo(handle, info, arg)                                  \
+__extension__ ({                                                              \
+  __typeof__ (info) _curl_info = info;                                        \
+  if(__builtin_constant_p(_curl_info)) {                                      \
+    if(_curl_is_string_info(_curl_info))                                      \
+      if(!_curl_is_arr((arg), char *))                                        \
+        _curl_easy_getinfo_err_string();                                      \
+    if(_curl_is_long_info(_curl_info))                                        \
+      if(!_curl_is_arr((arg), long))                                          \
+        _curl_easy_getinfo_err_long();                                        \
+    if(_curl_is_double_info(_curl_info))                                      \
+      if(!_curl_is_arr((arg), double))                                        \
+        _curl_easy_getinfo_err_double();                                      \
+    if(_curl_is_slist_info(_curl_info))                                       \
+      if(!_curl_is_arr((arg), struct curl_slist *))                           \
+        _curl_easy_getinfo_err_curl_slist();                                  \
+  }                                                                           \
+  curl_easy_getinfo(handle, _curl_info, arg);                                 \
+})
+
+/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
+ * for now just make sure that the functions are called with three
+ * arguments
+ */
+#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
+#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
+
+
+/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
+ * functions */
+
+/* To define a new warning, use _CURL_WARNING(identifier, "message") */
+#define _CURL_WARNING(id, message)                                            \
+  static void __attribute__((__warning__(message)))                           \
+  __attribute__((__unused__)) __attribute__((__noinline__))                   \
+  id(void) { __asm__(""); }
+
+_CURL_WARNING(_curl_easy_setopt_err_long,
+  "curl_easy_setopt expects a long argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
+  "curl_easy_setopt expects a curl_off_t argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_string,
+              "curl_easy_setopt expects a "
+              "string (char* or char[]) argument for this option"
+  )
+_CURL_WARNING(_curl_easy_setopt_err_write_callback,
+  "curl_easy_setopt expects a curl_write_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_read_cb,
+  "curl_easy_setopt expects a curl_read_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
+  "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
+  "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
+              "curl_easy_setopt expects a "
+              "curl_opensocket_callback argument for this option"
+  )
+_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
+  "curl_easy_setopt expects a curl_progress_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_debug_cb,
+  "curl_easy_setopt expects a curl_debug_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
+  "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_conv_cb,
+  "curl_easy_setopt expects a curl_conv_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
+  "curl_easy_setopt expects a curl_seek_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_cb_data,
+              "curl_easy_setopt expects a "
+              "private data pointer as argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
+              "curl_easy_setopt expects a "
+              "char buffer of CURL_ERROR_SIZE as argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_FILE,
+  "curl_easy_setopt expects a FILE* argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_postfields,
+  "curl_easy_setopt expects a void* or char* argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
+  "curl_easy_setopt expects a struct curl_httppost* argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_curl_slist,
+  "curl_easy_setopt expects a struct curl_slist* argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_CURLSH,
+  "curl_easy_setopt expects a CURLSH* argument for this option")
+
+_CURL_WARNING(_curl_easy_getinfo_err_string,
+  "curl_easy_getinfo expects a pointer to char * for this info")
+_CURL_WARNING(_curl_easy_getinfo_err_long,
+  "curl_easy_getinfo expects a pointer to long for this info")
+_CURL_WARNING(_curl_easy_getinfo_err_double,
+  "curl_easy_getinfo expects a pointer to double for this info")
+_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
+  "curl_easy_getinfo expects a pointer to struct curl_slist * for this info")
+
+/* groups of curl_easy_setops options that take the same type of argument */
+
+/* To add a new option to one of the groups, just add
+ *   (option) == CURLOPT_SOMETHING
+ * to the or-expression. If the option takes a long or curl_off_t, you don't
+ * have to do anything
+ */
+
+/* evaluates to true if option takes a long argument */
+#define _curl_is_long_option(option)                                          \
+  (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
+
+#define _curl_is_off_t_option(option)                                         \
+  ((option) > CURLOPTTYPE_OFF_T)
+
+/* evaluates to true if option takes a char* argument */
+#define _curl_is_string_option(option)                                        \
+  ((option) == CURLOPT_URL ||                                                 \
+   (option) == CURLOPT_PROXY ||                                               \
+   (option) == CURLOPT_INTERFACE ||                                           \
+   (option) == CURLOPT_NETRC_FILE ||                                          \
+   (option) == CURLOPT_USERPWD ||                                             \
+   (option) == CURLOPT_USERNAME ||                                            \
+   (option) == CURLOPT_PASSWORD ||                                            \
+   (option) == CURLOPT_PROXYUSERPWD ||                                        \
+   (option) == CURLOPT_PROXYUSERNAME ||                                       \
+   (option) == CURLOPT_PROXYPASSWORD ||                                       \
+   (option) == CURLOPT_NOPROXY ||                                             \
+   (option) == CURLOPT_ACCEPT_ENCODING ||                                     \
+   (option) == CURLOPT_REFERER ||                                             \
+   (option) == CURLOPT_USERAGENT ||                                           \
+   (option) == CURLOPT_COOKIE ||                                              \
+   (option) == CURLOPT_COOKIEFILE ||                                          \
+   (option) == CURLOPT_COOKIEJAR ||                                           \
+   (option) == CURLOPT_COOKIELIST ||                                          \
+   (option) == CURLOPT_FTPPORT ||                                             \
+   (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER ||                             \
+   (option) == CURLOPT_FTP_ACCOUNT ||                                         \
+   (option) == CURLOPT_RANGE ||                                               \
+   (option) == CURLOPT_CUSTOMREQUEST ||                                       \
+   (option) == CURLOPT_SSLCERT ||                                             \
+   (option) == CURLOPT_SSLCERTTYPE ||                                         \
+   (option) == CURLOPT_SSLKEY ||                                              \
+   (option) == CURLOPT_SSLKEYTYPE ||                                          \
+   (option) == CURLOPT_KEYPASSWD ||                                           \
+   (option) == CURLOPT_SSLENGINE ||                                           \
+   (option) == CURLOPT_CAINFO ||                                              \
+   (option) == CURLOPT_CAPATH ||                                              \
+   (option) == CURLOPT_RANDOM_FILE ||                                         \
+   (option) == CURLOPT_EGDSOCKET ||                                           \
+   (option) == CURLOPT_SSL_CIPHER_LIST ||                                     \
+   (option) == CURLOPT_KRBLEVEL ||                                            \
+   (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ||                             \
+   (option) == CURLOPT_SSH_PUBLIC_KEYFILE ||                                  \
+   (option) == CURLOPT_SSH_PRIVATE_KEYFILE ||                                 \
+   (option) == CURLOPT_CRLFILE ||                                             \
+   (option) == CURLOPT_ISSUERCERT ||                                          \
+   (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE ||                               \
+   (option) == CURLOPT_SSH_KNOWNHOSTS ||                                      \
+   (option) == CURLOPT_MAIL_FROM ||                                           \
+   (option) == CURLOPT_RTSP_SESSION_ID ||                                     \
+   (option) == CURLOPT_RTSP_STREAM_URI ||                                     \
+   (option) == CURLOPT_RTSP_TRANSPORT ||                                      \
+   0)
+
+/* evaluates to true if option takes a curl_write_callback argument */
+#define _curl_is_write_cb_option(option)                                      \
+  ((option) == CURLOPT_HEADERFUNCTION ||                                      \
+   (option) == CURLOPT_WRITEFUNCTION)
+
+/* evaluates to true if option takes a curl_conv_callback argument */
+#define _curl_is_conv_cb_option(option)                                       \
+  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION ||                            \
+   (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION ||                          \
+   (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
+
+/* evaluates to true if option takes a data argument to pass to a callback */
+#define _curl_is_cb_data_option(option)                                       \
+  ((option) == CURLOPT_WRITEDATA ||                                           \
+   (option) == CURLOPT_READDATA ||                                            \
+   (option) == CURLOPT_IOCTLDATA ||                                           \
+   (option) == CURLOPT_SOCKOPTDATA ||                                         \
+   (option) == CURLOPT_OPENSOCKETDATA ||                                      \
+   (option) == CURLOPT_PROGRESSDATA ||                                        \
+   (option) == CURLOPT_WRITEHEADER ||                                         \
+   (option) == CURLOPT_DEBUGDATA ||                                           \
+   (option) == CURLOPT_SSL_CTX_DATA ||                                        \
+   (option) == CURLOPT_SEEKDATA ||                                            \
+   (option) == CURLOPT_PRIVATE ||                                             \
+   (option) == CURLOPT_SSH_KEYDATA ||                                         \
+   (option) == CURLOPT_INTERLEAVEDATA ||                                      \
+   (option) == CURLOPT_CHUNK_DATA ||                                          \
+   (option) == CURLOPT_FNMATCH_DATA ||                                        \
+   0)
+
+/* evaluates to true if option takes a POST data argument (void* or char*) */
+#define _curl_is_postfields_option(option)                                    \
+  ((option) == CURLOPT_POSTFIELDS ||                                          \
+   (option) == CURLOPT_COPYPOSTFIELDS ||                                      \
+   0)
+
+/* evaluates to true if option takes a struct curl_slist * argument */
+#define _curl_is_slist_option(option)                                         \
+  ((option) == CURLOPT_HTTPHEADER ||                                          \
+   (option) == CURLOPT_HTTP200ALIASES ||                                      \
+   (option) == CURLOPT_QUOTE ||                                               \
+   (option) == CURLOPT_POSTQUOTE ||                                           \
+   (option) == CURLOPT_PREQUOTE ||                                            \
+   (option) == CURLOPT_TELNETOPTIONS ||                                       \
+   (option) == CURLOPT_MAIL_RCPT ||                                           \
+   0)
+
+/* groups of curl_easy_getinfo infos that take the same type of argument */
+
+/* evaluates to true if info expects a pointer to char * argument */
+#define _curl_is_string_info(info)                                            \
+  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
+
+/* evaluates to true if info expects a pointer to long argument */
+#define _curl_is_long_info(info)                                              \
+  (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
+
+/* evaluates to true if info expects a pointer to double argument */
+#define _curl_is_double_info(info)                                            \
+  (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
+
+/* true if info expects a pointer to struct curl_slist * argument */
+#define _curl_is_slist_info(info)                                             \
+  (CURLINFO_SLIST < (info))
+
+
+/* typecheck helpers -- check whether given expression has requested type*/
+
+/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
+ * otherwise define a new macro. Search for __builtin_types_compatible_p
+ * in the GCC manual.
+ * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
+ * the actual expression passed to the curl_easy_setopt macro. This
+ * means that you can only apply the sizeof and __typeof__ operators, no
+ * == or whatsoever.
+ */
+
+/* XXX: should evaluate to true iff expr is a pointer */
+#define _curl_is_any_ptr(expr)                                                \
+  (sizeof(expr) == sizeof(void*))
+
+/* evaluates to true if expr is NULL */
+/* XXX: must not evaluate expr, so this check is not accurate */
+#define _curl_is_NULL(expr)                                                   \
+  (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
+
+/* evaluates to true if expr is type*, const type* or NULL */
+#define _curl_is_ptr(expr, type)                                              \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), type *) ||                  \
+   __builtin_types_compatible_p(__typeof__(expr), const type *))
+
+/* evaluates to true if expr is one of type[], type*, NULL or const type* */
+#define _curl_is_arr(expr, type)                                              \
+  (_curl_is_ptr((expr), type) ||                                              \
+   __builtin_types_compatible_p(__typeof__(expr), type []))
+
+/* evaluates to true if expr is a string */
+#define _curl_is_string(expr)                                                 \
+  (_curl_is_arr((expr), char) ||                                              \
+   _curl_is_arr((expr), signed char) ||                                       \
+   _curl_is_arr((expr), unsigned char))
+
+/* evaluates to true if expr is a long (no matter the signedness)
+ * XXX: for now, int is also accepted (and therefore short and char, which
+ * are promoted to int when passed to a variadic function) */
+#define _curl_is_long(expr)                                                   \
+  (__builtin_types_compatible_p(__typeof__(expr), long) ||                    \
+   __builtin_types_compatible_p(__typeof__(expr), signed long) ||             \
+   __builtin_types_compatible_p(__typeof__(expr), unsigned long) ||           \
+   __builtin_types_compatible_p(__typeof__(expr), int) ||                     \
+   __builtin_types_compatible_p(__typeof__(expr), signed int) ||              \
+   __builtin_types_compatible_p(__typeof__(expr), unsigned int) ||            \
+   __builtin_types_compatible_p(__typeof__(expr), short) ||                   \
+   __builtin_types_compatible_p(__typeof__(expr), signed short) ||            \
+   __builtin_types_compatible_p(__typeof__(expr), unsigned short) ||          \
+   __builtin_types_compatible_p(__typeof__(expr), char) ||                    \
+   __builtin_types_compatible_p(__typeof__(expr), signed char) ||             \
+   __builtin_types_compatible_p(__typeof__(expr), unsigned char))
+
+/* evaluates to true if expr is of type curl_off_t */
+#define _curl_is_off_t(expr)                                                  \
+  (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
+
+/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
+/* XXX: also check size of an char[] array? */
+#define _curl_is_error_buffer(expr)                                           \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), char *) ||                  \
+   __builtin_types_compatible_p(__typeof__(expr), char[]))
+
+/* evaluates to true if expr is of type (const) void* or (const) FILE* */
+#if 0
+#define _curl_is_cb_data(expr)                                                \
+  (_curl_is_ptr((expr), void) ||                                              \
+   _curl_is_ptr((expr), FILE))
+#else /* be less strict */
+#define _curl_is_cb_data(expr)                                                \
+  _curl_is_any_ptr(expr)
+#endif
+
+/* evaluates to true if expr is of type FILE* */
+#define _curl_is_FILE(expr)                                                   \
+  (__builtin_types_compatible_p(__typeof__(expr), FILE *))
+
+/* evaluates to true if expr can be passed as POST data (void* or char*) */
+#define _curl_is_postfields(expr)                                             \
+  (_curl_is_ptr((expr), void) ||                                              \
+   _curl_is_arr((expr), char))
+
+/* FIXME: the whole callback checking is messy...
+ * The idea is to tolerate char vs. void and const vs. not const
+ * pointers in arguments at least
+ */
+/* helper: __builtin_types_compatible_p distinguishes between functions and
+ * function pointers, hide it */
+#define _curl_callback_compatible(func, type)                                 \
+  (__builtin_types_compatible_p(__typeof__(func), type) ||                    \
+   __builtin_types_compatible_p(__typeof__(func), type*))
+
+/* evaluates to true if expr is of type curl_read_callback or "similar" */
+#define _curl_is_read_cb(expr)                                          \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) ||       \
+   __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) ||      \
+   _curl_callback_compatible((expr), _curl_read_callback1) ||                 \
+   _curl_callback_compatible((expr), _curl_read_callback2) ||                 \
+   _curl_callback_compatible((expr), _curl_read_callback3) ||                 \
+   _curl_callback_compatible((expr), _curl_read_callback4) ||                 \
+   _curl_callback_compatible((expr), _curl_read_callback5) ||                 \
+   _curl_callback_compatible((expr), _curl_read_callback6))
+typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);
+typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);
+typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);
+typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);
+typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);
+typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);
+
+/* evaluates to true if expr is of type curl_write_callback or "similar" */
+#define _curl_is_write_cb(expr)                                               \
+  (_curl_is_read_cb(expr) ||                                            \
+   __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) ||      \
+   __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) ||     \
+   _curl_callback_compatible((expr), _curl_write_callback1) ||                \
+   _curl_callback_compatible((expr), _curl_write_callback2) ||                \
+   _curl_callback_compatible((expr), _curl_write_callback3) ||                \
+   _curl_callback_compatible((expr), _curl_write_callback4) ||                \
+   _curl_callback_compatible((expr), _curl_write_callback5) ||                \
+   _curl_callback_compatible((expr), _curl_write_callback6))
+typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);
+typedef size_t (_curl_write_callback2)(const char *, size_t, size_t,
+                                       const void*);
+typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);
+typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);
+typedef size_t (_curl_write_callback5)(const void *, size_t, size_t,
+                                       const void*);
+typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);
+
+/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
+#define _curl_is_ioctl_cb(expr)                                         \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) ||     \
+   _curl_callback_compatible((expr), _curl_ioctl_callback1) ||                \
+   _curl_callback_compatible((expr), _curl_ioctl_callback2) ||                \
+   _curl_callback_compatible((expr), _curl_ioctl_callback3) ||                \
+   _curl_callback_compatible((expr), _curl_ioctl_callback4))
+typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);
+typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);
+typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*);
+typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);
+
+/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
+#define _curl_is_sockopt_cb(expr)                                       \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) ||   \
+   _curl_callback_compatible((expr), _curl_sockopt_callback1) ||              \
+   _curl_callback_compatible((expr), _curl_sockopt_callback2))
+typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
+typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,
+                                      curlsocktype);
+
+/* evaluates to true if expr is of type curl_opensocket_callback or
+   "similar" */
+#define _curl_is_opensocket_cb(expr)                                    \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\
+   _curl_callback_compatible((expr), _curl_opensocket_callback1) ||           \
+   _curl_callback_compatible((expr), _curl_opensocket_callback2) ||           \
+   _curl_callback_compatible((expr), _curl_opensocket_callback3) ||           \
+   _curl_callback_compatible((expr), _curl_opensocket_callback4))
+typedef curl_socket_t (_curl_opensocket_callback1)
+  (void *, curlsocktype, struct curl_sockaddr *);
+typedef curl_socket_t (_curl_opensocket_callback2)
+  (void *, curlsocktype, const struct curl_sockaddr *);
+typedef curl_socket_t (_curl_opensocket_callback3)
+  (const void *, curlsocktype, struct curl_sockaddr *);
+typedef curl_socket_t (_curl_opensocket_callback4)
+  (const void *, curlsocktype, const struct curl_sockaddr *);
+
+/* evaluates to true if expr is of type curl_progress_callback or "similar" */
+#define _curl_is_progress_cb(expr)                                      \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) ||  \
+   _curl_callback_compatible((expr), _curl_progress_callback1) ||             \
+   _curl_callback_compatible((expr), _curl_progress_callback2))
+typedef int (_curl_progress_callback1)(void *,
+    double, double, double, double);
+typedef int (_curl_progress_callback2)(const void *,
+    double, double, double, double);
+
+/* evaluates to true if expr is of type curl_debug_callback or "similar" */
+#define _curl_is_debug_cb(expr)                                         \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) ||     \
+   _curl_callback_compatible((expr), _curl_debug_callback1) ||                \
+   _curl_callback_compatible((expr), _curl_debug_callback2) ||                \
+   _curl_callback_compatible((expr), _curl_debug_callback3) ||                \
+   _curl_callback_compatible((expr), _curl_debug_callback4) ||                \
+   _curl_callback_compatible((expr), _curl_debug_callback5) ||                \
+   _curl_callback_compatible((expr), _curl_debug_callback6) ||                \
+   _curl_callback_compatible((expr), _curl_debug_callback7) ||                \
+   _curl_callback_compatible((expr), _curl_debug_callback8))
+typedef int (_curl_debug_callback1) (CURL *,
+    curl_infotype, char *, size_t, void *);
+typedef int (_curl_debug_callback2) (CURL *,
+    curl_infotype, char *, size_t, const void *);
+typedef int (_curl_debug_callback3) (CURL *,
+    curl_infotype, const char *, size_t, void *);
+typedef int (_curl_debug_callback4) (CURL *,
+    curl_infotype, const char *, size_t, const void *);
+typedef int (_curl_debug_callback5) (CURL *,
+    curl_infotype, unsigned char *, size_t, void *);
+typedef int (_curl_debug_callback6) (CURL *,
+    curl_infotype, unsigned char *, size_t, const void *);
+typedef int (_curl_debug_callback7) (CURL *,
+    curl_infotype, const unsigned char *, size_t, void *);
+typedef int (_curl_debug_callback8) (CURL *,
+    curl_infotype, const unsigned char *, size_t, const void *);
+
+/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
+/* this is getting even messier... */
+#define _curl_is_ssl_ctx_cb(expr)                                       \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) ||   \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) ||              \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) ||              \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) ||              \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) ||              \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) ||              \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) ||              \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) ||              \
+   _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
+typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);
+typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
+typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
+typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);
+#ifdef HEADER_SSL_H
+/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
+ * this will of course break if we're included before OpenSSL headers...
+ */
+typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
+typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
+typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
+typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
+                                           const void *);
+#else
+typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
+typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
+typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
+typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
+#endif
+
+/* evaluates to true if expr is of type curl_conv_callback or "similar" */
+#define _curl_is_conv_cb(expr)                                          \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) ||      \
+   _curl_callback_compatible((expr), _curl_conv_callback1) ||                 \
+   _curl_callback_compatible((expr), _curl_conv_callback2) ||                 \
+   _curl_callback_compatible((expr), _curl_conv_callback3) ||                 \
+   _curl_callback_compatible((expr), _curl_conv_callback4))
+typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
+typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
+typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
+typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
+
+/* evaluates to true if expr is of type curl_seek_callback or "similar" */
+#define _curl_is_seek_cb(expr)                                          \
+  (_curl_is_NULL(expr) ||                                                     \
+   __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) ||      \
+   _curl_callback_compatible((expr), _curl_seek_callback1) ||                 \
+   _curl_callback_compatible((expr), _curl_seek_callback2))
+typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
+typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
+
+
+#endif /* __CURL_TYPECHECK_GCC_H */
diff --git a/Network/CURL720.hs b/Network/CURL720.hs
new file mode 100644
--- /dev/null
+++ b/Network/CURL720.hs
@@ -0,0 +1,525 @@
+-------------------------------------------------------------------------------
+-- |
+-- Module      :  Network.CURL720
+-- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis
+-- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
+-- 
+-- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- <<https://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs/CURL720>>
+-------------------------------------------------------------------------------
+
+module Network.CURL720
+  ( module Network.CURLXXX
+
+  -- |
+  -- To use functions from this module it is required to explicitly link
+  -- with @libcurl\/7.20@ (or newer) at runtime. So first things first:
+  --
+  -- > main = withlib CURL720 $ do
+  -- >   ...
+  --
+  -- Without such statement any use of the 'curl*' functions will fail.
+  -- Runtime linker will first try to load @libcurl@ binary image into
+  -- memory and after succesful loading, library version will be checked.
+  -- Standard dynamic loader search path is used to locate required
+  -- so\/dll\/dylib. Just install libcurl.so\/dll\/dylib into one of
+  -- the searched places (could be current directory).
+
+ 
+-------------------------------------------------------------------------------
+-- * Global interface
+-------------------------------------------------------------------------------
+ 
+  -- ** Version info
+  , curl_version
+  , curl_version_info
+  , CURL_version_info (..)
+  , CURLfeature
+      ( CURL_VERSION_IPV6
+      , CURL_VERSION_KERBEROS4
+      , CURL_VERSION_SSL
+      , CURL_VERSION_LIBZ
+      , CURL_VERSION_NTLM
+      , CURL_VERSION_GSSNEGOTIATE
+      , CURL_VERSION_DEBUG
+      , CURL_VERSION_CURLDEBUG
+      , CURL_VERSION_ASYNCHDNS
+      , CURL_VERSION_SPNEGO
+      , CURL_VERSION_LARGEFILE
+      , CURL_VERSION_IDN
+      , CURL_VERSION_SSPI
+      , CURL_VERSION_CONV
+      )
+
+-------------------------------------------------------------------------------
+-- * Easy interface
+-- | See <http://curl.haxx.se/libcurl/c/libcurl-easy.html>
+--   for easy interface overview.
+-------------------------------------------------------------------------------
+
+  -- ** Init / Cleanup
+  , curl_easy_init
+  , curl_easy_cleanup
+  , curl_easy_reset
+  , CURL
+
+  -- ** Transfer
+  , curl_easy_perform
+  , curl_easy_recv
+  , curl_easy_send
+
+  -- ** Get info
+  , curl_easy_getinfo
+  , CURLinfo
+      ( CURLINFO_EFFECTIVE_URL
+      , CURLINFO_RESPONSE_CODE
+      , CURLINFO_HTTP_CONNECTCODE
+      , CURLINFO_FILETIME
+      , CURLINFO_TOTAL_TIME
+      , CURLINFO_NAMELOOKUP_TIME
+      , CURLINFO_CONNECT_TIME
+      , CURLINFO_APPCONNECT_TIME
+      , CURLINFO_PRETRANSFER_TIME
+      , CURLINFO_STARTTRANSFER_TIME
+      , CURLINFO_REDIRECT_TIME
+      , CURLINFO_REDIRECT_COUNT
+      , CURLINFO_REDIRECT_URL
+      , CURLINFO_SIZE_UPLOAD
+      , CURLINFO_SIZE_DOWNLOAD
+      , CURLINFO_SPEED_DOWNLOAD
+      , CURLINFO_SPEED_UPLOAD
+      , CURLINFO_HEADER_SIZE
+      , CURLINFO_REQUEST_SIZE
+      , CURLINFO_SSL_VERIFYRESULT
+      , CURLINFO_SSL_ENGINES
+      , CURLINFO_CONTENT_LENGTH_DOWNLOAD
+      , CURLINFO_CONTENT_LENGTH_UPLOAD
+      , CURLINFO_CONTENT_TYPE
+      , CURLINFO_HTTPAUTH_AVAIL
+      , CURLINFO_PROXYAUTH_AVAIL
+      , CURLINFO_OS_ERRNO
+      , CURLINFO_NUM_CONNECTS
+      , CURLINFO_PRIMARY_IP
+      , CURLINFO_COOKIELIST
+      , CURLINFO_LASTSOCKET
+      , CURLINFO_FTP_ENTRY_PATH
+      , CURLINFO_CERTINFO
+      , CURLINFO_CONDITION_UNMET
+      , CURLINFO_RTSP_SESSION_ID
+      , CURLINFO_RTSP_CLIENT_CSEQ
+      , CURLINFO_RTSP_SERVER_CSEQ
+      , CURLINFO_RTSP_CSEQ_RECV
+      )
+
+  -- ** Set options
+  , curl_easy_setopt
+  , CURLoption
+      ---- BEHAVIOR OPTIONS ---------------------------------------------------
+      ( CURLOPT_VERBOSE
+      , CURLOPT_HEADER
+      , CURLOPT_NOPROGRESS
+      , CURLOPT_NOSIGNAL
+
+      ---- CALLBACK OPTIONS ---------------------------------------------------
+      , CURLOPT_WRITEFUNCTION
+     -- CURLOPT_WRITEDATA
+      , CURLOPT_READFUNCTION
+     -- CURLOPT_READDATA
+     -- CURLOPT_IOCTLFUNCTION
+     -- CURLOPT_IOCTLDATA
+     -- CURLOPT_SEEKFUNCTION
+     -- CURLOPT_SEEKDATA
+     -- CURLOPT_SOCKOPTFUNCTION
+     -- CURLOPT_SOCKOPTDATA
+     -- CURLOPT_OPENSOCKETFUNCTION
+     -- CURLOPT_OPENSOCKETDATA
+     -- CURLOPT_PROGRESSFUNCTION
+     -- CURLOPT_PROGRESSDATA
+     -- CURLOPT_HEADERFUNCTION
+     -- CURLOPT_HEADERDATA
+     -- CURLOPT_DEBUGFUNCTION
+     -- CURLOPT_DEBUGDATA
+     -- CURLOPT_SSL_CTX_FUNCTION
+     -- CURLOPT_SSL_CTX_DATA
+     -- CURLOPT_CONV_TO_NETWORK_FUNCTION
+     -- CURLOPT_CONV_FROM_NETWORK_FUNCTION
+     -- CURLOPT_CONV_FROM_UTF8_FUNCTION
+     -- CURLOPT_INTERLEAVEFUNCTION
+     -- CURLOPT_INTERLEAVEDATA
+
+      ---- ERROR OPTIONS ------------------------------------------------------
+     -- CURLOPT_ERRORBUFFER
+     -- CURLOPT_STDERR
+      , CURLOPT_FAILONERROR
+
+      ---- NETWORK OPTIONS ----------------------------------------------------
+      , CURLOPT_URL
+      , CURLOPT_PROTOCOLS
+      , CURLOPT_REDIR_PROTOCOLS
+      , CURLOPT_PROXY
+      , CURLOPT_PROXYPORT
+      , CURLOPT_PROXYTYPE
+      , CURLOPT_NOPROXY
+      , CURLOPT_HTTPPROXYTUNNEL
+      , CURLOPT_SOCKS5_GSSAPI_SERVICE
+      , CURLOPT_SOCKS5_GSSAPI_NEC
+      , CURLOPT_INTERFACE
+      , CURLOPT_LOCALPORT
+      , CURLOPT_LOCALPORTRANGE
+      , CURLOPT_DNS_CACHE_TIMEOUT
+     -- CURLOPT_DNS_USE_GLOBAL_CACHE
+      , CURLOPT_BUFFERSIZE
+      , CURLOPT_PORT
+      , CURLOPT_TCP_NODELAY
+      , CURLOPT_ADDRESS_SCOPE
+
+      ---- NAMES and PASSWORDS OPTIONS (Authentication) -----------------------
+      , CURLOPT_NETRC
+      , CURLOPT_NETRC_FILE
+      , CURLOPT_USERPWD
+      , CURLOPT_PROXYUSERPWD
+      , CURLOPT_USERNAME
+      , CURLOPT_PASSWORD
+      , CURLOPT_PROXYUSERNAME
+      , CURLOPT_PROXYPASSWORD
+      , CURLOPT_HTTPAUTH
+      , CURLOPT_PROXYAUTH
+
+      ---- HTTP OPTIONS -------------------------------------------------------
+      , CURLOPT_AUTOREFERER
+      , CURLOPT_ACCEPT_ENCODING  -- CURLOPT_ENCODING
+      , CURLOPT_FOLLOWLOCATION
+      , CURLOPT_UNRESTRICTED_AUTH
+      , CURLOPT_MAXREDIRS
+      , CURLOPT_POSTREDIR
+      , CURLOPT_PUT
+      , CURLOPT_POST
+     -- CURLOPT_POSTFIELDS
+      , CURLOPT_POSTFIELDSIZE
+      , CURLOPT_POSTFIELDSIZE_LARGE
+      , CURLOPT_COPYPOSTFIELDS
+     -- CURLOPT_HTTPPOST
+      , CURLOPT_REFERER
+      , CURLOPT_USERAGENT
+      , CURLOPT_HTTPHEADER
+      , CURLOPT_HTTP200ALIASES
+      , CURLOPT_COOKIE
+      , CURLOPT_COOKIEFILE
+      , CURLOPT_COOKIEJAR
+      , CURLOPT_COOKIESESSION
+      , CURLOPT_COOKIELIST
+      , CURLOPT_HTTPGET
+      , CURLOPT_HTTP_VERSION
+      , CURLOPT_IGNORE_CONTENT_LENGTH
+      , CURLOPT_HTTP_CONTENT_DECODING
+      , CURLOPT_HTTP_TRANSFER_DECODING
+
+      ---- SMTP OPTIONS -------------------------------------------------------
+      , CURLOPT_MAIL_FROM
+      , CURLOPT_MAIL_RCPT
+
+      ---- TFTP OPTIONS -------------------------------------------------------
+      , CURLOPT_TFTP_BLKSIZE
+
+      ---- FTP OPTIONS --------------------------------------------------------
+      , CURLOPT_FTPPORT
+      , CURLOPT_QUOTE
+      , CURLOPT_POSTQUOTE
+      , CURLOPT_PREQUOTE
+      , CURLOPT_DIRLISTONLY
+      , CURLOPT_APPEND
+      , CURLOPT_FTP_USE_EPRT
+      , CURLOPT_FTP_USE_EPSV
+      , CURLOPT_FTP_USE_PRET
+      , CURLOPT_FTP_CREATE_MISSING_DIRS
+      , CURLOPT_FTP_RESPONSE_TIMEOUT
+      , CURLOPT_FTP_ALTERNATIVE_TO_USER
+      , CURLOPT_FTP_SKIP_PASV_IP
+      , CURLOPT_USE_SSL
+      , CURLOPT_FTPSSLAUTH
+      , CURLOPT_FTP_SSL_CCC
+      , CURLOPT_FTP_ACCOUNT
+      , CURLOPT_FTP_FILEMETHOD
+
+      ---- RTSP OPTIONS -------------------------------------------------------
+      , CURLOPT_RTSP_REQUEST
+      , CURLOPT_RTSP_SESSION_ID
+      , CURLOPT_RTSP_STREAM_URI
+      , CURLOPT_RTSP_TRANSPORT
+      , CURLOPT_RTSP_HEADER
+      , CURLOPT_RTSP_CLIENT_CSEQ
+      , CURLOPT_RTSP_SERVER_CSEQ
+
+      ---- PROTOCOL OPTIONS ---------------------------------------------------
+      , CURLOPT_TRANSFERTEXT
+      , CURLOPT_PROXY_TRANSFER_MODE
+      , CURLOPT_CRLF
+      , CURLOPT_RANGE
+      , CURLOPT_RESUME_FROM
+      , CURLOPT_RESUME_FROM_LARGE
+      , CURLOPT_CUSTOMREQUEST
+      , CURLOPT_FILETIME
+      , CURLOPT_NOBODY
+      , CURLOPT_INFILESIZE
+      , CURLOPT_INFILESIZE_LARGE
+      , CURLOPT_UPLOAD
+      , CURLOPT_MAXFILESIZE
+      , CURLOPT_MAXFILESIZE_LARGE
+      , CURLOPT_TIMECONDITION
+      , CURLOPT_TIMEVALUE
+
+      ---- CONNECTION OPTIONS -------------------------------------------------
+      , CURLOPT_TIMEOUT
+      , CURLOPT_TIMEOUT_MS
+      , CURLOPT_LOW_SPEED_LIMIT
+      , CURLOPT_LOW_SPEED_TIME
+      , CURLOPT_MAX_SEND_SPEED_LARGE
+      , CURLOPT_MAX_RECV_SPEED_LARGE
+      , CURLOPT_MAXCONNECTS
+     -- CURLOPT_CLOSEPOLICY
+      , CURLOPT_FRESH_CONNECT
+      , CURLOPT_FORBID_REUSE
+      , CURLOPT_CONNECTTIMEOUT
+      , CURLOPT_CONNECTTIMEOUT_MS
+      , CURLOPT_IPRESOLVE
+      , CURLOPT_CONNECT_ONLY
+
+      ---- SSL and SECURITY OPTIONS -------------------------------------------
+      , CURLOPT_SSLCERT
+      , CURLOPT_SSLCERTTYPE
+      , CURLOPT_SSLKEY
+      , CURLOPT_SSLKEYTYPE
+      , CURLOPT_KEYPASSWD
+      , CURLOPT_SSLENGINE
+      , CURLOPT_SSLENGINE_DEFAULT
+      , CURLOPT_SSLVERSION
+      , CURLOPT_SSL_VERIFYPEER
+      , CURLOPT_CAINFO
+      , CURLOPT_ISSUERCERT
+      , CURLOPT_CAPATH
+      , CURLOPT_CRLFILE
+      , CURLOPT_CERTINFO
+      , CURLOPT_RANDOM_FILE
+      , CURLOPT_EGDSOCKET
+      , CURLOPT_SSL_VERIFYHOST
+      , CURLOPT_SSL_CIPHER_LIST
+      , CURLOPT_SSL_SESSIONID_CACHE
+      , CURLOPT_KRBLEVEL
+
+      ---- SSH OPTIONS --------------------------------------------------------
+      , CURLOPT_SSH_AUTH_TYPES
+      , CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
+      , CURLOPT_SSH_PUBLIC_KEYFILE
+      , CURLOPT_SSH_PRIVATE_KEYFILE
+      , CURLOPT_SSH_KNOWNHOSTS
+     -- CURLOPT_SSH_KEYFUNCTION
+     -- CURLOPT_SSH_KEYDATA
+
+      ---- OTHER OPTIONS ------------------------------------------------------
+     -- CURLOPT_PRIVATE
+      , CURLOPT_SHARE
+      , CURLOPT_NEW_FILE_PERMS
+      , CURLOPT_NEW_DIRECTORY_PERMS
+
+      ---- TELNET OPTIONS -----------------------------------------------------
+      , CURLOPT_TELNETOPTIONS
+      )
+
+  -- *** Callbacks
+  , CURL_write_callback, CURL_write_response (..)
+  , CURL_read_callback , CURL_read_response  (..)
+
+  -- *** Constants
+  , CURLproto
+      ( CURLPROTO_ALL
+      , CURLPROTO_HTTP
+      , CURLPROTO_HTTPS
+      , CURLPROTO_FTP
+      , CURLPROTO_FTPS
+      , CURLPROTO_SCP
+      , CURLPROTO_SFTP
+      , CURLPROTO_TELNET
+      , CURLPROTO_LDAP
+      , CURLPROTO_LDAPS
+      , CURLPROTO_DICT
+      , CURLPROTO_FILE
+      , CURLPROTO_TFTP
+      , CURLPROTO_IMAP
+      , CURLPROTO_IMAPS
+      , CURLPROTO_POP3
+      , CURLPROTO_POP3S
+      , CURLPROTO_SMTP
+      , CURLPROTO_SMTPS
+      , CURLPROTO_RTSP
+      )
+
+  , CURLproxy
+      ( CURLPROXY_HTTP
+      , CURLPROXY_HTTP_1_0
+      , CURLPROXY_SOCKS4
+      , CURLPROXY_SOCKS5
+      , CURLPROXY_SOCKS4A
+      , CURLPROXY_SOCKS5_HOSTNAME
+      )
+
+  , CURLnetrc
+      ( CURL_NETRC_IGNORED
+      , CURL_NETRC_OPTIONAL
+      , CURL_NETRC_REQUIRED
+      )
+
+  , CURLauth
+      ( CURLAUTH_BASIC
+      , CURLAUTH_DIGEST
+      , CURLAUTH_DIGEST_IE
+      , CURLAUTH_GSSNEGOTIATE
+      , CURLAUTH_NTLM
+      , CURLAUTH_ONLY
+      , CURLAUTH_ANY
+      , CURLAUTH_ANYSAFE
+      )
+
+  , CURLredir
+      ( CURL_REDIR_GET_ALL
+      , CURL_REDIR_POST_301
+      , CURL_REDIR_POST_302
+      , CURL_REDIR_POST_ALL
+      )
+
+  , CURLhttpver
+      ( CURL_HTTP_VERSION_NONE
+      , CURL_HTTP_VERSION_1_0
+      , CURL_HTTP_VERSION_1_1
+      )
+
+  , CURLftpcreate
+      ( CURLFTP_CREATE_DIR_NONE
+      , CURLFTP_CREATE_DIR
+      , CURLFTP_CREATE_DIR_RETRY
+      )
+
+  , CURLftpauth
+      ( CURLFTPAUTH_DEFAULT
+      , CURLFTPAUTH_SSL
+      , CURLFTPAUTH_TLS
+      )
+
+  , CURLftpssl
+      ( CURLFTPSSL_CCC_NONE
+      , CURLFTPSSL_CCC_PASSIVE
+      , CURLFTPSSL_CCC_ACTIVE
+      )
+
+  , CURLftpmethod
+      ( CURLFTPMETHOD_DEFAULT
+      , CURLFTPMETHOD_MULTICWD
+      , CURLFTPMETHOD_NOCWD
+      , CURLFTPMETHOD_SINGLECWD
+      )
+
+  , CURLrtspreq
+      ( CURL_RTSPREQ_OPTIONS
+      , CURL_RTSPREQ_DESCRIBE
+      , CURL_RTSPREQ_ANNOUNCE
+      , CURL_RTSPREQ_SETUP
+      , CURL_RTSPREQ_PLAY
+      , CURL_RTSPREQ_PAUSE
+      , CURL_RTSPREQ_TEARDOWN
+      , CURL_RTSPREQ_GET_PARAMETER
+      , CURL_RTSPREQ_SET_PARAMETER
+      , CURL_RTSPREQ_RECORD
+      , CURL_RTSPREQ_RECEIVE
+      )
+
+  , CURLtimecond
+      ( CURL_TIMECOND_NONE
+      , CURL_TIMECOND_IFMODSINCE
+      , CURL_TIMECOND_IFUNMODSINCE
+      , CURL_TIMECOND_LASTMOD
+      )
+
+  , CURLipresolve
+      ( CURL_IPRESOLVE_WHATEVER
+      , CURL_IPRESOLVE_V4
+      , CURL_IPRESOLVE_V6
+      )
+
+  , CURLusessl
+      ( CURLUSESSL_NONE
+      , CURLUSESSL_TRY
+      , CURLUSESSL_CONTROL
+      , CURLUSESSL_ALL
+      )
+
+  , CURLsslver
+      ( CURL_SSLVERSION_DEFAULT
+      , CURL_SSLVERSION_TLSv1
+      , CURL_SSLVERSION_SSLv2
+      , CURL_SSLVERSION_SSLv3
+      )
+
+  , CURLsshauth
+      ( CURLSSH_AUTH_ANY
+      , CURLSSH_AUTH_NONE
+      , CURLSSH_AUTH_PUBLICKEY
+      , CURLSSH_AUTH_PASSWORD
+      , CURLSSH_AUTH_HOST
+      , CURLSSH_AUTH_KEYBOARD
+      , CURLSSH_AUTH_DEFAULT
+      )
+
+  -- ** Exceptions
+  -- | More about error codes in libcurl on
+  --   <http://curl.haxx.se/libcurl/c/libcurl-errors.html>
+  , CURLE (..)
+  , CURLC (..)
+
+
+-------------------------------------------------------------------------------
+-- * Multi interface
+-- | See <http://curl.haxx.se/libcurl/c/libcurl-multi.html>
+--   for multi interface overview.
+-------------------------------------------------------------------------------
+-- | TODO
+
+
+-------------------------------------------------------------------------------
+-- * Share interface
+-- | See <http://curl.haxx.se/libcurl/c/libcurl-share.html>
+--   for share interface overview.
+-------------------------------------------------------------------------------
+
+  -- ** Init / Cleanup
+  , curl_share_init
+  , curl_share_cleanup
+  , CURLSH
+
+  -- ** Set options
+  , curl_share_setopt
+  , CURLSHoption
+      ( CURLSHOPT_SHARE
+      , CURLSHOPT_UNSHARE
+      )
+
+  , CURLSHlockdata
+      ( CURL_LOCK_DATA_COOKIE
+      , CURL_LOCK_DATA_DNS
+      , CURL_LOCK_DATA_SSL_SESSION
+      )
+
+  -- ** Exceptions
+  -- | More about error codes in libcurl on
+  --   <http://curl.haxx.se/libcurl/c/libcurl-errors.html>
+  , CURLSHE (..)
+  , CURLSHC (..)
+
+
+  ) where
+
+import Network.CURL000.LibHS
+import Network.CURL000.Types
+import Network.CURLXXX
+
diff --git a/Network/CURL730.hs b/Network/CURL730.hs
new file mode 100644
--- /dev/null
+++ b/Network/CURL730.hs
@@ -0,0 +1,575 @@
+-------------------------------------------------------------------------------
+-- |
+-- Module      :  Network.CURL730
+-- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis
+-- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
+-- 
+-- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- <<https://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs/CURL730>>
+-------------------------------------------------------------------------------
+
+module Network.CURL730
+  ( module Network.CURLXXX
+
+  -- |
+  -- To use functions from this module it is required to explicitly link
+  -- with @libcurl\/7.30@ (or newer) at runtime. So first things first:
+  --
+  -- > main = withlib CURL730 $ do
+  -- >   ...
+  --
+  -- Without such statement any use of the 'curl*' functions will fail.
+  -- Runtime linker will first try to load @libcurl@ binary image into
+  -- memory and after succesful loading, library version will be checked.
+  -- Standard dynamic loader search path is used to locate required
+  -- so\/dll\/dylib. Just install libcurl.so\/dll\/dylib into one of
+  -- the searched places (could be current directory).
+
+
+-------------------------------------------------------------------------------
+-- * Global interface
+-------------------------------------------------------------------------------
+ 
+  -- ** Version info
+  , curl_version
+  , curl_version_info
+  , CURL_version_info (..)
+  , CURLfeature
+      ( CURL_VERSION_IPV6
+      , CURL_VERSION_KERBEROS4
+      , CURL_VERSION_SSL
+      , CURL_VERSION_LIBZ
+      , CURL_VERSION_NTLM
+      , CURL_VERSION_GSSNEGOTIATE
+      , CURL_VERSION_DEBUG
+      , CURL_VERSION_CURLDEBUG
+      , CURL_VERSION_ASYNCHDNS
+      , CURL_VERSION_SPNEGO
+      , CURL_VERSION_LARGEFILE
+      , CURL_VERSION_IDN
+      , CURL_VERSION_SSPI
+      , CURL_VERSION_CONV
+      , CURL_VERSION_TLSAUTH_SRP
+      , CURL_VERSION_NTLM_WB
+      )
+
+-------------------------------------------------------------------------------
+-- * Easy interface
+-- | See <http://curl.haxx.se/libcurl/c/libcurl-easy.html>
+--   for easy interface overview.
+-------------------------------------------------------------------------------
+
+  -- ** Init / Cleanup
+  , curl_easy_init
+  , curl_easy_cleanup
+  , curl_easy_reset
+  , CURL
+
+  -- ** Transfer
+  , curl_easy_perform
+  , curl_easy_recv
+  , curl_easy_send
+
+  -- ** Get info
+  , curl_easy_getinfo
+  , CURLinfo
+      ( CURLINFO_EFFECTIVE_URL
+      , CURLINFO_RESPONSE_CODE
+      , CURLINFO_HTTP_CONNECTCODE
+      , CURLINFO_FILETIME
+      , CURLINFO_TOTAL_TIME
+      , CURLINFO_NAMELOOKUP_TIME
+      , CURLINFO_CONNECT_TIME
+      , CURLINFO_APPCONNECT_TIME
+      , CURLINFO_PRETRANSFER_TIME
+      , CURLINFO_STARTTRANSFER_TIME
+      , CURLINFO_REDIRECT_TIME
+      , CURLINFO_REDIRECT_COUNT
+      , CURLINFO_REDIRECT_URL
+      , CURLINFO_SIZE_UPLOAD
+      , CURLINFO_SIZE_DOWNLOAD
+      , CURLINFO_SPEED_DOWNLOAD
+      , CURLINFO_SPEED_UPLOAD
+      , CURLINFO_HEADER_SIZE
+      , CURLINFO_REQUEST_SIZE
+      , CURLINFO_SSL_VERIFYRESULT
+      , CURLINFO_SSL_ENGINES
+      , CURLINFO_CONTENT_LENGTH_DOWNLOAD
+      , CURLINFO_CONTENT_LENGTH_UPLOAD
+      , CURLINFO_CONTENT_TYPE
+      , CURLINFO_HTTPAUTH_AVAIL
+      , CURLINFO_PROXYAUTH_AVAIL
+      , CURLINFO_OS_ERRNO
+      , CURLINFO_NUM_CONNECTS
+      , CURLINFO_PRIMARY_IP
+      , CURLINFO_PRIMARY_PORT
+      , CURLINFO_LOCAL_IP
+      , CURLINFO_LOCAL_PORT
+      , CURLINFO_COOKIELIST
+      , CURLINFO_LASTSOCKET
+      , CURLINFO_FTP_ENTRY_PATH
+      , CURLINFO_CERTINFO
+      , CURLINFO_CONDITION_UNMET
+      , CURLINFO_RTSP_SESSION_ID
+      , CURLINFO_RTSP_CLIENT_CSEQ
+      , CURLINFO_RTSP_SERVER_CSEQ
+      , CURLINFO_RTSP_CSEQ_RECV
+      )
+
+  -- ** Set options
+  , curl_easy_setopt
+  , CURLoption
+      ---- BEHAVIOR OPTIONS ---------------------------------------------------
+      ( CURLOPT_VERBOSE
+      , CURLOPT_HEADER
+      , CURLOPT_NOPROGRESS
+      , CURLOPT_NOSIGNAL
+      , CURLOPT_WILDCARDMATCH
+
+      ---- CALLBACK OPTIONS ---------------------------------------------------
+      , CURLOPT_WRITEFUNCTION
+     -- CURLOPT_WRITEDATA
+      , CURLOPT_READFUNCTION
+     -- CURLOPT_READDATA
+     -- CURLOPT_IOCTLFUNCTION
+     -- CURLOPT_IOCTLDATA
+     -- CURLOPT_SEEKFUNCTION
+     -- CURLOPT_SEEKDATA
+     -- CURLOPT_SOCKOPTFUNCTION
+     -- CURLOPT_SOCKOPTDATA
+     -- CURLOPT_OPENSOCKETFUNCTION
+     -- CURLOPT_OPENSOCKETDATA
+     -- CURLOPT_CLOSESOCKETFUNCTION
+     -- CURLOPT_CLOSESOCKETDATA
+     -- CURLOPT_PROGRESSFUNCTION
+     -- CURLOPT_PROGRESSDATA
+     -- CURLOPT_HEADERFUNCTION
+     -- CURLOPT_HEADERDATA
+     -- CURLOPT_DEBUGFUNCTION
+     -- CURLOPT_DEBUGDATA
+     -- CURLOPT_SSL_CTX_FUNCTION
+     -- CURLOPT_SSL_CTX_DATA
+     -- CURLOPT_CONV_TO_NETWORK_FUNCTION
+     -- CURLOPT_CONV_FROM_NETWORK_FUNCTION
+     -- CURLOPT_CONV_FROM_UTF8_FUNCTION
+     -- CURLOPT_INTERLEAVEFUNCTION
+     -- CURLOPT_INTERLEAVEDATA
+     -- CURLOPT_CHUNK_BGN_FUNCTION
+     -- CURLOPT_CHUNK_END_FUNCTION
+     -- CURLOPT_CHUNK_DATA
+     -- CURLOPT_FNMATCH_FUNCTION
+     -- CURLOPT_FNMATCH_DATA
+
+      ---- ERROR OPTIONS ------------------------------------------------------
+     -- CURLOPT_ERRORBUFFER
+     -- CURLOPT_STDERR
+      , CURLOPT_FAILONERROR
+
+      ---- NETWORK OPTIONS ----------------------------------------------------
+      , CURLOPT_URL
+      , CURLOPT_PROTOCOLS
+      , CURLOPT_REDIR_PROTOCOLS
+      , CURLOPT_PROXY
+      , CURLOPT_PROXYPORT
+      , CURLOPT_PROXYTYPE
+      , CURLOPT_NOPROXY
+      , CURLOPT_HTTPPROXYTUNNEL
+      , CURLOPT_SOCKS5_GSSAPI_SERVICE
+      , CURLOPT_SOCKS5_GSSAPI_NEC
+      , CURLOPT_INTERFACE
+      , CURLOPT_LOCALPORT
+      , CURLOPT_LOCALPORTRANGE
+      , CURLOPT_DNS_CACHE_TIMEOUT
+     -- CURLOPT_DNS_USE_GLOBAL_CACHE
+      , CURLOPT_BUFFERSIZE
+      , CURLOPT_PORT
+      , CURLOPT_TCP_NODELAY
+      , CURLOPT_ADDRESS_SCOPE
+      , CURLOPT_TCP_KEEPALIVE
+      , CURLOPT_TCP_KEEPIDLE
+      , CURLOPT_TCP_KEEPINTVL
+
+      ---- NAMES and PASSWORDS OPTIONS (Authentication) -----------------------
+      , CURLOPT_NETRC
+      , CURLOPT_NETRC_FILE
+      , CURLOPT_USERPWD
+      , CURLOPT_PROXYUSERPWD
+      , CURLOPT_USERNAME
+      , CURLOPT_PASSWORD
+      , CURLOPT_PROXYUSERNAME
+      , CURLOPT_PROXYPASSWORD
+      , CURLOPT_HTTPAUTH
+      , CURLOPT_TLSAUTH_TYPE
+      , CURLOPT_TLSAUTH_USERNAME
+      , CURLOPT_TLSAUTH_PASSWORD
+      , CURLOPT_PROXYAUTH
+
+      ---- HTTP OPTIONS -------------------------------------------------------
+      , CURLOPT_AUTOREFERER
+      , CURLOPT_ACCEPT_ENCODING
+      , CURLOPT_TRANSFER_ENCODING
+      , CURLOPT_FOLLOWLOCATION
+      , CURLOPT_UNRESTRICTED_AUTH
+      , CURLOPT_MAXREDIRS
+      , CURLOPT_POSTREDIR
+      , CURLOPT_PUT
+      , CURLOPT_POST
+     -- CURLOPT_POSTFIELDS
+      , CURLOPT_POSTFIELDSIZE
+      , CURLOPT_POSTFIELDSIZE_LARGE
+      , CURLOPT_COPYPOSTFIELDS
+     -- CURLOPT_HTTPPOST
+      , CURLOPT_REFERER
+      , CURLOPT_USERAGENT
+      , CURLOPT_HTTPHEADER
+      , CURLOPT_HTTP200ALIASES
+      , CURLOPT_COOKIE
+      , CURLOPT_COOKIEFILE
+      , CURLOPT_COOKIEJAR
+      , CURLOPT_COOKIESESSION
+      , CURLOPT_COOKIELIST
+      , CURLOPT_HTTPGET
+      , CURLOPT_HTTP_VERSION
+      , CURLOPT_IGNORE_CONTENT_LENGTH
+      , CURLOPT_HTTP_CONTENT_DECODING
+      , CURLOPT_HTTP_TRANSFER_DECODING
+
+      ---- SMTP OPTIONS -------------------------------------------------------
+      , CURLOPT_MAIL_FROM
+      , CURLOPT_MAIL_RCPT
+      , CURLOPT_MAIL_AUTH
+
+      ---- TFTP OPTIONS -------------------------------------------------------
+      , CURLOPT_TFTP_BLKSIZE
+
+      ---- FTP OPTIONS --------------------------------------------------------
+      , CURLOPT_FTPPORT
+      , CURLOPT_QUOTE
+      , CURLOPT_POSTQUOTE
+      , CURLOPT_PREQUOTE
+      , CURLOPT_DIRLISTONLY
+      , CURLOPT_APPEND
+      , CURLOPT_FTP_USE_EPRT
+      , CURLOPT_FTP_USE_EPSV
+      , CURLOPT_FTP_USE_PRET
+      , CURLOPT_FTP_CREATE_MISSING_DIRS
+      , CURLOPT_FTP_RESPONSE_TIMEOUT
+      , CURLOPT_FTP_ALTERNATIVE_TO_USER
+      , CURLOPT_FTP_SKIP_PASV_IP
+      , CURLOPT_FTPSSLAUTH
+      , CURLOPT_FTP_SSL_CCC
+      , CURLOPT_FTP_ACCOUNT
+      , CURLOPT_FTP_FILEMETHOD
+
+      ---- RTSP OPTIONS -------------------------------------------------------
+      , CURLOPT_RTSP_REQUEST
+      , CURLOPT_RTSP_SESSION_ID
+      , CURLOPT_RTSP_STREAM_URI
+      , CURLOPT_RTSP_TRANSPORT
+      , CURLOPT_RTSP_HEADER
+      , CURLOPT_RTSP_CLIENT_CSEQ
+      , CURLOPT_RTSP_SERVER_CSEQ
+
+      ---- PROTOCOL OPTIONS ---------------------------------------------------
+      , CURLOPT_TRANSFERTEXT
+      , CURLOPT_PROXY_TRANSFER_MODE
+      , CURLOPT_CRLF
+      , CURLOPT_RANGE
+      , CURLOPT_RESUME_FROM
+      , CURLOPT_RESUME_FROM_LARGE
+      , CURLOPT_CUSTOMREQUEST
+      , CURLOPT_FILETIME
+      , CURLOPT_NOBODY
+      , CURLOPT_INFILESIZE
+      , CURLOPT_INFILESIZE_LARGE
+      , CURLOPT_UPLOAD
+      , CURLOPT_MAXFILESIZE
+      , CURLOPT_MAXFILESIZE_LARGE
+      , CURLOPT_TIMECONDITION
+      , CURLOPT_TIMEVALUE
+
+      ---- CONNECTION OPTIONS -------------------------------------------------
+      , CURLOPT_TIMEOUT
+      , CURLOPT_TIMEOUT_MS
+      , CURLOPT_LOW_SPEED_LIMIT
+      , CURLOPT_LOW_SPEED_TIME
+      , CURLOPT_MAX_SEND_SPEED_LARGE
+      , CURLOPT_MAX_RECV_SPEED_LARGE
+      , CURLOPT_MAXCONNECTS
+     -- CURLOPT_CLOSEPOLICY
+      , CURLOPT_FRESH_CONNECT
+      , CURLOPT_FORBID_REUSE
+      , CURLOPT_CONNECTTIMEOUT
+      , CURLOPT_CONNECTTIMEOUT_MS
+      , CURLOPT_IPRESOLVE
+      , CURLOPT_CONNECT_ONLY
+      , CURLOPT_USE_SSL
+      , CURLOPT_RESOLVE
+      , CURLOPT_DNS_SERVERS
+      , CURLOPT_ACCEPTTIMEOUT_MS
+
+      ---- SSL and SECURITY OPTIONS -------------------------------------------
+      , CURLOPT_SSLCERT
+      , CURLOPT_SSLCERTTYPE
+      , CURLOPT_SSLKEY
+      , CURLOPT_SSLKEYTYPE
+      , CURLOPT_KEYPASSWD
+      , CURLOPT_SSLENGINE
+      , CURLOPT_SSLENGINE_DEFAULT
+      , CURLOPT_SSLVERSION
+      , CURLOPT_SSL_VERIFYPEER
+      , CURLOPT_CAINFO
+      , CURLOPT_ISSUERCERT
+      , CURLOPT_CAPATH
+      , CURLOPT_CRLFILE
+      , CURLOPT_SSL_VERIFYHOST
+      , CURLOPT_CERTINFO
+      , CURLOPT_RANDOM_FILE
+      , CURLOPT_EGDSOCKET
+      , CURLOPT_SSL_CIPHER_LIST
+      , CURLOPT_SSL_SESSIONID_CACHE
+      , CURLOPT_SSL_OPTIONS
+      , CURLOPT_KRBLEVEL
+      , CURLOPT_GSSAPI_DELEGATION
+
+      ---- SSH OPTIONS --------------------------------------------------------
+      , CURLOPT_SSH_AUTH_TYPES
+      , CURLOPT_SSH_HOST_PUBLIC_KEY_MD5
+      , CURLOPT_SSH_PUBLIC_KEYFILE
+      , CURLOPT_SSH_PRIVATE_KEYFILE
+      , CURLOPT_SSH_KNOWNHOSTS
+     -- CURLOPT_SSH_KEYFUNCTION
+     -- CURLOPT_SSH_KEYDATA
+
+      ---- OTHER OPTIONS ------------------------------------------------------
+     -- CURLOPT_PRIVATE
+      , CURLOPT_SHARE
+      , CURLOPT_NEW_FILE_PERMS
+      , CURLOPT_NEW_DIRECTORY_PERMS
+
+      ---- TELNET OPTIONS -----------------------------------------------------
+      , CURLOPT_TELNETOPTIONS
+      )
+
+  -- *** Callbacks
+  , CURL_write_callback, CURL_write_response (..)
+  , CURL_read_callback , CURL_read_response  (..)
+
+  -- *** Constants
+  , CURLproto
+      ( CURLPROTO_ALL
+      , CURLPROTO_HTTP
+      , CURLPROTO_HTTPS
+      , CURLPROTO_FTP
+      , CURLPROTO_FTPS
+      , CURLPROTO_SCP
+      , CURLPROTO_SFTP
+      , CURLPROTO_TELNET
+      , CURLPROTO_LDAP
+      , CURLPROTO_LDAPS
+      , CURLPROTO_DICT
+      , CURLPROTO_FILE
+      , CURLPROTO_TFTP
+      , CURLPROTO_IMAP
+      , CURLPROTO_IMAPS
+      , CURLPROTO_POP3
+      , CURLPROTO_POP3S
+      , CURLPROTO_SMTP
+      , CURLPROTO_SMTPS
+      , CURLPROTO_RTSP
+      , CURLPROTO_RTMP
+      , CURLPROTO_RTMPT
+      , CURLPROTO_RTMPE
+      , CURLPROTO_RTMPTE
+      , CURLPROTO_RTMPS
+      , CURLPROTO_RTMPTS
+      , CURLPROTO_GOPHER
+      )
+
+  , CURLproxy
+      ( CURLPROXY_HTTP
+      , CURLPROXY_HTTP_1_0
+      , CURLPROXY_SOCKS4
+      , CURLPROXY_SOCKS5
+      , CURLPROXY_SOCKS4A
+      , CURLPROXY_SOCKS5_HOSTNAME
+      )
+
+  , CURLnetrc
+      ( CURL_NETRC_IGNORED
+      , CURL_NETRC_OPTIONAL
+      , CURL_NETRC_REQUIRED
+      )
+
+  , CURLauth
+      ( CURLAUTH_BASIC
+      , CURLAUTH_DIGEST
+      , CURLAUTH_DIGEST_IE
+      , CURLAUTH_GSSNEGOTIATE
+      , CURLAUTH_NTLM
+      , CURLAUTH_NTLM_WB
+      , CURLAUTH_ONLY
+      , CURLAUTH_ANY
+      , CURLAUTH_ANYSAFE
+      )
+
+  , CURLtlsauth
+      ( CURL_TLSAUTH_SRP
+      )
+
+  , CURLredir
+      ( CURL_REDIR_GET_ALL
+      , CURL_REDIR_POST_301
+      , CURL_REDIR_POST_302
+      , CURL_REDIR_POST_303
+      , CURL_REDIR_POST_ALL
+      )
+
+  , CURLhttpver
+      ( CURL_HTTP_VERSION_NONE
+      , CURL_HTTP_VERSION_1_0
+      , CURL_HTTP_VERSION_1_1
+      )
+
+  , CURLftpcreate
+      ( CURLFTP_CREATE_DIR_NONE
+      , CURLFTP_CREATE_DIR
+      , CURLFTP_CREATE_DIR_RETRY
+      )
+
+  , CURLftpauth
+      ( CURLFTPAUTH_DEFAULT
+      , CURLFTPAUTH_SSL
+      , CURLFTPAUTH_TLS
+      )
+
+  , CURLftpssl
+      ( CURLFTPSSL_CCC_NONE
+      , CURLFTPSSL_CCC_PASSIVE
+      , CURLFTPSSL_CCC_ACTIVE
+      )
+
+  , CURLftpmethod
+      ( CURLFTPMETHOD_DEFAULT
+      , CURLFTPMETHOD_MULTICWD
+      , CURLFTPMETHOD_NOCWD
+      , CURLFTPMETHOD_SINGLECWD
+      )
+
+  , CURLrtspreq
+      ( CURL_RTSPREQ_OPTIONS
+      , CURL_RTSPREQ_DESCRIBE
+      , CURL_RTSPREQ_ANNOUNCE
+      , CURL_RTSPREQ_SETUP
+      , CURL_RTSPREQ_PLAY
+      , CURL_RTSPREQ_PAUSE
+      , CURL_RTSPREQ_TEARDOWN
+      , CURL_RTSPREQ_GET_PARAMETER
+      , CURL_RTSPREQ_SET_PARAMETER
+      , CURL_RTSPREQ_RECORD
+      , CURL_RTSPREQ_RECEIVE
+      )
+
+  , CURLtimecond
+      ( CURL_TIMECOND_NONE
+      , CURL_TIMECOND_IFMODSINCE
+      , CURL_TIMECOND_IFUNMODSINCE
+      , CURL_TIMECOND_LASTMOD
+      )
+
+  , CURLipresolve
+      ( CURL_IPRESOLVE_WHATEVER
+      , CURL_IPRESOLVE_V4
+      , CURL_IPRESOLVE_V6
+      )
+
+  , CURLusessl
+      ( CURLUSESSL_NONE
+      , CURLUSESSL_TRY
+      , CURLUSESSL_CONTROL
+      , CURLUSESSL_ALL
+      )
+
+  , CURLsslver
+      ( CURL_SSLVERSION_DEFAULT
+      , CURL_SSLVERSION_TLSv1
+      , CURL_SSLVERSION_SSLv2
+      , CURL_SSLVERSION_SSLv3
+      )
+
+  , CURLsslopt
+      ( CURLSSLOPT_ALLOW_BEAST
+      )
+
+  , CURLgssapi
+      ( CURLGSSAPI_DELEGATION_NONE
+      , CURLGSSAPI_DELEGATION_POLICY_FLAG
+      , CURLGSSAPI_DELEGATION_FLAG
+      )
+
+  , CURLsshauth
+      ( CURLSSH_AUTH_ANY
+      , CURLSSH_AUTH_NONE
+      , CURLSSH_AUTH_PUBLICKEY
+      , CURLSSH_AUTH_PASSWORD
+      , CURLSSH_AUTH_HOST
+      , CURLSSH_AUTH_KEYBOARD
+      , CURLSSH_AUTH_AGENT
+      , CURLSSH_AUTH_DEFAULT
+      )
+
+  -- ** Exceptions
+  -- | More about error codes in libcurl on
+  --   <http://curl.haxx.se/libcurl/c/libcurl-errors.html>
+  , CURLE (..)
+  , CURLC (..)
+
+
+-------------------------------------------------------------------------------
+-- * Multi interface
+-- | See <http://curl.haxx.se/libcurl/c/libcurl-multi.html>
+--   for multi interface overview.
+-------------------------------------------------------------------------------
+-- | TODO
+
+
+-------------------------------------------------------------------------------
+-- * Share interface
+-- | See <http://curl.haxx.se/libcurl/c/libcurl-share.html>
+--   for share interface overview.
+-------------------------------------------------------------------------------
+
+  -- ** Init / Cleanup
+  , curl_share_init
+  , curl_share_cleanup
+  , CURLSH
+
+  -- ** Set options
+  , curl_share_setopt
+  , CURLSHoption
+      ( CURLSHOPT_SHARE
+      , CURLSHOPT_UNSHARE
+      )
+
+  , CURLSHlockdata
+      ( CURL_LOCK_DATA_COOKIE
+      , CURL_LOCK_DATA_DNS
+      , CURL_LOCK_DATA_SSL_SESSION
+      )
+
+  -- ** Exceptions
+  -- | More about error codes in libcurl on
+  --   <http://curl.haxx.se/libcurl/c/libcurl-errors.html>
+  , CURLSHE (..)
+  , CURLSHC (..)
+
+
+  ) where
+
+import Network.CURL000.LibHS
+import Network.CURL000.Types
+import Network.CURLXXX
+
diff --git a/Network/CURLXXX.hs b/Network/CURLXXX.hs
new file mode 100644
--- /dev/null
+++ b/Network/CURLXXX.hs
@@ -0,0 +1,23 @@
+-------------------------------------------------------------------------------
+-- |
+-- Module      :  Network.CURLXXX
+-- Copyright   :  Copyright © 2012-2014 Krzysztof Kardzis
+-- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
+-- 
+-- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- <<https://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs/CURLXXX>>
+-------------------------------------------------------------------------------
+
+module Network.CURLXXX (
+  -----------------------------------------------------------------------------
+  -- * Run-Time Linking
+  -----------------------------------------------------------------------------
+    module Network.CURL000.LibLD
+
+  ) where
+
+import Network.CURL000.LibLD
+
diff --git a/Network/Curlhs/Base.hsc b/Network/Curlhs/Base.hsc
deleted file mode 100644
--- a/Network/Curlhs/Base.hsc
+++ /dev/null
@@ -1,1814 +0,0 @@
--------------------------------------------------------------------------------
--- |
--- Module      :  Network.Curlhs.Base
--- Copyright   :  Copyright © 2012 Krzysztof Kardzis
--- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
--- 
--- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
--- Stability   :  experimental
--- Portability :  non-portable
---
---
--- Module "Network.Curlhs.Base" provides a direct low-level bindings to
--- @libcurl@. It is basically a 1:1 mapping of the @libcurl@'s C API,
--- a direct translation of \"curl/curl.h\" header files to Haskell FFI.
--- A higher level interface, without ubiquitous pointers and all of that
--- C stuff, is provided through the module "Network.Curlhs.Core".
---
--- Documentation about the library and/or particular functions may be found
--- in the @libcurl@'s manual pages or on the @libcurl@'s project site
--- (<http://curl.haxx.se/libcurl/>). Because API of this module mirrors API
--- of the external library, particular symbols may exist or not,
--- dependently of that, which version of @libcurl@ is used during compilation
--- of the package. The module as closely as possible tries to follow
--- the original @libcurl@ API. The main differences are in types of functions
--- such as @curl_easy_setopt@ and @curl_easy_getinfo@. Besides that all
--- symbol names are prefixed with \'c\' or \'C\'. 
---
--- As the name of the module may suggest, this module is a basis for the
--- rest of @curlhs@ package. For now exposed API is somewhat incomplete,
--- still lacks some things (like the \"multi interface\"), but the aim is
--- to provide here a complete API of @libcurl@, as defined in its C headers.
---
--------------------------------------------------------------------------------
-
-{-# LANGUAGE ForeignFunctionInterface #-}
-{-# LANGUAGE EmptyDataDecls           #-}
-
-module Network.Curlhs.Base where
-
-import Foreign.C.Types
-import Foreign.Storable (Storable (..))
-import Foreign.Ptr      (Ptr, FunPtr, castPtr)
-
-import Control.Applicative ((<$>), (<*>))
-
-
--------------------------------------------------------------------------------
-#{let alignof type = "(%ld)", (long) offsetof (struct {char x; type y;}, y)}
-
-#define CURL_NO_OLDIES
-#include "curl/curl.h"
-
-#define hsc_symbol(name, type) \
-  printf("c" #name " :: C" #type "\n"); \
-  printf("c" #name " =  C" #type " "); hsc_const(name);
-
-#define hsc_cconst(name, type) \
-  printf("c" #name " :: " #type "\n"); \
-  printf("c" #name " =  "); hsc_const(name);
-
-
--------------------------------------------------------------------------------
--- * Definitions from \"curl/curlver.h\"
--------------------------------------------------------------------------------
-libCURL_COPYRIGHT :: String
-libCURL_COPYRIGHT = #{const_str LIBCURL_COPYRIGHT}
-
-libCURL_TIMESTAMP :: String
-libCURL_TIMESTAMP = #{const_str LIBCURL_TIMESTAMP}
-
-libCURL_VERSION   :: String
-libCURL_VERSION   = #{const_str LIBCURL_VERSION  }
-
-libCURL_VERSION_NUM   :: Int
-libCURL_VERSION_NUM   = #{const LIBCURL_VERSION_NUM  }
-
-libCURL_VERSION_MAJOR :: Int
-libCURL_VERSION_MAJOR = #{const LIBCURL_VERSION_MAJOR}
-
-libCURL_VERSION_MINOR :: Int
-libCURL_VERSION_MINOR = #{const LIBCURL_VERSION_MINOR}
-
-libCURL_VERSION_PATCH :: Int
-libCURL_VERSION_PATCH = #{const LIBCURL_VERSION_PATCH}
-
-
--------------------------------------------------------------------------------
--- * Definitions from \"curl/curlbuild.h\"
--------------------------------------------------------------------------------
-type CCURL_off_t = CLLong  -- ??
-
-
--------------------------------------------------------------------------------
--- * Definitions from \"curl/curlrules.h\"
--------------------------------------------------------------------------------
--- todo
-
-
--------------------------------------------------------------------------------
--- * Definitions from \"curl/curl.h\"
--------------------------------------------------------------------------------
-data CCURL
-
-
--------------------------------------------------------------------------------
-#if defined(WIN32) && !defined(__LWIP_OPT_H__)
-type CCURL_socket_t = CUIntPtr -- SOCKET??
-#else
-type CCURL_socket_t = CInt
-#endif
-
-#{cconst CURL_SOCKET_BAD, CCURL_socket_t}
-
-
--------------------------------------------------------------------------------
--- ** CURL_httppost
--------------------------------------------------------------------------------
-data CCURL_httppost = CCURL_httppost
-  { ccurl_httppost_next           :: Ptr CCURL_httppost
-  , ccurl_httppost_name           :: Ptr CChar
-  , ccurl_httppost_namelength     :: CLong
-  , ccurl_httppost_contents       :: Ptr CChar
-  , ccurl_httppost_contentslength :: CLong
-  , ccurl_httppost_buffer         :: Ptr CChar
-  , ccurl_httppost_bufferlength   :: CLong
-  , ccurl_httppost_contenttype    :: Ptr CChar
-  , ccurl_httppost_contentheader  :: Ptr CCURL_slist
-  , ccurl_httppost_more           :: Ptr CCURL_httppost
-  , ccurl_httppost_flags          :: CLong
-  , ccurl_httppost_showfilename   :: Ptr CChar
-  , ccurl_httppost_userp          :: Ptr ()
-  } deriving (Show)
-
--- instance Storable CCURL_httppost where
---   sizeOf _    = #{size    struct curl_httppost}
---   alignment _ = #{alignof struct curl_httppost}
---   poke _ _    = undefined
---   peek _      = undefined
-
-#{cconst HTTPPOST_FILENAME   , CLong}
-#{cconst HTTPPOST_READFILE   , CLong}
-#{cconst HTTPPOST_PTRNAME    , CLong}
-#{cconst HTTPPOST_PTRCONTENTS, CLong}
-#{cconst HTTPPOST_BUFFER     , CLong}
-#{cconst HTTPPOST_PTRBUFFER  , CLong}
-#{cconst HTTPPOST_CALLBACK   , CLong}
- 
--------------------------------------------------------------------------------
--- ** Callbacks
--------------------------------------------------------------------------------
--- *** CURL_progress_callback
--------------------------------------------------------------------------------
-type CCURL_progress_callback
-  = Ptr () -> CDouble -> CDouble -> CDouble -> CDouble -> IO CInt
-
-foreign import ccall "wrapper"
-  wrap_ccurl_progress_callback
-    :: CCURL_progress_callback
-    -> IO (FunPtr CCURL_progress_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_write_callback
--------------------------------------------------------------------------------
-#{cconst CURL_MAX_WRITE_SIZE , CSize}
-#{cconst CURL_MAX_HTTP_HEADER, CSize}
-#{cconst CURL_WRITEFUNC_PAUSE, CSize}
-
-type CCURL_write_callback
-  = Ptr CChar -> CSize -> CSize -> Ptr () -> IO CSize
-
-foreign import ccall "wrapper"
-  wrap_ccurl_write_callback
-    :: CCURL_write_callback
-    -> IO (FunPtr CCURL_write_callback)
-
-
--------------------------------------------------------------------------------
--- ** CURL_fileinfo
--------------------------------------------------------------------------------
-newtype CCURLfiletype = CCURLfiletype CInt deriving (Eq, Show)   |7210:----|
-
-#{symbol CURLFILETYPE_FILE        , CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_DIRECTORY   , CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_SYMLINK     , CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_DEVICE_BLOCK, CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_DEVICE_CHAR , CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_NAMEDPIPE   , CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_SOCKET      , CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_DOOR        , CURLfiletype}                |7210:----|
-#{symbol CURLFILETYPE_UNKNOWN     , CURLfiletype}                |7210:----|
-
-#{cconst CURLFINFOFLAG_KNOWN_FILENAME  , CUInt}                  |7210:----|
-#{cconst CURLFINFOFLAG_KNOWN_FILETYPE  , CUInt}                  |7210:----|
-#{cconst CURLFINFOFLAG_KNOWN_TIME      , CUInt}                  |7210:----|
-#{cconst CURLFINFOFLAG_KNOWN_PERM      , CUInt}                  |7210:----|
-#{cconst CURLFINFOFLAG_KNOWN_UID       , CUInt}                  |7210:----|
-#{cconst CURLFINFOFLAG_KNOWN_GID       , CUInt}                  |7210:----|
-#{cconst CURLFINFOFLAG_KNOWN_SIZE      , CUInt}                  |7210:----|
-#{cconst CURLFINFOFLAG_KNOWN_HLINKCOUNT, CUInt}                  |7210:----|
-
-data CCURL_fileinfo = CCURL_fileinfo                             |7210:----|
-  { ccurl_fileinfo_filename       :: Ptr CChar                   |7210:----|
-  , ccurl_fileinfo_filetype       :: CCURLfiletype               |7210:----|
-  , ccurl_fileinfo_time           :: CTime                       |7210:----|
-  , ccurl_fileinfo_perm           :: CUInt                       |7210:----|
-  , ccurl_fileinfo_uid            :: CInt                        |7210:----|
-  , ccurl_fileinfo_gid            :: CInt                        |7210:----|
-  , ccurl_fileinfo_size           :: CCURL_off_t                 |7210:----|
-  , ccurl_fileinfo_hardlinks      :: CLong                       |7210:----|
-  , ccurl_fileinfo_strings_time   :: Ptr CChar                   |7210:----|
-  , ccurl_fileinfo_strings_perm   :: Ptr CChar                   |7210:----|
-  , ccurl_fileinfo_strings_user   :: Ptr CChar                   |7210:----|
-  , ccurl_fileinfo_strings_group  :: Ptr CChar                   |7210:----|
-  , ccurl_fileinfo_strings_target :: Ptr CChar                   |7210:----|
-  , ccurl_fileinfo_flags          :: CUInt                       |7210:----|
-  , ccurl_fileinfo_b_data         :: Ptr CChar                   |7210:----|
-  , ccurl_fileinfo_b_size         :: CSize                       |7210:----|
-  , ccurl_fileinfo_b_used         :: CSize                       |7210:----|
-  } deriving (Show)                                              |7210:----|
-
--- instance Storable CCURL_fileinfo where                        |7210:----|
---   sizeOf _    = #{size    struct curl_fileinfo}               |7210:----|
---   alignment _ = #{alignof struct curl_fileinfo}               |7210:----|
---   poke _ _    = undefined                                     |7210:----|
---   peek _      = undefined                                     |7210:----|
-
- 
--------------------------------------------------------------------------------
--- ** Callbacks
--------------------------------------------------------------------------------
--- *** CURL_chunk_bgn_callback
--------------------------------------------------------------------------------
-#{cconst CURL_CHUNK_BGN_FUNC_OK  , CLong}                        |7210:----|
-#{cconst CURL_CHUNK_BGN_FUNC_FAIL, CLong}                        |7210:----|
-#{cconst CURL_CHUNK_BGN_FUNC_SKIP, CLong}                        |7210:----|
-
-type CCURL_chunk_bgn_callback                                    |7210:----|
-  = Ptr () -> Ptr () -> CInt -> IO CLong                         |7210:----|
-
-foreign import ccall "wrapper"                                   |7210:----|
-  wrap_ccurl_chunk_bgn_callback                                  |7210:----|
-    :: CCURL_chunk_bgn_callback                                  |7210:----|
-    -> IO (FunPtr CCURL_chunk_bgn_callback)                      |7210:----|
-
-
--------------------------------------------------------------------------------
--- *** CURL_chunk_end_callback
--------------------------------------------------------------------------------
-#{cconst CURL_CHUNK_END_FUNC_OK  , CLong}                        |7210:----|
-#{cconst CURL_CHUNK_END_FUNC_FAIL, CLong}                        |7210:----|
-
-type CCURL_chunk_end_callback                                    |7210:----|
-  = Ptr () -> IO CLong                                           |7210:----|
-
-foreign import ccall "wrapper"                                   |7210:----|
-  wrap_ccurl_chunk_end_callback                                  |7210:----|
-    :: CCURL_chunk_end_callback                                  |7210:----|
-    -> IO (FunPtr CCURL_chunk_end_callback)                      |7210:----|
-
- 
--------------------------------------------------------------------------------
--- *** CURL_fnmatch_callback
--------------------------------------------------------------------------------
-#{cconst CURL_FNMATCHFUNC_MATCH  , CInt}                         |7210:----|
-#{cconst CURL_FNMATCHFUNC_NOMATCH, CInt}                         |7210:----|
-#{cconst CURL_FNMATCHFUNC_FAIL   , CInt}                         |7210:----|
-
-type CCURL_fnmatch_callback                                      |7210:----|
-  = Ptr () -> Ptr CChar -> Ptr CChar -> IO CInt                  |7210:----|
-
-foreign import ccall "wrapper"                                   |7210:----|
-  wrap_ccurl_fnmatch_callback                                    |7210:----|
-    :: CCURL_fnmatch_callback                                    |7210:----|
-    -> IO (FunPtr CCURL_fnmatch_callback)                        |7210:----|
-
- 
--------------------------------------------------------------------------------
--- *** CURL_seek_callback
--------------------------------------------------------------------------------
-#{cconst CURL_SEEKFUNC_OK      , CInt}
-#{cconst CURL_SEEKFUNC_FAIL    , CInt}
-#{cconst CURL_SEEKFUNC_CANTSEEK, CInt}
-
-type CCURL_seek_callback
-  = Ptr () -> CCURL_off_t -> CInt -> IO CInt
-
-foreign import ccall "wrapper"
-  wrap_ccurl_seek_callback
-    :: CCURL_seek_callback
-    -> IO (FunPtr CCURL_seek_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_read_callback
--------------------------------------------------------------------------------
-#{cconst CURL_READFUNC_ABORT, CSize}
-#{cconst CURL_READFUNC_PAUSE, CSize}
-
-type CCURL_read_callback
-  = Ptr CChar -> CSize -> CSize -> Ptr () -> IO CSize
-
-foreign import ccall "wrapper"
-  wrap_ccurl_read_callback
-    :: CCURL_read_callback
-    -> IO (FunPtr CCURL_read_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_sockopt_callback
--------------------------------------------------------------------------------
-newtype CCURLsocktype = CCURLsocktype CInt deriving (Eq, Show)
-
-#{symbol CURLSOCKTYPE_IPCXN, CURLsocktype}
-
-#{cconst CURL_SOCKOPT_OK               , CInt}                   |7215:----|
-#{cconst CURL_SOCKOPT_ERROR            , CInt}                   |7215:----|
-#{cconst CURL_SOCKOPT_ALREADY_CONNECTED, CInt}                   |7215:----|
-
-type CCURL_sockopt_callback
-  = Ptr () -> CCURL_socket_t -> CCURLsocktype -> IO CInt
-
-foreign import ccall "wrapper"
-  wrap_ccurl_sockopt_callback
-    :: CCURL_sockopt_callback
-    -> IO (FunPtr CCURL_sockopt_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_opensocket_callback
--------------------------------------------------------------------------------
-data CCURL_sockaddr = CCURL_sockaddr
-  { ccurl_sockaddr_family   :: CInt
-  , ccurl_sockaddr_socktype :: CInt
-  , ccurl_sockaddr_protocol :: CInt
-  , ccurl_sockaddr_addrlen  :: CUInt
-  , ccurl_sockaddr_addr     :: Ptr ()  -- sockaddr?? TODO
-  } deriving (Show)
-
--- instance Storable CCURL_sockaddr where
---   sizeOf _    = #{size    struct curl_sockaddr}
---   alignment _ = #{alignof struct curl_sockaddr}
---   poke _ _    = undefined
---   peek _      = undefined
-
-type CCURL_opensocket_callback
-  = Ptr () -> CCURLsocktype -> Ptr CCURL_sockaddr -> IO CCURL_socket_t
-
-foreign import ccall "wrapper"
-  wrap_ccurl_opensocket_callback
-    :: CCURL_opensocket_callback
-    -> IO (FunPtr CCURL_opensocket_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_closesocket_callback
--------------------------------------------------------------------------------
-type CCURL_closesocket_callback                                  |7217:----|
-  = Ptr () -> CCURL_socket_t -> IO CInt                          |7217:----|
-
-foreign import ccall "wrapper"                                   |7217:----|
-  wrap_ccurl_closesocket_callback                                |7217:----|
-    :: CCURL_closesocket_callback                                |7217:----|
-    -> IO (FunPtr CCURL_closesocket_callback)                    |7217:----|
-
- 
--------------------------------------------------------------------------------
--- *** CURL_ioctl_callback
--------------------------------------------------------------------------------
-newtype CCURLioerr = CCURLioerr CInt deriving (Eq, Show)
-
-#{symbol CURLIOE_OK           , CURLioerr}
-#{symbol CURLIOE_UNKNOWNCMD   , CURLioerr}
-#{symbol CURLIOE_FAILRESTART  , CURLioerr}
-
-newtype CCURLiocmd = CCURLiocmd CInt deriving (Eq, Show)
-
-#{symbol CURLIOCMD_NOP        , CURLiocmd}
-#{symbol CURLIOCMD_RESTARTREAD, CURLiocmd}
-
-type CCURL_ioctl_callback
-  = Ptr CCURL -> CCURLiocmd -> Ptr () -> IO CCURLioerr
-
-foreign import ccall "wrapper"
-  wrap_ccurl_ioctl_callback
-    :: CCURL_ioctl_callback
-    -> IO (FunPtr CCURL_ioctl_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_malloc_callback
--------------------------------------------------------------------------------
-type CCURL_malloc_callback
-  = CSize -> IO (Ptr ())
-
-foreign import ccall "wrapper"
-  wrap_ccurl_malloc_callback
-    :: CCURL_malloc_callback
-    -> IO (FunPtr CCURL_malloc_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_free_callback
--------------------------------------------------------------------------------
-type CCURL_free_callback
-  = Ptr () -> IO ()
-
-foreign import ccall "wrapper"
-  wrap_ccurl_free_callback
-    :: CCURL_free_callback
-    -> IO (FunPtr CCURL_free_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_realloc_callback
--------------------------------------------------------------------------------
-type CCURL_realloc_callback
-  = Ptr () -> CSize -> IO (Ptr ())
-
-foreign import ccall "wrapper"
-  wrap_ccurl_realloc_callback
-    :: CCURL_realloc_callback
-    -> IO (FunPtr CCURL_realloc_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_strdup_callback
--------------------------------------------------------------------------------
-type CCURL_strdup_callback
-  = Ptr CChar -> IO (Ptr CChar)
-
-foreign import ccall "wrapper"
-  wrap_ccurl_strdup_callback
-    :: CCURL_strdup_callback
-    -> IO (FunPtr CCURL_strdup_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_calloc_callback
--------------------------------------------------------------------------------
-type CCURL_calloc_callback
-  = CSize -> CSize -> IO (Ptr ())
-
-foreign import ccall "wrapper"
-  wrap_ccurl_calloc_callback
-    :: CCURL_calloc_callback
-    -> IO (FunPtr CCURL_calloc_callback)
-
- 
--------------------------------------------------------------------------------
--- *** CURL_debug_callback
--------------------------------------------------------------------------------
-newtype CCURL_infotype = CCURL_infotype CInt deriving (Eq, Show)
-
-#{symbol CURLINFO_TEXT        , CURL_infotype}
-#{symbol CURLINFO_HEADER_IN   , CURL_infotype}
-#{symbol CURLINFO_HEADER_OUT  , CURL_infotype}
-#{symbol CURLINFO_DATA_IN     , CURL_infotype}
-#{symbol CURLINFO_DATA_OUT    , CURL_infotype}
-#{symbol CURLINFO_SSL_DATA_IN , CURL_infotype}
-#{symbol CURLINFO_SSL_DATA_OUT, CURL_infotype}
-#{symbol CURLINFO_END         , CURL_infotype}
-
-type CCURL_debug_callback
-  = Ptr CCURL -> CCURL_infotype -> Ptr CChar -> CSize -> Ptr () -> IO CInt
-
-foreign import ccall "wrapper"
-  wrap_ccurl_debug_callback
-    :: CCURL_debug_callback
-    -> IO (FunPtr CCURL_debug_callback)
-
-
--------------------------------------------------------------------------------
--- ** Constants
--------------------------------------------------------------------------------
--- *** CURLcode
--------------------------------------------------------------------------------
-newtype CCURLcode = CCURLcode CInt deriving (Eq, Show)
-
-#{symbol CURLE_OK                      , CURLcode}
-#{symbol CURLE_UNSUPPORTED_PROTOCOL    , CURLcode}
-#{symbol CURLE_FAILED_INIT             , CURLcode}
-#{symbol CURLE_URL_MALFORMAT           , CURLcode}
-#{symbol CURLE_NOT_BUILT_IN            , CURLcode} |7215:----|
-#{symbol CURLE_COULDNT_RESOLVE_PROXY   , CURLcode}
-#{symbol CURLE_COULDNT_RESOLVE_HOST    , CURLcode}
-#{symbol CURLE_COULDNT_CONNECT         , CURLcode}
-#{symbol CURLE_FTP_WEIRD_SERVER_REPLY  , CURLcode}
-#{symbol CURLE_REMOTE_ACCESS_DENIED    , CURLcode}
-#{symbol CURLE_FTP_ACCEPT_FAILED       , CURLcode} |7240:----|
-#{symbol CURLE_FTP_WEIRD_PASS_REPLY    , CURLcode}
-#{symbol CURLE_FTP_ACCEPT_TIMEOUT      , CURLcode} |7240:----|
-#{symbol CURLE_FTP_WEIRD_PASV_REPLY    , CURLcode}
-#{symbol CURLE_FTP_WEIRD_227_FORMAT    , CURLcode}
-#{symbol CURLE_FTP_CANT_GET_HOST       , CURLcode}
-#{symbol CURLE_FTP_COULDNT_SET_TYPE    , CURLcode}
-#{symbol CURLE_PARTIAL_FILE            , CURLcode}
-#{symbol CURLE_FTP_COULDNT_RETR_FILE   , CURLcode}
-#{symbol CURLE_QUOTE_ERROR             , CURLcode}
-#{symbol CURLE_HTTP_RETURNED_ERROR     , CURLcode}
-#{symbol CURLE_WRITE_ERROR             , CURLcode}
-#{symbol CURLE_UPLOAD_FAILED           , CURLcode}
-#{symbol CURLE_READ_ERROR              , CURLcode}
-#{symbol CURLE_OUT_OF_MEMORY           , CURLcode}
-#{symbol CURLE_OPERATION_TIMEDOUT      , CURLcode}
-#{symbol CURLE_FTP_PORT_FAILED         , CURLcode}
-#{symbol CURLE_FTP_COULDNT_USE_REST    , CURLcode}
-#{symbol CURLE_RANGE_ERROR             , CURLcode}
-#{symbol CURLE_HTTP_POST_ERROR         , CURLcode}
-#{symbol CURLE_SSL_CONNECT_ERROR       , CURLcode}
-#{symbol CURLE_BAD_DOWNLOAD_RESUME     , CURLcode}
-#{symbol CURLE_FILE_COULDNT_READ_FILE  , CURLcode}
-#{symbol CURLE_LDAP_CANNOT_BIND        , CURLcode}
-#{symbol CURLE_LDAP_SEARCH_FAILED      , CURLcode}
-#{symbol CURLE_FUNCTION_NOT_FOUND      , CURLcode}
-#{symbol CURLE_ABORTED_BY_CALLBACK     , CURLcode}
-#{symbol CURLE_BAD_FUNCTION_ARGUMENT   , CURLcode}
-#{symbol CURLE_INTERFACE_FAILED        , CURLcode}
-#{symbol CURLE_TOO_MANY_REDIRECTS      , CURLcode}
-#{symbol CURLE_UNKNOWN_TELNET_OPTION   , CURLcode} |----:7214|
-#{symbol CURLE_UNKNOWN_OPTION          , CURLcode} |7215:----|
-#{symbol CURLE_TELNET_OPTION_SYNTAX    , CURLcode}
-#{symbol CURLE_PEER_FAILED_VERIFICATION, CURLcode}
-#{symbol CURLE_GOT_NOTHING             , CURLcode}
-#{symbol CURLE_SSL_ENGINE_NOTFOUND     , CURLcode}
-#{symbol CURLE_SSL_ENGINE_SETFAILED    , CURLcode}
-#{symbol CURLE_SEND_ERROR              , CURLcode}
-#{symbol CURLE_RECV_ERROR              , CURLcode}
-#{symbol CURLE_SSL_CERTPROBLEM         , CURLcode}
-#{symbol CURLE_SSL_CIPHER              , CURLcode}
-#{symbol CURLE_SSL_CACERT              , CURLcode}
-#{symbol CURLE_BAD_CONTENT_ENCODING    , CURLcode}
-#{symbol CURLE_LDAP_INVALID_URL        , CURLcode}
-#{symbol CURLE_FILESIZE_EXCEEDED       , CURLcode}
-#{symbol CURLE_USE_SSL_FAILED          , CURLcode}
-#{symbol CURLE_SEND_FAIL_REWIND        , CURLcode}
-#{symbol CURLE_SSL_ENGINE_INITFAILED   , CURLcode}
-#{symbol CURLE_LOGIN_DENIED            , CURLcode}
-#{symbol CURLE_TFTP_NOTFOUND           , CURLcode}
-#{symbol CURLE_TFTP_PERM               , CURLcode}
-#{symbol CURLE_REMOTE_DISK_FULL        , CURLcode}
-#{symbol CURLE_TFTP_ILLEGAL            , CURLcode}
-#{symbol CURLE_TFTP_UNKNOWNID          , CURLcode}
-#{symbol CURLE_REMOTE_FILE_EXISTS      , CURLcode}
-#{symbol CURLE_TFTP_NOSUCHUSER         , CURLcode}
-#{symbol CURLE_CONV_FAILED             , CURLcode}
-#{symbol CURLE_CONV_REQD               , CURLcode}
-#{symbol CURLE_SSL_CACERT_BADFILE      , CURLcode}
-#{symbol CURLE_REMOTE_FILE_NOT_FOUND   , CURLcode}
-#{symbol CURLE_SSH                     , CURLcode}
-#{symbol CURLE_SSL_SHUTDOWN_FAILED     , CURLcode}
-#{symbol CURLE_AGAIN                   , CURLcode}
-#{symbol CURLE_SSL_CRL_BADFILE         , CURLcode}
-#{symbol CURLE_SSL_ISSUER_ERROR        , CURLcode}
-#{symbol CURLE_FTP_PRET_FAILED         , CURLcode}
-#{symbol CURLE_RTSP_CSEQ_ERROR         , CURLcode}
-#{symbol CURLE_RTSP_SESSION_ERROR      , CURLcode}
-#{symbol CURLE_FTP_BAD_FILE_LIST       , CURLcode} |7210:----|
-#{symbol CURLE_CHUNK_FAILED            , CURLcode} |7210:----|
-
-
--------------------------------------------------------------------------------
--- ** Callbacks
--------------------------------------------------------------------------------
--- *** CURL_conv_callback
--------------------------------------------------------------------------------
-type CCURL_conv_callback
-  = Ptr CChar -> CSize -> IO CCURLcode
-
-foreign import ccall "wrapper"
-  wrap_ccurl_conv_callback
-    :: CCURL_conv_callback
-    -> IO (FunPtr CCURL_conv_callback)
-
-
--------------------------------------------------------------------------------
--- *** CURL_ssl_ctx_callback
--------------------------------------------------------------------------------
-type CCURL_ssl_ctx_callback
-  = Ptr CCURL -> Ptr () -> Ptr () -> IO CCURLcode
-
-foreign import ccall "wrapper"
-  wrap_ccurl_ssl_ctx_callback
-    :: CCURL_ssl_ctx_callback
-    -> IO (FunPtr CCURL_ssl_ctx_callback)
-
- 
--------------------------------------------------------------------------------
--- ** Constants
--------------------------------------------------------------------------------
--- *** CURLproxy
--------------------------------------------------------------------------------
-#{cconst CURLPROXY_HTTP           , CLong}
-#{cconst CURLPROXY_HTTP_1_0       , CLong}
-#{cconst CURLPROXY_SOCKS4         , CLong}
-#{cconst CURLPROXY_SOCKS5         , CLong}
-#{cconst CURLPROXY_SOCKS4A        , CLong}
-#{cconst CURLPROXY_SOCKS5_HOSTNAME, CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLauth
--------------------------------------------------------------------------------
-#{cconst CURLAUTH_NONE        , CLong}
-#{cconst CURLAUTH_BASIC       , CLong}
-#{cconst CURLAUTH_DIGEST      , CLong}
-#{cconst CURLAUTH_GSSNEGOTIATE, CLong}
-#{cconst CURLAUTH_NTLM        , CLong}
-#{cconst CURLAUTH_DIGEST_IE   , CLong}
-#{cconst CURLAUTH_NTLM_WB     , CLong} |7220:----|
-#{cconst CURLAUTH_ONLY        , CLong} |7213:----|
-#{cconst CURLAUTH_ANY         , CLong}
-#{cconst CURLAUTH_ANYSAFE     , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLsshauth
--------------------------------------------------------------------------------
-#{cconst CURLSSH_AUTH_ANY      , CLong}
-#{cconst CURLSSH_AUTH_NONE     , CLong}
-#{cconst CURLSSH_AUTH_PUBLICKEY, CLong}
-#{cconst CURLSSH_AUTH_PASSWORD , CLong}
-#{cconst CURLSSH_AUTH_HOST     , CLong}
-#{cconst CURLSSH_AUTH_KEYBOARD , CLong}
-#{cconst CURLSSH_AUTH_DEFAULT  , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLgssapi
--------------------------------------------------------------------------------
-#{cconst CURLGSSAPI_DELEGATION_NONE       , CLong}               |7220:----|
-#{cconst CURLGSSAPI_DELEGATION_POLICY_FLAG, CLong}               |7220:----|
-#{cconst CURLGSSAPI_DELEGATION_FLAG       , CLong}               |7220:----|
-
-
--------------------------------------------------------------------------------
--- *** CURL_error_size
--------------------------------------------------------------------------------
-#{cconst CURL_ERROR_SIZE, CLong}
-
-
--------------------------------------------------------------------------------
--- ** Callbacks
--------------------------------------------------------------------------------
--- *** CURL_sshkey_callback
--------------------------------------------------------------------------------
-data CCURL_khkey = CCURL_khkey
-  { ccurl_khkey_key     :: Ptr CChar
-  , ccurl_khkey_len     :: CSize
-  , ccurl_khkey_keytype :: CCURL_khtype
-  } deriving (Show)
-
--- instance Storable CCURL_khkey where
---   sizeOf _    = #{size    struct curl_khkey}
---   alignment _ = #{alignof struct curl_khkey}
---   poke _ _    = undefined
---   peek _      = undefined
-
-newtype CCURL_khtype = CCURL_khtype CInt deriving (Eq, Show)
-
-#{symbol CURLKHTYPE_UNKNOWN, CURL_khtype}
-#{symbol CURLKHTYPE_RSA1   , CURL_khtype}
-#{symbol CURLKHTYPE_RSA    , CURL_khtype}
-#{symbol CURLKHTYPE_DSS    , CURL_khtype}
- 
-newtype CCURL_khstat = CCURL_khstat CInt deriving (Eq, Show)
-
-#{symbol CURLKHSTAT_FINE_ADD_TO_FILE, CURL_khstat}
-#{symbol CURLKHSTAT_FINE            , CURL_khstat}
-#{symbol CURLKHSTAT_REJECT          , CURL_khstat}
-#{symbol CURLKHSTAT_DEFER           , CURL_khstat}
-
-newtype CCURL_khmatch = CCURL_khmatch CInt deriving (Eq, Show)
-
-#{symbol CURLKHMATCH_OK      , CURL_khmatch}
-#{symbol CURLKHMATCH_MISMATCH, CURL_khmatch}
-#{symbol CURLKHMATCH_MISSING , CURL_khmatch}
- 
-type CCURL_sshkey_callback
-  = Ptr CCURL -> Ptr CCURL_khkey -> Ptr CCURL_khkey
-    -> CCURL_khmatch -> Ptr () -> IO CCURL_khstat
-
-foreign import ccall "wrapper"
-  wrap_ccurl_sshkey_callback
-    :: CCURL_sshkey_callback
-    -> IO (FunPtr CCURL_sshkey_callback)
-
- 
--------------------------------------------------------------------------------
--- ** Constants
--------------------------------------------------------------------------------
--- *** CURLusessl
--------------------------------------------------------------------------------
-#{cconst CURLUSESSL_NONE   , CLong}
-#{cconst CURLUSESSL_TRY    , CLong}
-#{cconst CURLUSESSL_CONTROL, CLong}
-#{cconst CURLUSESSL_ALL    , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLsslopt
--------------------------------------------------------------------------------
-#{cconst CURLSSLOPT_ALLOW_BEAST, CLong}                          |7250:----|
-
-
--------------------------------------------------------------------------------
--- *** CURLftpssl
--------------------------------------------------------------------------------
-#{cconst CURLFTPSSL_CCC_NONE   , CLong}
-#{cconst CURLFTPSSL_CCC_PASSIVE, CLong}
-#{cconst CURLFTPSSL_CCC_ACTIVE , CLong}
- 
-
--------------------------------------------------------------------------------
--- *** CURLftpauth
--------------------------------------------------------------------------------
-#{cconst CURLFTPAUTH_DEFAULT, CLong}
-#{cconst CURLFTPAUTH_SSL    , CLong}
-#{cconst CURLFTPAUTH_TLS    , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLftpcreate
--------------------------------------------------------------------------------
-#{cconst CURLFTP_CREATE_DIR_NONE , CLong}
-#{cconst CURLFTP_CREATE_DIR      , CLong}
-#{cconst CURLFTP_CREATE_DIR_RETRY, CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLftpmethod
--------------------------------------------------------------------------------
-#{cconst CURLFTPMETHOD_DEFAULT  , CLong}
-#{cconst CURLFTPMETHOD_MULTICWD , CLong}
-#{cconst CURLFTPMETHOD_NOCWD    , CLong}
-#{cconst CURLFTPMETHOD_SINGLECWD, CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLproto
--------------------------------------------------------------------------------
-#{cconst CURLPROTO_HTTP  , CLong}
-#{cconst CURLPROTO_HTTPS , CLong}
-#{cconst CURLPROTO_FTP   , CLong}
-#{cconst CURLPROTO_FTPS  , CLong}
-#{cconst CURLPROTO_SCP   , CLong}
-#{cconst CURLPROTO_SFTP  , CLong}
-#{cconst CURLPROTO_TELNET, CLong}
-#{cconst CURLPROTO_LDAP  , CLong}
-#{cconst CURLPROTO_LDAPS , CLong}
-#{cconst CURLPROTO_DICT  , CLong}
-#{cconst CURLPROTO_FILE  , CLong}
-#{cconst CURLPROTO_TFTP  , CLong}
-#{cconst CURLPROTO_IMAP  , CLong}
-#{cconst CURLPROTO_IMAPS , CLong}
-#{cconst CURLPROTO_POP3  , CLong}
-#{cconst CURLPROTO_POP3S , CLong}
-#{cconst CURLPROTO_SMTP  , CLong}
-#{cconst CURLPROTO_SMTPS , CLong}
-#{cconst CURLPROTO_RTSP  , CLong}
-#{cconst CURLPROTO_RTMP  , CLong} |7210:----|
-#{cconst CURLPROTO_RTMPT , CLong} |7210:----|
-#{cconst CURLPROTO_RTMPE , CLong} |7210:----|
-#{cconst CURLPROTO_RTMPTE, CLong} |7210:----|
-#{cconst CURLPROTO_RTMPS , CLong} |7210:----|
-#{cconst CURLPROTO_RTMPTS, CLong} |7210:----|
-#{cconst CURLPROTO_GOPHER, CLong} |7212:----|
-#{cconst CURLPROTO_ALL   , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLoption
--------------------------------------------------------------------------------
-newtype CCURLoption'CLong   = CCURLoption'CLong   CInt deriving (Eq, Show)
-newtype CCURLoption'Int64   = CCURLoption'Int64   CInt deriving (Eq, Show)
-newtype CCURLoption'CString = CCURLoption'CString CInt deriving (Eq, Show)
-newtype CCURLoption'CFile   = CCURLoption'CFile   CInt deriving (Eq, Show)
-newtype CCURLoption'SList   = CCURLoption'SList   CInt deriving (Eq, Show)
-newtype CCURLoption'HTTPP   = CCURLoption'HTTPP   CInt deriving (Eq, Show)
-newtype CCURLoption'CURLSH  = CCURLoption'CURLSH  CInt deriving (Eq, Show)
-newtype CCURLoption'UsrPtr  = CCURLoption'UsrPtr  CInt deriving (Eq, Show)
-newtype CCURLoption'FunPtr  = CCURLoption'FunPtr  CInt deriving (Eq, Show)
-
-#define hsc_curlopt(name, type) \
-  printf("c" #name " :: CCURLoption'" #type "\n"); \
-  printf("c" #name " =  CCURLoption'" #type " "); hsc_const(name);
-
-#{curlopt CURLOPT_FILE                       , CFile   }
-#{curlopt CURLOPT_URL                        , CString }
-#{curlopt CURLOPT_PORT                       , CLong   }
-#{curlopt CURLOPT_PROXY                      , CString }
-#{curlopt CURLOPT_USERPWD                    , CString }
-#{curlopt CURLOPT_PROXYUSERPWD               , CString }
-#{curlopt CURLOPT_RANGE                      , CString }
-#{curlopt CURLOPT_INFILE                     , CFile   }
-#{curlopt CURLOPT_ERRORBUFFER                , CString }
-#{curlopt CURLOPT_WRITEFUNCTION              , FunPtr  }
-#{curlopt CURLOPT_READFUNCTION               , FunPtr  }
-#{curlopt CURLOPT_TIMEOUT                    , CLong   }
-#{curlopt CURLOPT_INFILESIZE                 , CLong   }
-#{curlopt CURLOPT_POSTFIELDS                 , CString }  -- UsrPtr??
-#{curlopt CURLOPT_REFERER                    , CString }
-#{curlopt CURLOPT_FTPPORT                    , CString }
-#{curlopt CURLOPT_USERAGENT                  , CString }
-#{curlopt CURLOPT_LOW_SPEED_LIMIT            , CLong   }
-#{curlopt CURLOPT_LOW_SPEED_TIME             , CLong   }
-#{curlopt CURLOPT_RESUME_FROM                , CLong   }
-#{curlopt CURLOPT_COOKIE                     , CString }
-#{curlopt CURLOPT_HTTPHEADER                 , SList   }
-#{curlopt CURLOPT_HTTPPOST                   , HTTPP   }
-#{curlopt CURLOPT_SSLCERT                    , CString }
-#{curlopt CURLOPT_KEYPASSWD                  , CString }
-#{curlopt CURLOPT_CRLF                       , CLong   }
-#{curlopt CURLOPT_QUOTE                      , SList   }
-#{curlopt CURLOPT_WRITEHEADER                , CFile   }  -- UsrPtr??
-#{curlopt CURLOPT_COOKIEFILE                 , CString }
-#{curlopt CURLOPT_SSLVERSION                 , CLong   }
-#{curlopt CURLOPT_TIMECONDITION              , CLong   }
-#{curlopt CURLOPT_TIMEVALUE                  , CLong   }
-#{curlopt CURLOPT_CUSTOMREQUEST              , CString }
-#{curlopt CURLOPT_STDERR                     , CFile   }
-#{curlopt CURLOPT_POSTQUOTE                  , SList   }
-{-# DEPRECATED cCURLOPT_WRITEINFO                 "" #-} |7220:----|
-#{curlopt CURLOPT_WRITEINFO                  , CString }
-#{curlopt CURLOPT_VERBOSE                    , CLong   }
-#{curlopt CURLOPT_HEADER                     , CLong   }
-#{curlopt CURLOPT_NOPROGRESS                 , CLong   }
-#{curlopt CURLOPT_NOBODY                     , CLong   }
-#{curlopt CURLOPT_FAILONERROR                , CLong   }
-#{curlopt CURLOPT_UPLOAD                     , CLong   }
-#{curlopt CURLOPT_POST                       , CLong   }
-#{curlopt CURLOPT_DIRLISTONLY                , CLong   }
-#{curlopt CURLOPT_APPEND                     , CLong   }
-#{curlopt CURLOPT_NETRC                      , CLong   }
-#{curlopt CURLOPT_FOLLOWLOCATION             , CLong   }
-#{curlopt CURLOPT_TRANSFERTEXT               , CLong   }
-#{curlopt CURLOPT_PUT                        , CLong   }
-#{curlopt CURLOPT_PROGRESSFUNCTION           , FunPtr  }
-#{curlopt CURLOPT_PROGRESSDATA               , UsrPtr  }
-#{curlopt CURLOPT_AUTOREFERER                , CLong   }
-#{curlopt CURLOPT_PROXYPORT                  , CLong   }
-#{curlopt CURLOPT_POSTFIELDSIZE              , CLong   }
-#{curlopt CURLOPT_HTTPPROXYTUNNEL            , CLong   }
-#{curlopt CURLOPT_INTERFACE                  , CString }
-#{curlopt CURLOPT_KRBLEVEL                   , CString }
-#{curlopt CURLOPT_SSL_VERIFYPEER             , CLong   }
-#{curlopt CURLOPT_CAINFO                     , CString }
-#{curlopt CURLOPT_MAXREDIRS                  , CLong   }
-#{curlopt CURLOPT_FILETIME                   , CLong   }
-#{curlopt CURLOPT_TELNETOPTIONS              , SList   }
-#{curlopt CURLOPT_MAXCONNECTS                , CLong   }
-{-# DEPRECATED cCURLOPT_CLOSEPOLICY               "" #-} |7217:----|
-#{curlopt CURLOPT_CLOSEPOLICY                , CLong   }
-#{curlopt CURLOPT_FRESH_CONNECT              , CLong   }
-#{curlopt CURLOPT_FORBID_REUSE               , CLong   }
-#{curlopt CURLOPT_RANDOM_FILE                , CString }
-#{curlopt CURLOPT_EGDSOCKET                  , CString }
-#{curlopt CURLOPT_CONNECTTIMEOUT             , CLong   }
-#{curlopt CURLOPT_HEADERFUNCTION             , FunPtr  }
-#{curlopt CURLOPT_HTTPGET                    , CLong   }
-#{curlopt CURLOPT_SSL_VERIFYHOST             , CLong   }
-#{curlopt CURLOPT_COOKIEJAR                  , CString }
-#{curlopt CURLOPT_SSL_CIPHER_LIST            , CString }
-#{curlopt CURLOPT_HTTP_VERSION               , CLong   }
-#{curlopt CURLOPT_FTP_USE_EPSV               , CLong   }
-#{curlopt CURLOPT_SSLCERTTYPE                , CString }
-#{curlopt CURLOPT_SSLKEY                     , CString }
-#{curlopt CURLOPT_SSLKEYTYPE                 , CString }
-#{curlopt CURLOPT_SSLENGINE                  , CString }
-#{curlopt CURLOPT_SSLENGINE_DEFAULT          , CLong   }
-{-# DEPRECATED cCURLOPT_DNS_USE_GLOBAL_CACHE      "" #-} |7220:----|
-#{curlopt CURLOPT_DNS_USE_GLOBAL_CACHE       , CLong   }
-#{curlopt CURLOPT_DNS_CACHE_TIMEOUT          , CLong   }
-#{curlopt CURLOPT_PREQUOTE                   , SList   }
-#{curlopt CURLOPT_DEBUGFUNCTION              , FunPtr  }
-#{curlopt CURLOPT_DEBUGDATA                  , UsrPtr  }
-#{curlopt CURLOPT_COOKIESESSION              , CLong   }
-#{curlopt CURLOPT_CAPATH                     , CString }
-#{curlopt CURLOPT_BUFFERSIZE                 , CLong   }
-#{curlopt CURLOPT_NOSIGNAL                   , CLong   }
-#{curlopt CURLOPT_SHARE                      , CURLSH  }
-#{curlopt CURLOPT_PROXYTYPE                  , CLong   }
-#{curlopt CURLOPT_ENCODING                   , CString } |----:7215|
-#{curlopt CURLOPT_ACCEPT_ENCODING            , CString } |7216:----|
-#{curlopt CURLOPT_PRIVATE                    , UsrPtr  }
-#{curlopt CURLOPT_HTTP200ALIASES             , SList   }
-#{curlopt CURLOPT_UNRESTRICTED_AUTH          , CLong   }
-#{curlopt CURLOPT_FTP_USE_EPRT               , CLong   }
-#{curlopt CURLOPT_HTTPAUTH                   , CLong   }
-#{curlopt CURLOPT_SSL_CTX_FUNCTION           , FunPtr  }
-#{curlopt CURLOPT_SSL_CTX_DATA               , UsrPtr  }
-#{curlopt CURLOPT_FTP_CREATE_MISSING_DIRS    , CLong   }
-#{curlopt CURLOPT_PROXYAUTH                  , CLong   }
-#{curlopt CURLOPT_FTP_RESPONSE_TIMEOUT       , CLong   }
-#{curlopt CURLOPT_IPRESOLVE                  , CLong   }
-#{curlopt CURLOPT_MAXFILESIZE                , CLong   }
-#{curlopt CURLOPT_INFILESIZE_LARGE           , Int64   }
-#{curlopt CURLOPT_RESUME_FROM_LARGE          , Int64   }
-#{curlopt CURLOPT_MAXFILESIZE_LARGE          , Int64   }
-#{curlopt CURLOPT_NETRC_FILE                 , CString }
-#{curlopt CURLOPT_USE_SSL                    , CLong   }
-#{curlopt CURLOPT_POSTFIELDSIZE_LARGE        , Int64   }
-#{curlopt CURLOPT_TCP_NODELAY                , CLong   }
-#{curlopt CURLOPT_FTPSSLAUTH                 , CLong   }
-#{curlopt CURLOPT_IOCTLFUNCTION              , FunPtr  }
-#{curlopt CURLOPT_IOCTLDATA                  , UsrPtr  }
-#{curlopt CURLOPT_FTP_ACCOUNT                , CString }
-#{curlopt CURLOPT_COOKIELIST                 , CString }
-#{curlopt CURLOPT_IGNORE_CONTENT_LENGTH      , CLong   }
-#{curlopt CURLOPT_FTP_SKIP_PASV_IP           , CLong   }
-#{curlopt CURLOPT_FTP_FILEMETHOD             , CLong   }
-#{curlopt CURLOPT_LOCALPORT                  , CLong   }
-#{curlopt CURLOPT_LOCALPORTRANGE             , CLong   }
-#{curlopt CURLOPT_CONNECT_ONLY               , CLong   }
-#{curlopt CURLOPT_CONV_FROM_NETWORK_FUNCTION , FunPtr  }
-#{curlopt CURLOPT_CONV_TO_NETWORK_FUNCTION   , FunPtr  }
-#{curlopt CURLOPT_CONV_FROM_UTF8_FUNCTION    , FunPtr  }
-#{curlopt CURLOPT_MAX_SEND_SPEED_LARGE       , Int64   }
-#{curlopt CURLOPT_MAX_RECV_SPEED_LARGE       , Int64   }
-#{curlopt CURLOPT_FTP_ALTERNATIVE_TO_USER    , CString }
-#{curlopt CURLOPT_SOCKOPTFUNCTION            , FunPtr  }
-#{curlopt CURLOPT_SOCKOPTDATA                , UsrPtr  }
-#{curlopt CURLOPT_SSL_SESSIONID_CACHE        , CLong   }
-#{curlopt CURLOPT_SSH_AUTH_TYPES             , CLong   }
-#{curlopt CURLOPT_SSH_PUBLIC_KEYFILE         , CString }
-#{curlopt CURLOPT_SSH_PRIVATE_KEYFILE        , CString }
-#{curlopt CURLOPT_FTP_SSL_CCC                , CLong   }
-#{curlopt CURLOPT_TIMEOUT_MS                 , CLong   }
-#{curlopt CURLOPT_CONNECTTIMEOUT_MS          , CLong   }
-#{curlopt CURLOPT_HTTP_TRANSFER_DECODING     , CLong   }
-#{curlopt CURLOPT_HTTP_CONTENT_DECODING      , CLong   }
-#{curlopt CURLOPT_NEW_FILE_PERMS             , CLong   }
-#{curlopt CURLOPT_NEW_DIRECTORY_PERMS        , CLong   }
-#{curlopt CURLOPT_POSTREDIR                  , CLong   }
-#{curlopt CURLOPT_SSH_HOST_PUBLIC_KEY_MD5    , CString }
-#{curlopt CURLOPT_OPENSOCKETFUNCTION         , FunPtr  }
-#{curlopt CURLOPT_OPENSOCKETDATA             , UsrPtr  }
-#{curlopt CURLOPT_COPYPOSTFIELDS             , CString }
-#{curlopt CURLOPT_PROXY_TRANSFER_MODE        , CLong   }
-#{curlopt CURLOPT_SEEKFUNCTION               , FunPtr  }
-#{curlopt CURLOPT_SEEKDATA                   , UsrPtr  }
-#{curlopt CURLOPT_CRLFILE                    , CString }
-#{curlopt CURLOPT_ISSUERCERT                 , CString }
-#{curlopt CURLOPT_ADDRESS_SCOPE              , CLong   }
-#{curlopt CURLOPT_CERTINFO                   , CLong   }
-#{curlopt CURLOPT_USERNAME                   , CString }
-#{curlopt CURLOPT_PASSWORD                   , CString }
-#{curlopt CURLOPT_PROXYUSERNAME              , CString }
-#{curlopt CURLOPT_PROXYPASSWORD              , CString }
-#{curlopt CURLOPT_NOPROXY                    , CString }
-#{curlopt CURLOPT_TFTP_BLKSIZE               , CLong   }
-#{curlopt CURLOPT_SOCKS5_GSSAPI_SERVICE      , CString }
-#{curlopt CURLOPT_SOCKS5_GSSAPI_NEC          , CLong   }
-#{curlopt CURLOPT_PROTOCOLS                  , CLong   }
-#{curlopt CURLOPT_REDIR_PROTOCOLS            , CLong   }
-#{curlopt CURLOPT_SSH_KNOWNHOSTS             , CString }
-#{curlopt CURLOPT_SSH_KEYFUNCTION            , FunPtr  }
-#{curlopt CURLOPT_SSH_KEYDATA                , UsrPtr  }
-#{curlopt CURLOPT_MAIL_FROM                  , CString }
-#{curlopt CURLOPT_MAIL_RCPT                  , SList   }
-#{curlopt CURLOPT_FTP_USE_PRET               , CLong   }
-#{curlopt CURLOPT_RTSP_REQUEST               , CLong   }
-#{curlopt CURLOPT_RTSP_SESSION_ID            , CString }
-#{curlopt CURLOPT_RTSP_STREAM_URI            , CString }
-#{curlopt CURLOPT_RTSP_TRANSPORT             , CString }
-#{curlopt CURLOPT_RTSP_CLIENT_CSEQ           , CLong   }
-#{curlopt CURLOPT_RTSP_SERVER_CSEQ           , CLong   }
-#{curlopt CURLOPT_INTERLEAVEDATA             , UsrPtr  }
-#{curlopt CURLOPT_INTERLEAVEFUNCTION         , FunPtr  }
-#{curlopt CURLOPT_WILDCARDMATCH              , CLong   } |7210:----|
-#{curlopt CURLOPT_CHUNK_BGN_FUNCTION         , FunPtr  } |7210:----|
-#{curlopt CURLOPT_CHUNK_END_FUNCTION         , FunPtr  } |7210:----|
-#{curlopt CURLOPT_FNMATCH_FUNCTION           , FunPtr  } |7210:----|
-#{curlopt CURLOPT_CHUNK_DATA                 , UsrPtr  } |7210:----|
-#{curlopt CURLOPT_FNMATCH_DATA               , UsrPtr  } |7210:----|
-#{curlopt CURLOPT_RESOLVE                    , SList   } |7213:----|
-#{curlopt CURLOPT_TLSAUTH_USERNAME           , CString } |7214:----|
-#{curlopt CURLOPT_TLSAUTH_PASSWORD           , CString } |7214:----|
-#{curlopt CURLOPT_TLSAUTH_TYPE               , CString } |7214:----|
-#{curlopt CURLOPT_TRANSFER_ENCODING          , CLong   } |7216:----|
-#{curlopt CURLOPT_CLOSESOCKETFUNCTION        , FunPtr  } |7217:----|
-#{curlopt CURLOPT_CLOSESOCKETDATA            , UsrPtr  } |7217:----|
-#{curlopt CURLOPT_GSSAPI_DELEGATION          , CLong   } |7220:----|
-#{curlopt CURLOPT_DNS_SERVERS                , CString } |7240:----|
-#{curlopt CURLOPT_ACCEPTTIMEOUT_MS           , CLong   } |7240:----|
-#{curlopt CURLOPT_TCP_KEEPALIVE              , CLong   } |7250:----|
-#{curlopt CURLOPT_TCP_KEEPIDLE               , CLong   } |7250:----|
-#{curlopt CURLOPT_TCP_KEEPINTVL              , CLong   } |7250:----|
-#{curlopt CURLOPT_SSL_OPTIONS                , CLong   } |7250:----|
-#{curlopt CURLOPT_MAIL_AUTH                  , CString } |7250:----|
-
-#{curlopt CURLOPT_WRITEDATA                  , UsrPtr  }
-#{curlopt CURLOPT_READDATA                   , UsrPtr  }
-#{curlopt CURLOPT_HEADERDATA                 , UsrPtr  }
-#{curlopt CURLOPT_RTSPHEADER                 , SList   }
-
-
--------------------------------------------------------------------------------
--- *** CURLipresolve
--------------------------------------------------------------------------------
-#{cconst CURL_IPRESOLVE_WHATEVER, CLong}
-#{cconst CURL_IPRESOLVE_V4      , CLong}
-#{cconst CURL_IPRESOLVE_V6      , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLhttpver
--------------------------------------------------------------------------------
-#{cconst CURL_HTTP_VERSION_NONE, CLong}
-#{cconst CURL_HTTP_VERSION_1_0 , CLong}
-#{cconst CURL_HTTP_VERSION_1_1 , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLrtspreq
--------------------------------------------------------------------------------
-#{cconst CURL_RTSPREQ_NONE         , CLong}
-#{cconst CURL_RTSPREQ_OPTIONS      , CLong}
-#{cconst CURL_RTSPREQ_DESCRIBE     , CLong}
-#{cconst CURL_RTSPREQ_ANNOUNCE     , CLong}
-#{cconst CURL_RTSPREQ_SETUP        , CLong}
-#{cconst CURL_RTSPREQ_PLAY         , CLong}
-#{cconst CURL_RTSPREQ_PAUSE        , CLong}
-#{cconst CURL_RTSPREQ_TEARDOWN     , CLong}
-#{cconst CURL_RTSPREQ_GET_PARAMETER, CLong}
-#{cconst CURL_RTSPREQ_SET_PARAMETER, CLong}
-#{cconst CURL_RTSPREQ_RECORD       , CLong}
-#{cconst CURL_RTSPREQ_RECEIVE      , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLnetrc
--------------------------------------------------------------------------------
-#{cconst CURL_NETRC_IGNORED , CLong}
-#{cconst CURL_NETRC_OPTIONAL, CLong}
-#{cconst CURL_NETRC_REQUIRED, CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLsslver
--------------------------------------------------------------------------------
-#{cconst CURL_SSLVERSION_DEFAULT, CLong}
-#{cconst CURL_SSLVERSION_TLSv1  , CLong}
-#{cconst CURL_SSLVERSION_SSLv2  , CLong}
-#{cconst CURL_SSLVERSION_SSLv3  , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLtlsauth
--------------------------------------------------------------------------------
-#{cconst CURL_TLSAUTH_NONE, CLong}                               |7214:----|
-#{cconst CURL_TLSAUTH_SRP , CLong}                               |7214:----|
-
-
--------------------------------------------------------------------------------
--- *** CURLredir
--------------------------------------------------------------------------------
-#{cconst CURL_REDIR_GET_ALL , CLong}
-#{cconst CURL_REDIR_POST_301, CLong}
-#{cconst CURL_REDIR_POST_302, CLong}
-#{cconst CURL_REDIR_POST_ALL, CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLtimecond
--------------------------------------------------------------------------------
-#{cconst CURL_TIMECOND_NONE        , CLong}
-#{cconst CURL_TIMECOND_IFMODSINCE  , CLong}
-#{cconst CURL_TIMECOND_IFUNMODSINCE, CLong}
-#{cconst CURL_TIMECOND_LASTMOD     , CLong}
-
-
--------------------------------------------------------------------------------
--- ** Functions
--------------------------------------------------------------------------------
-{-# DEPRECATED ccurl_strequal "" #-}
-foreign import ccall "curl_strequal"
-  ccurl_strequal
-    :: Ptr CChar
-    -> Ptr CChar
-    -> IO CInt
-
-
--------------------------------------------------------------------------------
-{-# DEPRECATED ccurl_strnequal "" #-}
-foreign import ccall "curl_strnequal"
-  ccurl_strnequal
-    :: Ptr CChar
-    -> Ptr CChar
-    -> CSize
-    -> IO CInt
-
-
--------------------------------------------------------------------------------
--- ** CURL_forms
--------------------------------------------------------------------------------
-newtype CCURLformoption = CCURLformoption CInt deriving (Eq, Show)
- 
--- #{symbol CURLFORM_COPYNAME      , CURLformoption}
--- #{symbol CURLFORM_PTRNAME       , CURLformoption}
--- #{symbol CURLFORM_NAMELENGTH    , CURLformoption}
--- #{symbol CURLFORM_COPYCONTENTS  , CURLformoption}
--- #{symbol CURLFORM_PTRCONTENTS   , CURLformoption}
--- #{symbol CURLFORM_CONTENTSLENGTH, CURLformoption}
--- #{symbol CURLFORM_FILECONTENT   , CURLformoption}
--- #{symbol CURLFORM_ARRAY         , CURLformoption}
--- #{symbol CURLFORM_FILE          , CURLformoption}
--- #{symbol CURLFORM_BUFFER        , CURLformoption}
--- #{symbol CURLFORM_BUFFERPTR     , CURLformoption}
--- #{symbol CURLFORM_BUFFERLENGTH  , CURLformoption}
--- #{symbol CURLFORM_CONTENTTYPE   , CURLformoption}
--- #{symbol CURLFORM_CONTENTHEADER , CURLformoption}
--- #{symbol CURLFORM_FILENAME      , CURLformoption}
--- #{symbol CURLFORM_END           , CURLformoption}
--- #{symbol CURLFORM_STREAM        , CURLformoption}
-
-
--------------------------------------------------------------------------------
-data CCURL_forms = CCURL_forms
-  { ccurl_forms_option :: CCURLformoption
-  , ccurl_forms_value  :: Ptr CChar
-  } deriving (Show)
-
--- instance Storable CCURL_forms where
---   sizeOf _    = #{size    struct curl_forms}
---   alignment _ = #{alignof struct curl_forms}
---   poke _ _    = undefined
---   peek _      = undefined
-
-
--------------------------------------------------------------------------------
-newtype CCURLformcode = CCURLformcode CInt deriving (Eq, Show)
-
-#{symbol CURL_FORMADD_OK            , CURLformcode}
-#{symbol CURL_FORMADD_MEMORY        , CURLformcode}
-#{symbol CURL_FORMADD_OPTION_TWICE  , CURLformcode}
-#{symbol CURL_FORMADD_NULL          , CURLformcode}
-#{symbol CURL_FORMADD_UNKNOWN_OPTION, CURLformcode}
-#{symbol CURL_FORMADD_INCOMPLETE    , CURLformcode}
-#{symbol CURL_FORMADD_ILLEGAL_ARRAY , CURLformcode}
-#{symbol CURL_FORMADD_DISABLED      , CURLformcode}
-
-
--- ----------------------------------------------------------------------------
--- CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
---                                       struct curl_httppost **last_post,
---                                       ...);
-
-
--------------------------------------------------------------------------------
-type CCURL_formget_callback
-  = Ptr () -> Ptr CChar -> CSize -> IO CSize
-
-foreign import ccall "wrapper"
-  wrap_ccurl_formget_callback
-    :: CCURL_formget_callback
-    -> IO (FunPtr CCURL_formget_callback)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_formget"
-  ccurl_formget
-    :: Ptr CCURL_httppost
-    -> Ptr ()
-    -> FunPtr CCURL_formget_callback
-    -> IO CInt
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_formfree"
-  ccurl_formfree
-    :: Ptr CCURL_httppost
-    -> IO ()
-
-
--------------------------------------------------------------------------------
--- ** Functions
--------------------------------------------------------------------------------
-{-# DEPRECATED ccurl_getenv "" #-}
-foreign import ccall "curl_getenv"
-  ccurl_getenv
-    :: Ptr CChar
-    -> IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_version"
-  ccurl_version
-    :: IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_escape"
-  ccurl_easy_escape
-    :: Ptr CCURL
-    -> Ptr CChar
-    -> CInt
-    -> IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_escape"
-  ccurl_escape
-    :: Ptr CChar
-    -> CInt
-    -> IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_unescape"
-  ccurl_easy_unescape
-    :: Ptr CCURL
-    -> Ptr CChar
-    -> CInt
-    -> Ptr CInt
-    -> IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_unescape"
-  ccurl_unescape
-    :: Ptr CChar
-    -> CInt
-    -> IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_free"
-  ccurl_free
-    :: Ptr a
-    -> IO ()
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_global_init"
-  ccurl_global_init
-    :: CLong
-    -> IO CCURLcode
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_global_init_mem"
-  ccurl_global_init_mem
-    :: CLong
-    -> FunPtr CCURL_malloc_callback
-    -> FunPtr CCURL_free_callback
-    -> FunPtr CCURL_realloc_callback
-    -> FunPtr CCURL_strdup_callback
-    -> FunPtr CCURL_calloc_callback
-    -> IO CCURLcode
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_global_cleanup"
-  ccurl_global_cleanup
-    :: IO ()
-
-
--------------------------------------------------------------------------------
--- ** CURL_slist
--------------------------------------------------------------------------------
-data CCURL_slist = CCURL_slist
-  { ccurl_slist_data :: Ptr CChar
-  , ccurl_slist_next :: Ptr CCURL_slist
-  } deriving (Show)
-
-instance Storable CCURL_slist where
-  sizeOf _    = #{size    struct curl_slist}
-  alignment _ = #{alignof struct curl_slist}
-  poke _ _    = undefined
-  peek ptr    = CCURL_slist
-    <$> #{peek struct curl_slist, data} ptr
-    <*> #{peek struct curl_slist, next} ptr
-
- 
--------------------------------------------------------------------------------
--- ** Functions
--------------------------------------------------------------------------------
-foreign import ccall "curl_slist_append"
-  ccurl_slist_append
-    :: Ptr CCURL_slist
-    -> Ptr CChar
-    -> IO (Ptr CCURL_slist)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_slist_free_all"
-  ccurl_slist_free_all
-    :: Ptr CCURL_slist
-    -> IO ()
-
- 
--------------------------------------------------------------------------------
-foreign import ccall "curl_getdate"
-  ccurl_getdate
-    :: Ptr CChar
-    -> Ptr CTime
-    -> IO CTime
-
-
--------------------------------------------------------------------------------
--- ** CURL_certinfo
--------------------------------------------------------------------------------
-data CCURL_certinfo = CCURL_certinfo
-  { ccurl_certinfo_num_of_certs :: CInt
-  , ccurl_certinfo_certinfo     :: Ptr (Ptr CCURL_slist)
-  } deriving (Show)
-
-instance Storable CCURL_certinfo where
-  sizeOf _    = #{size    struct curl_certinfo}
-  alignment _ = #{alignof struct curl_certinfo}
-  poke _ _    = undefined
-  peek ptr    = CCURL_certinfo
-    <$> #{peek struct curl_certinfo, num_of_certs} ptr
-    <*> #{peek struct curl_certinfo, certinfo    } ptr
-
-
--------------------------------------------------------------------------------
--- ** Constants
--------------------------------------------------------------------------------
--- *** CURLinfo
--------------------------------------------------------------------------------
-newtype CCURLinfo'CString = CCURLinfo'CString CInt deriving (Eq, Show)
-newtype CCURLinfo'CDouble = CCURLinfo'CDouble CInt deriving (Eq, Show)
-newtype CCURLinfo'CLong   = CCURLinfo'CLong   CInt deriving (Eq, Show)
-newtype CCURLinfo'SList   = CCURLinfo'SList   CInt deriving (Eq, Show)
-newtype CCURLinfo'CertI   = CCURLinfo'CertI   CInt deriving (Eq, Show)
-
-#define hsc_curlinfo(name, type) \
-  printf("c" #name " :: CCURLinfo'" #type "\n"); \
-  printf("c" #name " =  CCURLinfo'" #type " "); hsc_const(name);
-
-#{curlinfo CURLINFO_EFFECTIVE_URL          , CString}
-#{curlinfo CURLINFO_RESPONSE_CODE          , CLong  }
-#{curlinfo CURLINFO_TOTAL_TIME             , CDouble}
-#{curlinfo CURLINFO_NAMELOOKUP_TIME        , CDouble}
-#{curlinfo CURLINFO_CONNECT_TIME           , CDouble}
-#{curlinfo CURLINFO_PRETRANSFER_TIME       , CDouble}
-#{curlinfo CURLINFO_SIZE_UPLOAD            , CDouble}
-#{curlinfo CURLINFO_SIZE_DOWNLOAD          , CDouble}
-#{curlinfo CURLINFO_SPEED_DOWNLOAD         , CDouble}
-#{curlinfo CURLINFO_SPEED_UPLOAD           , CDouble}
-#{curlinfo CURLINFO_HEADER_SIZE            , CLong  }
-#{curlinfo CURLINFO_REQUEST_SIZE           , CLong  }
-#{curlinfo CURLINFO_SSL_VERIFYRESULT       , CLong  }
-#{curlinfo CURLINFO_FILETIME               , CLong  }
-#{curlinfo CURLINFO_CONTENT_LENGTH_DOWNLOAD, CDouble}
-#{curlinfo CURLINFO_CONTENT_LENGTH_UPLOAD  , CDouble}
-#{curlinfo CURLINFO_STARTTRANSFER_TIME     , CDouble}
-#{curlinfo CURLINFO_CONTENT_TYPE           , CString}
-#{curlinfo CURLINFO_REDIRECT_TIME          , CDouble}
-#{curlinfo CURLINFO_REDIRECT_COUNT         , CLong  }
-#{curlinfo CURLINFO_PRIVATE                , CString}
-#{curlinfo CURLINFO_HTTP_CONNECTCODE       , CLong  }
-#{curlinfo CURLINFO_HTTPAUTH_AVAIL         , CLong  }
-#{curlinfo CURLINFO_PROXYAUTH_AVAIL        , CLong  }
-#{curlinfo CURLINFO_OS_ERRNO               , CLong  }
-#{curlinfo CURLINFO_NUM_CONNECTS           , CLong  }
-#{curlinfo CURLINFO_SSL_ENGINES            , SList  }
-#{curlinfo CURLINFO_COOKIELIST             , SList  }
-#{curlinfo CURLINFO_LASTSOCKET             , CLong  }
-#{curlinfo CURLINFO_FTP_ENTRY_PATH         , CString}
-#{curlinfo CURLINFO_REDIRECT_URL           , CString}
-#{curlinfo CURLINFO_PRIMARY_IP             , CString}
-#{curlinfo CURLINFO_APPCONNECT_TIME        , CDouble}
-#{curlinfo CURLINFO_CERTINFO               , CertI  }
-#{curlinfo CURLINFO_CONDITION_UNMET        , CLong  }
-#{curlinfo CURLINFO_RTSP_SESSION_ID        , CString}
-#{curlinfo CURLINFO_RTSP_CLIENT_CSEQ       , CLong  }
-#{curlinfo CURLINFO_RTSP_SERVER_CSEQ       , CLong  }
-#{curlinfo CURLINFO_RTSP_CSEQ_RECV         , CLong  }
-#{curlinfo CURLINFO_PRIMARY_PORT           , CLong  } |7210:----|
-#{curlinfo CURLINFO_LOCAL_IP               , CString} |7210:----|
-#{curlinfo CURLINFO_LOCAL_PORT             , CLong  } |7210:----|
-
-
--------------------------------------------------------------------------------
--- *** CURLclosepol
--------------------------------------------------------------------------------
-#{cconst CURLCLOSEPOLICY_NONE               , CLong}
-#{cconst CURLCLOSEPOLICY_OLDEST             , CLong}
-#{cconst CURLCLOSEPOLICY_LEAST_RECENTLY_USED, CLong}
-#{cconst CURLCLOSEPOLICY_LEAST_TRAFFIC      , CLong}
-#{cconst CURLCLOSEPOLICY_SLOWEST            , CLong}
-#{cconst CURLCLOSEPOLICY_CALLBACK           , CLong}
-
-
--------------------------------------------------------------------------------
--- *** CURLglobal
--------------------------------------------------------------------------------
-#{cconst CURL_GLOBAL_SSL    , CLong}
-#{cconst CURL_GLOBAL_WIN32  , CLong}
-#{cconst CURL_GLOBAL_ALL    , CLong}
-#{cconst CURL_GLOBAL_NOTHING, CLong}
-#{cconst CURL_GLOBAL_DEFAULT, CLong}
-
-
--------------------------------------------------------------------------------
--- ** Share interface
--------------------------------------------------------------------------------
-newtype CCURL_lock_data = CCURL_lock_data CInt deriving (Eq, Show)
-
-#{symbol CURL_LOCK_DATA_COOKIE     , CURL_lock_data}
-#{symbol CURL_LOCK_DATA_DNS        , CURL_lock_data}
-#{symbol CURL_LOCK_DATA_SSL_SESSION, CURL_lock_data}
-#{symbol CURL_LOCK_DATA_CONNECT    , CURL_lock_data}
- 
-
--------------------------------------------------------------------------------
-newtype CCURL_lock_access = CCURL_lock_access CInt deriving (Eq, Show)
-
-#{symbol CURL_LOCK_ACCESS_NONE  , CURL_lock_access}
-#{symbol CURL_LOCK_ACCESS_SHARED, CURL_lock_access}
-#{symbol CURL_LOCK_ACCESS_SINGLE, CURL_lock_access}
-
-
--------------------------------------------------------------------------------
-type CCURL_lock_function
-  = Ptr CCURL -> CCURL_lock_data -> CCURL_lock_access -> Ptr () -> IO ()
-
-foreign import ccall "wrapper"
-  wrap_ccurl_lock_function
-    :: CCURL_lock_function
-    -> IO (FunPtr CCURL_lock_function)
-
-
--------------------------------------------------------------------------------
-type CCURL_unlock_function
-  = Ptr CCURL -> CCURL_lock_data -> Ptr () -> IO ()
-
-foreign import ccall "wrapper"
-  wrap_ccurl_unlock_function
-    :: CCURL_unlock_function
-    -> IO (FunPtr CCURL_unlock_function)
-
-
--------------------------------------------------------------------------------
-data CCURLSH
-
- 
--------------------------------------------------------------------------------
-newtype CCURLSHcode = CCURLSHcode CInt deriving (Eq, Show)
-
-#{symbol CURLSHE_OK          , CURLSHcode}
-#{symbol CURLSHE_BAD_OPTION  , CURLSHcode}
-#{symbol CURLSHE_IN_USE      , CURLSHcode}
-#{symbol CURLSHE_INVALID     , CURLSHcode}
-#{symbol CURLSHE_NOMEM       , CURLSHcode}
-#{symbol CURLSHE_NOT_BUILT_IN, CURLSHcode} |7230:----|
-
-
--------------------------------------------------------------------------------
-newtype CCURLSHoption'Lock    = CCURLSHoption'Lock    CInt deriving (Eq, Show)
-newtype CCURLSHoption'FLOCK   = CCURLSHoption'FLOCK   CInt deriving (Eq, Show)
-newtype CCURLSHoption'FUNLOCK = CCURLSHoption'FUNLOCK CInt deriving (Eq, Show)
-newtype CCURLSHoption'UsrPtr  = CCURLSHoption'UsrPtr  CInt deriving (Eq, Show)
-
-#define hsc_curlshopt(name, type) \
-  printf("c" #name " :: CCURLSHoption'" #type "\n"); \
-  printf("c" #name " =  CCURLSHoption'" #type " "); hsc_const(name);
-
-#{curlshopt CURLSHOPT_SHARE     , Lock   }
-#{curlshopt CURLSHOPT_UNSHARE   , Lock   }
-#{curlshopt CURLSHOPT_LOCKFUNC  , FLOCK  }
-#{curlshopt CURLSHOPT_UNLOCKFUNC, FUNLOCK}
-#{curlshopt CURLSHOPT_USERDATA  , UsrPtr }
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_share_init"
-  ccurl_share_init
-    :: IO (Ptr CCURLSH)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_share_setopt"
-  ccurl_share_setopt'Lock   
-    :: Ptr CCURLSH
-    -> CCURLSHoption'Lock   
-    -> CCURL_lock_data
-    -> IO CCURLSHcode
-
-foreign import ccall "curl_share_setopt"
-  ccurl_share_setopt'FLOCK
-    :: Ptr CCURLSH
-    -> CCURLSHoption'FLOCK
-    -> FunPtr CCURL_lock_function
-    -> IO CCURLSHcode
-
-foreign import ccall "curl_share_setopt"
-  ccurl_share_setopt'FUNLOCK
-    :: Ptr CCURLSH
-    -> CCURLSHoption'FUNLOCK
-    -> FunPtr CCURL_unlock_function
-    -> IO CCURLSHcode
-
-foreign import ccall "curl_share_setopt"
-  ccurl_share_setopt'UsrPtr 
-    :: Ptr CCURLSH
-    -> CCURLSHoption'UsrPtr 
-    -> Ptr ()
-    -> IO CCURLSHcode
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_share_cleanup"
-  ccurl_share_cleanup
-    :: Ptr CCURLSH
-    -> IO CCURLSHcode
-
-
--------------------------------------------------------------------------------
--- ** CURL_version_info
--------------------------------------------------------------------------------
-newtype CCURLversion = CCURLversion CInt deriving (Eq, Show)
-
-instance Storable CCURLversion where
-  sizeOf _    = #{size    CURLversion}
-  alignment _ = #{alignof CURLversion}
-  poke _ _    = undefined
-  peek ptr    = CCURLversion <$> peek (castPtr ptr)
-
-#{symbol CURLVERSION_FIRST , CURLversion}
-#{symbol CURLVERSION_SECOND, CURLversion}
-#{symbol CURLVERSION_THIRD , CURLversion}
-#{symbol CURLVERSION_FOURTH, CURLversion}
-#{symbol CURLVERSION_NOW   , CURLversion}
-
-
--------------------------------------------------------------------------------
-data CCURL_version_info_data = CCURL_version_info_data
-  { ccurl_version_info_data_age             :: CCURLversion
-  , ccurl_version_info_data_version         :: Ptr CChar
-  , ccurl_version_info_data_version_num     :: CUInt
-  , ccurl_version_info_data_host            :: Ptr CChar
-  , ccurl_version_info_data_features        :: CInt
-  , ccurl_version_info_data_ssl_version     :: Ptr CChar
-  , ccurl_version_info_data_ssl_version_num :: CLong
-  , ccurl_version_info_data_libz_version    :: Ptr CChar
-  , ccurl_version_info_data_protocols       :: Ptr (Ptr CChar)
-  , ccurl_version_info_data_ares            :: Ptr CChar
-  , ccurl_version_info_data_ares_num        :: CInt
-  , ccurl_version_info_data_libidn          :: Ptr CChar
-  , ccurl_version_info_data_iconv_ver_num   :: CInt
-  , ccurl_version_info_data_libssh_version  :: Ptr CChar
-  } deriving (Show)
-
-instance Storable CCURL_version_info_data where
-  sizeOf _    = #{size    curl_version_info_data}
-  alignment _ = #{alignof curl_version_info_data}
-  poke _ _    = undefined
-  peek ptr    = CCURL_version_info_data
-    <$> #{peek curl_version_info_data, age            } ptr
-    <*> #{peek curl_version_info_data, version        } ptr
-    <*> #{peek curl_version_info_data, version_num    } ptr
-    <*> #{peek curl_version_info_data, host           } ptr
-    <*> #{peek curl_version_info_data, features       } ptr
-    <*> #{peek curl_version_info_data, ssl_version    } ptr
-    <*> #{peek curl_version_info_data, ssl_version_num} ptr
-    <*> #{peek curl_version_info_data, libz_version   } ptr
-    <*> #{peek curl_version_info_data, protocols      } ptr
-    <*> #{peek curl_version_info_data, ares           } ptr
-    <*> #{peek curl_version_info_data, ares_num       } ptr
-    <*> #{peek curl_version_info_data, libidn         } ptr
-    <*> #{peek curl_version_info_data, iconv_ver_num  } ptr
-    <*> #{peek curl_version_info_data, libssh_version } ptr
-
-
--------------------------------------------------------------------------------
-#{cconst CURL_VERSION_IPV6        , CInt}
-#{cconst CURL_VERSION_KERBEROS4   , CInt}
-#{cconst CURL_VERSION_SSL         , CInt}
-#{cconst CURL_VERSION_LIBZ        , CInt}
-#{cconst CURL_VERSION_NTLM        , CInt}
-#{cconst CURL_VERSION_GSSNEGOTIATE, CInt}
-#{cconst CURL_VERSION_DEBUG       , CInt}
-#{cconst CURL_VERSION_ASYNCHDNS   , CInt}
-#{cconst CURL_VERSION_SPNEGO      , CInt}
-#{cconst CURL_VERSION_LARGEFILE   , CInt}
-#{cconst CURL_VERSION_IDN         , CInt}
-#{cconst CURL_VERSION_SSPI        , CInt}
-#{cconst CURL_VERSION_CONV        , CInt}
-#{cconst CURL_VERSION_CURLDEBUG   , CInt}
-#{cconst CURL_VERSION_TLSAUTH_SRP , CInt} |7214:----|
-#{cconst CURL_VERSION_NTLM_WB     , CInt} |7220:----|
-
- 
--------------------------------------------------------------------------------
--- ** Functions
--------------------------------------------------------------------------------
-foreign import ccall "curl_version_info"
-  ccurl_version_info
-    :: CCURLversion
-    -> IO (Ptr CCURL_version_info_data)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_strerror"
-  ccurl_easy_strerror
-    :: CCURLcode
-    -> IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_share_strerror"
-  ccurl_share_strerror
-    :: CCURLSHcode
-    -> IO (Ptr CChar)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_pause"
-  ccurl_easy_pause
-    :: Ptr CCURL
-    -> CInt
-    -> IO CCURLcode
- 
-#{cconst CURLPAUSE_RECV     , CInt}
-#{cconst CURLPAUSE_RECV_CONT, CInt}
-#{cconst CURLPAUSE_SEND     , CInt}
-#{cconst CURLPAUSE_SEND_CONT, CInt}
-#{cconst CURLPAUSE_ALL      , CInt}
-#{cconst CURLPAUSE_CONT     , CInt}
-
-
--------------------------------------------------------------------------------
--- * Definitions from \"curl/easy.h\"
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_init"
-  ccurl_easy_init
-    :: IO (Ptr CCURL)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'CLong
-    :: Ptr CCURL
-    -> CCURLoption'CLong
-    -> CLong
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'Int64
-    :: Ptr CCURL
-    -> CCURLoption'Int64
-    -> CCURL_off_t
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'CString
-    :: Ptr CCURL
-    -> CCURLoption'CString
-    -> Ptr CChar
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'CFile
-    :: Ptr CCURL
-    -> CCURLoption'CFile
-    -> Ptr CFile
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'SList
-    :: Ptr CCURL
-    -> CCURLoption'SList
-    -> Ptr CCURL_slist
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'HTTPP
-    :: Ptr CCURL
-    -> CCURLoption'HTTPP
-    -> Ptr CCURL_httppost
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'CURLSH
-    :: Ptr CCURL
-    -> CCURLoption'CURLSH
-    -> Ptr CCURLSH
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'UsrPtr
-    :: Ptr CCURL
-    -> CCURLoption'UsrPtr
-    -> Ptr ()
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_setopt"
-  ccurl_easy_setopt'FunPtr
-    :: Ptr CCURL
-    -> CCURLoption'FunPtr
-    -> FunPtr a
-    -> IO CCURLcode
-
-#define hsc_setFunPtrAlias(fn, un, ln) \
-  printf("ccurl_easy_setopt'" #fn "\n"); \
-  printf("  :: Ptr CCURL -> FunPtr CCURL_" #ln "_callback -> IO CCURLcode\n");\
-  printf("ccurl_easy_setopt'" #fn " curl fptr\n"); \
-  printf("  = ccurl_easy_setopt'FunPtr curl cCURLOPT_" #un "FUNCTION fptr");
-
-#{setFunPtrAlias FWRITE      , WRITE      , write      }
-#{setFunPtrAlias FREAD       , READ       , read       }
-#{setFunPtrAlias FPROGRESS   , PROGRESS   , progress   }
-#{setFunPtrAlias FHEADER     , HEADER     , write      }
-#{setFunPtrAlias FDEBUG      , DEBUG      , debug      }
-#{setFunPtrAlias FSSLCTX     , SSL_CTX_   , ssl_ctx    }
-#{setFunPtrAlias FIOCTL      , IOCTL      , ioctl      }
-#{setFunPtrAlias FCONVFROM   , CONV_FROM_NETWORK_, conv}
-#{setFunPtrAlias FCONVTO     , CONV_TO_NETWORK_  , conv}
-#{setFunPtrAlias FCONVUTF8   , CONV_FROM_UTF8_   , conv}
-#{setFunPtrAlias FSOCKOPT    , SOCKOPT    , sockopt    }
-#{setFunPtrAlias FOPENSOCKET , OPENSOCKET , opensocket }
-#{setFunPtrAlias FSEEK       , SEEK       , seek       }
-#{setFunPtrAlias FSSHKEY     , SSH_KEY    , sshkey     }
-#{setFunPtrAlias FINTERLEAVE , INTERLEAVE , write      }
-#{setFunPtrAlias FCHUNKBGN   , CHUNK_BGN_ , chunk_bgn  } |7210:----|
-#{setFunPtrAlias FCHUNKEND   , CHUNK_END_ , chunk_end  } |7210:----|
-#{setFunPtrAlias FFNMATCH    , FNMATCH_   , fnmatch    } |7210:----|
-#{setFunPtrAlias FCLOSESOCKET, CLOSESOCKET, closesocket} |7217:----|
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_perform"
-  ccurl_easy_perform
-    :: Ptr CCURL
-    -> IO CCURLcode
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_cleanup"
-  ccurl_easy_cleanup
-    :: Ptr CCURL
-    -> IO ()
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_getinfo"
-  ccurl_easy_getinfo'CString
-    :: Ptr CCURL
-    -> CCURLinfo'CString
-    -> Ptr (Ptr CChar)
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_getinfo"
-  ccurl_easy_getinfo'CDouble
-    :: Ptr CCURL
-    -> CCURLinfo'CDouble
-    -> Ptr CDouble
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_getinfo"
-  ccurl_easy_getinfo'CLong
-    :: Ptr CCURL
-    -> CCURLinfo'CLong
-    -> Ptr CLong
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_getinfo"
-  ccurl_easy_getinfo'SList
-    :: Ptr CCURL
-    -> CCURLinfo'SList
-    -> Ptr (Ptr CCURL_slist)
-    -> IO CCURLcode
-
-foreign import ccall "curl_easy_getinfo"
-  ccurl_easy_getinfo'CertI
-    :: Ptr CCURL
-    -> CCURLinfo'CertI
-    -> Ptr (Ptr CCURL_certinfo)
-    -> IO CCURLcode
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_duphandle"
-  ccurl_easy_duphandle
-    :: Ptr CCURL
-    -> IO (Ptr CCURL)
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_reset"
-  ccurl_easy_reset
-    :: Ptr CCURL
-    -> IO ()
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_recv"
-  ccurl_easy_recv
-    :: Ptr CCURL
-    -> Ptr a
-    -> CSize
-    -> Ptr CSize
-    -> IO CCURLcode
-
-
--------------------------------------------------------------------------------
-foreign import ccall "curl_easy_send"
-  ccurl_easy_send
-    :: Ptr CCURL
-    -> Ptr a
-    -> CSize
-    -> Ptr CSize
-    -> IO CCURLcode
-
- 
--------------------------------------------------------------------------------
--- * Definitions from \"curl/multi.h\"
--------------------------------------------------------------------------------
--- todo
-
diff --git a/Network/Curlhs/Core.hs b/Network/Curlhs/Core.hs
deleted file mode 100644
--- a/Network/Curlhs/Core.hs
+++ /dev/null
@@ -1,122 +0,0 @@
--------------------------------------------------------------------------------
--- |
--- Module      :  Network.Curlhs.Core
--- Copyright   :  Copyright © 2012 Krzysztof Kardzis
--- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
--- 
--- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
--- Stability   :  experimental
--- Portability :  non-portable
---
---
--- Module "Network.Curlhs.Core" provides a mid-level interface to @libcurl@.
--- For a direct low-level bindings go to "Network.Curlhs.Base".
---
--- API of this module follows the API of @libcurl@ as defined in version
--- 7.25.0 of the library. But it also depends on the version of @libcurl@
--- that is used during compilation of the @curlhs@ package. It is possible
--- to use @curlhs@ with older versions of @libcurl@, just keep in mind
--- that some features may not be available then.
---
--- There is not much documentation here, maybe the future will change that,
--- but for now please use the original @libcurl@ documentation. API provided
--- here follows the original API, so this shouldn't be a big problem.
--- Documentation about @libcurl@ and/or its particular functions may be
--- found in manual pages, which are available among others at the @libcurl@
--- project site (please refer to <http://curl.haxx.se/libcurl/>).
--- 
--- Exposed API is still somewhat incomplete, but is usable.
--- Work on the rest are in progress.
---
--- Simple example:
---
--- > import qualified Data.ByteString.Char8 as BS
--- > import Data.IORef (newIORef, readIORef, atomicModifyIORef)
--- > import Control.Exception (bracket)
--- > import Network.Curlhs.Core
--- > 
--- > curlGET :: BS.ByteString -> IO BS.ByteString
--- > curlGET url = do
--- >   buff <- newIORef BS.empty
--- >   bracket (curl_easy_init) (curl_easy_cleanup) $ \curl -> do
--- >     curl_easy_setopt curl
--- >       [ CURLOPT_URL     url
--- >       , CURLOPT_VERBOSE True
--- >       , CURLOPT_WRITEFUNCTION $ Just (memwrite buff)
--- >       ]
--- >     curl_easy_perform curl
--- >   readIORef buff
--- > 
--- > memwrite buff newbs = atomicModifyIORef buff $ \oldbuff ->
--- >   (BS.append oldbuff newbs, CURL_WRITEFUNC_OK)
---
--------------------------------------------------------------------------------
-
-module Network.Curlhs.Core (
-
-  -- * Global interface
-
-  -- ** Version info
-    curl_version
-  , curl_version_info
-  , CURL_version_info_data (..)
-  , CURL_version (..)
-
-  -- ** Error codes
-  -- |  More about error codes in libcurl on
-  --    <http://curl.haxx.se/libcurl/c/libcurl-errors.html>
-  , curl_easy_strerror
-  , CURLcode (..)
-
-  -- * Easy interface
-  -- | See <http://curl.haxx.se/libcurl/c/libcurl-easy.html>
-  --   for easy interface overview.
-
-  -- ** Init, reset, cleanup
-  , curl_easy_init
-  , curl_easy_reset
-  , curl_easy_cleanup
-  , CURL
-
-  -- ** Transfer
-  , curl_easy_perform
-
-  -- ** Get info
-  , curl_easy_getinfo
-  , CURLinfo (..)
-
-  -- ** Set options
-  , curl_easy_setopt
-  , CURLoption (..)
-
-  -- *** Callbacks
-  , CURL_write_callback, CURL_write_response (..)
-  , CURL_read_callback , CURL_read_response  (..)
-
-  -- *** Constants
-  , CURLproto     (..)
-  , CURLproxy     (..)
-  , CURLnetrc     (..)
-  , CURLauth      (..)
-  , CURLtlsauth   (..) |7214:----|
-  , CURLredir     (..)
-  , CURLhttpver   (..)
-  , CURLftpcreate (..)
-  , CURLftpauth   (..)
-  , CURLftpssl    (..)
-  , CURLftpmethod (..)
-  , CURLrtspreq   (..)
-  , CURLtimecond  (..)
-  , CURLclosepol  (..)
-  , CURLipresolve (..)
-  , CURLusessl    (..)
-  , CURLsslver    (..)
-  , CURLsslopt    (..) |7250:----|
-  , CURLgssapi    (..) |7220:----|
-  , CURLsshauth   (..)
-
-  ) where
-
-import Network.Curlhs.Types
-import Network.Curlhs.Easy
-
diff --git a/Network/Curlhs/Easy.hs b/Network/Curlhs/Easy.hs
deleted file mode 100644
--- a/Network/Curlhs/Easy.hs
+++ /dev/null
@@ -1,284 +0,0 @@
--------------------------------------------------------------------------------
--- |
--- Module      :  Network.Curlhs.Easy
--- Copyright   :  Copyright © 2012 Krzysztof Kardzis
--- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
--- 
--- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
--- Stability   :  experimental
--- Portability :  non-portable
---
--------------------------------------------------------------------------------
-
-module Network.Curlhs.Easy
-  ( curl_version
-  , curl_version_info
-  , curl_easy_strerror
-  , curl_easy_init
-  , curl_easy_reset
-  , curl_easy_cleanup
-  , curl_easy_perform
-  , curl_easy_getinfo
-  , curl_easy_setopt
-  ) where
-
-import Foreign.Marshal.Alloc (alloca)
-import Foreign.Marshal.Utils (toBool)
-import Foreign.Storable      (peek, sizeOf)
-import Foreign.C.String      (peekCString)
-import Foreign.C.Types       (CChar, CInt)
-import Foreign.Ptr           (Ptr, nullPtr, plusPtr)
-
-import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
-import Data.Time.Clock       (UTCTime)
-import Data.Maybe            (mapMaybe)
-import Data.Bits             ((.&.))
-import Data.IORef            (newIORef)
-
-import Control.Applicative   ((<$>), (<*>))
-import Control.Exception     (throwIO)
-
-import Network.Curlhs.Errors
-import Network.Curlhs.Setopt
-import Network.Curlhs.Types
-import Network.Curlhs.Base
-
-
--------------------------------------------------------------------------------
--- | Returns the libcurl version string
---   (<http://curl.haxx.se/libcurl/c/curl_version.html>).
--------------------------------------------------------------------------------
-curl_version :: IO String
-curl_version = ccurl_version >>= peekCString
-
-
--------------------------------------------------------------------------------
--- | Returns run-time libcurl version info
---   (<http://curl.haxx.se/libcurl/c/curl_version_info.html>).
--------------------------------------------------------------------------------
-curl_version_info :: IO CURL_version_info_data
-curl_version_info = ccurl_version_info cCURLVERSION_NOW >>= peek >>=
-  \cval -> CURL_version_info_data
-    <$> (peekCString      $ ccurl_version_info_data_version         cval)
-    <*> (peekCIntegral    $ ccurl_version_info_data_version_num     cval)
-    <*> (peekCString      $ ccurl_version_info_data_host            cval)
-    <*> (peekCFeatures    $ ccurl_version_info_data_features        cval)
-    <*> (peekCStringMaybe $ ccurl_version_info_data_ssl_version     cval)
-    <*> (peekCIntegral    $ ccurl_version_info_data_ssl_version_num cval)
-    <*> (peekCStringMaybe $ ccurl_version_info_data_libz_version    cval)
-    <*> (peekCStringList  $ ccurl_version_info_data_protocols       cval)
-    <*> (peekCStringMaybe $ ccurl_version_info_data_ares            cval)
-    <*> (peekCIntegral    $ ccurl_version_info_data_ares_num        cval)
-    <*> (peekCStringMaybe $ ccurl_version_info_data_libidn          cval)
-    <*> (peekCIntegral    $ ccurl_version_info_data_iconv_ver_num   cval)
-    <*> (peekCStringMaybe $ ccurl_version_info_data_libssh_version  cval)
-
-peekCStringList :: Ptr (Ptr CChar) -> IO [String]
-peekCStringList ptr = peek ptr >>= \cstring ->
-  if (cstring == nullPtr) then return [] else do
-    let size = sizeOf (undefined :: Ptr CChar)
-    strings <- peekCStringList (plusPtr ptr size)
-    string  <- peekCString cstring
-    return (string : strings)
-
-peekCStringMaybe :: Ptr CChar -> IO (Maybe String)
-peekCStringMaybe ptr = if (ptr /= nullPtr)
-  then Just <$> peekCString ptr
-  else return Nothing
-
-peekCIntegral :: (Num h, Integral c) => c -> IO h
-peekCIntegral = return . fromIntegral
-
-peekCFeatures :: CInt -> IO [CURL_version]
-peekCFeatures mask =
-  return $ mapMaybe (\(v, b) -> if (mask .&. b == 0) then Nothing else Just v)
-    [ (CURL_VERSION_IPV6        , cCURL_VERSION_IPV6        )
-    , (CURL_VERSION_KERBEROS4   , cCURL_VERSION_KERBEROS4   )
-    , (CURL_VERSION_SSL         , cCURL_VERSION_SSL         )
-    , (CURL_VERSION_LIBZ        , cCURL_VERSION_LIBZ        )
-    , (CURL_VERSION_NTLM        , cCURL_VERSION_NTLM        )
-    , (CURL_VERSION_GSSNEGOTIATE, cCURL_VERSION_GSSNEGOTIATE)
-    , (CURL_VERSION_DEBUG       , cCURL_VERSION_DEBUG       )
-    , (CURL_VERSION_ASYNCHDNS   , cCURL_VERSION_ASYNCHDNS   )
-    , (CURL_VERSION_SPNEGO      , cCURL_VERSION_SPNEGO      )
-    , (CURL_VERSION_LARGEFILE   , cCURL_VERSION_LARGEFILE   )
-    , (CURL_VERSION_IDN         , cCURL_VERSION_IDN         )
-    , (CURL_VERSION_SSPI        , cCURL_VERSION_SSPI        )
-    , (CURL_VERSION_CONV        , cCURL_VERSION_CONV        )
-    , (CURL_VERSION_CURLDEBUG   , cCURL_VERSION_CURLDEBUG   )
-    , (CURL_VERSION_TLSAUTH_SRP , cCURL_VERSION_TLSAUTH_SRP ) |7214:----|
-    , (CURL_VERSION_NTLM_WB     , cCURL_VERSION_NTLM_WB     ) |7220:----|
-    ]
-
-
--------------------------------------------------------------------------------
--- | Start a libcurl easy session
---   (<http://curl.haxx.se/libcurl/c/curl_easy_init.html>).
--------------------------------------------------------------------------------
-curl_easy_init :: IO CURL
-curl_easy_init = ccurl_easy_init >>= \ccurl -> if (ccurl == nullPtr)
-  then throwIO CURLE_FAILED_INIT
-  else CURL ccurl
-    <$> newIORef Nothing
-    <*> newIORef Nothing
-
-
--------------------------------------------------------------------------------
--- | Reset all options of a libcurl session handle
---   (<http://curl.haxx.se/libcurl/c/curl_easy_reset.html>).
--------------------------------------------------------------------------------
-curl_easy_reset :: CURL -> IO ()
-curl_easy_reset curl =
-  ccurl_easy_reset (ccurlptr curl) >> freeCallbacks curl
-
-
--------------------------------------------------------------------------------
--- | End a libcurl easy session
---   (<http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html>).
--------------------------------------------------------------------------------
-curl_easy_cleanup :: CURL -> IO ()
-curl_easy_cleanup curl =
-  ccurl_easy_cleanup (ccurlptr curl) >> freeCallbacks curl
-
-
--------------------------------------------------------------------------------
--- | Perform a file transfer
---   (<http://curl.haxx.se/libcurl/c/curl_easy_perform.html>).
--------------------------------------------------------------------------------
-curl_easy_perform :: CURL -> IO ()
-curl_easy_perform curl = withCODE $ ccurl_easy_perform (ccurlptr curl)
-
-
--------------------------------------------------------------------------------
--- | Extract information from a curl handle
---   (<http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html>).
--------------------------------------------------------------------------------
-curl_easy_getinfo :: CURL -> IO CURLinfo
-curl_easy_getinfo curl = let ccurl = ccurlptr curl in CURLinfo
-  <$> getinfo'String   ccurl cCURLINFO_EFFECTIVE_URL
-  <*> getinfo'RespCode ccurl cCURLINFO_RESPONSE_CODE
-  <*> getinfo'RespCode ccurl cCURLINFO_HTTP_CONNECTCODE
-  <*> getinfo'FileTime ccurl cCURLINFO_FILETIME
-  <*> getinfo'Double   ccurl cCURLINFO_TOTAL_TIME
-  <*> getinfo'Double   ccurl cCURLINFO_NAMELOOKUP_TIME
-  <*> getinfo'Double   ccurl cCURLINFO_CONNECT_TIME
-  <*> getinfo'Double   ccurl cCURLINFO_APPCONNECT_TIME
-  <*> getinfo'Double   ccurl cCURLINFO_PRETRANSFER_TIME
-  <*> getinfo'Double   ccurl cCURLINFO_STARTTRANSFER_TIME
-  <*> getinfo'Double   ccurl cCURLINFO_REDIRECT_TIME
-  <*> getinfo'Int      ccurl cCURLINFO_REDIRECT_COUNT
-  <*> getinfo'MString  ccurl cCURLINFO_REDIRECT_URL
-  <*> getinfo'Double   ccurl cCURLINFO_SIZE_UPLOAD
-  <*> getinfo'Double   ccurl cCURLINFO_SIZE_DOWNLOAD
-  <*> getinfo'Double   ccurl cCURLINFO_SPEED_DOWNLOAD
-  <*> getinfo'Double   ccurl cCURLINFO_SPEED_UPLOAD
-  <*> getinfo'Int      ccurl cCURLINFO_HEADER_SIZE
-  <*> getinfo'Int      ccurl cCURLINFO_REQUEST_SIZE
-  <*> getinfo'Int      ccurl cCURLINFO_SSL_VERIFYRESULT
-  <*> getinfo'SList    ccurl cCURLINFO_SSL_ENGINES
-  <*> getinfo'ContentL ccurl cCURLINFO_CONTENT_LENGTH_DOWNLOAD
-  <*> getinfo'ContentL ccurl cCURLINFO_CONTENT_LENGTH_UPLOAD
-  <*> getinfo'MString  ccurl cCURLINFO_CONTENT_TYPE
---  <*> getinfo'String   ccurl cCURLINFO_PRIVATE
-  <*> getinfo'CurlAuth ccurl cCURLINFO_HTTPAUTH_AVAIL
-  <*> getinfo'CurlAuth ccurl cCURLINFO_PROXYAUTH_AVAIL
-  <*> getinfo'Int      ccurl cCURLINFO_OS_ERRNO
-  <*> getinfo'Int      ccurl cCURLINFO_NUM_CONNECTS
-  <*> getinfo'String   ccurl cCURLINFO_PRIMARY_IP
-  <*> getinfo'Int      ccurl cCURLINFO_PRIMARY_PORT
-  <*> getinfo'String   ccurl cCURLINFO_LOCAL_IP
-  <*> getinfo'Int      ccurl cCURLINFO_LOCAL_PORT
-  <*> getinfo'SList    ccurl cCURLINFO_COOKIELIST
-  <*> getinfo'Socket   ccurl cCURLINFO_LASTSOCKET
-  <*> getinfo'MString  ccurl cCURLINFO_FTP_ENTRY_PATH
-  <*> getinfo'CertInfo ccurl cCURLINFO_CERTINFO
-  <*> getinfo'TimeCond ccurl cCURLINFO_CONDITION_UNMET
-  <*> getinfo'MString  ccurl cCURLINFO_RTSP_SESSION_ID
-  <*> getinfo'Int      ccurl cCURLINFO_RTSP_CLIENT_CSEQ
-  <*> getinfo'Int      ccurl cCURLINFO_RTSP_SERVER_CSEQ
-  <*> getinfo'Int      ccurl cCURLINFO_RTSP_CSEQ_RECV
-
-getinfo'String :: Ptr CCURL -> CCURLinfo'CString -> IO String
-getinfo'String ccurl cinfo = alloca $ \ptr -> do
-  withCODE $ ccurl_easy_getinfo'CString ccurl cinfo ptr
-  peek ptr >>= peekCString
-
-getinfo'MString :: Ptr CCURL -> CCURLinfo'CString -> IO (Maybe String)
-getinfo'MString ccurl cinfo = alloca $ \ptr -> do
-  withCODE $ ccurl_easy_getinfo'CString ccurl cinfo ptr
-  peek ptr >>= \csptr -> if (csptr /= nullPtr)
-    then Just <$> peekCString csptr
-    else return Nothing
-
-getinfo'Double :: Ptr CCURL -> CCURLinfo'CDouble -> IO Double
-getinfo'Double ccurl cinfo = alloca $ \ptr -> do
-  withCODE $ ccurl_easy_getinfo'CDouble ccurl cinfo ptr
-  realToFrac <$> peek ptr
-
-getinfo'ContentL :: Ptr CCURL -> CCURLinfo'CDouble -> IO (Maybe Double)
-getinfo'ContentL ccurl cinfo = getinfo'Double ccurl cinfo >>= \v ->
-  return $ if (v == (-1)) then Nothing else Just v
-
-getinfo'SList :: Ptr CCURL -> CCURLinfo'SList -> IO [String]
-getinfo'SList ccurl cinfo = alloca $ \ptr -> do
-  withCODE $ ccurl_easy_getinfo'SList ccurl cinfo ptr
-  peek ptr >>= \slist -> do
-    strings <- peek'CCURL_slist slist
-    ccurl_slist_free_all slist
-    return strings
-
-getinfo'CertInfo :: Ptr CCURL -> CCURLinfo'CertI -> IO [[String]]
-getinfo'CertInfo ccurl cinfo = alloca $ \ptr -> do
-  withCODE $ ccurl_easy_getinfo'CertI ccurl cinfo ptr
-  peek ptr >>= peek'CCURL_certinfo
-
-getinfo'Int :: Ptr CCURL -> CCURLinfo'CLong -> IO Int
-getinfo'Int ccurl cinfo = alloca $ \ptr -> do
-  withCODE $ ccurl_easy_getinfo'CLong ccurl cinfo ptr
-  fromIntegral <$> peek ptr
-
-getinfo'RespCode :: Ptr CCURL -> CCURLinfo'CLong -> IO (Maybe Int)
-getinfo'RespCode ccurl cinfo = getinfo'Int ccurl cinfo >>= \v ->
-  return $ if (v == 0) then Nothing else Just v
-
-getinfo'FileTime :: Ptr CCURL -> CCURLinfo'CLong -> IO (Maybe UTCTime)
-getinfo'FileTime ccurl cinfo = getinfo'Int ccurl cinfo >>= \v ->
-  return $ if (v == (-1) || v == 0) then Nothing
-    else Just (posixSecondsToUTCTime $ realToFrac v)
-
-getinfo'Socket :: Ptr CCURL -> CCURLinfo'CLong -> IO (Maybe Int)
-getinfo'Socket ccurl cinfo = getinfo'Int ccurl cinfo >>= \v ->
-  return $ if (v == (-1)) then Nothing else Just v
-
-getinfo'TimeCond :: Ptr CCURL -> CCURLinfo'CLong -> IO Bool
-getinfo'TimeCond ccurl cinfo = toBool <$> getinfo'Int ccurl cinfo
-
-getinfo'CurlAuth :: Ptr CCURL -> CCURLinfo'CLong -> IO [CURLauth]
-getinfo'CurlAuth ccurl cinfo = do
-  mask <- fromIntegral <$> getinfo'Int ccurl cinfo
-  return $ mapMaybe (\(v, b) -> if (mask .&. b == 0) then Nothing else Just v)
-    [ (CURLAUTH_BASIC       , cCURLAUTH_BASIC       )
-    , (CURLAUTH_DIGEST      , cCURLAUTH_DIGEST      )
-    , (CURLAUTH_DIGEST_IE   , cCURLAUTH_DIGEST_IE   )
-    , (CURLAUTH_GSSNEGOTIATE, cCURLAUTH_GSSNEGOTIATE)
-    , (CURLAUTH_NTLM        , cCURLAUTH_NTLM        )
-    , (CURLAUTH_NTLM_WB     , cCURLAUTH_NTLM_WB     ) |7220:----|
-    ]
-
-
-peek'CCURL_slist :: Ptr CCURL_slist -> IO [String]
-peek'CCURL_slist ptr =
-  if (ptr == nullPtr) then return [] else peek ptr >>= \slist -> do
-    slist_head <- peekCString      $ ccurl_slist_data slist
-    slist_tail <- peek'CCURL_slist $ ccurl_slist_next slist
-    return (slist_head : slist_tail)
-
-peek'CCURL_certinfo :: Ptr CCURL_certinfo -> IO [[String]]
-peek'CCURL_certinfo ptr =
-  if (ptr == nullPtr) then return [] else peek ptr >>= \certinfo -> do
-    let numOfCerts = fromIntegral $ ccurl_certinfo_num_of_certs certinfo
-    let size = sizeOf (undefined :: Ptr CCURL_slist)
-    let ptr0 = ccurl_certinfo_certinfo certinfo
-    let ptrs = map (\i -> plusPtr ptr0 (i * size)) [0 .. (numOfCerts - 1)]
-    mapM (\sptr -> peek sptr >>= peek'CCURL_slist) ptrs
-
diff --git a/Network/Curlhs/Errors.hsc b/Network/Curlhs/Errors.hsc
deleted file mode 100644
--- a/Network/Curlhs/Errors.hsc
+++ /dev/null
@@ -1,216 +0,0 @@
--------------------------------------------------------------------------------
--- |
--- Module      :  Network.Curlhs.Errors
--- Copyright   :  Copyright © 2012 Krzysztof Kardzis
--- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
--- 
--- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
--- Stability   :  experimental
--- Portability :  non-portable
---
--------------------------------------------------------------------------------
-
-module Network.Curlhs.Errors
-  ( curl_easy_strerror
-  , withCODE
-  ) where
-
-import Data.ByteString   (ByteString, packCString)
-
-import Control.Exception (throwIO)
-import Control.Monad     (when)
-
-import Network.Curlhs.Types
-import Network.Curlhs.Base
-
-
--------------------------------------------------------------------------------
-withCODE :: IO CCURLcode -> IO ()
-withCODE action =
-  action >>= \code -> when (code /= cCURLE_OK) (throwIO (fromCCURLcode code))
-
-
--------------------------------------------------------------------------------
--- | Returns a string describing error code
---   (<http://curl.haxx.se/libcurl/c/curl_easy_strerror.html>).
--------------------------------------------------------------------------------
-curl_easy_strerror :: CURLcode -> IO ByteString
-curl_easy_strerror code =
-  ccurl_easy_strerror (fromCURLcode code) >>= packCString
-
-
--------------------------------------------------------------------------------
-#{let curlcode code = #code " -> c" #code}
-
-fromCURLcode :: CURLcode -> CCURLcode
-fromCURLcode x = case x of
-  #{curlcode CURLE_OK                      }
-  #{curlcode CURLE_UNSUPPORTED_PROTOCOL    }
-  #{curlcode CURLE_FAILED_INIT             }
-  #{curlcode CURLE_URL_MALFORMAT           }
-  #{curlcode CURLE_NOT_BUILT_IN            } |7215:----|
-  #{curlcode CURLE_COULDNT_RESOLVE_PROXY   }
-  #{curlcode CURLE_COULDNT_RESOLVE_HOST    }
-  #{curlcode CURLE_COULDNT_CONNECT         }
-  #{curlcode CURLE_FTP_WEIRD_SERVER_REPLY  }
-  #{curlcode CURLE_REMOTE_ACCESS_DENIED    }
-  #{curlcode CURLE_FTP_ACCEPT_FAILED       } |7240:----|
-  #{curlcode CURLE_FTP_WEIRD_PASS_REPLY    }
-  #{curlcode CURLE_FTP_ACCEPT_TIMEOUT      } |7240:----|
-  #{curlcode CURLE_FTP_WEIRD_PASV_REPLY    }
-  #{curlcode CURLE_FTP_WEIRD_227_FORMAT    }
-  #{curlcode CURLE_FTP_CANT_GET_HOST       }
-  #{curlcode CURLE_FTP_COULDNT_SET_TYPE    }
-  #{curlcode CURLE_PARTIAL_FILE            }
-  #{curlcode CURLE_FTP_COULDNT_RETR_FILE   }
-  #{curlcode CURLE_QUOTE_ERROR             }
-  #{curlcode CURLE_HTTP_RETURNED_ERROR     }
-  #{curlcode CURLE_WRITE_ERROR             }
-  #{curlcode CURLE_UPLOAD_FAILED           }
-  #{curlcode CURLE_READ_ERROR              }
-  #{curlcode CURLE_OUT_OF_MEMORY           }
-  #{curlcode CURLE_OPERATION_TIMEDOUT      }
-  #{curlcode CURLE_FTP_PORT_FAILED         }
-  #{curlcode CURLE_FTP_COULDNT_USE_REST    }
-  #{curlcode CURLE_RANGE_ERROR             }
-  #{curlcode CURLE_HTTP_POST_ERROR         }
-  #{curlcode CURLE_SSL_CONNECT_ERROR       }
-  #{curlcode CURLE_BAD_DOWNLOAD_RESUME     }
-  #{curlcode CURLE_FILE_COULDNT_READ_FILE  }
-  #{curlcode CURLE_LDAP_CANNOT_BIND        }
-  #{curlcode CURLE_LDAP_SEARCH_FAILED      }
-  #{curlcode CURLE_FUNCTION_NOT_FOUND      }
-  #{curlcode CURLE_ABORTED_BY_CALLBACK     }
-  #{curlcode CURLE_BAD_FUNCTION_ARGUMENT   }
-  #{curlcode CURLE_INTERFACE_FAILED        }
-  #{curlcode CURLE_TOO_MANY_REDIRECTS      }
-  #{curlcode CURLE_UNKNOWN_TELNET_OPTION   } |----:7214|
-  #{curlcode CURLE_UNKNOWN_OPTION          } |7215:----|
-  #{curlcode CURLE_TELNET_OPTION_SYNTAX    }
-  #{curlcode CURLE_PEER_FAILED_VERIFICATION}
-  #{curlcode CURLE_GOT_NOTHING             }
-  #{curlcode CURLE_SSL_ENGINE_NOTFOUND     }
-  #{curlcode CURLE_SSL_ENGINE_SETFAILED    }
-  #{curlcode CURLE_SEND_ERROR              }
-  #{curlcode CURLE_RECV_ERROR              }
-  #{curlcode CURLE_SSL_CERTPROBLEM         }
-  #{curlcode CURLE_SSL_CIPHER              }
-  #{curlcode CURLE_SSL_CACERT              }
-  #{curlcode CURLE_BAD_CONTENT_ENCODING    }
-  #{curlcode CURLE_LDAP_INVALID_URL        }
-  #{curlcode CURLE_FILESIZE_EXCEEDED       }
-  #{curlcode CURLE_USE_SSL_FAILED          }
-  #{curlcode CURLE_SEND_FAIL_REWIND        }
-  #{curlcode CURLE_SSL_ENGINE_INITFAILED   }
-  #{curlcode CURLE_LOGIN_DENIED            }
-  #{curlcode CURLE_TFTP_NOTFOUND           }
-  #{curlcode CURLE_TFTP_PERM               }
-  #{curlcode CURLE_REMOTE_DISK_FULL        }
-  #{curlcode CURLE_TFTP_ILLEGAL            }
-  #{curlcode CURLE_TFTP_UNKNOWNID          }
-  #{curlcode CURLE_REMOTE_FILE_EXISTS      }
-  #{curlcode CURLE_TFTP_NOSUCHUSER         }
-  #{curlcode CURLE_CONV_FAILED             }
-  #{curlcode CURLE_CONV_REQD               }
-  #{curlcode CURLE_SSL_CACERT_BADFILE      }
-  #{curlcode CURLE_REMOTE_FILE_NOT_FOUND   }
-  #{curlcode CURLE_SSH                     }
-  #{curlcode CURLE_SSL_SHUTDOWN_FAILED     }
-  #{curlcode CURLE_AGAIN                   }
-  #{curlcode CURLE_SSL_CRL_BADFILE         }
-  #{curlcode CURLE_SSL_ISSUER_ERROR        }
-  #{curlcode CURLE_FTP_PRET_FAILED         }
-  #{curlcode CURLE_RTSP_CSEQ_ERROR         }
-  #{curlcode CURLE_RTSP_SESSION_ERROR      }
-  #{curlcode CURLE_FTP_BAD_FILE_LIST       } |7210:----|
-  #{curlcode CURLE_CHUNK_FAILED            } |7210:----|
-
-
--------------------------------------------------------------------------------
-#{let ccurlcode code = "| x == c" #code " = " #code}
-
-fromCCURLcode :: CCURLcode -> CURLcode
-fromCCURLcode x
-  #{ccurlcode CURLE_OK                      }
-  #{ccurlcode CURLE_UNSUPPORTED_PROTOCOL    }
-  #{ccurlcode CURLE_FAILED_INIT             }
-  #{ccurlcode CURLE_URL_MALFORMAT           }
-  #{ccurlcode CURLE_NOT_BUILT_IN            } |7215:----|
-  #{ccurlcode CURLE_COULDNT_RESOLVE_PROXY   }
-  #{ccurlcode CURLE_COULDNT_RESOLVE_HOST    }
-  #{ccurlcode CURLE_COULDNT_CONNECT         }
-  #{ccurlcode CURLE_FTP_WEIRD_SERVER_REPLY  }
-  #{ccurlcode CURLE_REMOTE_ACCESS_DENIED    }
-  #{ccurlcode CURLE_FTP_ACCEPT_FAILED       } |7240:----|
-  #{ccurlcode CURLE_FTP_WEIRD_PASS_REPLY    }
-  #{ccurlcode CURLE_FTP_ACCEPT_TIMEOUT      } |7240:----|
-  #{ccurlcode CURLE_FTP_WEIRD_PASV_REPLY    }
-  #{ccurlcode CURLE_FTP_WEIRD_227_FORMAT    }
-  #{ccurlcode CURLE_FTP_CANT_GET_HOST       }
-  #{ccurlcode CURLE_FTP_COULDNT_SET_TYPE    }
-  #{ccurlcode CURLE_PARTIAL_FILE            }
-  #{ccurlcode CURLE_FTP_COULDNT_RETR_FILE   }
-  #{ccurlcode CURLE_QUOTE_ERROR             }
-  #{ccurlcode CURLE_HTTP_RETURNED_ERROR     }
-  #{ccurlcode CURLE_WRITE_ERROR             }
-  #{ccurlcode CURLE_UPLOAD_FAILED           }
-  #{ccurlcode CURLE_READ_ERROR              }
-  #{ccurlcode CURLE_OUT_OF_MEMORY           }
-  #{ccurlcode CURLE_OPERATION_TIMEDOUT      }
-  #{ccurlcode CURLE_FTP_PORT_FAILED         }
-  #{ccurlcode CURLE_FTP_COULDNT_USE_REST    }
-  #{ccurlcode CURLE_RANGE_ERROR             }
-  #{ccurlcode CURLE_HTTP_POST_ERROR         }
-  #{ccurlcode CURLE_SSL_CONNECT_ERROR       }
-  #{ccurlcode CURLE_BAD_DOWNLOAD_RESUME     }
-  #{ccurlcode CURLE_FILE_COULDNT_READ_FILE  }
-  #{ccurlcode CURLE_LDAP_CANNOT_BIND        }
-  #{ccurlcode CURLE_LDAP_SEARCH_FAILED      }
-  #{ccurlcode CURLE_FUNCTION_NOT_FOUND      }
-  #{ccurlcode CURLE_ABORTED_BY_CALLBACK     }
-  #{ccurlcode CURLE_BAD_FUNCTION_ARGUMENT   }
-  #{ccurlcode CURLE_INTERFACE_FAILED        }
-  #{ccurlcode CURLE_TOO_MANY_REDIRECTS      }
-  #{ccurlcode CURLE_UNKNOWN_TELNET_OPTION   } |----:7214|
-  #{ccurlcode CURLE_UNKNOWN_OPTION          } |7215:----|
-  #{ccurlcode CURLE_TELNET_OPTION_SYNTAX    }
-  #{ccurlcode CURLE_PEER_FAILED_VERIFICATION}
-  #{ccurlcode CURLE_GOT_NOTHING             }
-  #{ccurlcode CURLE_SSL_ENGINE_NOTFOUND     }
-  #{ccurlcode CURLE_SSL_ENGINE_SETFAILED    }
-  #{ccurlcode CURLE_SEND_ERROR              }
-  #{ccurlcode CURLE_RECV_ERROR              }
-  #{ccurlcode CURLE_SSL_CERTPROBLEM         }
-  #{ccurlcode CURLE_SSL_CIPHER              }
-  #{ccurlcode CURLE_SSL_CACERT              }
-  #{ccurlcode CURLE_BAD_CONTENT_ENCODING    }
-  #{ccurlcode CURLE_LDAP_INVALID_URL        }
-  #{ccurlcode CURLE_FILESIZE_EXCEEDED       }
-  #{ccurlcode CURLE_USE_SSL_FAILED          }
-  #{ccurlcode CURLE_SEND_FAIL_REWIND        }
-  #{ccurlcode CURLE_SSL_ENGINE_INITFAILED   }
-  #{ccurlcode CURLE_LOGIN_DENIED            }
-  #{ccurlcode CURLE_TFTP_NOTFOUND           }
-  #{ccurlcode CURLE_TFTP_PERM               }
-  #{ccurlcode CURLE_REMOTE_DISK_FULL        }
-  #{ccurlcode CURLE_TFTP_ILLEGAL            }
-  #{ccurlcode CURLE_TFTP_UNKNOWNID          }
-  #{ccurlcode CURLE_REMOTE_FILE_EXISTS      }
-  #{ccurlcode CURLE_TFTP_NOSUCHUSER         }
-  #{ccurlcode CURLE_CONV_FAILED             }
-  #{ccurlcode CURLE_CONV_REQD               }
-  #{ccurlcode CURLE_SSL_CACERT_BADFILE      }
-  #{ccurlcode CURLE_REMOTE_FILE_NOT_FOUND   }
-  #{ccurlcode CURLE_SSH                     }
-  #{ccurlcode CURLE_SSL_SHUTDOWN_FAILED     }
-  #{ccurlcode CURLE_AGAIN                   }
-  #{ccurlcode CURLE_SSL_CRL_BADFILE         }
-  #{ccurlcode CURLE_SSL_ISSUER_ERROR        }
-  #{ccurlcode CURLE_FTP_PRET_FAILED         }
-  #{ccurlcode CURLE_RTSP_CSEQ_ERROR         }
-  #{ccurlcode CURLE_RTSP_SESSION_ERROR      }
-  #{ccurlcode CURLE_FTP_BAD_FILE_LIST       } |7210:----|
-  #{ccurlcode CURLE_CHUNK_FAILED            } |7210:----|
-  | otherwise = error "unknown CURLcode"
-
-
diff --git a/Network/Curlhs/Setopt.hsc b/Network/Curlhs/Setopt.hsc
deleted file mode 100644
--- a/Network/Curlhs/Setopt.hsc
+++ /dev/null
@@ -1,513 +0,0 @@
--------------------------------------------------------------------------------
--- |
--- Module      :  Network.Curlhs.Setopt
--- Copyright   :  Copyright © 2012 Krzysztof Kardzis
--- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
--- 
--- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
--- Stability   :  experimental
--- Portability :  non-portable
---
--------------------------------------------------------------------------------
-
-module Network.Curlhs.Setopt
-  ( curl_easy_setopt
-  , freeCallbacks
-  ) where
-
-import Foreign.Marshal.Utils (copyBytes, fromBool)
-import Foreign.C.Types       (CLong)
-import Foreign.Ptr           (FunPtr, nullFunPtr, freeHaskellFunPtr)
-
-import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
-import Data.Time.Clock       (UTCTime)
-import Data.Bits             ((.|.))
-import Data.List             (foldl')
-import Data.IORef            (IORef, atomicModifyIORef)
-
-import qualified Data.ByteString as BS
-import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
-import Data.ByteString        (ByteString, useAsCString, packCStringLen)
-
-import Network.Curlhs.Errors
-import Network.Curlhs.Types
-import Network.Curlhs.Base
-
-
--------------------------------------------------------------------------------
-freeCallbacks :: CURL -> IO ()
-freeCallbacks curl = do
-  keepCallback (cb_write curl) Nothing
-  keepCallback (cb_read  curl) Nothing
-
-keepCallback :: IORef (Maybe (FunPtr a)) -> Maybe (FunPtr a) -> IO ()
-keepCallback r mf =
-  atomicModifyIORef r (\v -> (mf, v)) >>= maybe (return ()) freeHaskellFunPtr
-
-makeCallback :: Maybe cb -> IORef (Maybe (FunPtr a))
-             -> (FunPtr a -> IO CCURLcode) -> (cb -> IO (FunPtr a)) -> IO ()
-makeCallback (Just cb) ref setcb wrapcb = withCODE $ do
-  fptr <- wrapcb cb
-  code <- setcb fptr
-  if (code == cCURLE_OK)
-    then keepCallback ref (Just fptr)
-    else freeHaskellFunPtr fptr
-  return code
-makeCallback Nothing ref setcb _ = withCODE $ do
-  code <- setcb nullFunPtr
-  keepCallback ref Nothing
-  return code
-
-
--------------------------------------------------------------------------------
-#{let setopt opt, fun = #opt " x -> " #fun " c" #opt " x"}
-
--------------------------------------------------------------------------------
--- | Set options for a curl easy handle
---   (<http://curl.haxx.se/libcurl/c/curl_easy_setopt.html>).
--------------------------------------------------------------------------------
-curl_easy_setopt :: CURL -> [CURLoption] -> IO ()
-curl_easy_setopt curl opts = flip mapM_ opts $ \opt -> case opt of
-
-  ---- CALLBACK OPTIONS -------------------------------------------------------
-  CURLOPT_WRITEFUNCTION f -> so'FWRITE curl f
-  CURLOPT_READFUNCTION  f -> so'FREAD  curl f
-
-  ---- BEHAVIOR OPTIONS -------------------------------------------------------
-  #{setopt CURLOPT_VERBOSE                , bool     }
-  #{setopt CURLOPT_HEADER                 , bool     }
-  #{setopt CURLOPT_NOPROGRESS             , bool     }
-  #{setopt CURLOPT_NOSIGNAL               , bool     }
-  #{setopt CURLOPT_WILDCARDMATCH          , bool     } |7210:----|
-
-  ---- ERROR OPTIONS ----------------------------------------------------------
-  -- CURLOPT_ERRORBUFFER
-  -- CURLOPT_STDERR
-  #{setopt CURLOPT_FAILONERROR            , bool     }
-
-  ---- NETWORK OPTIONS --------------------------------------------------------
-  #{setopt CURLOPT_URL                    , string   }
-  #{setopt CURLOPT_PROTOCOLS              , enum     }
-  #{setopt CURLOPT_REDIR_PROTOCOLS        , enum     }
-  #{setopt CURLOPT_PROXY                  , string   }
-  #{setopt CURLOPT_PROXYPORT              , int      }
-  #{setopt CURLOPT_PROXYTYPE              , enum     }
-  #{setopt CURLOPT_NOPROXY                , string   }
-  #{setopt CURLOPT_HTTPPROXYTUNNEL        , bool     }
-  #{setopt CURLOPT_SOCKS5_GSSAPI_SERVICE  , string   }
-  #{setopt CURLOPT_SOCKS5_GSSAPI_NEC      , bool     }
-  #{setopt CURLOPT_INTERFACE              , string   }
-  #{setopt CURLOPT_LOCALPORT              , int      }
-  #{setopt CURLOPT_LOCALPORTRANGE         , int      }
-  #{setopt CURLOPT_DNS_CACHE_TIMEOUT      , int      }
-  #{setopt CURLOPT_DNS_USE_GLOBAL_CACHE   , bool     }
-  #{setopt CURLOPT_BUFFERSIZE             , int      }
-  #{setopt CURLOPT_PORT                   , int      }
-  #{setopt CURLOPT_TCP_NODELAY            , bool     }
-  #{setopt CURLOPT_ADDRESS_SCOPE          , int      }
-  #{setopt CURLOPT_TCP_KEEPALIVE          , bool     } |7250:----|
-  #{setopt CURLOPT_TCP_KEEPIDLE           , int      } |7250:----|
-  #{setopt CURLOPT_TCP_KEEPINTVL          , int      } |7250:----|
-
-  ---- NAMES and PASSWORDS OPTIONS (Authentication) ---------------------------
-  #{setopt CURLOPT_NETRC                  , enum     }
-  #{setopt CURLOPT_NETRC_FILE             , string   }
-  #{setopt CURLOPT_USERPWD                , string   }
-  #{setopt CURLOPT_PROXYUSERPWD           , string   }
-  #{setopt CURLOPT_USERNAME               , string   }
-  #{setopt CURLOPT_PASSWORD               , string   }
-  #{setopt CURLOPT_PROXYUSERNAME          , string   }
-  #{setopt CURLOPT_PROXYPASSWORD          , string   }
-  #{setopt CURLOPT_HTTPAUTH               , enum     }
-  #{setopt CURLOPT_TLSAUTH_TYPE           , string   } |7214:----|
-  #{setopt CURLOPT_TLSAUTH_USERNAME       , string   } |7214:----|
-  #{setopt CURLOPT_TLSAUTH_PASSWORD       , string   } |7214:----|
-  #{setopt CURLOPT_PROXYAUTH              , enum     }
-
-  ---- HTTP OPTIONS -----------------------------------------------------------
-  #{setopt CURLOPT_AUTOREFERER            , bool     }
-  #{setopt CURLOPT_ENCODING               , string   } |----:7215|
-  #{setopt CURLOPT_ACCEPT_ENCODING        , string   } |7216:----|
-  #{setopt CURLOPT_TRANSFER_ENCODING      , bool     } |7216:----|
-  #{setopt CURLOPT_FOLLOWLOCATION         , bool     }
-  #{setopt CURLOPT_UNRESTRICTED_AUTH      , bool     }
-  #{setopt CURLOPT_MAXREDIRS              , int      }
-  #{setopt CURLOPT_POSTREDIR              , enum     }
-  #{setopt CURLOPT_PUT                    , bool     }
-  #{setopt CURLOPT_POST                   , bool     }
-  -- #{setopt CURLOPT_POSTFIELDS             , buffer   }
-  #{setopt CURLOPT_POSTFIELDSIZE          , int      }
-  #{setopt CURLOPT_POSTFIELDSIZE_LARGE    , int64    }
-  #{setopt CURLOPT_COPYPOSTFIELDS         , string   }
-  -- CURLOPT_HTTPPOST
-  #{setopt CURLOPT_REFERER                , string   }
-  #{setopt CURLOPT_USERAGENT              , string   }
-  -- #{setopt CURLOPT_HTTPHEADER             , slist    }
-  -- #{setopt CURLOPT_HTTP200ALIASES         , slist    }
-  #{setopt CURLOPT_COOKIE                 , string   }
-  #{setopt CURLOPT_COOKIEFILE             , string   }
-  #{setopt CURLOPT_COOKIEJAR              , string   }
-  #{setopt CURLOPT_COOKIESESSION          , bool     }
-  #{setopt CURLOPT_COOKIELIST             , string   }
-  #{setopt CURLOPT_HTTPGET                , bool     }
-  #{setopt CURLOPT_HTTP_VERSION           , enum     }
-  #{setopt CURLOPT_IGNORE_CONTENT_LENGTH  , bool     }
-  #{setopt CURLOPT_HTTP_CONTENT_DECODING  , bool     }
-  #{setopt CURLOPT_HTTP_TRANSFER_DECODING , bool     }
-
-  ---- SMTP OPTIONS -----------------------------------------------------------
-  #{setopt CURLOPT_MAIL_FROM              , string   }
-  -- #{setopt CURLOPT_MAIL_RCTP              , slist    }
-  #{setopt CURLOPT_MAIL_AUTH              , string   } |7250:----|
-
-  ---- TFTP OPTIONS -----------------------------------------------------------
-  #{setopt CURLOPT_TFTP_BLKSIZE           , int      }
-
-  ---- FTP OPTIONS ------------------------------------------------------------
-  #{setopt CURLOPT_FTPPORT                , string   }
-  -- #{setopt CURLOPT_QUOTE                  , slist    }
-  -- #{setopt CURLOPT_POSTQUOTE              , slist    }
-  -- #{setopt CURLOPT_PREQUOTE               , slist    }
-  #{setopt CURLOPT_DIRLISTONLY            , bool     }
-  #{setopt CURLOPT_APPEND                 , bool     }
-  #{setopt CURLOPT_FTP_USE_EPRT           , bool     }
-  #{setopt CURLOPT_FTP_USE_EPSV           , bool     }
-  #{setopt CURLOPT_FTP_USE_PRET           , bool     }
-  #{setopt CURLOPT_FTP_CREATE_MISSING_DIRS, enum     }
-  #{setopt CURLOPT_FTP_RESPONSE_TIMEOUT   , int      }
-  #{setopt CURLOPT_FTP_ALTERNATIVE_TO_USER, string   }
-  #{setopt CURLOPT_FTP_SKIP_PASV_IP       , bool     }
-  #{setopt CURLOPT_FTPSSLAUTH             , enum     }
-  #{setopt CURLOPT_FTP_SSL_CCC            , enum     }
-  #{setopt CURLOPT_FTP_ACCOUNT            , string   }
-  #{setopt CURLOPT_FTP_FILEMETHOD         , enum     }
-
-  ---- RTSP OPTIONS -----------------------------------------------------------
-  #{setopt CURLOPT_RTSP_REQUEST           , enum     }
-  #{setopt CURLOPT_RTSP_SESSION_ID        , string   }
-  #{setopt CURLOPT_RTSP_STREAM_URI        , string   }
-  #{setopt CURLOPT_RTSP_TRANSPORT         , string   }
-  -- #{setopt CURLOPT_RTSP_HEADER            , slist    }
-  #{setopt CURLOPT_RTSP_CLIENT_CSEQ       , int      }
-  #{setopt CURLOPT_RTSP_SERVER_CSEQ       , int      }
-
-  ---- PROTOCOL OPTIONS -------------------------------------------------------
-  #{setopt CURLOPT_TRANSFERTEXT           , bool     }
-  #{setopt CURLOPT_PROXY_TRANSFER_MODE    , bool     }
-  #{setopt CURLOPT_CRLF                   , bool     }
-  #{setopt CURLOPT_RANGE                  , string   }
-  #{setopt CURLOPT_RESUME_FROM            , int      }
-  #{setopt CURLOPT_RESUME_FROM_LARGE      , int64    }
-  #{setopt CURLOPT_CUSTOMREQUEST          , string   }
-  #{setopt CURLOPT_FILETIME               , bool     }
-  #{setopt CURLOPT_NOBODY                 , bool     }
-  #{setopt CURLOPT_INFILESIZE             , int      }
-  #{setopt CURLOPT_INFILESIZE_LARGE       , int64    }
-  #{setopt CURLOPT_UPLOAD                 , bool     }
-  #{setopt CURLOPT_MAXFILESIZE            , int      }
-  #{setopt CURLOPT_MAXFILESIZE_LARGE      , int64    }
-  #{setopt CURLOPT_TIMECONDITION          , enum     }
-  #{setopt CURLOPT_TIMEVALUE              , time     }
-
-  ---- CONNECTION OPTIONS -----------------------------------------------------
-  #{setopt CURLOPT_TIMEOUT                , int      }
-  #{setopt CURLOPT_TIMEOUT_MS             , int      }
-  #{setopt CURLOPT_LOW_SPEED_LIMIT        , int      }
-  #{setopt CURLOPT_LOW_SPEED_TIME         , int      }
-  #{setopt CURLOPT_MAX_SEND_SPEED_LARGE   , int64    }
-  #{setopt CURLOPT_MAX_RECV_SPEED_LARGE   , int64    }
-  #{setopt CURLOPT_MAXCONNECTS            , int      }
-  #{setopt CURLOPT_CLOSEPOLICY            , enum     }
-  #{setopt CURLOPT_FRESH_CONNECT          , bool     }
-  #{setopt CURLOPT_FORBID_REUSE           , bool     }
-  #{setopt CURLOPT_CONNECTTIMEOUT         , int      }
-  #{setopt CURLOPT_CONNECTTIMEOUT_MS      , int      }
-  #{setopt CURLOPT_IPRESOLVE              , enum     }
-  #{setopt CURLOPT_CONNECT_ONLY           , bool     }
-  #{setopt CURLOPT_USE_SSL                , enum     }
-  -- #{setopt CURLOPT_RESOLVE                , slist    } |7213:----|
-  #{setopt CURLOPT_DNS_SERVERS            , string   } |7240:----|
-  #{setopt CURLOPT_ACCEPTTIMEOUT_MS       , int      } |7240:----|
-
-  ---- SSL and SECURITY OPTIONS -----------------------------------------------
-  #{setopt CURLOPT_SSLCERT                , string   }
-  #{setopt CURLOPT_SSLCERTTYPE            , string   }
-  #{setopt CURLOPT_SSLKEY                 , string   }
-  #{setopt CURLOPT_SSLKEYTYPE             , string   }
-  #{setopt CURLOPT_KEYPASSWD              , string   }
-  #{setopt CURLOPT_SSLENGINE              , string   }
-  #{setopt CURLOPT_SSLENGINE_DEFAULT      , bool     }
-  #{setopt CURLOPT_SSLVERSION             , enum     }
-  #{setopt CURLOPT_SSL_VERIFYPEER         , bool     }
-  #{setopt CURLOPT_CAINFO                 , string   }
-  #{setopt CURLOPT_ISSUERCERT             , string   }
-  #{setopt CURLOPT_CAPATH                 , string   }
-  #{setopt CURLOPT_CRLFILE                , string   }
-  #{setopt CURLOPT_SSL_VERIFYHOST         , int      }
-  #{setopt CURLOPT_CERTINFO               , bool     }
-  #{setopt CURLOPT_RANDOM_FILE            , string   }
-  #{setopt CURLOPT_EGDSOCKET              , string   }
-  #{setopt CURLOPT_SSL_CIPHER_LIST        , string   }
-  #{setopt CURLOPT_SSL_SESSIONID_CACHE    , bool     }
-  #{setopt CURLOPT_SSL_OPTIONS            , enum     } |7250:----|
-  #{setopt CURLOPT_KRBLEVEL               , string   }
-  #{setopt CURLOPT_GSSAPI_DELEGATION      , enum     } |7220:----|
-
-  ---- SSH OPTIONS ------------------------------------------------------------
-  #{setopt CURLOPT_SSH_AUTH_TYPES         , enum     }
-  #{setopt CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, string   }
-  #{setopt CURLOPT_SSH_PUBLIC_KEYFILE     , string   }
-  #{setopt CURLOPT_SSH_PRIVATE_KEYFILE    , string   }
-  #{setopt CURLOPT_SSH_KNOWNHOSTS         , string   }
-  -- CURLOPT_SSH_KEYFUNCTION
-  -- CURLOPT_SSH_KEYDATA
-
-  ---- OTHER OPTIONS ----------------------------------------------------------
-  -- CURLOPT_PRIVATE
-  -- CURLOPT_SHARE
-  #{setopt CURLOPT_NEW_FILE_PERMS         , int      }
-  #{setopt CURLOPT_NEW_DIRECTORY_PERMS    , int      }
-
-  ---- TELNET OPTIONS ---------------------------------------------------------
-  -- #{setopt CURLOPT_TELNETOPTIONS          , slist    }
-
-  -----------------------------------------------------------------------------
-  where
-    string copt s = setopt'CString curl copt s
-    int64  copt x = setopt'Int64   curl copt (fromIntegral   x)
-    int    copt x = setopt'CLong   curl copt (fromIntegral   x)
-    bool   copt x = setopt'CLong   curl copt (fromBool       x)
-    time   copt x = setopt'CLong   curl copt (fromUTCTime    x)
-    enum   copt x = setopt'CLong   curl copt (fromCURLenum   x)
-
-
-
--------------------------------------------------------------------------------
-setopt'CString :: CURL -> CCURLoption'CString -> ByteString -> IO ()
-setopt'CString curl copt val = useAsCString val $ \ptr ->
-  withCODE $ ccurl_easy_setopt'CString (ccurlptr curl) copt ptr
-
-setopt'Int64 :: CURL -> CCURLoption'Int64 -> CCURL_off_t -> IO ()
-setopt'Int64 curl copt cval =
-  withCODE $ ccurl_easy_setopt'Int64 (ccurlptr curl) copt cval
-
-setopt'CLong :: CURL -> CCURLoption'CLong -> CLong -> IO ()
-setopt'CLong curl copt cval =
-  withCODE $ ccurl_easy_setopt'CLong (ccurlptr curl) copt cval
-
-
--------------------------------------------------------------------------------
-so'FWRITE :: CURL -> Maybe CURL_write_callback -> IO ()
-so'FWRITE curl mcb = makeCallback mcb (cb_write curl)
-  (ccurl_easy_setopt'FWRITE (ccurlptr curl))
-  (\cb -> wrap_ccurl_write_callback (write_callback cb))
-
-write_callback :: CURL_write_callback -> CCURL_write_callback
-write_callback fwrite ptr size nmemb _ = do
-  stat <- packCStringLen (ptr, fromIntegral (size * nmemb)) >>= fwrite
-  return $ case stat of
-    CURL_WRITEFUNC_OK    -> (size * nmemb)
-    CURL_WRITEFUNC_FAIL  -> 0
-    CURL_WRITEFUNC_PAUSE -> cCURL_WRITEFUNC_PAUSE
-
-
--------------------------------------------------------------------------------
-so'FREAD :: CURL -> Maybe CURL_read_callback -> IO ()
-so'FREAD curl mcb = makeCallback mcb (cb_read curl)
-  (ccurl_easy_setopt'FREAD (ccurlptr curl))
-  (\cb -> wrap_ccurl_read_callback (read_callback cb))
-
-read_callback :: CURL_read_callback -> CCURL_read_callback
-read_callback fread buff size nmemb _ = do
-  let buffLen = fromIntegral (size * nmemb)
-  stat <- fread buffLen
-  case stat of
-    CURL_READFUNC_PAUSE -> return cCURL_READFUNC_PAUSE
-    CURL_READFUNC_ABORT -> return cCURL_READFUNC_ABORT
-    CURL_READFUNC_OK bs -> unsafeUseAsCStringLen (BS.take buffLen bs)
-      (\(cs, cl) -> copyBytes buff cs cl >> return (fromIntegral cl))
-
-
--------------------------------------------------------------------------------
-fromUTCTime :: UTCTime -> CLong
-fromUTCTime = truncate . utcTimeToPOSIXSeconds
-
-
--------------------------------------------------------------------------------
-#{let option opt = #opt " -> c" #opt}
-
-class CURLenum a where
-  fromCURLenum :: a -> CLong
-
-instance CURLenum a => CURLenum [a] where
-  fromCURLenum xs = foldl' (.|.) 0 $ map fromCURLenum xs
-
-instance CURLenum CURLproto where
-  fromCURLenum x = case x of
-    #{option CURLPROTO_ALL   }
-    #{option CURLPROTO_HTTP  }
-    #{option CURLPROTO_HTTPS }
-    #{option CURLPROTO_FTP   }
-    #{option CURLPROTO_FTPS  }
-    #{option CURLPROTO_SCP   }
-    #{option CURLPROTO_SFTP  }
-    #{option CURLPROTO_TELNET}
-    #{option CURLPROTO_LDAP  }
-    #{option CURLPROTO_LDAPS }
-    #{option CURLPROTO_DICT  }
-    #{option CURLPROTO_FILE  }
-    #{option CURLPROTO_TFTP  }
-    #{option CURLPROTO_IMAP  }
-    #{option CURLPROTO_IMAPS }
-    #{option CURLPROTO_POP3  }
-    #{option CURLPROTO_POP3S }
-    #{option CURLPROTO_SMTP  }
-    #{option CURLPROTO_SMTPS }
-    #{option CURLPROTO_RTSP  }
-    #{option CURLPROTO_RTMP  } |7210:----|
-    #{option CURLPROTO_RTMPT } |7210:----|
-    #{option CURLPROTO_RTMPE } |7210:----|
-    #{option CURLPROTO_RTMPTE} |7210:----|
-    #{option CURLPROTO_RTMPS } |7210:----|
-    #{option CURLPROTO_RTMPTS} |7210:----|
-    #{option CURLPROTO_GOPHER} |7212:----|
-
-instance CURLenum CURLproxy where
-  fromCURLenum x = case x of
-    #{option CURLPROXY_HTTP           }
-    #{option CURLPROXY_HTTP_1_0       }
-    #{option CURLPROXY_SOCKS4         }
-    #{option CURLPROXY_SOCKS5         }
-    #{option CURLPROXY_SOCKS4A        }
-    #{option CURLPROXY_SOCKS5_HOSTNAME}
-
-instance CURLenum CURLnetrc where
-  fromCURLenum x = case x of
-    #{option CURL_NETRC_IGNORED }
-    #{option CURL_NETRC_OPTIONAL}
-    #{option CURL_NETRC_REQUIRED}
-
-instance CURLenum CURLauth where
-  fromCURLenum x = case x of
-    #{option CURLAUTH_BASIC       }
-    #{option CURLAUTH_DIGEST      }
-    #{option CURLAUTH_DIGEST_IE   }
-    #{option CURLAUTH_GSSNEGOTIATE}
-    #{option CURLAUTH_NTLM        }
-    #{option CURLAUTH_NTLM_WB     } |7220:----|
-    #{option CURLAUTH_ONLY        } |7213:----|
-    #{option CURLAUTH_ANY         }
-    #{option CURLAUTH_ANYSAFE     }
-
-instance CURLenum CURLtlsauth where                              |7214:----|
-  fromCURLenum x = case x of                                     |7214:----|
-    #{option CURL_TLSAUTH_SRP}                                   |7214:----|
-
-instance CURLenum CURLredir where
-  fromCURLenum x = case x of
-    #{option CURL_REDIR_GET_ALL }
-    #{option CURL_REDIR_POST_301}
-    #{option CURL_REDIR_POST_302}
-    #{option CURL_REDIR_POST_ALL}
-
-instance CURLenum CURLhttpver where
-  fromCURLenum x = case x of
-    #{option CURL_HTTP_VERSION_NONE}
-    #{option CURL_HTTP_VERSION_1_0 }
-    #{option CURL_HTTP_VERSION_1_1 }
-
-instance CURLenum CURLftpcreate where
-  fromCURLenum x = case x of
-    #{option CURLFTP_CREATE_DIR_NONE }
-    #{option CURLFTP_CREATE_DIR      }
-    #{option CURLFTP_CREATE_DIR_RETRY}
-
-instance CURLenum CURLftpauth where
-  fromCURLenum x = case x of
-    #{option CURLFTPAUTH_DEFAULT}
-    #{option CURLFTPAUTH_SSL    }
-    #{option CURLFTPAUTH_TLS    }
-
-instance CURLenum CURLftpssl where
-  fromCURLenum x = case x of
-    #{option CURLFTPSSL_CCC_NONE   }
-    #{option CURLFTPSSL_CCC_PASSIVE}
-    #{option CURLFTPSSL_CCC_ACTIVE }
-
-instance CURLenum CURLftpmethod where
-  fromCURLenum x = case x of
-    #{option CURLFTPMETHOD_DEFAULT  }
-    #{option CURLFTPMETHOD_MULTICWD }
-    #{option CURLFTPMETHOD_NOCWD    }
-    #{option CURLFTPMETHOD_SINGLECWD}
-
-instance CURLenum CURLrtspreq where
-  fromCURLenum x = case x of
-    #{option CURL_RTSPREQ_OPTIONS      }
-    #{option CURL_RTSPREQ_DESCRIBE     }
-    #{option CURL_RTSPREQ_ANNOUNCE     }
-    #{option CURL_RTSPREQ_SETUP        }
-    #{option CURL_RTSPREQ_PLAY         }
-    #{option CURL_RTSPREQ_PAUSE        }
-    #{option CURL_RTSPREQ_TEARDOWN     }
-    #{option CURL_RTSPREQ_GET_PARAMETER}
-    #{option CURL_RTSPREQ_SET_PARAMETER}
-    #{option CURL_RTSPREQ_RECORD       }
-    #{option CURL_RTSPREQ_RECEIVE      }
-
-instance CURLenum CURLtimecond where
-  fromCURLenum x = case x of
-    #{option CURL_TIMECOND_NONE        }
-    #{option CURL_TIMECOND_IFMODSINCE  }
-    #{option CURL_TIMECOND_IFUNMODSINCE}
-    #{option CURL_TIMECOND_LASTMOD     }
-
-instance CURLenum CURLclosepol where
-  fromCURLenum x = case x of
-    #{option CURLCLOSEPOLICY_NONE               }
-    #{option CURLCLOSEPOLICY_OLDEST             }
-    #{option CURLCLOSEPOLICY_LEAST_RECENTLY_USED}
-    #{option CURLCLOSEPOLICY_LEAST_TRAFFIC      }
-    #{option CURLCLOSEPOLICY_SLOWEST            }
-    #{option CURLCLOSEPOLICY_CALLBACK           }
-
-instance CURLenum CURLipresolve where
-  fromCURLenum x = case x of
-    #{option CURL_IPRESOLVE_WHATEVER}
-    #{option CURL_IPRESOLVE_V4      }
-    #{option CURL_IPRESOLVE_V6      }
-
-instance CURLenum CURLusessl where
-  fromCURLenum x = case x of
-    #{option CURLUSESSL_NONE   }
-    #{option CURLUSESSL_TRY    }
-    #{option CURLUSESSL_CONTROL}
-    #{option CURLUSESSL_ALL    }
-
-instance CURLenum CURLsslver where
-  fromCURLenum x = case x of
-    #{option CURL_SSLVERSION_DEFAULT}
-    #{option CURL_SSLVERSION_TLSv1  }
-    #{option CURL_SSLVERSION_SSLv2  }
-    #{option CURL_SSLVERSION_SSLv3  }
-
-instance CURLenum CURLsslopt where                               |7250:----|
-  fromCURLenum x = case x of                                     |7250:----|
-    #{option CURLSSLOPT_ALLOW_BEAST}                             |7250:----|
-
-instance CURLenum CURLgssapi where                               |7220:----|
-  fromCURLenum x = case x of                                     |7220:----|
-    #{option CURLGSSAPI_DELEGATION_NONE       }                  |7220:----|
-    #{option CURLGSSAPI_DELEGATION_POLICY_FLAG}                  |7220:----|
-    #{option CURLGSSAPI_DELEGATION_FLAG       }                  |7220:----|
-
-instance CURLenum CURLsshauth where
-  fromCURLenum x = case x of
-    #{option CURLSSH_AUTH_ANY      }
-    #{option CURLSSH_AUTH_NONE     }
-    #{option CURLSSH_AUTH_PUBLICKEY}
-    #{option CURLSSH_AUTH_PASSWORD }
-    #{option CURLSSH_AUTH_HOST     }
-    #{option CURLSSH_AUTH_KEYBOARD }
-    #{option CURLSSH_AUTH_DEFAULT  }
-
diff --git a/Network/Curlhs/Types.hs b/Network/Curlhs/Types.hs
deleted file mode 100644
--- a/Network/Curlhs/Types.hs
+++ /dev/null
@@ -1,675 +0,0 @@
--------------------------------------------------------------------------------
--- |
--- Module      :  Network.Curlhs.Types
--- Copyright   :  Copyright © 2012 Krzysztof Kardzis
--- License     :  ISC License (MIT/BSD-style, see LICENSE file for details)
--- 
--- Maintainer  :  Krzysztof Kardzis <kkardzis@gmail.com>
--- Stability   :  experimental
--- Portability :  non-portable
---
--------------------------------------------------------------------------------
-
-{-# LANGUAGE DeriveDataTypeable #-}
-
-module Network.Curlhs.Types where
-
-import Foreign.Ptr       (Ptr, FunPtr)
-
-import Data.ByteString   (ByteString)
-import Data.Typeable     (Typeable)
-import Data.IORef        (IORef)
-import Data.Time         (UTCTime)
-import Data.Int          (Int64)
-
-import Control.Exception (Exception)
-
-import Network.Curlhs.Base
-
-
--------------------------------------------------------------------------------
-data CURL = CURL
-  { ccurlptr :: Ptr CCURL
-  , cb_write :: IORef (Maybe (FunPtr CCURL_write_callback))
-  , cb_read  :: IORef (Maybe (FunPtr CCURL_read_callback ))
-  }
-
-
--------------------------------------------------------------------------------
-data CURLcode
-  = CURLE_OK
-  | CURLE_UNSUPPORTED_PROTOCOL
-  | CURLE_FAILED_INIT
-  | CURLE_URL_MALFORMAT
-  | CURLE_NOT_BUILT_IN             |7215:----|
-  | CURLE_COULDNT_RESOLVE_PROXY
-  | CURLE_COULDNT_RESOLVE_HOST
-  | CURLE_COULDNT_CONNECT
-  | CURLE_FTP_WEIRD_SERVER_REPLY
-  | CURLE_REMOTE_ACCESS_DENIED
-  | CURLE_FTP_ACCEPT_FAILED        |7240:----|
-  | CURLE_FTP_WEIRD_PASS_REPLY
-  | CURLE_FTP_ACCEPT_TIMEOUT       |7240:----|
-  | CURLE_FTP_WEIRD_PASV_REPLY
-  | CURLE_FTP_WEIRD_227_FORMAT
-  | CURLE_FTP_CANT_GET_HOST
-  | CURLE_FTP_COULDNT_SET_TYPE
-  | CURLE_PARTIAL_FILE
-  | CURLE_FTP_COULDNT_RETR_FILE
-  | CURLE_QUOTE_ERROR
-  | CURLE_HTTP_RETURNED_ERROR
-  | CURLE_WRITE_ERROR
-  | CURLE_UPLOAD_FAILED
-  | CURLE_READ_ERROR
-  | CURLE_OUT_OF_MEMORY
-  | CURLE_OPERATION_TIMEDOUT
-  | CURLE_FTP_PORT_FAILED
-  | CURLE_FTP_COULDNT_USE_REST
-  | CURLE_RANGE_ERROR
-  | CURLE_HTTP_POST_ERROR
-  | CURLE_SSL_CONNECT_ERROR
-  | CURLE_BAD_DOWNLOAD_RESUME
-  | CURLE_FILE_COULDNT_READ_FILE
-  | CURLE_LDAP_CANNOT_BIND
-  | CURLE_LDAP_SEARCH_FAILED
-  | CURLE_FUNCTION_NOT_FOUND
-  | CURLE_ABORTED_BY_CALLBACK
-  | CURLE_BAD_FUNCTION_ARGUMENT
-  | CURLE_INTERFACE_FAILED
-  | CURLE_TOO_MANY_REDIRECTS
-  | CURLE_UNKNOWN_TELNET_OPTION    |----:7214|
-  | CURLE_UNKNOWN_OPTION           |7215:----|
-  | CURLE_TELNET_OPTION_SYNTAX
-  | CURLE_PEER_FAILED_VERIFICATION
-  | CURLE_GOT_NOTHING
-  | CURLE_SSL_ENGINE_NOTFOUND
-  | CURLE_SSL_ENGINE_SETFAILED
-  | CURLE_SEND_ERROR
-  | CURLE_RECV_ERROR
-  | CURLE_SSL_CERTPROBLEM
-  | CURLE_SSL_CIPHER
-  | CURLE_SSL_CACERT
-  | CURLE_BAD_CONTENT_ENCODING
-  | CURLE_LDAP_INVALID_URL
-  | CURLE_FILESIZE_EXCEEDED
-  | CURLE_USE_SSL_FAILED
-  | CURLE_SEND_FAIL_REWIND
-  | CURLE_SSL_ENGINE_INITFAILED
-  | CURLE_LOGIN_DENIED
-  | CURLE_TFTP_NOTFOUND
-  | CURLE_TFTP_PERM
-  | CURLE_REMOTE_DISK_FULL
-  | CURLE_TFTP_ILLEGAL
-  | CURLE_TFTP_UNKNOWNID
-  | CURLE_REMOTE_FILE_EXISTS
-  | CURLE_TFTP_NOSUCHUSER
-  | CURLE_CONV_FAILED
-  | CURLE_CONV_REQD
-  | CURLE_SSL_CACERT_BADFILE
-  | CURLE_REMOTE_FILE_NOT_FOUND
-  | CURLE_SSH
-  | CURLE_SSL_SHUTDOWN_FAILED
-  | CURLE_AGAIN
-  | CURLE_SSL_CRL_BADFILE
-  | CURLE_SSL_ISSUER_ERROR
-  | CURLE_FTP_PRET_FAILED
-  | CURLE_RTSP_CSEQ_ERROR
-  | CURLE_RTSP_SESSION_ERROR
-  | CURLE_FTP_BAD_FILE_LIST        |7210:----|
-  | CURLE_CHUNK_FAILED             |7210:----|
-  deriving (Eq, Show, Typeable)
-
-instance Exception CURLcode
-
-
--------------------------------------------------------------------------------
-data CURL_version_info_data = CURL_version_info_data
-  { curl_version_info_data_version         :: String
-  , curl_version_info_data_version_num     :: Int
-  , curl_version_info_data_host            :: String
-  , curl_version_info_data_features        :: [CURL_version]
-  , curl_version_info_data_ssl_version     :: Maybe String
-  , curl_version_info_data_ssl_version_num :: Int
-  , curl_version_info_data_libz_version    :: Maybe String
-  , curl_version_info_data_protocols       :: [String]
-  , curl_version_info_data_ares            :: Maybe String
-  , curl_version_info_data_ares_num        :: Int
-  , curl_version_info_data_libidn          :: Maybe String
-  , curl_version_info_data_iconv_ver_num   :: Int
-  , curl_version_info_data_libssh_version  :: Maybe String
-  } deriving (Show)
-
-
--------------------------------------------------------------------------------
-data CURL_version
-  = CURL_VERSION_IPV6
-  | CURL_VERSION_KERBEROS4
-  | CURL_VERSION_SSL
-  | CURL_VERSION_LIBZ
-  | CURL_VERSION_NTLM
-  | CURL_VERSION_GSSNEGOTIATE
-  | CURL_VERSION_DEBUG
-  | CURL_VERSION_ASYNCHDNS
-  | CURL_VERSION_SPNEGO
-  | CURL_VERSION_LARGEFILE
-  | CURL_VERSION_IDN
-  | CURL_VERSION_SSPI
-  | CURL_VERSION_CONV
-  | CURL_VERSION_CURLDEBUG
-  | CURL_VERSION_TLSAUTH_SRP
-  | CURL_VERSION_NTLM_WB
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLinfo = CURLinfo
-  { curlinfo_effective_url           :: String
-  , curlinfo_response_code           :: Maybe Int
-  , curlinfo_http_connectcode        :: Maybe Int
-  , curlinfo_filetime                :: Maybe UTCTime
-  , curlinfo_total_time              :: Double
-  , curlinfo_namelookup_time         :: Double
-  , curlinfo_connect_time            :: Double
-  , curlinfo_appconnect_time         :: Double
-  , curlinfo_pretransfer_time        :: Double
-  , curlinfo_starttransfer_time      :: Double
-  , curlinfo_redirect_time           :: Double
-  , curlinfo_redirect_count          :: Int
-  , curlinfo_redirect_url            :: Maybe String
-  , curlinfo_size_upload             :: Double
-  , curlinfo_size_download           :: Double
-  , curlinfo_speed_download          :: Double
-  , curlinfo_speed_upload            :: Double
-  , curlinfo_header_size             :: Int
-  , curlinfo_request_size            :: Int
-  , curlinfo_ssl_verifyresult        :: Int  -- Bool??
-  , curlinfo_ssl_engines             :: [String]
-  , curlinfo_content_length_download :: Maybe Double
-  , curlinfo_content_length_upload   :: Maybe Double
-  , curlinfo_content_type            :: Maybe String
---  , curlinfo_private                 :: String   -- void??
-  , curlinfo_httpauth_avail          :: [CURLauth]
-  , curlinfo_proxyauth_avail         :: [CURLauth]
-  , curlinfo_os_errno                :: Int
-  , curlinfo_num_connects            :: Int
-  , curlinfo_primary_ip              :: String
-  , curlinfo_primary_port            :: Int
-  , curlinfo_local_ip                :: String
-  , curlinfo_local_port              :: Int
-  , curlinfo_cookielist              :: [String]
-  , curlinfo_lastsocket              :: Maybe Int
-  , curlinfo_ftp_entry_path          :: Maybe String
-  , curlinfo_certinfo                :: [[String]]
-  , curlinfo_condition_unmet         :: Bool
-  , curlinfo_rtsp_session_id         :: Maybe String
-  , curlinfo_rtsp_client_cseq        :: Int
-  , curlinfo_rtsp_server_cseq        :: Int
-  , curlinfo_rtsp_cseq_recv          :: Int
-  } deriving (Show)
-
-
-
--------------------------------------------------------------------------------
-data CURLoption
-  ---- BEHAVIOR OPTIONS -------------------------------------------------------
-  = CURLOPT_VERBOSE                 Bool
-  | CURLOPT_HEADER                  Bool
-  | CURLOPT_NOPROGRESS              Bool
-  | CURLOPT_NOSIGNAL                Bool
-  | CURLOPT_WILDCARDMATCH           Bool |7210:----|
-
-  ---- CALLBACK OPTIONS -------------------------------------------------------
-  | CURLOPT_WRITEFUNCTION           (Maybe CURL_write_callback)
- -- CURLOPT_WRITEDATA
-  | CURLOPT_READFUNCTION            (Maybe CURL_read_callback)
- -- CURLOPT_READDATA
- -- CURLOPT_IOCTLFUNCTION
- -- CURLOPT_IOCTLDATA
- -- CURLOPT_SEEKFUNCTION
- -- CURLOPT_SEEKDATA
- -- CURLOPT_SOCKOPTFUNCTION
- -- CURLOPT_SOCKOPTDATA
- -- CURLOPT_OPENSOCKETFUNCTION
- -- CURLOPT_OPENSOCKETDATA
- -- CURLOPT_CLOSESOCKETFUNCTION |7217:----|
- -- CURLOPT_CLOSESOCKETDATA     |7217:----|
- -- CURLOPT_PROGRESSFUNCTION
- -- CURLOPT_PROGRESSDATA
- -- CURLOPT_HEADERFUNCTION
- -- CURLOPT_HEADERDATA
- -- CURLOPT_DEBUGFUNCTION
- -- CURLOPT_DEBUGDATA
- -- CURLOPT_SSL_CTX_FUNCTION
- -- CURLOPT_SSL_CTX_DATA
- -- CURLOPT_CONV_TO_NETWORK_FUNCTION
- -- CURLOPT_CONV_FROM_NETWORK_FUNCTION
- -- CURLOPT_CONV_FROM_UTF8_FUNCTION
- -- CURLOPT_INTERLEAVEFUNCTION
- -- CURLOPT_INTERLEAVEDATA
- -- CURLOPT_CHUNK_BGN_FUNCTION |7210:----|
- -- CURLOPT_CHUNK_END_FUNCTION |7210:----|
- -- CURLOPT_CHUNK_DATA         |7210:----|
- -- CURLOPT_FNMATCH_FUNCTION   |7210:----|
- -- CURLOPT_FNMATCH_DATA       |7210:----|
-
-  ---- ERROR OPTIONS ----------------------------------------------------------
- -- CURLOPT_ERRORBUFFER             (IORef (Maybe ByteString))
- -- CURLOPT_STDERR                  Handle
-  | CURLOPT_FAILONERROR             Bool
-
-  ---- NETWORK OPTIONS --------------------------------------------------------
-  | CURLOPT_URL                     ByteString
-  | CURLOPT_PROTOCOLS               [CURLproto]
-  | CURLOPT_REDIR_PROTOCOLS         [CURLproto]
-  | CURLOPT_PROXY                   ByteString
-  | CURLOPT_PROXYPORT               Int
-  | CURLOPT_PROXYTYPE               CURLproxy
-  | CURLOPT_NOPROXY                 ByteString
-  | CURLOPT_HTTPPROXYTUNNEL         Bool
-  | CURLOPT_SOCKS5_GSSAPI_SERVICE   ByteString
-  | CURLOPT_SOCKS5_GSSAPI_NEC       Bool
-  | CURLOPT_INTERFACE               ByteString
-  | CURLOPT_LOCALPORT               Int
-  | CURLOPT_LOCALPORTRANGE          Int
-  | CURLOPT_DNS_CACHE_TIMEOUT       Int
-  | CURLOPT_DNS_USE_GLOBAL_CACHE    Bool
-  | CURLOPT_BUFFERSIZE              Int
-  | CURLOPT_PORT                    Int
-  | CURLOPT_TCP_NODELAY             Bool
-  | CURLOPT_ADDRESS_SCOPE           Int
-  | CURLOPT_TCP_KEEPALIVE           Bool          |7250:----|
-  | CURLOPT_TCP_KEEPIDLE            Int           |7250:----|
-  | CURLOPT_TCP_KEEPINTVL           Int           |7250:----|
-
-  ---- NAMES and PASSWORDS OPTIONS (Authentication) ---------------------------
-  | CURLOPT_NETRC                   CURLnetrc
-  | CURLOPT_NETRC_FILE              ByteString
-  | CURLOPT_USERPWD                 ByteString
-  | CURLOPT_PROXYUSERPWD            ByteString
-  | CURLOPT_USERNAME                ByteString
-  | CURLOPT_PASSWORD                ByteString
-  | CURLOPT_PROXYUSERNAME           ByteString
-  | CURLOPT_PROXYPASSWORD           ByteString
-  | CURLOPT_HTTPAUTH                [CURLauth]
- -- CURLOPT_TLSAUTH_TYPE            [CURLtlsauth] |7214:----|
-  | CURLOPT_TLSAUTH_TYPE            ByteString    |7214:----|
-  | CURLOPT_TLSAUTH_USERNAME        ByteString    |7214:----|
-  | CURLOPT_TLSAUTH_PASSWORD        ByteString    |7214:----|
-  | CURLOPT_PROXYAUTH               [CURLauth]
-
-  ---- HTTP OPTIONS -----------------------------------------------------------
-  | CURLOPT_AUTOREFERER             Bool
-  | CURLOPT_ENCODING                ByteString    |----:7215|
-  | CURLOPT_ACCEPT_ENCODING         ByteString    |7216:----|
-  | CURLOPT_TRANSFER_ENCODING       Bool          |7216:----|
-  | CURLOPT_FOLLOWLOCATION          Bool
-  | CURLOPT_UNRESTRICTED_AUTH       Bool
-  | CURLOPT_MAXREDIRS               Int
-  | CURLOPT_POSTREDIR               [CURLredir]
-  | CURLOPT_PUT                     Bool
-  | CURLOPT_POST                    Bool
- -- CURLOPT_POSTFIELDS              ByteString -- not copied
-  | CURLOPT_POSTFIELDSIZE           Int
-  | CURLOPT_POSTFIELDSIZE_LARGE     Int64
-  | CURLOPT_COPYPOSTFIELDS          ByteString
- -- CURLOPT_HTTPPOST                [CURL_httppost]
-  | CURLOPT_REFERER                 ByteString
-  | CURLOPT_USERAGENT               ByteString
- -- CURLOPT_HTTPHEADER              [ByteString]
- -- CURLOPT_HTTP200ALIASES          [ByteString]
-  | CURLOPT_COOKIE                  ByteString
-  | CURLOPT_COOKIEFILE              ByteString
-  | CURLOPT_COOKIEJAR               ByteString
-  | CURLOPT_COOKIESESSION           Bool
-  | CURLOPT_COOKIELIST              ByteString
-  | CURLOPT_HTTPGET                 Bool
-  | CURLOPT_HTTP_VERSION            CURLhttpver
-  | CURLOPT_IGNORE_CONTENT_LENGTH   Bool
-  | CURLOPT_HTTP_CONTENT_DECODING   Bool
-  | CURLOPT_HTTP_TRANSFER_DECODING  Bool
-
-  ---- SMTP OPTIONS -----------------------------------------------------------
-  | CURLOPT_MAIL_FROM               ByteString
- -- CURLOPT_MAIL_RCTP               [ByteString]
-  | CURLOPT_MAIL_AUTH               ByteString    |7250:----|
-
-  ---- TFTP OPTIONS -----------------------------------------------------------
-  | CURLOPT_TFTP_BLKSIZE            Int
-
-  ---- FTP OPTIONS ------------------------------------------------------------
-  | CURLOPT_FTPPORT                 ByteString
- -- CURLOPT_QUOTE                   [ByteString]
- -- CURLOPT_POSTQUOTE               [ByteString]
- -- CURLOPT_PREQUOTE                [ByteString]
-  | CURLOPT_DIRLISTONLY             Bool
-  | CURLOPT_APPEND                  Bool
-  | CURLOPT_FTP_USE_EPRT            Bool
-  | CURLOPT_FTP_USE_EPSV            Bool
-  | CURLOPT_FTP_USE_PRET            Bool
-  | CURLOPT_FTP_CREATE_MISSING_DIRS CURLftpcreate
-  | CURLOPT_FTP_RESPONSE_TIMEOUT    Int
-  | CURLOPT_FTP_ALTERNATIVE_TO_USER ByteString
-  | CURLOPT_FTP_SKIP_PASV_IP        Bool
-  | CURLOPT_FTPSSLAUTH              CURLftpauth
-  | CURLOPT_FTP_SSL_CCC             CURLftpssl
-  | CURLOPT_FTP_ACCOUNT             ByteString
-  | CURLOPT_FTP_FILEMETHOD          CURLftpmethod
-
-  ---- RTSP OPTIONS -----------------------------------------------------------
-  | CURLOPT_RTSP_REQUEST            CURLrtspreq
-  | CURLOPT_RTSP_SESSION_ID         ByteString
-  | CURLOPT_RTSP_STREAM_URI         ByteString
-  | CURLOPT_RTSP_TRANSPORT          ByteString
- -- CURLOPT_RTSP_HEADER             [ByteString]
-  | CURLOPT_RTSP_CLIENT_CSEQ        Int
-  | CURLOPT_RTSP_SERVER_CSEQ        Int
-
-  ---- PROTOCOL OPTIONS -------------------------------------------------------
-  | CURLOPT_TRANSFERTEXT            Bool
-  | CURLOPT_PROXY_TRANSFER_MODE     Bool
-  | CURLOPT_CRLF                    Bool
-  | CURLOPT_RANGE                   ByteString
-  | CURLOPT_RESUME_FROM             Int
-  | CURLOPT_RESUME_FROM_LARGE       Int64
-  | CURLOPT_CUSTOMREQUEST           ByteString
-  | CURLOPT_FILETIME                Bool
-  | CURLOPT_NOBODY                  Bool
-  | CURLOPT_INFILESIZE              Int
-  | CURLOPT_INFILESIZE_LARGE        Int64
-  | CURLOPT_UPLOAD                  Bool
-  | CURLOPT_MAXFILESIZE             Int
-  | CURLOPT_MAXFILESIZE_LARGE       Int64
-  | CURLOPT_TIMECONDITION           CURLtimecond
-  | CURLOPT_TIMEVALUE               UTCTime
-
-  ---- CONNECTION OPTIONS -----------------------------------------------------
-  | CURLOPT_TIMEOUT                 Int
-  | CURLOPT_TIMEOUT_MS              Int
-  | CURLOPT_LOW_SPEED_LIMIT         Int
-  | CURLOPT_LOW_SPEED_TIME          Int
-  | CURLOPT_MAX_SEND_SPEED_LARGE    Int64
-  | CURLOPT_MAX_RECV_SPEED_LARGE    Int64
-  | CURLOPT_MAXCONNECTS             Int
-  | CURLOPT_CLOSEPOLICY             CURLclosepol
-  | CURLOPT_FRESH_CONNECT           Bool
-  | CURLOPT_FORBID_REUSE            Bool
-  | CURLOPT_CONNECTTIMEOUT          Int
-  | CURLOPT_CONNECTTIMEOUT_MS       Int
-  | CURLOPT_IPRESOLVE               CURLipresolve
-  | CURLOPT_CONNECT_ONLY            Bool
-  | CURLOPT_USE_SSL                 CURLusessl
- -- CURLOPT_RESOLVE                 [ByteString]  |7213:----|
-  | CURLOPT_DNS_SERVERS             ByteString    |7240:----|
-  | CURLOPT_ACCEPTTIMEOUT_MS        Int           |7240:----|
-
-  ---- SSL and SECURITY OPTIONS -----------------------------------------------
-  | CURLOPT_SSLCERT                 ByteString
-  | CURLOPT_SSLCERTTYPE             ByteString
-  | CURLOPT_SSLKEY                  ByteString
-  | CURLOPT_SSLKEYTYPE              ByteString
-  | CURLOPT_KEYPASSWD               ByteString
-  | CURLOPT_SSLENGINE               ByteString
-  | CURLOPT_SSLENGINE_DEFAULT       Bool
-  | CURLOPT_SSLVERSION              CURLsslver
-  | CURLOPT_SSL_VERIFYPEER          Bool
-  | CURLOPT_CAINFO                  ByteString
-  | CURLOPT_ISSUERCERT              ByteString
-  | CURLOPT_CAPATH                  ByteString
-  | CURLOPT_CRLFILE                 ByteString
-  | CURLOPT_SSL_VERIFYHOST          Int
-  | CURLOPT_CERTINFO                Bool
-  | CURLOPT_RANDOM_FILE             ByteString
-  | CURLOPT_EGDSOCKET               ByteString
-  | CURLOPT_SSL_CIPHER_LIST         ByteString
-  | CURLOPT_SSL_SESSIONID_CACHE     Bool
-  | CURLOPT_SSL_OPTIONS             CURLsslopt    |7250:----|
-  | CURLOPT_KRBLEVEL                ByteString
-  | CURLOPT_GSSAPI_DELEGATION       CURLgssapi    |7220:----|
-
-  ---- SSH OPTIONS ------------------------------------------------------------
-  | CURLOPT_SSH_AUTH_TYPES          [CURLsshauth]
-  | CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 ByteString
-  | CURLOPT_SSH_PUBLIC_KEYFILE      ByteString
-  | CURLOPT_SSH_PRIVATE_KEYFILE     ByteString
-  | CURLOPT_SSH_KNOWNHOSTS          ByteString
- -- CURLOPT_SSH_KEYFUNCTION         (Maybe CURL_sshkey_callback)
- -- CURLOPT_SSH_KEYDATA             -- ?
-
-  ---- OTHER OPTIONS ----------------------------------------------------------
- -- CURLOPT_PRIVATE                 -- ?
- -- CURLOPT_SHARE                   CURLSH
-  | CURLOPT_NEW_FILE_PERMS          Int
-  | CURLOPT_NEW_DIRECTORY_PERMS     Int
-
-  ---- TELNET OPTIONS ---------------------------------------------------------
- -- CURLOPT_TELNETOPTIONS           [ByteString]
-
-
--------------------------------------------------------------------------------
-data CURLproto
-  = CURLPROTO_ALL
-  | CURLPROTO_HTTP
-  | CURLPROTO_HTTPS
-  | CURLPROTO_FTP
-  | CURLPROTO_FTPS
-  | CURLPROTO_SCP
-  | CURLPROTO_SFTP
-  | CURLPROTO_TELNET
-  | CURLPROTO_LDAP
-  | CURLPROTO_LDAPS
-  | CURLPROTO_DICT
-  | CURLPROTO_FILE
-  | CURLPROTO_TFTP
-  | CURLPROTO_IMAP
-  | CURLPROTO_IMAPS
-  | CURLPROTO_POP3
-  | CURLPROTO_POP3S
-  | CURLPROTO_SMTP
-  | CURLPROTO_SMTPS
-  | CURLPROTO_RTSP
-  | CURLPROTO_RTMP   |7210:----|
-  | CURLPROTO_RTMPT  |7210:----|
-  | CURLPROTO_RTMPE  |7210:----|
-  | CURLPROTO_RTMPTE |7210:----|
-  | CURLPROTO_RTMPS  |7210:----|
-  | CURLPROTO_RTMPTS |7210:----|
-  | CURLPROTO_GOPHER |7212:----|
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLproxy
-  = CURLPROXY_HTTP
-  | CURLPROXY_HTTP_1_0
-  | CURLPROXY_SOCKS4
-  | CURLPROXY_SOCKS5
-  | CURLPROXY_SOCKS4A
-  | CURLPROXY_SOCKS5_HOSTNAME
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLnetrc
-  = CURL_NETRC_IGNORED
-  | CURL_NETRC_OPTIONAL
-  | CURL_NETRC_REQUIRED
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLauth
-  = CURLAUTH_BASIC
-  | CURLAUTH_DIGEST
-  | CURLAUTH_DIGEST_IE
-  | CURLAUTH_GSSNEGOTIATE
-  | CURLAUTH_NTLM
-  | CURLAUTH_NTLM_WB      |7220:----|
-  | CURLAUTH_ONLY         |7213:----|
-  | CURLAUTH_ANY
-  | CURLAUTH_ANYSAFE
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLtlsauth                                                 |7214:----|
-  = CURL_TLSAUTH_SRP                                             |7214:----|
-  deriving (Eq, Show)                                            |7214:----|
-
-
--------------------------------------------------------------------------------
-data CURLredir
-  = CURL_REDIR_GET_ALL
-  | CURL_REDIR_POST_301
-  | CURL_REDIR_POST_302
-  | CURL_REDIR_POST_ALL
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLhttpver
-  = CURL_HTTP_VERSION_NONE
-  | CURL_HTTP_VERSION_1_0
-  | CURL_HTTP_VERSION_1_1
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLftpcreate
-  = CURLFTP_CREATE_DIR_NONE
-  | CURLFTP_CREATE_DIR
-  | CURLFTP_CREATE_DIR_RETRY
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLftpauth
-  = CURLFTPAUTH_DEFAULT
-  | CURLFTPAUTH_SSL
-  | CURLFTPAUTH_TLS
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLftpssl
-  = CURLFTPSSL_CCC_NONE
-  | CURLFTPSSL_CCC_PASSIVE
-  | CURLFTPSSL_CCC_ACTIVE
-  deriving (Eq, Show)
- 
-
--------------------------------------------------------------------------------
-data CURLftpmethod
-  = CURLFTPMETHOD_DEFAULT
-  | CURLFTPMETHOD_MULTICWD
-  | CURLFTPMETHOD_NOCWD
-  | CURLFTPMETHOD_SINGLECWD
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLrtspreq
-  = CURL_RTSPREQ_OPTIONS
-  | CURL_RTSPREQ_DESCRIBE
-  | CURL_RTSPREQ_ANNOUNCE
-  | CURL_RTSPREQ_SETUP
-  | CURL_RTSPREQ_PLAY
-  | CURL_RTSPREQ_PAUSE
-  | CURL_RTSPREQ_TEARDOWN
-  | CURL_RTSPREQ_GET_PARAMETER
-  | CURL_RTSPREQ_SET_PARAMETER
-  | CURL_RTSPREQ_RECORD
-  | CURL_RTSPREQ_RECEIVE
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLtimecond
-  = CURL_TIMECOND_NONE
-  | CURL_TIMECOND_IFMODSINCE
-  | CURL_TIMECOND_IFUNMODSINCE
-  | CURL_TIMECOND_LASTMOD
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLclosepol
-  = CURLCLOSEPOLICY_NONE
-  | CURLCLOSEPOLICY_OLDEST
-  | CURLCLOSEPOLICY_LEAST_RECENTLY_USED
-  | CURLCLOSEPOLICY_LEAST_TRAFFIC
-  | CURLCLOSEPOLICY_SLOWEST
-  | CURLCLOSEPOLICY_CALLBACK
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLipresolve
-  = CURL_IPRESOLVE_WHATEVER
-  | CURL_IPRESOLVE_V4
-  | CURL_IPRESOLVE_V6
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLusessl
-  = CURLUSESSL_NONE
-  | CURLUSESSL_TRY
-  | CURLUSESSL_CONTROL
-  | CURLUSESSL_ALL
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLsslver
-  = CURL_SSLVERSION_DEFAULT
-  | CURL_SSLVERSION_TLSv1
-  | CURL_SSLVERSION_SSLv2
-  | CURL_SSLVERSION_SSLv3
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-data CURLsslopt                                                  |7250:----|
-  = CURLSSLOPT_ALLOW_BEAST                                       |7250:----|
-  deriving (Eq, Show)                                            |7250:----|
-
-
--------------------------------------------------------------------------------
-data CURLgssapi                                                  |7220:----|
-  = CURLGSSAPI_DELEGATION_NONE                                   |7220:----|
-  | CURLGSSAPI_DELEGATION_POLICY_FLAG                            |7220:----|
-  | CURLGSSAPI_DELEGATION_FLAG                                   |7220:----|
-  deriving (Eq, Show)                                            |7220:----|
-
-
--------------------------------------------------------------------------------
-data CURLsshauth
-  = CURLSSH_AUTH_ANY
-  | CURLSSH_AUTH_NONE
-  | CURLSSH_AUTH_PUBLICKEY
-  | CURLSSH_AUTH_PASSWORD
-  | CURLSSH_AUTH_HOST
-  | CURLSSH_AUTH_KEYBOARD
-  | CURLSSH_AUTH_DEFAULT
-  deriving (Eq, Show)
-
-
--------------------------------------------------------------------------------
-type CURL_write_callback = ByteString -> IO CURL_write_response
-
-data CURL_write_response
-  = CURL_WRITEFUNC_OK
-  | CURL_WRITEFUNC_FAIL
-  | CURL_WRITEFUNC_PAUSE
-  deriving (Eq)
-
-
-type CURL_read_callback = Int -> IO CURL_read_response
-
-data CURL_read_response
-  = CURL_READFUNC_OK ByteString
-  | CURL_READFUNC_ABORT
-  | CURL_READFUNC_PAUSE
-  deriving (Eq)
-
-
diff --git a/README b/README
deleted file mode 100644
--- a/README
+++ /dev/null
@@ -1,6 +0,0 @@
-This package provides a Haskell bindings to libcurl, the multiprotocol file
-transfer library which powers the popular tool curl (see http://curl.haxx.se
-and http://curl.haxx.se/libcurl/ for more info).
-
-The project is in early stage so please be patient.
-
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+# Network.CURL [![Build Status][travis.img]][travis.htm]
+
+Package *curlhs* provides Haskell bindings to *libcurl*, the multiprotocol
+file transfer library which powers the popular tool *curl*
+(see http://curl.haxx.se/libcurl for more info).
+
+
+[![Analytics][ga.img]][ga.htm]
+
+[ga.img]: https://ga-beacon.appspot.com/UA-53767359-1/github/curlhs
+[ga.htm]: https://github.com/igrigorik/ga-beacon
+
+[travis.img]: https://travis-ci.org/kkardzis/curlhs.svg
+[travis.htm]: https://travis-ci.org/kkardzis/curlhs
+
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,109 +1,2 @@
-module Main where
-
 import Distribution.Simple
-import Distribution.Simple.Utils
-import Distribution.Simple.PreProcess
-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo, buildDir)
-import Distribution.PackageDescription    (BuildInfo)
-import Distribution.Verbosity             (Verbosity)
-import System.FilePath                    ((</>), replaceExtension)
-import Text.ParserCombinators.ReadP
-import Text.Read.Lex (readDecP)
-import Data.IORef    (IORef, newIORef, readIORef, writeIORef)
-import Data.List     (find, isPrefixOf)
-
-
--------------------------------------------------------------------------------
-main = newIORef Nothing >>= \cvr -> defaultMainWithHooks simpleUserHooks
-  { hookedPreProcessors = ("hs", ppHsX cvr) : ("hsc", ppHscX cvr)
-                        : knownSuffixHandlers }
-
-
--------------------------------------------------------------------------------
-ppHsX :: IORef (Maybe Int) -> BuildInfo -> LocalBuildInfo -> PreProcessor
-ppHsX cvr bi lbi = PreProcessor
-  { platformIndependent = False
-  , runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity -> do
-      cv <- findCURLVER cvr bi lbi verbosity
-      withUTF8FileContents inFile (writeUTF8File outFile . processFile cv)
-  }
-
--------------------------------------------------------------------------------
-ppHscX :: IORef (Maybe Int) -> BuildInfo -> LocalBuildInfo -> PreProcessor
-ppHscX cvr bi lbi = PreProcessor
-  { platformIndependent = False
-  , runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity -> do
-      cv <- findCURLVER cvr bi lbi verbosity
-      let hscFile = replaceExtension outFile "hsc"
-      withUTF8FileContents inFile (writeUTF8File hscFile . processFile cv)
-      runSimplePreProcessor (ppHsc2hs bi lbi) hscFile outFile verbosity
-  }
-
--------------------------------------------------------------------------------
-findCURLVER :: IORef (Maybe Int)
-            -> BuildInfo -> LocalBuildInfo -> Verbosity -> IO Int
-findCURLVER cvr bi lbi verbosity = readIORef cvr >>= \mcv -> case mcv of
-  Just cv -> return cv
-  Nothing -> do
-    info verbosity "Looking for LIBCURL_VERSION_NUM in \"curl/curl.h\""
-    let cvFile = buildDir lbi </> "CURLVER"
-    writeUTF8File cvFile curlverFileContent
-    runSimplePreProcessor (ppHsc2hs bi lbi) cvFile cvFile verbosity
-    mcv <- fmap parseCV $ readUTF8File cvFile
-    case mcv of
-      Nothing -> die "Can't find libcurl version info"
-      Just cv -> writeIORef cvr mcv >> return cv
-
-curlverFileContent :: String
-curlverFileContent = unlines
-  [ "#include \"curl/curl.h\""
-  , "CURLVER = #{const LIBCURL_VERSION_NUM}" ]
-
-parseCV :: String -> Maybe Int
-parseCV cvf = do
-  cvl <- find (isPrefixOf "CURLVER") $ lines cvf
-  case (readP_to_S readDecP $ last $ words cvl) of
-    [(cv,[])] -> Just cv
-    _         -> Nothing
-
--------------------------------------------------------------------------------
-processFile :: Int -> String -> String
-processFile cv file = unlines $ map (processLine cv) $ lines file
-
-processLine :: Int -> String -> String
-processLine cv line =
-  case (readP_to_S parseLine $ reverse line) of
-    [((vmin, vmax, text),[])]
-      -> if (vmin <= cv && cv <= vmax) then text else concat ["-- ", line]
-    _ -> line
-
-parseLine :: ReadP (Int, Int, String)
-parseLine =
-  char '|' >> parseVTAG >>= \vmax ->
-  char ':' >> parseVTAG >>= \vmin ->
-  char '|' >> parseTEXT >>= \text ->
-  return (maybe 0x000000 id vmin, maybe 0xFFFFFF id vmax, text)
-
-parseTEXT :: ReadP String
-parseTEXT = skipSpaces >> manyTill get eof >>= return . reverse
-
-parseVTAG :: ReadP (Maybe Int)
-parseVTAG = count 4 get >>= \vtag -> if (vtag == "----") then return Nothing
-  else maybe pfail (return . Just) $ lookup (reverse vtag)
-    [ ("7200", 0x071400)
-    , ("7201", 0x071401)
-    , ("7210", 0x071500)
-    , ("7211", 0x071501)
-    , ("7212", 0x071502)
-    , ("7213", 0x071503)
-    , ("7214", 0x071504)
-    , ("7215", 0x071505)
-    , ("7216", 0x071506)
-    , ("7217", 0x071507)
-    , ("7220", 0x071600)
-    , ("7230", 0x071700)
-    , ("7231", 0x071701)
-    , ("7240", 0x071800)
-    , ("7250", 0x071900)
-    ]
-
+main = defaultMain
diff --git a/curlhs.cabal b/curlhs.cabal
--- a/curlhs.cabal
+++ b/curlhs.cabal
@@ -1,18 +1,17 @@
 name:           curlhs
-version:        0.0.2
+version:        0.1.1
 synopsis:       bindings to libcurl, the multiprotocol file transfer library
 author:         Krzysztof Kardzis <kkardzis@gmail.com>
 maintainer:     Krzysztof Kardzis <kkardzis@gmail.com>
-copyright:      Copyright © 2012 Krzysztof Kardzis
+copyright:      Copyright © 2012-2014 Krzysztof Kardzis
 -- license:     ISC License (MIT/BSD-style, see LICENSE file for details)
 license:        OtherLicense
 license-file:   LICENSE
-category:       Network, Web, FFI
+category:       Network
 stability:      Experimental
-build-type:     Custom
+build-type:     Simple
 cabal-version:  >=1.6
-tested-with:    GHC ==7.0.3
-homepage:       https://github.com/kkardzis/curlhs
+homepage:       https://kkardzis.github.com/curlhs
 
 description:
   Package @curlhs@ provides a mid-level interface to @libcurl@, the
@@ -37,52 +36,48 @@
   /supported, fast, thoroughly documented and is already used by many        /
   /known, big and successful companies and numerous applications.            /
   .
-  Package @curlhs@ depends on @libcurl@ as an external library. To compile
-  and later use @curlhs@, it is required to first install @libcurl@ somewhere
-  on the system, best in place that is easy to locate by the compiler.
-  Information about how to compile and install @libcurl@ may be found on
-  its project site. A simple way may be to use one of the available
-  precompiled packages.
-  .
-  Current version of @curlhs@ follows @libcurl@ in version 7.25.0. It is
-  also possible to use @curlhs@ with older versions of @libcurl@, but some
-  features may not be available then (@curlhs@ should easily compile
-  with @libcurl@ from version 7.20.0 upward).
-  .
   Package is distributed under ISC License (MIT/BSD-style, see LICENSE file
   for details). It is marked as @OtherLicense@ due to limitations of Cabal.
+  .
+  <<https://ga-beacon.appspot.com/UA-53767359-1/hackage/curlhs>>
 
 extra-source-files:
-  README
+  Network/CURL000/curl-7.30.0/COPYING
+  Network/CURL000/curl-7.30.0/curl.h
+  Network/CURL000/curl-7.30.0/curlbuild.h
+  Network/CURL000/curl-7.30.0/curlrules.h
+  Network/CURL000/curl-7.30.0/curlver.h
+  Network/CURL000/curl-7.30.0/easy.h
+  Network/CURL000/curl-7.30.0/multi.h
+  Network/CURL000/curl-7.30.0/stdcheaders.h
+  Network/CURL000/curl-7.30.0/typecheck-gcc.h
+  README.md
 
 library
-  extra-libraries: curl
-  build-tools:     hsc2hs
-  ghc-options:     -Wall -fwarn-tabs
+  ghc-options: -Wall -fwarn-tabs
+  build-tools: hsc2hs
 
   build-depends:
-    bytestring == 0.9.*,
-    base       == 4.*,
-    time       == 1.*
+    base ==4.*, rtld, bytestring, time
 
   exposed-modules:
-    Network.Curlhs.Base
-    Network.Curlhs.Core
+    Network.CURL720
+    Network.CURL730
+    Network.CURLXXX
 
   other-modules:
-    Network.Curlhs.Easy
-    -- Network.Curlhs.Multi
-    -- Network.Curlhs.Share
-    Network.Curlhs.Setopt
-    Network.Curlhs.Errors
-    Network.Curlhs.Types
+    Network.CURL000.LibCC
+    Network.CURL000.LibHS
+    Network.CURL000.LibLD
+    Network.CURL000.Types
 
-  -- maybe not elegant, but convenient during tests
-  -- if os(windows)
-  --   include-dirs:   .\curl-7.25.0-devel-mingw32\include
-  --   extra-lib-dirs: .\curl-7.25.0-devel-mingw32\bin
+  c-sources:
+    Network/CURL000/LibC0.c
 
+  include-dirs:
+    Network/CURL000
+
 source-repository head
-  type:     git
   location: https://github.com/kkardzis/curlhs
+  type:     git
 
