              EmptyDataDecls
  #-}
 module Network.LibRSync.Internal where
+
+import Control.Applicative((<$>),(<*>))
+import Control.Monad
 
 import Data.ByteString
 import Data.Conduit

                                           }

instance Storable CRSyncSourceState where
    sizeOf _  = {#sizeof rsyncSourceState_t #}
    alignment = undefined
    peek      = undefined
    poke      = undefined


--------------------------------------------------------------------------------
-- | The CTypes

data CInMemoryBuffer = CInMemoryBuffer (Ptr CChar) CSize CSize

{#pointer *inMemoryBuffer_t as CInMemoryBufferPtr -> CInMemoryBuffer #}

instance Storable CInMemoryBuffer where
    sizeOf    = const {#sizeof inMemoryBuffer_t #}
    alignment = const 4
    peek p    = CInMemoryBuffer
                <$> {#get inMemoryBuffer_t->buffer #} p
                <*> liftM fromIntegral ({#get inMemoryBuffer_t->size #}   p)
                <*> liftM fromIntegral ({#get inMemoryBuffer_t->inUse #}  p)
   poke       = undefined



getData                          :: CInMemoryBuffer -> IO ByteString
getData (CInMemoryBuffer xs _ s) = packCStringLen (xs,fromIntegral s)





