-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | The LDAP Data Interchange Format (LDIF) parser
--
-- LDIF files parser implementation using Parsec and based on RFC 2849 -
-- The LDAP Data Interchange Format (LDIF).
--
-- Current implementation is unfinished and need to be enhanced for
-- base64 encoded values and various DN escaping.
--
-- It includes following tool:
--
--
-- - diffLDIF command generates change LDIF between two content LDIF
-- files.
--
@package ldif
@version 0.0.2
-- | LDIF related types
module Text.LDIF.Types
-- | Represents LDIF structure, it can be either simply LDIF data dump or |
-- changes LDIF with LDAP operations
data LDIF
LDIFContent :: Maybe String -> [ContentRecord] -> LDIF
lcVersion :: LDIF -> Maybe String
lcEntries :: LDIF -> [ContentRecord]
LDIFChanges :: Maybe String -> [ChangeRecord] -> LDIF
lcVersion :: LDIF -> Maybe String
lcChanges :: LDIF -> [ChangeRecord]
-- | Represents one data record within LDIF file with DN and content
data ContentRecord
ContentRecord :: DN -> [AttrValue] -> ContentRecord
coDN :: ContentRecord -> DN
coAttrVals :: ContentRecord -> [AttrValue]
-- | Represents one change record within LDIF file with DN and content
data ChangeRecord
ChangeRecord :: DN -> Change -> ChangeRecord
chDN :: ChangeRecord -> DN
chOp :: ChangeRecord -> Change
-- | Represents one LDAP operation within changes LDIF
data Change
ChangeAdd :: [AttrValue] -> Change
chAttrVals :: Change -> [AttrValue]
ChangeDelete :: Change
ChangeModify :: [Modify] -> Change
chMods :: Change -> [Modify]
ChangeModDN :: Change
-- | Represents ChangeModify operations upon one entry within given DN
data Modify
ModAdd :: Attribute -> [Value] -> Modify
modAttr :: Modify -> Attribute
modAttrVals :: Modify -> [Value]
ModDelete :: Attribute -> [Value] -> Modify
modAttr :: Modify -> Attribute
modAttrVals :: Modify -> [Value]
ModReplace :: Attribute -> [Value] -> Modify
modAttr :: Modify -> Attribute
modAttrVals :: Modify -> [Value]
-- | Represents Distinguished Name (DN)
data DN
DN :: [AttrValue] -> DN
dnAttrVals :: DN -> [AttrValue]
type Attribute = String
type Value = String
type AttrValue = (Attribute, Value)
instance Show DN
instance Eq DN
instance Show Modify
instance Eq Modify
instance Show Change
instance Eq Change
instance Show ChangeRecord
instance Eq ChangeRecord
instance Show ContentRecord
instance Eq ContentRecord
instance Show LDIF
instance Eq LDIF
module Text.LDIF.Parser
-- | Parse string as LDIF content and return LDIF or ParseError
parseLDIFStr :: String -> Either ParseError LDIF
-- | Read and parse provided file and return LDIF or ParseError
parseLDIFFile :: String -> IO (Either ParseError LDIF)
-- | Parse string as DN and return DN type or ParseError
parseDNStr :: String -> Either ParseError DN
-- | LDIF serializers
module Text.LDIF.Printer
-- | Serialize LDIF in LDIF Format
ldif2Str :: LDIF -> String
-- | Serialize DN to LDIF Format
dn2Str :: DN -> String
-- | Serialize Change Record in LDIF Format
change2Str :: ChangeRecord -> String
-- | Serialize Content Record in LDIF Format
content2Str :: ContentRecord -> String
-- | LDIF related operations
module Text.LDIF.Proc
-- | Find all Changes with given DN
findChangesByDN :: LDIF -> DN -> [ChangeRecord]
-- | Find all Contents with given DN
findContentsByDN :: LDIF -> DN -> [ContentRecord]
-- | Find first Content with given DN
findContentByDN :: LDIF -> DN -> Maybe ContentRecord
-- | Create Change LDIF between to LDIF contents. If any | of input
-- argument is not LDIFContent it returns Nothing. | If there is not
-- difference the Change LDIF with empty | change list is returned. | |
-- Unsing following strategy: | 1. Iterate over L1 DN's and Modify /
-- Remove Content | 2. Iterate over L2 and Add Content not in L1
diffLDIF :: LDIF -> LDIF -> Maybe LDIF
-- | Diff two AttrVal Records if any of provided. | Implementation uses
-- inefficient algorithm for large count of attributes within
-- ContentRecord.
diffRecord :: ContentRecord -> ContentRecord -> Maybe ChangeRecord
module Text.LDIF