module Codec.Archive.Types (
Entry (..)
, EntryContent (..)
, Ownership (..)
, ModTime
, Id
, Permissions
, ArchiveEncryption (..)
, ArchiveResult (..)
, module Codec.Archive.Types.Foreign
, ArchiveOpenCallback
, ArchiveCloseCallback
, ArchiveSwitchCallback
, resultToErr
) where
import Codec.Archive.Types.Foreign
import qualified Data.ByteString as BS
import Data.Int (Int64)
import Foreign.C.Types (CInt, CLong, CTime)
import Foreign.Ptr (Ptr)
import System.Posix.Types (CMode (..))
type ArchiveOpenCallback a = Ptr Archive -> Ptr a -> IO ArchiveResult
type ArchiveCloseCallback a = Ptr Archive -> Ptr a -> IO ArchiveResult
type ArchiveSwitchCallback a b = Ptr Archive -> Ptr a -> Ptr b -> IO ArchiveResult
resultToErr :: ArchiveResult -> CInt
resultToErr = fromIntegral . fromEnum
data ArchiveEncryption = HasEncryption
| NoEncryption
| EncryptionUnsupported
| EncryptionUnknown
data EntryContent = NormalFile !BS.ByteString
| Directory
| Symlink !FilePath
| Hardlink !FilePath
deriving (Eq)
data Entry = Entry { filepath :: !FilePath
, content :: !EntryContent
, permissions :: !Permissions
, ownership :: !Ownership
, time :: !(Maybe ModTime)
}
deriving (Eq)
data Ownership = Ownership { userName :: !(Maybe String)
, groupName :: !(Maybe String)
, ownerId :: !Id
, groupId :: !Id
}
deriving (Eq, Show)
type Permissions = CMode
type ModTime = (CTime, CLong)
type Id = Int64