-- Copyright (c) 2019  Herbert Valerio Riedel <hvr@gnu.org>
--
--  This file is free software: you may copy, redistribute and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation, either version 2 of the License, or (at your
--  option) any later version.
--
--  This file is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--  General Public License for more details.
--
--  You should have received a copy of the GNU General Public License
--  along with this program (see `LICENSE`).  If not, see
--  <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>.

{-# LANGUAGE CPP                        #-}
{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures             #-}
{-# LANGUAGE LambdaCase                 #-}
{-# LANGUAGE RecordWildCards            #-}
{-# LANGUAGE StandaloneDeriving         #-}
{-# LANGUAGE Trustworthy                #-}
{-# LANGUAGE TypeOperators              #-}

#if !defined(HS_LDAPv3_ANNOTATED)
{-# OPTIONS_GHC -fno-warn-dodgy-exports #-}
#endif

-- This module is compiled twice; once with ASN.1 type-annotating
-- `newtype` wrappers; and a 2nd time with those newtypes made
-- "transparent" by redefining them as `type` synonyms. The public API
-- exposes the latter version; ASN.1 encoding/decoding goes via the
-- former version.

#if defined(HS_LDAPv3_ANNOTATED)
# define MODULE_NAME LDAPv3.Message.Annotated
#else
# define MODULE_NAME LDAPv3.Message
#endif

-- | This module provides a pure Haskell implementation of the /Lightweight Directory Access Protocol (LDAP)/ version 3 as specified in <https://tools.ietf.org/html/rfc4511 RFC4511>.
--
-- Serializing and deserializing to and from the wire <https://en.wikipedia.org/wiki/ASN.1 ASN.1> encoding is provided via the 'Bin.Binary' instance of 'LDAPMessage'. For the purpose of implementing network clients and servers, the operations
--
-- * 'Bin.encode'
-- * 'Data.Binary.Get.runGetIncremental'
--
-- are most useful.

module MODULE_NAME
    ( -- * LDAPv3 Protocol data structures
      --
      -- | The Haskell data structures defined in this module closely follow the protocol specification as laid out in <https://tools.ietf.org/html/rfc4511 RFC4511>.
      --
      -- For convenience, the normative <https://en.wikipedia.org/wiki/ASN.1 ASN.1> definitions for each Haskell data type are quoted.

      -- ** Common Elements (<https://tools.ietf.org/html/rfc4511#section-4.1 RFC4511 Section 4.1>)

      -- 4.1.1.  Message Envelope
      LDAPMessage(..)
    , MessageID(..)
    , MaxInt
    , ProtocolOp(..)

      -- 4.1.2.  String Types
    , LDAPString
    , LDAPOID
      -- 4.1.3.  Distinguished Name and Relative Distinguished Name
    , LDAPDN
    , RelativeLDAPDN
      -- 4.1.4.  Attribute Descriptions
    , AttributeDescription
      -- 4.1.5.  Attribute Value
    , AttributeValue
      -- 4.1.6.  Attribute Value Assertion
    , AttributeValueAssertion(..)
    , AssertionValue
      -- 4.1.7.  Attribute and PartialAttribute
    , PartialAttribute(..)
    , Attribute(..)
      -- 4.1.8.  Matching Rule Identifier
    , MatchingRuleId
      -- 4.1.9.  Result Message
    , LDAPResult(..)
    , ResultCode(..)
      -- 4.1.10.  Referral
    , Referral
    , URI
      -- 4.1.11.  Controls
    , Controls
    , Control(..)

      -- ** Bind Operation  (<https://tools.ietf.org/html/rfc4511#section-4.2 RFC4511 Section 4.2>)

    , BindRequest(..)
    , AuthenticationChoice(..)
    , SaslCredentials(..)
    , BindResponse(..)

      -- ** Unbind Operation  (<https://tools.ietf.org/html/rfc4511#section-4.3 RFC4511 Section 4.3>)

    , UnbindRequest

      -- ** Unsolicited Notification  (<https://tools.ietf.org/html/rfc4511#section-4.4 RFC4511 Section 4.4>)
      --
      -- | Unsolicited notifications are represented by an 'ExtendedResponse' message with its 'MessageID' set to @0@.

      -- ** Search Operation  (<https://tools.ietf.org/html/rfc4511#section-4.5 RFC4511 Section 4.5>)

    , SearchRequest(..)
    , Scope(..)
    , DerefAliases(..)
    , AttributeSelection
    , Filter(..)
    , SubstringFilter(..)
    , Substring(..)
    , MatchingRuleAssertion(..)

      -- *** Search Result   (<https://tools.ietf.org/html/rfc4511#section-4.5.2 RFC4511 Section 4.5.2>)

    , SearchResultEntry(..)
    , PartialAttributeList
    , SearchResultReference(..)
    , SearchResultDone

      -- ** Modify Operation   (<https://tools.ietf.org/html/rfc4511#section-4.6 RFC4511 Section 4.6>)

    , ModifyRequest(..)
    , Change(..)
    , Operation(..)
    , ModifyResponse

      -- ** Add Operation   (<https://tools.ietf.org/html/rfc4511#section-4.7 RFC4511 Section 4.7>)

    , AddRequest(..)
    , AttributeList
    , AddResponse

      -- ** Delete Operation   (<https://tools.ietf.org/html/rfc4511#section-4.8 RFC4511 Section 4.8>)

    , DelRequest
    , DelResponse

      -- ** Modify DN Operation   (<https://tools.ietf.org/html/rfc4511#section-4.9 RFC4511 Section 4.9>)

    , ModifyDNRequest(..)
    , ModifyDNResponse

      -- ** Compare Operation   (<https://tools.ietf.org/html/rfc4511#section-4.10 RFC4511 Section 4.10>)

    , CompareRequest(..)
    , CompareResponse

      -- ** Abandon Operation   (<https://tools.ietf.org/html/rfc4511#section-4.11 RFC4511 Section 4.11>)

    , AbandonRequest

      -- ** Extended Operation   (<https://tools.ietf.org/html/rfc4511#section-4.12 RFC4511 Section 4.12>)

    , ExtendedRequest(..)
    , ExtendedResponse(..)

      -- ** Intermediate Response  (<https://tools.ietf.org/html/rfc4511#section-4.13 RFC4511 Section 4.13>)

    , IntermediateResponse(..)

      -- * ASN.1 Helpers
    , NULL
    , OCTET_STRING
    , BOOLEAN_DEFAULT(..)
    , SET(..)
    , SET1(..)
    , COMPONENTS_OF(..)

      -- ** ASN.1 type-level tagging
    , EXPLICIT(..)
    , IMPLICIT(..)
    , ENUMERATED(..)
    , CHOICE(..)
    , TagK(..)

      -- * Unsigned integer sub-type
    , UIntBounds
    , UInt
    , fromUInt
    , toUInt
    ) where

import           Common
import           Data.ASN1.Prim           (TagK (..))
import           Data.Int.Subtypes
import           LDAPv3.ResultCode

import qualified Data.Binary              as Bin

import           Data.ASN1                (Enumerated, NULL, OCTET_STRING, SET (..), SET1 (..))
#if defined(HS_LDAPv3_ANNOTATED)
import           Data.ASN1                (ASN1 (..), ASN1Constructed, BOOLEAN_DEFAULT (..), CHOICE (..),
                                           COMPONENTS_OF (..), ENUMERATED (..), EXPLICIT (..), IMPLICIT (..),
                                           gasn1decodeChoice, gasn1encodeChoice, toBinaryGet, toBinaryPut)
import           Data.ASN1.Prim           (Tag (..))
#else /* defined(HS_LDAPv3_ANNOTATED) */
import qualified LDAPv3.Message.Annotated as Annotated (LDAPMessage)
import           Unsafe.Coerce            (unsafeCoerce)

-- | ASN.1 @IMPLICIT@ Annotation
type IMPLICIT (tag :: TagK) x = x

-- | ASN.1 @EXPLICIT@ Annotation
type EXPLICIT (tag :: TagK) x = x

-- | ASN.1 @ENUMERATED@ Annotation
type ENUMERATED x = x

-- | Helper representing a @BOOLEAN DEFAULT (TRUE|FALSE)@ ASN.1 type annotation
type BOOLEAN_DEFAULT (def :: Bool) = Bool

-- | ASN.1 @COMPONENTS OF@ Annotation
type COMPONENTS_OF x = x

-- | ASN.1 @CHOICE@ Annotation
type CHOICE x = x

#endif /* defined(HS_LDAPv3_ANNOTATED) */

----------------------------------------------------------------------------
-- LDAPv3 protocol

{- | Message Envelope (<https://tools.ietf.org/html/rfc4511#section-4.1.1 RFC4511 Section 4.1.1>)

> LDAPMessage ::= SEQUENCE {
>      messageID       MessageID,
>      protocolOp      CHOICE {
>           bindRequest           BindRequest,
>           bindResponse          BindResponse,
>           unbindRequest         UnbindRequest,
>           searchRequest         SearchRequest,
>           searchResEntry        SearchResultEntry,
>           searchResDone         SearchResultDone,
>           searchResRef          SearchResultReference,
>           modifyRequest         ModifyRequest,
>           modifyResponse        ModifyResponse,
>           addRequest            AddRequest,
>           addResponse           AddResponse,
>           delRequest            DelRequest,
>           delResponse           DelResponse,
>           modDNRequest          ModifyDNRequest,
>           modDNResponse         ModifyDNResponse,
>           compareRequest        CompareRequest,
>           compareResponse       CompareResponse,
>           abandonRequest        AbandonRequest,
>           extendedReq           ExtendedRequest,
>           extendedResp          ExtendedResponse,
>           ...,
>           intermediateResponse  IntermediateResponse },
>      controls       [0] Controls OPTIONAL }

-}
data LDAPMessage = LDAPMessage
  { LDAPMessage -> MessageID
_LDAPMessage'messageID  :: MessageID
  , LDAPMessage -> CHOICE ProtocolOp
_LDAPMessage'protocolOp :: CHOICE ProtocolOp
  , LDAPMessage -> Maybe (IMPLICIT ('CONTEXTUAL 0) Controls)
_LDAPMessage'controls   :: Maybe ('CONTEXTUAL 0 `IMPLICIT` Controls)
  } deriving ((forall x. LDAPMessage -> Rep LDAPMessage x)
-> (forall x. Rep LDAPMessage x -> LDAPMessage)
-> Generic LDAPMessage
forall x. Rep LDAPMessage x -> LDAPMessage
forall x. LDAPMessage -> Rep LDAPMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LDAPMessage x -> LDAPMessage
$cfrom :: forall x. LDAPMessage -> Rep LDAPMessage x
Generic,Int -> LDAPMessage -> ShowS
[LDAPMessage] -> ShowS
LDAPMessage -> String
(Int -> LDAPMessage -> ShowS)
-> (LDAPMessage -> String)
-> ([LDAPMessage] -> ShowS)
-> Show LDAPMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LDAPMessage] -> ShowS
$cshowList :: [LDAPMessage] -> ShowS
show :: LDAPMessage -> String
$cshow :: LDAPMessage -> String
showsPrec :: Int -> LDAPMessage -> ShowS
$cshowsPrec :: Int -> LDAPMessage -> ShowS
Show,LDAPMessage -> LDAPMessage -> Bool
(LDAPMessage -> LDAPMessage -> Bool)
-> (LDAPMessage -> LDAPMessage -> Bool) -> Eq LDAPMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LDAPMessage -> LDAPMessage -> Bool
$c/= :: LDAPMessage -> LDAPMessage -> Bool
== :: LDAPMessage -> LDAPMessage -> Bool
$c== :: LDAPMessage -> LDAPMessage -> Bool
Eq)

-- | Encodes to\/from ASN.1 as per <https://tools.ietf.org/html/rfc4511#section-5.1 RFC4511 Section 5.1>
#if defined(HS_LDAPv3_ANNOTATED)
instance Bin.Binary LDAPMessage where
  put = void . toBinaryPut . asn1encode
  get = toBinaryGet asn1decode
#else
instance Bin.Binary LDAPMessage where
  put :: LDAPMessage -> Put
put = LDAPMessage -> Put
forall t. Binary t => t -> Put
Bin.put (LDAPMessage -> Put)
-> (LDAPMessage -> LDAPMessage) -> LDAPMessage -> Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LDAPMessage -> LDAPMessage
forall a b. a -> b
unsafeCoerce :: LDAPMessage -> Annotated.LDAPMessage)
  get :: Get LDAPMessage
get = (LDAPMessage -> LDAPMessage
forall a b. a -> b
unsafeCoerce :: Annotated.LDAPMessage -> LDAPMessage) (LDAPMessage -> LDAPMessage) -> Get LDAPMessage -> Get LDAPMessage
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get LDAPMessage
forall t. Binary t => Get t
Bin.get
#endif

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 LDAPMessage
instance ASN1Constructed LDAPMessage
#endif

{- | Message ID (<https://tools.ietf.org/html/rfc4511#section-4.1.1.1 RFC4511 Section 4.1.1.1>)

> MessageID ::= INTEGER (0 ..  maxInt)

-}
newtype MessageID = MessageID (UInt 0 MaxInt Int32)
                  deriving ((forall x. MessageID -> Rep MessageID x)
-> (forall x. Rep MessageID x -> MessageID) -> Generic MessageID
forall x. Rep MessageID x -> MessageID
forall x. MessageID -> Rep MessageID x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MessageID x -> MessageID
$cfrom :: forall x. MessageID -> Rep MessageID x
Generic,MessageID -> ()
(MessageID -> ()) -> NFData MessageID
forall a. (a -> ()) -> NFData a
rnf :: MessageID -> ()
$crnf :: MessageID -> ()
NFData,Eq MessageID
Eq MessageID =>
(MessageID -> MessageID -> Ordering)
-> (MessageID -> MessageID -> Bool)
-> (MessageID -> MessageID -> Bool)
-> (MessageID -> MessageID -> Bool)
-> (MessageID -> MessageID -> Bool)
-> (MessageID -> MessageID -> MessageID)
-> (MessageID -> MessageID -> MessageID)
-> Ord MessageID
MessageID -> MessageID -> Bool
MessageID -> MessageID -> Ordering
MessageID -> MessageID -> MessageID
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: MessageID -> MessageID -> MessageID
$cmin :: MessageID -> MessageID -> MessageID
max :: MessageID -> MessageID -> MessageID
$cmax :: MessageID -> MessageID -> MessageID
>= :: MessageID -> MessageID -> Bool
$c>= :: MessageID -> MessageID -> Bool
> :: MessageID -> MessageID -> Bool
$c> :: MessageID -> MessageID -> Bool
<= :: MessageID -> MessageID -> Bool
$c<= :: MessageID -> MessageID -> Bool
< :: MessageID -> MessageID -> Bool
$c< :: MessageID -> MessageID -> Bool
compare :: MessageID -> MessageID -> Ordering
$ccompare :: MessageID -> MessageID -> Ordering
$cp1Ord :: Eq MessageID
Ord,MessageID
MessageID -> MessageID -> Bounded MessageID
forall a. a -> a -> Bounded a
maxBound :: MessageID
$cmaxBound :: MessageID
minBound :: MessageID
$cminBound :: MessageID
Bounded,Int -> MessageID -> ShowS
[MessageID] -> ShowS
MessageID -> String
(Int -> MessageID -> ShowS)
-> (MessageID -> String)
-> ([MessageID] -> ShowS)
-> Show MessageID
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MessageID] -> ShowS
$cshowList :: [MessageID] -> ShowS
show :: MessageID -> String
$cshow :: MessageID -> String
showsPrec :: Int -> MessageID -> ShowS
$cshowsPrec :: Int -> MessageID -> ShowS
Show,MessageID -> MessageID -> Bool
(MessageID -> MessageID -> Bool)
-> (MessageID -> MessageID -> Bool) -> Eq MessageID
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MessageID -> MessageID -> Bool
$c/= :: MessageID -> MessageID -> Bool
== :: MessageID -> MessageID -> Bool
$c== :: MessageID -> MessageID -> Bool
Eq)

#if defined(HS_LDAPv3_ANNOTATED)
deriving instance ASN1 MessageID
#endif

{- | LDAPv3 protocol ASN.1 constant as per <https://tools.ietf.org/html/rfc4511#section-4.1.1 RFC4511 Section 4.1.1>

> maxInt INTEGER ::= 2147483647 -- (2^^31 - 1)

-}
type MaxInt = 2147483647

-- | @CHOICE@ type inlined in @LDAPMessage.protocolOp@  (<https://tools.ietf.org/html/rfc4511#section-4.1.1 RFC4511 Section 4.1.1>)
--
data ProtocolOp
  = ProtocolOp'bindRequest     BindRequest
  | ProtocolOp'bindResponse    BindResponse
  | ProtocolOp'unbindRequest   UnbindRequest
  | ProtocolOp'searchRequest   SearchRequest
  | ProtocolOp'searchResEntry  SearchResultEntry
  | ProtocolOp'searchResDone   SearchResultDone
  | ProtocolOp'searchResRef    SearchResultReference
  | ProtocolOp'modifyRequest   ModifyRequest
  | ProtocolOp'modifyResponse  ModifyResponse
  | ProtocolOp'addRequest      AddRequest
  | ProtocolOp'addResponse     AddResponse
  | ProtocolOp'delRequest      DelRequest
  | ProtocolOp'delResponse     DelResponse
  | ProtocolOp'modDNRequest    ModifyDNRequest
  | ProtocolOp'modDNResponse   ModifyDNResponse
  | ProtocolOp'compareRequest  CompareRequest
  | ProtocolOp'compareResponse CompareResponse
  | ProtocolOp'abandonRequest  AbandonRequest
  | ProtocolOp'extendedReq     ExtendedRequest
  | ProtocolOp'extendedResp    ExtendedResponse
  | ProtocolOp'intermediateResponse  IntermediateResponse
  deriving ((forall x. CHOICE ProtocolOp -> Rep (CHOICE ProtocolOp) x)
-> (forall x. Rep (CHOICE ProtocolOp) x -> CHOICE ProtocolOp)
-> Generic (CHOICE ProtocolOp)
forall x. Rep (CHOICE ProtocolOp) x -> CHOICE ProtocolOp
forall x. CHOICE ProtocolOp -> Rep (CHOICE ProtocolOp) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep (CHOICE ProtocolOp) x -> CHOICE ProtocolOp
$cfrom :: forall x. CHOICE ProtocolOp -> Rep (CHOICE ProtocolOp) x
Generic,Int -> CHOICE ProtocolOp -> ShowS
[CHOICE ProtocolOp] -> ShowS
CHOICE ProtocolOp -> String
(Int -> CHOICE ProtocolOp -> ShowS)
-> (CHOICE ProtocolOp -> String)
-> ([CHOICE ProtocolOp] -> ShowS)
-> Show (CHOICE ProtocolOp)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CHOICE ProtocolOp] -> ShowS
$cshowList :: [CHOICE ProtocolOp] -> ShowS
show :: CHOICE ProtocolOp -> String
$cshow :: CHOICE ProtocolOp -> String
showsPrec :: Int -> CHOICE ProtocolOp -> ShowS
$cshowsPrec :: Int -> CHOICE ProtocolOp -> ShowS
Show,CHOICE ProtocolOp -> CHOICE ProtocolOp -> Bool
(CHOICE ProtocolOp -> CHOICE ProtocolOp -> Bool)
-> (CHOICE ProtocolOp -> CHOICE ProtocolOp -> Bool)
-> Eq (CHOICE ProtocolOp)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CHOICE ProtocolOp -> CHOICE ProtocolOp -> Bool
$c/= :: CHOICE ProtocolOp -> CHOICE ProtocolOp -> Bool
== :: CHOICE ProtocolOp -> CHOICE ProtocolOp -> Bool
$c== :: CHOICE ProtocolOp -> CHOICE ProtocolOp -> Bool
Eq)

instance NFData ProtocolOp

----------------------------------------------------------------------------

{- | Controls  (<https://tools.ietf.org/html/rfc4511#section-4.1.11 RFC4511 Section 4.1.11>)

> Controls ::= SEQUENCE OF control Control

-}
type Controls = [Control]

{- | Control Entry  (<https://tools.ietf.org/html/rfc4511#section-4.1.11 RFC4511 Section 4.1.11>)

> Control ::= SEQUENCE {
>      controlType             LDAPOID,
>      criticality             BOOLEAN DEFAULT FALSE,
>      controlValue            OCTET STRING OPTIONAL }

-}
data Control = Control
  { Control -> LDAPOID
_Control'controlType  :: LDAPOID
  , Control -> Bool
_Control'criticality  :: BOOLEAN_DEFAULT 'False
  , Control -> Maybe LDAPOID
_Control'controlValue :: Maybe OCTET_STRING
  } deriving ((forall x. Control -> Rep Control x)
-> (forall x. Rep Control x -> Control) -> Generic Control
forall x. Rep Control x -> Control
forall x. Control -> Rep Control x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Control x -> Control
$cfrom :: forall x. Control -> Rep Control x
Generic,Int -> Control -> ShowS
IMPLICIT ('CONTEXTUAL 0) Controls -> ShowS
Control -> String
(Int -> Control -> ShowS)
-> (Control -> String)
-> (IMPLICIT ('CONTEXTUAL 0) Controls -> ShowS)
-> Show Control
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: IMPLICIT ('CONTEXTUAL 0) Controls -> ShowS
$cshowList :: IMPLICIT ('CONTEXTUAL 0) Controls -> ShowS
show :: Control -> String
$cshow :: Control -> String
showsPrec :: Int -> Control -> ShowS
$cshowsPrec :: Int -> Control -> ShowS
Show,Control -> Control -> Bool
(Control -> Control -> Bool)
-> (Control -> Control -> Bool) -> Eq Control
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Control -> Control -> Bool
$c/= :: Control -> Control -> Bool
== :: Control -> Control -> Bool
$c== :: Control -> Control -> Bool
Eq)

instance NFData Control

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 Control
instance ASN1Constructed Control
#endif

{- | Object identifier  (<https://tools.ietf.org/html/rfc4511#section-4.1.2 RFC4511 Section 4.1.2>)

> LDAPOID ::= OCTET STRING -- Constrained to <numericoid>
>                          -- [RFC4512]

-}
type LDAPOID = OCTET_STRING

----------------------------------------------------------------------------

{- | Bind Request  (<https://tools.ietf.org/html/rfc4511#section-4.2 RFC4511 Section 4.2>)

> BindRequest ::= [APPLICATION 0] SEQUENCE {
>      version                 INTEGER (1 ..  127),
>      name                    LDAPDN,
>      authentication          AuthenticationChoice }

-}

data BindRequest = BindRequest
  { BindRequest -> UInt 1 127 Int8
bindRequest'version        :: UInt 1 127 Int8
  , BindRequest -> LDAPDN
bindRequest'name           :: LDAPDN
  , BindRequest -> AuthenticationChoice
bindRequest'authentication :: AuthenticationChoice
  } deriving ((forall x. BindRequest -> Rep BindRequest x)
-> (forall x. Rep BindRequest x -> BindRequest)
-> Generic BindRequest
forall x. Rep BindRequest x -> BindRequest
forall x. BindRequest -> Rep BindRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BindRequest x -> BindRequest
$cfrom :: forall x. BindRequest -> Rep BindRequest x
Generic,Int -> BindRequest -> ShowS
[BindRequest] -> ShowS
BindRequest -> String
(Int -> BindRequest -> ShowS)
-> (BindRequest -> String)
-> ([BindRequest] -> ShowS)
-> Show BindRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BindRequest] -> ShowS
$cshowList :: [BindRequest] -> ShowS
show :: BindRequest -> String
$cshow :: BindRequest -> String
showsPrec :: Int -> BindRequest -> ShowS
$cshowsPrec :: Int -> BindRequest -> ShowS
Show,BindRequest -> BindRequest -> Bool
(BindRequest -> BindRequest -> Bool)
-> (BindRequest -> BindRequest -> Bool) -> Eq BindRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BindRequest -> BindRequest -> Bool
$c/= :: BindRequest -> BindRequest -> Bool
== :: BindRequest -> BindRequest -> Bool
$c== :: BindRequest -> BindRequest -> Bool
Eq)

instance NFData BindRequest

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 BindRequest where asn1defTag _ = Application 0
instance ASN1Constructed BindRequest
#endif

----------------------------------------------------------------------------

{- | See 'BindRequest'

> AuthenticationChoice ::= CHOICE {
>      simple                  [0] OCTET STRING,
>                              -- 1 and 2 reserved
>      sasl                    [3] SaslCredentials,
>      ...  }

-}
data AuthenticationChoice
  = AuthenticationChoice'simple  ('CONTEXTUAL 0 `IMPLICIT` OCTET_STRING)
  | AuthenticationChoice'sasl    ('CONTEXTUAL 3 `IMPLICIT` SaslCredentials)
  deriving ((forall x. AuthenticationChoice -> Rep AuthenticationChoice x)
-> (forall x. Rep AuthenticationChoice x -> AuthenticationChoice)
-> Generic AuthenticationChoice
forall x. Rep AuthenticationChoice x -> AuthenticationChoice
forall x. AuthenticationChoice -> Rep AuthenticationChoice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuthenticationChoice x -> AuthenticationChoice
$cfrom :: forall x. AuthenticationChoice -> Rep AuthenticationChoice x
Generic,Int -> AuthenticationChoice -> ShowS
[AuthenticationChoice] -> ShowS
AuthenticationChoice -> String
(Int -> AuthenticationChoice -> ShowS)
-> (AuthenticationChoice -> String)
-> ([AuthenticationChoice] -> ShowS)
-> Show AuthenticationChoice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthenticationChoice] -> ShowS
$cshowList :: [AuthenticationChoice] -> ShowS
show :: AuthenticationChoice -> String
$cshow :: AuthenticationChoice -> String
showsPrec :: Int -> AuthenticationChoice -> ShowS
$cshowsPrec :: Int -> AuthenticationChoice -> ShowS
Show,AuthenticationChoice -> AuthenticationChoice -> Bool
(AuthenticationChoice -> AuthenticationChoice -> Bool)
-> (AuthenticationChoice -> AuthenticationChoice -> Bool)
-> Eq AuthenticationChoice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthenticationChoice -> AuthenticationChoice -> Bool
$c/= :: AuthenticationChoice -> AuthenticationChoice -> Bool
== :: AuthenticationChoice -> AuthenticationChoice -> Bool
$c== :: AuthenticationChoice -> AuthenticationChoice -> Bool
Eq)

instance NFData AuthenticationChoice

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 AuthenticationChoice where
  asn1decode = gasn1decodeChoice
  asn1encode = gasn1encodeChoice
#endif

{- | See 'AuthenticationChoice'

> SaslCredentials ::= SEQUENCE {
>      mechanism               LDAPString,
>      credentials             OCTET STRING OPTIONAL }

-}
data SaslCredentials = SaslCredentials
  { SaslCredentials -> LDAPDN
_SaslCredentials'mechanism   :: LDAPString
  , SaslCredentials -> Maybe LDAPOID
_SaslCredentials'credentials :: Maybe OCTET_STRING
  } deriving ((forall x. SaslCredentials -> Rep SaslCredentials x)
-> (forall x. Rep SaslCredentials x -> SaslCredentials)
-> Generic SaslCredentials
forall x. Rep SaslCredentials x -> SaslCredentials
forall x. SaslCredentials -> Rep SaslCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SaslCredentials x -> SaslCredentials
$cfrom :: forall x. SaslCredentials -> Rep SaslCredentials x
Generic,Int -> SaslCredentials -> ShowS
[SaslCredentials] -> ShowS
SaslCredentials -> String
(Int -> SaslCredentials -> ShowS)
-> (SaslCredentials -> String)
-> ([SaslCredentials] -> ShowS)
-> Show SaslCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SaslCredentials] -> ShowS
$cshowList :: [SaslCredentials] -> ShowS
show :: SaslCredentials -> String
$cshow :: SaslCredentials -> String
showsPrec :: Int -> SaslCredentials -> ShowS
$cshowsPrec :: Int -> SaslCredentials -> ShowS
Show,SaslCredentials -> SaslCredentials -> Bool
(SaslCredentials -> SaslCredentials -> Bool)
-> (SaslCredentials -> SaslCredentials -> Bool)
-> Eq SaslCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SaslCredentials -> SaslCredentials -> Bool
$c/= :: SaslCredentials -> SaslCredentials -> Bool
== :: SaslCredentials -> SaslCredentials -> Bool
$c== :: SaslCredentials -> SaslCredentials -> Bool
Eq)

instance NFData SaslCredentials

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 SaslCredentials
instance ASN1Constructed SaslCredentials
#endif

----------------------------------------------------------------------------

{- | Bind Response  (<https://tools.ietf.org/html/rfc4511#section-4.2 RFC4511 Section 4.2>)

> BindResponse ::= [APPLICATION 1] SEQUENCE {
>      COMPONENTS OF LDAPResult,
>      serverSaslCreds    [7] OCTET STRING OPTIONAL }

-}

data BindResponse = BindResponse
  { BindResponse -> COMPONENTS_OF LDAPResult
_BindResponse'LDAPResult      :: COMPONENTS_OF LDAPResult
  , BindResponse -> Maybe LDAPOID
_BindResponse'serverSaslCreds :: Maybe ('CONTEXTUAL 7 `IMPLICIT` OCTET_STRING)
  } deriving ((forall x. BindResponse -> Rep BindResponse x)
-> (forall x. Rep BindResponse x -> BindResponse)
-> Generic BindResponse
forall x. Rep BindResponse x -> BindResponse
forall x. BindResponse -> Rep BindResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BindResponse x -> BindResponse
$cfrom :: forall x. BindResponse -> Rep BindResponse x
Generic,Int -> BindResponse -> ShowS
[BindResponse] -> ShowS
BindResponse -> String
(Int -> BindResponse -> ShowS)
-> (BindResponse -> String)
-> ([BindResponse] -> ShowS)
-> Show BindResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BindResponse] -> ShowS
$cshowList :: [BindResponse] -> ShowS
show :: BindResponse -> String
$cshow :: BindResponse -> String
showsPrec :: Int -> BindResponse -> ShowS
$cshowsPrec :: Int -> BindResponse -> ShowS
Show,BindResponse -> BindResponse -> Bool
(BindResponse -> BindResponse -> Bool)
-> (BindResponse -> BindResponse -> Bool) -> Eq BindResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BindResponse -> BindResponse -> Bool
$c/= :: BindResponse -> BindResponse -> Bool
== :: BindResponse -> BindResponse -> Bool
$c== :: BindResponse -> BindResponse -> Bool
Eq)

instance NFData BindResponse

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 BindResponse where asn1defTag _ = Application 1
instance ASN1Constructed BindResponse
#endif

----------------------------------------------------------------------------

{- | Unbind Operation  (<https://tools.ietf.org/html/rfc4511#section-4.3 RFC4511 Section 4.3>)

> UnbindRequest ::= [APPLICATION 2] NULL

-}
type UnbindRequest = ('APPLICATION 2 `IMPLICIT` NULL)

----------------------------------------------------------------------------

{- | Search Request  (<https://tools.ietf.org/html/rfc4511#section-4.5.1 RFC4511 Section 4.5.1>)

> SearchRequest ::= [APPLICATION 3] SEQUENCE {
>      baseObject      LDAPDN,
>      scope           ENUMERATED {
>           baseObject              (0),
>           singleLevel             (1),
>           wholeSubtree            (2),
>           ...  },
>      derefAliases    ENUMERATED {
>           neverDerefAliases       (0),
>           derefInSearching        (1),
>           derefFindingBaseObj     (2),
>           derefAlways             (3) },
>      sizeLimit       INTEGER (0 ..  maxInt),
>      timeLimit       INTEGER (0 ..  maxInt),
>      typesOnly       BOOLEAN,
>      filter          Filter,
>      attributes      AttributeSelection }

-}
data SearchRequest = SearchRequest
  { SearchRequest -> LDAPDN
_SearchRequest'baseObject   :: LDAPDN
  , SearchRequest -> Scope
_SearchRequest'scope        :: ENUMERATED Scope
  , SearchRequest -> DerefAliases
_SearchRequest'derefAliases :: ENUMERATED DerefAliases
  , SearchRequest -> UInt 0 MaxInt Int32
_SearchRequest'sizeLimit    :: (UInt 0 MaxInt Int32)
  , SearchRequest -> UInt 0 MaxInt Int32
_SearchRequest'timeLimit    :: (UInt 0 MaxInt Int32)
  , SearchRequest -> Bool
_SearchRequest'typesOnly    :: Bool
  , SearchRequest -> Filter
_SearchRequest'filter       :: Filter
  , SearchRequest -> AttributeSelection
_SearchRequest'attributes   :: AttributeSelection
  } deriving ((forall x. SearchRequest -> Rep SearchRequest x)
-> (forall x. Rep SearchRequest x -> SearchRequest)
-> Generic SearchRequest
forall x. Rep SearchRequest x -> SearchRequest
forall x. SearchRequest -> Rep SearchRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchRequest x -> SearchRequest
$cfrom :: forall x. SearchRequest -> Rep SearchRequest x
Generic,Int -> SearchRequest -> ShowS
[SearchRequest] -> ShowS
SearchRequest -> String
(Int -> SearchRequest -> ShowS)
-> (SearchRequest -> String)
-> ([SearchRequest] -> ShowS)
-> Show SearchRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchRequest] -> ShowS
$cshowList :: [SearchRequest] -> ShowS
show :: SearchRequest -> String
$cshow :: SearchRequest -> String
showsPrec :: Int -> SearchRequest -> ShowS
$cshowsPrec :: Int -> SearchRequest -> ShowS
Show,SearchRequest -> SearchRequest -> Bool
(SearchRequest -> SearchRequest -> Bool)
-> (SearchRequest -> SearchRequest -> Bool) -> Eq SearchRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchRequest -> SearchRequest -> Bool
$c/= :: SearchRequest -> SearchRequest -> Bool
== :: SearchRequest -> SearchRequest -> Bool
$c== :: SearchRequest -> SearchRequest -> Bool
Eq)

instance NFData SearchRequest

{- | See 'SearchRequest'

> AttributeSelection ::= SEQUENCE OF selector LDAPString
>                -- The LDAPString is constrained to
>                -- <attributeSelector> in Section 4.5.1.8

-}
type AttributeSelection = [LDAPString]

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 SearchRequest where asn1defTag _ = Application 3
instance ASN1Constructed SearchRequest
#endif

-- | See 'SearchRequest'  (<https://tools.ietf.org/html/rfc4511#section-4.5.1.2 RFC4511 Section 4.5.1.2>)
data Scope
  = Scope'baseObject
  | Scope'singleLevel
  | Scope'wholeSubtree
  deriving ((forall x. Scope -> Rep Scope x)
-> (forall x. Rep Scope x -> Scope) -> Generic Scope
forall x. Rep Scope x -> Scope
forall x. Scope -> Rep Scope x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scope x -> Scope
$cfrom :: forall x. Scope -> Rep Scope x
Generic,Scope
Scope -> Scope -> Bounded Scope
forall a. a -> a -> Bounded a
maxBound :: Scope
$cmaxBound :: Scope
minBound :: Scope
$cminBound :: Scope
Bounded,Int -> Scope
Scope -> Int
Scope -> [Scope]
Scope -> Scope
Scope -> Scope -> [Scope]
Scope -> Scope -> Scope -> [Scope]
(Scope -> Scope)
-> (Scope -> Scope)
-> (Int -> Scope)
-> (Scope -> Int)
-> (Scope -> [Scope])
-> (Scope -> Scope -> [Scope])
-> (Scope -> Scope -> [Scope])
-> (Scope -> Scope -> Scope -> [Scope])
-> Enum Scope
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Scope -> Scope -> Scope -> [Scope]
$cenumFromThenTo :: Scope -> Scope -> Scope -> [Scope]
enumFromTo :: Scope -> Scope -> [Scope]
$cenumFromTo :: Scope -> Scope -> [Scope]
enumFromThen :: Scope -> Scope -> [Scope]
$cenumFromThen :: Scope -> Scope -> [Scope]
enumFrom :: Scope -> [Scope]
$cenumFrom :: Scope -> [Scope]
fromEnum :: Scope -> Int
$cfromEnum :: Scope -> Int
toEnum :: Int -> Scope
$ctoEnum :: Int -> Scope
pred :: Scope -> Scope
$cpred :: Scope -> Scope
succ :: Scope -> Scope
$csucc :: Scope -> Scope
Enum,Int -> Scope -> ShowS
[Scope] -> ShowS
Scope -> String
(Int -> Scope -> ShowS)
-> (Scope -> String) -> ([Scope] -> ShowS) -> Show Scope
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scope] -> ShowS
$cshowList :: [Scope] -> ShowS
show :: Scope -> String
$cshow :: Scope -> String
showsPrec :: Int -> Scope -> ShowS
$cshowsPrec :: Int -> Scope -> ShowS
Show,Scope -> Scope -> Bool
(Scope -> Scope -> Bool) -> (Scope -> Scope -> Bool) -> Eq Scope
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scope -> Scope -> Bool
$c/= :: Scope -> Scope -> Bool
== :: Scope -> Scope -> Bool
$c== :: Scope -> Scope -> Bool
Eq)

instance NFData Scope where rnf :: Scope -> ()
rnf = Scope -> ()
forall a. a -> ()
rwhnf
instance Enumerated Scope

-- | See 'SearchRequest'  (<https://tools.ietf.org/html/rfc4511#section-4.5.1.3 RFC4511 Section 4.5.1.3>)
data DerefAliases
  = DerefAliases'neverDerefAliases
  | DerefAliases'derefInSearching
  | DerefAliases'derefFindingBaseObj
  | DerefAliases'derefAlways
  deriving ((forall x. DerefAliases -> Rep DerefAliases x)
-> (forall x. Rep DerefAliases x -> DerefAliases)
-> Generic DerefAliases
forall x. Rep DerefAliases x -> DerefAliases
forall x. DerefAliases -> Rep DerefAliases x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DerefAliases x -> DerefAliases
$cfrom :: forall x. DerefAliases -> Rep DerefAliases x
Generic,DerefAliases
DerefAliases -> DerefAliases -> Bounded DerefAliases
forall a. a -> a -> Bounded a
maxBound :: DerefAliases
$cmaxBound :: DerefAliases
minBound :: DerefAliases
$cminBound :: DerefAliases
Bounded,Int -> DerefAliases
DerefAliases -> Int
DerefAliases -> [DerefAliases]
DerefAliases -> DerefAliases
DerefAliases -> DerefAliases -> [DerefAliases]
DerefAliases -> DerefAliases -> DerefAliases -> [DerefAliases]
(DerefAliases -> DerefAliases)
-> (DerefAliases -> DerefAliases)
-> (Int -> DerefAliases)
-> (DerefAliases -> Int)
-> (DerefAliases -> [DerefAliases])
-> (DerefAliases -> DerefAliases -> [DerefAliases])
-> (DerefAliases -> DerefAliases -> [DerefAliases])
-> (DerefAliases -> DerefAliases -> DerefAliases -> [DerefAliases])
-> Enum DerefAliases
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: DerefAliases -> DerefAliases -> DerefAliases -> [DerefAliases]
$cenumFromThenTo :: DerefAliases -> DerefAliases -> DerefAliases -> [DerefAliases]
enumFromTo :: DerefAliases -> DerefAliases -> [DerefAliases]
$cenumFromTo :: DerefAliases -> DerefAliases -> [DerefAliases]
enumFromThen :: DerefAliases -> DerefAliases -> [DerefAliases]
$cenumFromThen :: DerefAliases -> DerefAliases -> [DerefAliases]
enumFrom :: DerefAliases -> [DerefAliases]
$cenumFrom :: DerefAliases -> [DerefAliases]
fromEnum :: DerefAliases -> Int
$cfromEnum :: DerefAliases -> Int
toEnum :: Int -> DerefAliases
$ctoEnum :: Int -> DerefAliases
pred :: DerefAliases -> DerefAliases
$cpred :: DerefAliases -> DerefAliases
succ :: DerefAliases -> DerefAliases
$csucc :: DerefAliases -> DerefAliases
Enum,Int -> DerefAliases -> ShowS
[DerefAliases] -> ShowS
DerefAliases -> String
(Int -> DerefAliases -> ShowS)
-> (DerefAliases -> String)
-> ([DerefAliases] -> ShowS)
-> Show DerefAliases
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DerefAliases] -> ShowS
$cshowList :: [DerefAliases] -> ShowS
show :: DerefAliases -> String
$cshow :: DerefAliases -> String
showsPrec :: Int -> DerefAliases -> ShowS
$cshowsPrec :: Int -> DerefAliases -> ShowS
Show,DerefAliases -> DerefAliases -> Bool
(DerefAliases -> DerefAliases -> Bool)
-> (DerefAliases -> DerefAliases -> Bool) -> Eq DerefAliases
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DerefAliases -> DerefAliases -> Bool
$c/= :: DerefAliases -> DerefAliases -> Bool
== :: DerefAliases -> DerefAliases -> Bool
$c== :: DerefAliases -> DerefAliases -> Bool
Eq)

instance NFData DerefAliases where rnf :: DerefAliases -> ()
rnf = DerefAliases -> ()
forall a. a -> ()
rwhnf
instance Enumerated DerefAliases

{- | Search Filter  (<https://tools.ietf.org/html/rfc4511#section-4.5.1.7 RFC4511 Section 4.5.1.7>)

> Filter ::= CHOICE {
>      and             [0] SET SIZE (1..MAX) OF filter Filter,
>      or              [1] SET SIZE (1..MAX) OF filter Filter,
>      not             [2] Filter,
>      equalityMatch   [3] AttributeValueAssertion,
>      substrings      [4] SubstringFilter,
>      greaterOrEqual  [5] AttributeValueAssertion,
>      lessOrEqual     [6] AttributeValueAssertion,
>      present         [7] AttributeDescription,
>      approxMatch     [8] AttributeValueAssertion,
>      extensibleMatch [9] MatchingRuleAssertion,
>      ...  }

-}
data Filter
  = Filter'and             ('CONTEXTUAL 0 `IMPLICIT` SET1 Filter)
  | Filter'or              ('CONTEXTUAL 1 `IMPLICIT` SET1 Filter)
  | Filter'not             ('CONTEXTUAL 2 `EXPLICIT` Filter)
  | Filter'equalityMatch   ('CONTEXTUAL 3 `IMPLICIT` AttributeValueAssertion)
  | Filter'substrings      ('CONTEXTUAL 4 `IMPLICIT` SubstringFilter)
  | Filter'greaterOrEqual  ('CONTEXTUAL 5 `IMPLICIT` AttributeValueAssertion)
  | Filter'lessOrEqual     ('CONTEXTUAL 6 `IMPLICIT` AttributeValueAssertion)
  | Filter'present         ('CONTEXTUAL 7 `IMPLICIT` AttributeDescription)
  | Filter'approxMatch     ('CONTEXTUAL 8 `IMPLICIT` AttributeValueAssertion)
  | Filter'extensibleMatch ('CONTEXTUAL 9 `IMPLICIT` MatchingRuleAssertion)
  deriving ((forall x. Filter -> Rep Filter x)
-> (forall x. Rep Filter x -> Filter) -> Generic Filter
forall x. Rep Filter x -> Filter
forall x. Filter -> Rep Filter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Filter x -> Filter
$cfrom :: forall x. Filter -> Rep Filter x
Generic,Int -> Filter -> ShowS
[Filter] -> ShowS
Filter -> String
(Int -> Filter -> ShowS)
-> (Filter -> String) -> ([Filter] -> ShowS) -> Show Filter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Filter] -> ShowS
$cshowList :: [Filter] -> ShowS
show :: Filter -> String
$cshow :: Filter -> String
showsPrec :: Int -> Filter -> ShowS
$cshowsPrec :: Int -> Filter -> ShowS
Show,Filter -> Filter -> Bool
(Filter -> Filter -> Bool)
-> (Filter -> Filter -> Bool) -> Eq Filter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Filter -> Filter -> Bool
$c/= :: Filter -> Filter -> Bool
== :: Filter -> Filter -> Bool
$c== :: Filter -> Filter -> Bool
Eq)

instance NFData Filter

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 Filter where
  asn1decode = gasn1decodeChoice
  asn1encode = gasn1encodeChoice
#endif

{- | Attribute Descriptions  (<https://tools.ietf.org/html/rfc4511#section-4.1.4 RFC4511 Section 4.1.4>)

> AttributeDescription ::= LDAPString
>                         -- Constrained to <attributedescription>
>                         -- [RFC4512]

-}
type AttributeDescription = LDAPString

{- | Attribute Value  (<https://tools.ietf.org/html/rfc4511#section-4.1.5 RFC4511 Section 4.1.5>)

> AttributeValue ::= OCTET STRING

-}
type AttributeValue = OCTET_STRING

{- | Attribute Value Assertion  (<https://tools.ietf.org/html/rfc4511#section-4.1.6 RFC4511 Section 4.1.6>)

> AttributeValueAssertion ::= SEQUENCE {
>      attributeDesc   AttributeDescription,
>      assertionValue  AssertionValue }

-}
data AttributeValueAssertion = AttributeValueAssertion
  { AttributeValueAssertion -> LDAPDN
_AttributeValueAssertion'attributeDesc  :: AttributeDescription
  , AttributeValueAssertion -> LDAPOID
_AttributeValueAssertion'assertionValue :: AssertionValue
  } deriving ((forall x.
 AttributeValueAssertion -> Rep AttributeValueAssertion x)
-> (forall x.
    Rep AttributeValueAssertion x -> AttributeValueAssertion)
-> Generic AttributeValueAssertion
forall x. Rep AttributeValueAssertion x -> AttributeValueAssertion
forall x. AttributeValueAssertion -> Rep AttributeValueAssertion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeValueAssertion x -> AttributeValueAssertion
$cfrom :: forall x. AttributeValueAssertion -> Rep AttributeValueAssertion x
Generic,Int -> AttributeValueAssertion -> ShowS
[AttributeValueAssertion] -> ShowS
AttributeValueAssertion -> String
(Int -> AttributeValueAssertion -> ShowS)
-> (AttributeValueAssertion -> String)
-> ([AttributeValueAssertion] -> ShowS)
-> Show AttributeValueAssertion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeValueAssertion] -> ShowS
$cshowList :: [AttributeValueAssertion] -> ShowS
show :: AttributeValueAssertion -> String
$cshow :: AttributeValueAssertion -> String
showsPrec :: Int -> AttributeValueAssertion -> ShowS
$cshowsPrec :: Int -> AttributeValueAssertion -> ShowS
Show,AttributeValueAssertion -> AttributeValueAssertion -> Bool
(AttributeValueAssertion -> AttributeValueAssertion -> Bool)
-> (AttributeValueAssertion -> AttributeValueAssertion -> Bool)
-> Eq AttributeValueAssertion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeValueAssertion -> AttributeValueAssertion -> Bool
$c/= :: AttributeValueAssertion -> AttributeValueAssertion -> Bool
== :: AttributeValueAssertion -> AttributeValueAssertion -> Bool
$c== :: AttributeValueAssertion -> AttributeValueAssertion -> Bool
Eq)

instance NFData AttributeValueAssertion

-- | > AssertionValue ::= OCTET STRING
type AssertionValue = OCTET_STRING

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 AttributeValueAssertion
instance ASN1Constructed AttributeValueAssertion
#endif

{- | Substring 'Filter'  (<https://tools.ietf.org/html/rfc4511#section-4.5.1.7.2 RFC4511 Section 4.5.1.7.2>)

> SubstringFilter ::= SEQUENCE {
>      type           AttributeDescription,
>      substrings     SEQUENCE SIZE (1..MAX) OF substring CHOICE {
>           initial [0] AssertionValue,  -- can occur at most once
>           any     [1] AssertionValue,
>           final   [2] AssertionValue } -- can occur at most once
>      }

__NOTE__: The additional invariants imposed on the ordering and occurence counts of the @initial@ and @final@ entries MUST currently be enforced by the consumer of this library. Future versions of this library might change to enforce these invariants at the type-level.

Specifically, the invariant stated by the specification is:

/There SHALL be at most one @initial@ and at most one @final@ in the @substrings@ of a SubstringFilter.  If @initial@ is present, it SHALL be the first element of @substrings@.  If @final@ is present, it SHALL be the last element of @substrings@./

-}
data SubstringFilter = SubstringFilter
  { SubstringFilter -> LDAPDN
_SubstringFilter'type       :: AttributeDescription
  , SubstringFilter -> NonEmpty (CHOICE Substring)
_SubstringFilter'substrings :: NonEmpty (CHOICE Substring)
  } deriving ((forall x. SubstringFilter -> Rep SubstringFilter x)
-> (forall x. Rep SubstringFilter x -> SubstringFilter)
-> Generic SubstringFilter
forall x. Rep SubstringFilter x -> SubstringFilter
forall x. SubstringFilter -> Rep SubstringFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubstringFilter x -> SubstringFilter
$cfrom :: forall x. SubstringFilter -> Rep SubstringFilter x
Generic,Int -> SubstringFilter -> ShowS
[SubstringFilter] -> ShowS
SubstringFilter -> String
(Int -> SubstringFilter -> ShowS)
-> (SubstringFilter -> String)
-> ([SubstringFilter] -> ShowS)
-> Show SubstringFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubstringFilter] -> ShowS
$cshowList :: [SubstringFilter] -> ShowS
show :: SubstringFilter -> String
$cshow :: SubstringFilter -> String
showsPrec :: Int -> SubstringFilter -> ShowS
$cshowsPrec :: Int -> SubstringFilter -> ShowS
Show,SubstringFilter -> SubstringFilter -> Bool
(SubstringFilter -> SubstringFilter -> Bool)
-> (SubstringFilter -> SubstringFilter -> Bool)
-> Eq SubstringFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubstringFilter -> SubstringFilter -> Bool
$c/= :: SubstringFilter -> SubstringFilter -> Bool
== :: SubstringFilter -> SubstringFilter -> Bool
$c== :: SubstringFilter -> SubstringFilter -> Bool
Eq)

instance NFData SubstringFilter

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 SubstringFilter
instance ASN1Constructed SubstringFilter
#endif

-- | See 'SubstringFilter'
data Substring
  = Substring'initial ('CONTEXTUAL 0 `IMPLICIT` AssertionValue) -- ^ may occur at most once; must be first element if present
  | Substring'any     ('CONTEXTUAL 1 `IMPLICIT` AssertionValue)
  | Substring'final   ('CONTEXTUAL 2 `IMPLICIT` AssertionValue) -- ^ may occur at most once; must be last element if present
  deriving ((forall x. CHOICE Substring -> Rep (CHOICE Substring) x)
-> (forall x. Rep (CHOICE Substring) x -> CHOICE Substring)
-> Generic (CHOICE Substring)
forall x. Rep (CHOICE Substring) x -> CHOICE Substring
forall x. CHOICE Substring -> Rep (CHOICE Substring) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep (CHOICE Substring) x -> CHOICE Substring
$cfrom :: forall x. CHOICE Substring -> Rep (CHOICE Substring) x
Generic,Int -> CHOICE Substring -> ShowS
[CHOICE Substring] -> ShowS
CHOICE Substring -> String
(Int -> CHOICE Substring -> ShowS)
-> (CHOICE Substring -> String)
-> ([CHOICE Substring] -> ShowS)
-> Show (CHOICE Substring)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CHOICE Substring] -> ShowS
$cshowList :: [CHOICE Substring] -> ShowS
show :: CHOICE Substring -> String
$cshow :: CHOICE Substring -> String
showsPrec :: Int -> CHOICE Substring -> ShowS
$cshowsPrec :: Int -> CHOICE Substring -> ShowS
Show,CHOICE Substring -> CHOICE Substring -> Bool
(CHOICE Substring -> CHOICE Substring -> Bool)
-> (CHOICE Substring -> CHOICE Substring -> Bool)
-> Eq (CHOICE Substring)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CHOICE Substring -> CHOICE Substring -> Bool
$c/= :: CHOICE Substring -> CHOICE Substring -> Bool
== :: CHOICE Substring -> CHOICE Substring -> Bool
$c== :: CHOICE Substring -> CHOICE Substring -> Bool
Eq)

instance NFData Substring

{- | Matching Rule Identifier  (<https://tools.ietf.org/html/rfc4511#section-4.1.8 RFC4511 Section 4.1.8>)

> MatchingRuleId ::= LDAPString

-}
type MatchingRuleId = LDAPString

{- | See 'SearchRequest' 'Filter'

> MatchingRuleAssertion ::= SEQUENCE {
>      matchingRule    [1] MatchingRuleId OPTIONAL,
>      type            [2] AttributeDescription OPTIONAL,
>      matchValue      [3] AssertionValue,
>      dnAttributes    [4] BOOLEAN DEFAULT FALSE }

-}
data MatchingRuleAssertion = MatchingRuleAssertion
  { MatchingRuleAssertion -> Maybe LDAPDN
_MatchingRuleAssertion'matchingRule :: Maybe ('CONTEXTUAL 1 `IMPLICIT` MatchingRuleId)
  , MatchingRuleAssertion -> Maybe LDAPDN
_MatchingRuleAssertion'type         :: Maybe ('CONTEXTUAL 2 `IMPLICIT` AttributeDescription)
  , MatchingRuleAssertion -> LDAPOID
_MatchingRuleAssertion'matchValue   ::       ('CONTEXTUAL 3 `IMPLICIT` AssertionValue)
  , MatchingRuleAssertion -> Bool
_MatchingRuleAssertion'dnAttributes ::       ('CONTEXTUAL 4 `IMPLICIT` BOOLEAN_DEFAULT 'False)
  } deriving ((forall x. MatchingRuleAssertion -> Rep MatchingRuleAssertion x)
-> (forall x. Rep MatchingRuleAssertion x -> MatchingRuleAssertion)
-> Generic MatchingRuleAssertion
forall x. Rep MatchingRuleAssertion x -> MatchingRuleAssertion
forall x. MatchingRuleAssertion -> Rep MatchingRuleAssertion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MatchingRuleAssertion x -> MatchingRuleAssertion
$cfrom :: forall x. MatchingRuleAssertion -> Rep MatchingRuleAssertion x
Generic,Int -> MatchingRuleAssertion -> ShowS
[MatchingRuleAssertion] -> ShowS
MatchingRuleAssertion -> String
(Int -> MatchingRuleAssertion -> ShowS)
-> (MatchingRuleAssertion -> String)
-> ([MatchingRuleAssertion] -> ShowS)
-> Show MatchingRuleAssertion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MatchingRuleAssertion] -> ShowS
$cshowList :: [MatchingRuleAssertion] -> ShowS
show :: MatchingRuleAssertion -> String
$cshow :: MatchingRuleAssertion -> String
showsPrec :: Int -> MatchingRuleAssertion -> ShowS
$cshowsPrec :: Int -> MatchingRuleAssertion -> ShowS
Show,MatchingRuleAssertion -> MatchingRuleAssertion -> Bool
(MatchingRuleAssertion -> MatchingRuleAssertion -> Bool)
-> (MatchingRuleAssertion -> MatchingRuleAssertion -> Bool)
-> Eq MatchingRuleAssertion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MatchingRuleAssertion -> MatchingRuleAssertion -> Bool
$c/= :: MatchingRuleAssertion -> MatchingRuleAssertion -> Bool
== :: MatchingRuleAssertion -> MatchingRuleAssertion -> Bool
$c== :: MatchingRuleAssertion -> MatchingRuleAssertion -> Bool
Eq)

instance NFData MatchingRuleAssertion

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 MatchingRuleAssertion
instance ASN1Constructed MatchingRuleAssertion
#endif

----------------------------------------------------------------------------

{- | Search Result Continuation Reference  (<https://tools.ietf.org/html/rfc4511#section-4.5.3 RFC4511 Section 4.5.3>)

> SearchResultReference ::= [APPLICATION 19] SEQUENCE
>                           SIZE (1..MAX) OF uri URI

-}

newtype SearchResultReference = SearchResultReference ('APPLICATION 19 `IMPLICIT` NonEmpty URI)
  deriving ((forall x. SearchResultReference -> Rep SearchResultReference x)
-> (forall x. Rep SearchResultReference x -> SearchResultReference)
-> Generic SearchResultReference
forall x. Rep SearchResultReference x -> SearchResultReference
forall x. SearchResultReference -> Rep SearchResultReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchResultReference x -> SearchResultReference
$cfrom :: forall x. SearchResultReference -> Rep SearchResultReference x
Generic,SearchResultReference -> ()
(SearchResultReference -> ()) -> NFData SearchResultReference
forall a. (a -> ()) -> NFData a
rnf :: SearchResultReference -> ()
$crnf :: SearchResultReference -> ()
NFData,Int -> SearchResultReference -> ShowS
[SearchResultReference] -> ShowS
SearchResultReference -> String
(Int -> SearchResultReference -> ShowS)
-> (SearchResultReference -> String)
-> ([SearchResultReference] -> ShowS)
-> Show SearchResultReference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchResultReference] -> ShowS
$cshowList :: [SearchResultReference] -> ShowS
show :: SearchResultReference -> String
$cshow :: SearchResultReference -> String
showsPrec :: Int -> SearchResultReference -> ShowS
$cshowsPrec :: Int -> SearchResultReference -> ShowS
Show,SearchResultReference -> SearchResultReference -> Bool
(SearchResultReference -> SearchResultReference -> Bool)
-> (SearchResultReference -> SearchResultReference -> Bool)
-> Eq SearchResultReference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchResultReference -> SearchResultReference -> Bool
$c/= :: SearchResultReference -> SearchResultReference -> Bool
== :: SearchResultReference -> SearchResultReference -> Bool
$c== :: SearchResultReference -> SearchResultReference -> Bool
Eq)

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 SearchResultReference where
  asn1defTag _ = Application 19 -- not used
  asn1decode = SearchResultReference <$> asn1decode
  asn1encode (SearchResultReference v) = asn1encode v
#endif

----------------------------------------------------------------------------

{- | Search Result Entry  (<https://tools.ietf.org/html/rfc4511#section-4.5.2 RFC4511 Section 4.5.2>)

> SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
>      objectName      LDAPDN,
>      attributes      PartialAttributeList }

-}
data SearchResultEntry = SearchResultEntry
  { SearchResultEntry -> LDAPDN
_SearchResultEntry'objectName :: LDAPDN
  , SearchResultEntry -> PartialAttributeList
_SearchResultEntry'attributes :: PartialAttributeList
  } deriving ((forall x. SearchResultEntry -> Rep SearchResultEntry x)
-> (forall x. Rep SearchResultEntry x -> SearchResultEntry)
-> Generic SearchResultEntry
forall x. Rep SearchResultEntry x -> SearchResultEntry
forall x. SearchResultEntry -> Rep SearchResultEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchResultEntry x -> SearchResultEntry
$cfrom :: forall x. SearchResultEntry -> Rep SearchResultEntry x
Generic,Int -> SearchResultEntry -> ShowS
[SearchResultEntry] -> ShowS
SearchResultEntry -> String
(Int -> SearchResultEntry -> ShowS)
-> (SearchResultEntry -> String)
-> ([SearchResultEntry] -> ShowS)
-> Show SearchResultEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchResultEntry] -> ShowS
$cshowList :: [SearchResultEntry] -> ShowS
show :: SearchResultEntry -> String
$cshow :: SearchResultEntry -> String
showsPrec :: Int -> SearchResultEntry -> ShowS
$cshowsPrec :: Int -> SearchResultEntry -> ShowS
Show,SearchResultEntry -> SearchResultEntry -> Bool
(SearchResultEntry -> SearchResultEntry -> Bool)
-> (SearchResultEntry -> SearchResultEntry -> Bool)
-> Eq SearchResultEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchResultEntry -> SearchResultEntry -> Bool
$c/= :: SearchResultEntry -> SearchResultEntry -> Bool
== :: SearchResultEntry -> SearchResultEntry -> Bool
$c== :: SearchResultEntry -> SearchResultEntry -> Bool
Eq)

instance NFData SearchResultEntry

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 SearchResultEntry where asn1defTag _ = Application 4
instance ASN1Constructed SearchResultEntry
#endif

{- | See 'SearchResultEntry'

> PartialAttributeList ::= SEQUENCE OF
>                      partialAttribute PartialAttribute

-}
type PartialAttributeList = [PartialAttribute]

{- | Partial Attribute  (<https://tools.ietf.org/html/rfc4511#section-4.1.7 RFC4511 Section 4.1.7>)

> PartialAttribute ::= SEQUENCE {
>      type       AttributeDescription,
>      vals       SET OF value AttributeValue }

-}
data PartialAttribute = PartialAttribute
  { PartialAttribute -> LDAPDN
_PartialAttribute'type :: AttributeDescription
  , PartialAttribute -> SET LDAPOID
_PartialAttribute'vals :: SET AttributeValue
  } deriving ((forall x. PartialAttribute -> Rep PartialAttribute x)
-> (forall x. Rep PartialAttribute x -> PartialAttribute)
-> Generic PartialAttribute
forall x. Rep PartialAttribute x -> PartialAttribute
forall x. PartialAttribute -> Rep PartialAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PartialAttribute x -> PartialAttribute
$cfrom :: forall x. PartialAttribute -> Rep PartialAttribute x
Generic,Int -> PartialAttribute -> ShowS
PartialAttributeList -> ShowS
PartialAttribute -> String
(Int -> PartialAttribute -> ShowS)
-> (PartialAttribute -> String)
-> (PartialAttributeList -> ShowS)
-> Show PartialAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: PartialAttributeList -> ShowS
$cshowList :: PartialAttributeList -> ShowS
show :: PartialAttribute -> String
$cshow :: PartialAttribute -> String
showsPrec :: Int -> PartialAttribute -> ShowS
$cshowsPrec :: Int -> PartialAttribute -> ShowS
Show,PartialAttribute -> PartialAttribute -> Bool
(PartialAttribute -> PartialAttribute -> Bool)
-> (PartialAttribute -> PartialAttribute -> Bool)
-> Eq PartialAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartialAttribute -> PartialAttribute -> Bool
$c/= :: PartialAttribute -> PartialAttribute -> Bool
== :: PartialAttribute -> PartialAttribute -> Bool
$c== :: PartialAttribute -> PartialAttribute -> Bool
Eq)

instance NFData PartialAttribute

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 PartialAttribute
instance ASN1Constructed PartialAttribute
#endif


{- | Attribute  (<https://tools.ietf.org/html/rfc4511#section-4.1.7 RFC4511 Section 4.1.7>)

> Attribute ::= PartialAttribute(WITH COMPONENTS {
>      ...,
>      vals (SIZE(1..MAX))})

-}
data Attribute = Attribute
  { Attribute -> LDAPDN
_Attribute'type :: AttributeDescription
  , Attribute -> SET1 LDAPOID
_Attribute'vals :: SET1 AttributeValue
  } deriving ((forall x. Attribute -> Rep Attribute x)
-> (forall x. Rep Attribute x -> Attribute) -> Generic Attribute
forall x. Rep Attribute x -> Attribute
forall x. Attribute -> Rep Attribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Attribute x -> Attribute
$cfrom :: forall x. Attribute -> Rep Attribute x
Generic,Int -> Attribute -> ShowS
[Attribute] -> ShowS
Attribute -> String
(Int -> Attribute -> ShowS)
-> (Attribute -> String)
-> ([Attribute] -> ShowS)
-> Show Attribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Attribute] -> ShowS
$cshowList :: [Attribute] -> ShowS
show :: Attribute -> String
$cshow :: Attribute -> String
showsPrec :: Int -> Attribute -> ShowS
$cshowsPrec :: Int -> Attribute -> ShowS
Show,Attribute -> Attribute -> Bool
(Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool) -> Eq Attribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Attribute -> Attribute -> Bool
$c/= :: Attribute -> Attribute -> Bool
== :: Attribute -> Attribute -> Bool
$c== :: Attribute -> Attribute -> Bool
Eq)

instance NFData Attribute

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 Attribute
instance ASN1Constructed Attribute
#endif

----------------------------------------------------------------------------

{- | Search Result Done  (<https://tools.ietf.org/html/rfc4511#section-4.5.2 RFC4511 Section 4.5.2>)

> SearchResultDone ::= [APPLICATION 5] LDAPResult

-}
type SearchResultDone = ('APPLICATION 5 `IMPLICIT` LDAPResult)

----------------------------------------------------------------------------

{- | Result Message  (<https://tools.ietf.org/html/rfc4511#section-4.1.9 RFC4511 Section 4.1.9>)

> LDAPResult ::= SEQUENCE {
>      resultCode         ENUMERATED {
>           success                      (0),
>           operationsError              (1),
>           protocolError                (2),
>           timeLimitExceeded            (3),
>           sizeLimitExceeded            (4),
>           compareFalse                 (5),
>           compareTrue                  (6),
>           authMethodNotSupported       (7),
>           strongerAuthRequired         (8),
>                -- 9 reserved --
>           referral                     (10),
>           adminLimitExceeded           (11),
>           unavailableCriticalExtension (12),
>           confidentialityRequired      (13),
>           saslBindInProgress           (14),
>           noSuchAttribute              (16),
>           undefinedAttributeType       (17),
>           inappropriateMatching        (18),
>           constraintViolation          (19),
>           attributeOrValueExists       (20),
>           invalidAttributeSyntax       (21),
>                -- 22-31 unused --
>           noSuchObject                 (32),
>           aliasProblem                 (33),
>           invalidDNSyntax              (34),
>                -- 35 reserved for undefined isLeaf --
>           aliasDereferencingProblem    (36),
>                -- 37-47 unused --
>           inappropriateAuthentication  (48),
>           invalidCredentials           (49),
>           insufficientAccessRights     (50),
>           busy                         (51),
>           unavailable                  (52),
>           unwillingToPerform           (53),
>           loopDetect                   (54),
>                -- 55-63 unused --
>           namingViolation              (64),
>           objectClassViolation         (65),
>           notAllowedOnNonLeaf          (66),
>           notAllowedOnRDN              (67),
>           entryAlreadyExists           (68),
>           objectClassModsProhibited    (69),
>                -- 70 reserved for CLDAP --
>           affectsMultipleDSAs          (71),
>                -- 72-79 unused --
>           other                        (80),
>           ...  },
>      matchedDN          LDAPDN,
>      diagnosticMessage  LDAPString,
>      referral           [3] Referral OPTIONAL }

-}
data LDAPResult = LDAPResult
  { COMPONENTS_OF LDAPResult -> ENUMERATED ResultCode
_LDAPResult'resultCode        :: ENUMERATED ResultCode
  , COMPONENTS_OF LDAPResult -> LDAPDN
_LDAPResult'matchedDN         :: LDAPDN
  , COMPONENTS_OF LDAPResult -> LDAPDN
_LDAPResult'diagnosticMessage :: LDAPString
  , COMPONENTS_OF LDAPResult
-> Maybe (IMPLICIT ('CONTEXTUAL 3) Referral)
_LDAPResult'referral          :: Maybe ('CONTEXTUAL 3 `IMPLICIT` Referral)
  } deriving ((forall x.
 COMPONENTS_OF LDAPResult -> Rep (COMPONENTS_OF LDAPResult) x)
-> (forall x.
    Rep (COMPONENTS_OF LDAPResult) x -> COMPONENTS_OF LDAPResult)
-> Generic (COMPONENTS_OF LDAPResult)
forall x.
Rep (COMPONENTS_OF LDAPResult) x -> COMPONENTS_OF LDAPResult
forall x.
COMPONENTS_OF LDAPResult -> Rep (COMPONENTS_OF LDAPResult) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep (COMPONENTS_OF LDAPResult) x -> COMPONENTS_OF LDAPResult
$cfrom :: forall x.
COMPONENTS_OF LDAPResult -> Rep (COMPONENTS_OF LDAPResult) x
Generic,Int -> COMPONENTS_OF LDAPResult -> ShowS
[COMPONENTS_OF LDAPResult] -> ShowS
COMPONENTS_OF LDAPResult -> String
(Int -> COMPONENTS_OF LDAPResult -> ShowS)
-> (COMPONENTS_OF LDAPResult -> String)
-> ([COMPONENTS_OF LDAPResult] -> ShowS)
-> Show (COMPONENTS_OF LDAPResult)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [COMPONENTS_OF LDAPResult] -> ShowS
$cshowList :: [COMPONENTS_OF LDAPResult] -> ShowS
show :: COMPONENTS_OF LDAPResult -> String
$cshow :: COMPONENTS_OF LDAPResult -> String
showsPrec :: Int -> COMPONENTS_OF LDAPResult -> ShowS
$cshowsPrec :: Int -> COMPONENTS_OF LDAPResult -> ShowS
Show,COMPONENTS_OF LDAPResult -> COMPONENTS_OF LDAPResult -> Bool
(COMPONENTS_OF LDAPResult -> COMPONENTS_OF LDAPResult -> Bool)
-> (COMPONENTS_OF LDAPResult -> COMPONENTS_OF LDAPResult -> Bool)
-> Eq (COMPONENTS_OF LDAPResult)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: COMPONENTS_OF LDAPResult -> COMPONENTS_OF LDAPResult -> Bool
$c/= :: COMPONENTS_OF LDAPResult -> COMPONENTS_OF LDAPResult -> Bool
== :: COMPONENTS_OF LDAPResult -> COMPONENTS_OF LDAPResult -> Bool
$c== :: COMPONENTS_OF LDAPResult -> COMPONENTS_OF LDAPResult -> Bool
Eq)

instance NFData LDAPResult

{- | Referral result code  (<https://tools.ietf.org/html/rfc4511#section-4.1.10 RFC4511 Section 4.1.10>)

> Referral ::= SEQUENCE SIZE (1..MAX) OF uri URI

-}
type Referral = ('CONTEXTUAL 3 `IMPLICIT` NonEmpty URI)

{- |

> URI ::= LDAPString     -- limited to characters permitted in
>                        -- URIs

-}
type URI = LDAPString

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 LDAPResult
instance ASN1Constructed LDAPResult
#endif

{- | String Type  (<https://tools.ietf.org/html/rfc4511#section-4.1.2 RFC4511 Section 4.1.2>)

> LDAPString ::= OCTET STRING -- UTF-8 encoded,
>                             -- [ISO10646] characters

-}
type LDAPString = ShortText

{- | Distinguished Name  (<https://tools.ietf.org/html/rfc4511#section-4.1.3 RFC4511 Section 4.1.3>)

> LDAPDN ::= LDAPString -- Constrained to <distinguishedName>
>                       -- [RFC4514]

-}
type LDAPDN = LDAPString

{- | Relative Distinguished Name  (<https://tools.ietf.org/html/rfc4511#section-4.1.3 RFC4511 Section 4.1.3>)

> RelativeLDAPDN ::= LDAPString -- Constrained to <name-component>
>                               -- [RFC4514]

-}
type RelativeLDAPDN = LDAPString

{- | Modify Operation  (<https://tools.ietf.org/html/rfc4511#section-4.6 RFC4511 Section 4.6>)

> ModifyRequest ::= [APPLICATION 6] SEQUENCE {
>      object          LDAPDN,
>      changes         SEQUENCE OF change SEQUENCE {
>           operation       ENUMERATED {
>                add     (0),
>                delete  (1),
>                replace (2),
>                ...  },
>           modification    PartialAttribute } }

-}
data ModifyRequest = ModifyRequest
  { ModifyRequest -> LDAPDN
_ModifyRequest'object  :: LDAPDN
  , ModifyRequest -> [Change]
_ModifyRequest'changes :: [Change]
  } deriving ((forall x. ModifyRequest -> Rep ModifyRequest x)
-> (forall x. Rep ModifyRequest x -> ModifyRequest)
-> Generic ModifyRequest
forall x. Rep ModifyRequest x -> ModifyRequest
forall x. ModifyRequest -> Rep ModifyRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyRequest x -> ModifyRequest
$cfrom :: forall x. ModifyRequest -> Rep ModifyRequest x
Generic,Int -> ModifyRequest -> ShowS
[ModifyRequest] -> ShowS
ModifyRequest -> String
(Int -> ModifyRequest -> ShowS)
-> (ModifyRequest -> String)
-> ([ModifyRequest] -> ShowS)
-> Show ModifyRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyRequest] -> ShowS
$cshowList :: [ModifyRequest] -> ShowS
show :: ModifyRequest -> String
$cshow :: ModifyRequest -> String
showsPrec :: Int -> ModifyRequest -> ShowS
$cshowsPrec :: Int -> ModifyRequest -> ShowS
Show,ModifyRequest -> ModifyRequest -> Bool
(ModifyRequest -> ModifyRequest -> Bool)
-> (ModifyRequest -> ModifyRequest -> Bool) -> Eq ModifyRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyRequest -> ModifyRequest -> Bool
$c/= :: ModifyRequest -> ModifyRequest -> Bool
== :: ModifyRequest -> ModifyRequest -> Bool
$c== :: ModifyRequest -> ModifyRequest -> Bool
Eq)

instance NFData ModifyRequest

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 ModifyRequest where asn1defTag _ = Application 6
instance ASN1Constructed ModifyRequest
#endif

-- | See 'ModifyRequest'
data Change = Change
  { Change -> Operation
_Change'operation    :: ENUMERATED Operation
  , Change -> PartialAttribute
_Change'modification :: PartialAttribute
  } deriving ((forall x. Change -> Rep Change x)
-> (forall x. Rep Change x -> Change) -> Generic Change
forall x. Rep Change x -> Change
forall x. Change -> Rep Change x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Change x -> Change
$cfrom :: forall x. Change -> Rep Change x
Generic,Int -> Change -> ShowS
[Change] -> ShowS
Change -> String
(Int -> Change -> ShowS)
-> (Change -> String) -> ([Change] -> ShowS) -> Show Change
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Change] -> ShowS
$cshowList :: [Change] -> ShowS
show :: Change -> String
$cshow :: Change -> String
showsPrec :: Int -> Change -> ShowS
$cshowsPrec :: Int -> Change -> ShowS
Show,Change -> Change -> Bool
(Change -> Change -> Bool)
-> (Change -> Change -> Bool) -> Eq Change
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Change -> Change -> Bool
$c/= :: Change -> Change -> Bool
== :: Change -> Change -> Bool
$c== :: Change -> Change -> Bool
Eq)

instance NFData Change

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 Change
instance ASN1Constructed Change
#endif

-- | See 'ModifyRequest' and 'Change'
data Operation
  = Operation'add
  | Operation'delete
  | Operation'replace
  deriving ((forall x. Operation -> Rep Operation x)
-> (forall x. Rep Operation x -> Operation) -> Generic Operation
forall x. Rep Operation x -> Operation
forall x. Operation -> Rep Operation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Operation x -> Operation
$cfrom :: forall x. Operation -> Rep Operation x
Generic,Operation
Operation -> Operation -> Bounded Operation
forall a. a -> a -> Bounded a
maxBound :: Operation
$cmaxBound :: Operation
minBound :: Operation
$cminBound :: Operation
Bounded,Int -> Operation
Operation -> Int
Operation -> [Operation]
Operation -> Operation
Operation -> Operation -> [Operation]
Operation -> Operation -> Operation -> [Operation]
(Operation -> Operation)
-> (Operation -> Operation)
-> (Int -> Operation)
-> (Operation -> Int)
-> (Operation -> [Operation])
-> (Operation -> Operation -> [Operation])
-> (Operation -> Operation -> [Operation])
-> (Operation -> Operation -> Operation -> [Operation])
-> Enum Operation
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Operation -> Operation -> Operation -> [Operation]
$cenumFromThenTo :: Operation -> Operation -> Operation -> [Operation]
enumFromTo :: Operation -> Operation -> [Operation]
$cenumFromTo :: Operation -> Operation -> [Operation]
enumFromThen :: Operation -> Operation -> [Operation]
$cenumFromThen :: Operation -> Operation -> [Operation]
enumFrom :: Operation -> [Operation]
$cenumFrom :: Operation -> [Operation]
fromEnum :: Operation -> Int
$cfromEnum :: Operation -> Int
toEnum :: Int -> Operation
$ctoEnum :: Int -> Operation
pred :: Operation -> Operation
$cpred :: Operation -> Operation
succ :: Operation -> Operation
$csucc :: Operation -> Operation
Enum,Int -> Operation -> ShowS
[Operation] -> ShowS
Operation -> String
(Int -> Operation -> ShowS)
-> (Operation -> String)
-> ([Operation] -> ShowS)
-> Show Operation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Operation] -> ShowS
$cshowList :: [Operation] -> ShowS
show :: Operation -> String
$cshow :: Operation -> String
showsPrec :: Int -> Operation -> ShowS
$cshowsPrec :: Int -> Operation -> ShowS
Show,Operation -> Operation -> Bool
(Operation -> Operation -> Bool)
-> (Operation -> Operation -> Bool) -> Eq Operation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Operation -> Operation -> Bool
$c/= :: Operation -> Operation -> Bool
== :: Operation -> Operation -> Bool
$c== :: Operation -> Operation -> Bool
Eq)

instance NFData Operation where rnf :: Operation -> ()
rnf = Operation -> ()
forall a. a -> ()
rwhnf
instance Enumerated Operation


{- | Modify Response  (<https://tools.ietf.org/html/rfc4511#section-4.6 RFC4511 Section 4.6>)

> ModifyResponse ::= [APPLICATION 7] LDAPResult

-}
type ModifyResponse = ('APPLICATION 7 `IMPLICIT` LDAPResult)

{- | Add Operation  (<https://tools.ietf.org/html/rfc4511#section-4.7 RFC4511 Section 4.7>)

> AddRequest ::= [APPLICATION 8] SEQUENCE {
>      entry           LDAPDN,
>      attributes      AttributeList }

-}
data AddRequest = AddRequest
  { AddRequest -> LDAPDN
_AddRequest'entry      :: LDAPDN
  , AddRequest -> [Attribute]
_AddRequest'attributes :: AttributeList
  } deriving ((forall x. AddRequest -> Rep AddRequest x)
-> (forall x. Rep AddRequest x -> AddRequest) -> Generic AddRequest
forall x. Rep AddRequest x -> AddRequest
forall x. AddRequest -> Rep AddRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddRequest x -> AddRequest
$cfrom :: forall x. AddRequest -> Rep AddRequest x
Generic,Int -> AddRequest -> ShowS
[AddRequest] -> ShowS
AddRequest -> String
(Int -> AddRequest -> ShowS)
-> (AddRequest -> String)
-> ([AddRequest] -> ShowS)
-> Show AddRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddRequest] -> ShowS
$cshowList :: [AddRequest] -> ShowS
show :: AddRequest -> String
$cshow :: AddRequest -> String
showsPrec :: Int -> AddRequest -> ShowS
$cshowsPrec :: Int -> AddRequest -> ShowS
Show,AddRequest -> AddRequest -> Bool
(AddRequest -> AddRequest -> Bool)
-> (AddRequest -> AddRequest -> Bool) -> Eq AddRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddRequest -> AddRequest -> Bool
$c/= :: AddRequest -> AddRequest -> Bool
== :: AddRequest -> AddRequest -> Bool
$c== :: AddRequest -> AddRequest -> Bool
Eq)

instance NFData AddRequest

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 AddRequest where asn1defTag _ = Application 8
instance ASN1Constructed AddRequest
#endif

{- | Attribute List

> AttributeList ::= SEQUENCE OF attribute Attribute

-}
type AttributeList = [Attribute]

{- | Add Response  (<https://tools.ietf.org/html/rfc4511#section-4.7 RFC4511 Section 4.7>)

> AddResponse ::= [APPLICATION 9] LDAPResult

-}
type AddResponse = ('APPLICATION 9 `IMPLICIT` LDAPResult)


{- | Delete Operation  (<https://tools.ietf.org/html/rfc4511#section-4.8 RFC4511 Section 4.8>)

> DelRequest ::= [APPLICATION 10] LDAPDN

-}
type DelRequest = ('APPLICATION 10 `IMPLICIT` LDAPDN)

{- | Delete Response  (<https://tools.ietf.org/html/rfc4511#section-4.8 RFC4511 Section 4.8>)

> DelResponse ::= [APPLICATION 11] LDAPResult

-}
type DelResponse = ('APPLICATION 11 `IMPLICIT` LDAPResult)

{- | Modify DN Operation  (<https://tools.ietf.org/html/rfc4511#section-4.9 RFC4511 Section 4.9>)

ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
     entry           LDAPDN,
     newrdn          RelativeLDAPDN,
     deleteoldrdn    BOOLEAN,
     newSuperior     [0] LDAPDN OPTIONAL }

-}
data ModifyDNRequest = ModifyDNRequest
  { ModifyDNRequest -> LDAPDN
_ModifyDNRequest'entry        :: LDAPDN
  , ModifyDNRequest -> LDAPDN
_ModifyDNRequest'newrdn       :: RelativeLDAPDN
  , ModifyDNRequest -> Bool
_ModifyDNRequest'deleteoldrdn :: Bool
  , ModifyDNRequest -> Maybe LDAPDN
_ModifyDNRequest'newSuperior  :: Maybe ('CONTEXTUAL 0 `IMPLICIT` LDAPDN)
  } deriving ((forall x. ModifyDNRequest -> Rep ModifyDNRequest x)
-> (forall x. Rep ModifyDNRequest x -> ModifyDNRequest)
-> Generic ModifyDNRequest
forall x. Rep ModifyDNRequest x -> ModifyDNRequest
forall x. ModifyDNRequest -> Rep ModifyDNRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyDNRequest x -> ModifyDNRequest
$cfrom :: forall x. ModifyDNRequest -> Rep ModifyDNRequest x
Generic,Int -> ModifyDNRequest -> ShowS
[ModifyDNRequest] -> ShowS
ModifyDNRequest -> String
(Int -> ModifyDNRequest -> ShowS)
-> (ModifyDNRequest -> String)
-> ([ModifyDNRequest] -> ShowS)
-> Show ModifyDNRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyDNRequest] -> ShowS
$cshowList :: [ModifyDNRequest] -> ShowS
show :: ModifyDNRequest -> String
$cshow :: ModifyDNRequest -> String
showsPrec :: Int -> ModifyDNRequest -> ShowS
$cshowsPrec :: Int -> ModifyDNRequest -> ShowS
Show,ModifyDNRequest -> ModifyDNRequest -> Bool
(ModifyDNRequest -> ModifyDNRequest -> Bool)
-> (ModifyDNRequest -> ModifyDNRequest -> Bool)
-> Eq ModifyDNRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyDNRequest -> ModifyDNRequest -> Bool
$c/= :: ModifyDNRequest -> ModifyDNRequest -> Bool
== :: ModifyDNRequest -> ModifyDNRequest -> Bool
$c== :: ModifyDNRequest -> ModifyDNRequest -> Bool
Eq)

instance NFData ModifyDNRequest

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 ModifyDNRequest where asn1defTag _ = Application 12
instance ASN1Constructed ModifyDNRequest
#endif


{- | Modify DN Response  (<https://tools.ietf.org/html/rfc4511#section-4.9 RFC4511 Section 4.9>)

> ModifyDNResponse ::= [APPLICATION 13] LDAPResult

-}
type ModifyDNResponse = ('APPLICATION 13 `IMPLICIT` LDAPResult)


{- | Compare Operation  (<https://tools.ietf.org/html/rfc4511#section-4.10 RFC4511 Section 4.10>)

> CompareRequest ::= [APPLICATION 14] SEQUENCE {
>      entry           LDAPDN,
>      ava             AttributeValueAssertion }

-}
data CompareRequest = CompareRequest
  { CompareRequest -> LDAPDN
_CompareRequest'entry :: LDAPDN
  , CompareRequest -> AttributeValueAssertion
_CompareRequest'ava   :: AttributeValueAssertion
  } deriving ((forall x. CompareRequest -> Rep CompareRequest x)
-> (forall x. Rep CompareRequest x -> CompareRequest)
-> Generic CompareRequest
forall x. Rep CompareRequest x -> CompareRequest
forall x. CompareRequest -> Rep CompareRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompareRequest x -> CompareRequest
$cfrom :: forall x. CompareRequest -> Rep CompareRequest x
Generic,Int -> CompareRequest -> ShowS
[CompareRequest] -> ShowS
CompareRequest -> String
(Int -> CompareRequest -> ShowS)
-> (CompareRequest -> String)
-> ([CompareRequest] -> ShowS)
-> Show CompareRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompareRequest] -> ShowS
$cshowList :: [CompareRequest] -> ShowS
show :: CompareRequest -> String
$cshow :: CompareRequest -> String
showsPrec :: Int -> CompareRequest -> ShowS
$cshowsPrec :: Int -> CompareRequest -> ShowS
Show,CompareRequest -> CompareRequest -> Bool
(CompareRequest -> CompareRequest -> Bool)
-> (CompareRequest -> CompareRequest -> Bool) -> Eq CompareRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompareRequest -> CompareRequest -> Bool
$c/= :: CompareRequest -> CompareRequest -> Bool
== :: CompareRequest -> CompareRequest -> Bool
$c== :: CompareRequest -> CompareRequest -> Bool
Eq)

instance NFData CompareRequest

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 CompareRequest where asn1defTag _ = Application 14
instance ASN1Constructed CompareRequest
#endif

{- | Compare Response  (<https://tools.ietf.org/html/rfc4511#section-4.10 RFC4511 Section 4.10>)

> CompareResponse ::= [APPLICATION 15] LDAPResult

-}
type CompareResponse = ('APPLICATION 15 `IMPLICIT` LDAPResult)


{- | Abandon Operation  (<https://tools.ietf.org/html/rfc4511#section-4.11 RFC4511 Section 4.11>)

> AbandonRequest ::= [APPLICATION 16] MessageID

-}
type AbandonRequest = ('APPLICATION 16 `IMPLICIT` MessageID)

{- | Extended Request  (<https://tools.ietf.org/html/rfc4511#section-4.12 RFC4511 Section 4.12>)

> ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
>      requestName      [0] LDAPOID,
>      requestValue     [1] OCTET STRING OPTIONAL }

-}
data ExtendedRequest = ExtendedRequest
  { ExtendedRequest -> LDAPOID
_ExtendedRequest'responseName  ::       ('CONTEXTUAL 0 `IMPLICIT` LDAPOID)
  , ExtendedRequest -> Maybe LDAPOID
_ExtendedRequest'responseValue :: Maybe ('CONTEXTUAL 1 `IMPLICIT` OCTET_STRING)
  } deriving ((forall x. ExtendedRequest -> Rep ExtendedRequest x)
-> (forall x. Rep ExtendedRequest x -> ExtendedRequest)
-> Generic ExtendedRequest
forall x. Rep ExtendedRequest x -> ExtendedRequest
forall x. ExtendedRequest -> Rep ExtendedRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExtendedRequest x -> ExtendedRequest
$cfrom :: forall x. ExtendedRequest -> Rep ExtendedRequest x
Generic,Int -> ExtendedRequest -> ShowS
[ExtendedRequest] -> ShowS
ExtendedRequest -> String
(Int -> ExtendedRequest -> ShowS)
-> (ExtendedRequest -> String)
-> ([ExtendedRequest] -> ShowS)
-> Show ExtendedRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExtendedRequest] -> ShowS
$cshowList :: [ExtendedRequest] -> ShowS
show :: ExtendedRequest -> String
$cshow :: ExtendedRequest -> String
showsPrec :: Int -> ExtendedRequest -> ShowS
$cshowsPrec :: Int -> ExtendedRequest -> ShowS
Show,ExtendedRequest -> ExtendedRequest -> Bool
(ExtendedRequest -> ExtendedRequest -> Bool)
-> (ExtendedRequest -> ExtendedRequest -> Bool)
-> Eq ExtendedRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExtendedRequest -> ExtendedRequest -> Bool
$c/= :: ExtendedRequest -> ExtendedRequest -> Bool
== :: ExtendedRequest -> ExtendedRequest -> Bool
$c== :: ExtendedRequest -> ExtendedRequest -> Bool
Eq)

instance NFData ExtendedRequest

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 ExtendedRequest where asn1defTag _ = Application 23
instance ASN1Constructed ExtendedRequest
#endif

{- | Extended Response  (<https://tools.ietf.org/html/rfc4511#section-4.12 RFC4511 Section 4.12>)

> ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
>      COMPONENTS OF LDAPResult,
>      responseName     [10] LDAPOID OPTIONAL,
>      responseValue    [11] OCTET STRING OPTIONAL }

-}
data ExtendedResponse = ExtendedResponse
  { ExtendedResponse -> COMPONENTS_OF LDAPResult
_ExtendedResponse'LDAPResult    :: COMPONENTS_OF LDAPResult
  , ExtendedResponse -> Maybe LDAPOID
_ExtendedResponse'responseName  :: Maybe ('CONTEXTUAL 10 `IMPLICIT` LDAPOID)
  , ExtendedResponse -> Maybe LDAPOID
_ExtendedResponse'responseValue :: Maybe ('CONTEXTUAL 11 `IMPLICIT` OCTET_STRING)
  } deriving ((forall x. ExtendedResponse -> Rep ExtendedResponse x)
-> (forall x. Rep ExtendedResponse x -> ExtendedResponse)
-> Generic ExtendedResponse
forall x. Rep ExtendedResponse x -> ExtendedResponse
forall x. ExtendedResponse -> Rep ExtendedResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExtendedResponse x -> ExtendedResponse
$cfrom :: forall x. ExtendedResponse -> Rep ExtendedResponse x
Generic,Int -> ExtendedResponse -> ShowS
[ExtendedResponse] -> ShowS
ExtendedResponse -> String
(Int -> ExtendedResponse -> ShowS)
-> (ExtendedResponse -> String)
-> ([ExtendedResponse] -> ShowS)
-> Show ExtendedResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExtendedResponse] -> ShowS
$cshowList :: [ExtendedResponse] -> ShowS
show :: ExtendedResponse -> String
$cshow :: ExtendedResponse -> String
showsPrec :: Int -> ExtendedResponse -> ShowS
$cshowsPrec :: Int -> ExtendedResponse -> ShowS
Show,ExtendedResponse -> ExtendedResponse -> Bool
(ExtendedResponse -> ExtendedResponse -> Bool)
-> (ExtendedResponse -> ExtendedResponse -> Bool)
-> Eq ExtendedResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExtendedResponse -> ExtendedResponse -> Bool
$c/= :: ExtendedResponse -> ExtendedResponse -> Bool
== :: ExtendedResponse -> ExtendedResponse -> Bool
$c== :: ExtendedResponse -> ExtendedResponse -> Bool
Eq)

instance NFData ExtendedResponse

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 ExtendedResponse where asn1defTag _ = Application 24
instance ASN1Constructed ExtendedResponse
#endif

{- | Intermediate Response  (<https://tools.ietf.org/html/rfc4511#section-4.13 RFC4511 Section 4.13>)

> IntermediateResponse ::= [APPLICATION 25] SEQUENCE {
>         responseName     [0] LDAPOID OPTIONAL,
>         responseValue    [1] OCTET STRING OPTIONAL }

-}
data IntermediateResponse = IntermediateResponse
  { IntermediateResponse -> Maybe LDAPOID
_IntermediateResponse'responseName  :: Maybe ('CONTEXTUAL 0 `IMPLICIT` LDAPOID)
  , IntermediateResponse -> Maybe LDAPOID
_IntermediateResponse'responseValue :: Maybe ('CONTEXTUAL 1 `IMPLICIT` OCTET_STRING)
  } deriving ((forall x. IntermediateResponse -> Rep IntermediateResponse x)
-> (forall x. Rep IntermediateResponse x -> IntermediateResponse)
-> Generic IntermediateResponse
forall x. Rep IntermediateResponse x -> IntermediateResponse
forall x. IntermediateResponse -> Rep IntermediateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntermediateResponse x -> IntermediateResponse
$cfrom :: forall x. IntermediateResponse -> Rep IntermediateResponse x
Generic,Int -> IntermediateResponse -> ShowS
[IntermediateResponse] -> ShowS
IntermediateResponse -> String
(Int -> IntermediateResponse -> ShowS)
-> (IntermediateResponse -> String)
-> ([IntermediateResponse] -> ShowS)
-> Show IntermediateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntermediateResponse] -> ShowS
$cshowList :: [IntermediateResponse] -> ShowS
show :: IntermediateResponse -> String
$cshow :: IntermediateResponse -> String
showsPrec :: Int -> IntermediateResponse -> ShowS
$cshowsPrec :: Int -> IntermediateResponse -> ShowS
Show,IntermediateResponse -> IntermediateResponse -> Bool
(IntermediateResponse -> IntermediateResponse -> Bool)
-> (IntermediateResponse -> IntermediateResponse -> Bool)
-> Eq IntermediateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntermediateResponse -> IntermediateResponse -> Bool
$c/= :: IntermediateResponse -> IntermediateResponse -> Bool
== :: IntermediateResponse -> IntermediateResponse -> Bool
$c== :: IntermediateResponse -> IntermediateResponse -> Bool
Eq)

instance NFData IntermediateResponse

#if defined(HS_LDAPv3_ANNOTATED)
instance ASN1 IntermediateResponse where asn1defTag _ = Application 25
instance ASN1Constructed IntermediateResponse
#endif