File: Data.hsc

package info (click to toggle)
ldap-haskell 0.6.11-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 164 kB
  • sloc: haskell: 83; ansic: 34; makefile: 2
file content (344 lines) | stat: -rw-r--r-- 14,098 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
-- AUTO-GENERATED FILE, DO NOT EDIT.  GENERATED BY utils/genconsts.hs
{- |
   Module     : LDAP.Data
   Copyright  : Copyright (C) 2005 John Goerzen
   License    : BSD

   Maintainer : John Goerzen,
   Maintainer : jgoerzen\@complete.org
   Stability  : provisional
   Portability: portable

Haskell types for LDAP constants

Written by John Goerzen, jgoerzen\@complete.org
-}

module LDAP.Data (module LDAP.Data) where

#include "ldap.h"


data LDAPReturnCode =
   LdapSuccess
 | LdapOperationsError
 | LdapProtocolError
 | LdapTimelimitExceeded
 | LdapSizelimitExceeded
 | LdapCompareFalse
 | LdapCompareTrue
 | LdapAuthMethodNotSupported
 | LdapStrongAuthNotSupported
 | LdapStrongAuthRequired
 | LdapPartialResults
 | LdapReferral
 | LdapAdminlimitExceeded
 | LdapUnavailableCriticalExtension
 | LdapConfidentialityRequired
 | LdapSaslBindInProgress
 | LdapNoSuchAttribute
 | LdapUndefinedType
 | LdapInappropriateMatching
 | LdapConstraintViolation
 | LdapTypeOrValueExists
 | LdapInvalidSyntax
 | LdapNoSuchObject
 | LdapAliasProblem
 | LdapInvalidDnSyntax
 | LdapIsLeaf
 | LdapAliasDerefProblem
 | LdapProxyAuthzFailure
 | LdapInappropriateAuth
 | LdapInvalidCredentials
 | LdapInsufficientAccess
 | LdapBusy
 | LdapUnavailable
 | LdapUnwillingToPerform
 | LdapLoopDetect
 | LdapNamingViolation
 | LdapObjectClassViolation
 | LdapNotAllowedOnNonleaf
 | LdapNotAllowedOnRdn
 | LdapAlreadyExists
 | LdapNoObjectClassMods
 | LdapResultsTooLarge
 | LdapAffectsMultipleDsas
 | LdapOther
 | LdapServerDown
 | LdapLocalError
 | LdapEncodingError
 | LdapDecodingError
 | LdapTimeout
 | LdapAuthUnknown
 | LdapFilterError
 | LdapUserCancelled
 | LdapParamError
 | LdapNoMemory
 | LdapConnectError
 | LdapNotSupported
 | LdapControlNotFound
 | LdapNoResultsReturned
 | LdapMoreResultsToReturn
 | LdapClientLoop
 | LdapReferralLimitExceeded
 | UnknownLDAPReturnCode Int

 deriving (Show)

instance Enum LDAPReturnCode where
 toEnum (#{const LDAP_SUCCESS}) = LdapSuccess
 toEnum (#{const LDAP_OPERATIONS_ERROR}) = LdapOperationsError
 toEnum (#{const LDAP_PROTOCOL_ERROR}) = LdapProtocolError
 toEnum (#{const LDAP_TIMELIMIT_EXCEEDED}) = LdapTimelimitExceeded
 toEnum (#{const LDAP_SIZELIMIT_EXCEEDED}) = LdapSizelimitExceeded
 toEnum (#{const LDAP_COMPARE_FALSE}) = LdapCompareFalse
 toEnum (#{const LDAP_COMPARE_TRUE}) = LdapCompareTrue
 toEnum (#{const LDAP_AUTH_METHOD_NOT_SUPPORTED}) = LdapAuthMethodNotSupported
 toEnum (#{const LDAP_STRONG_AUTH_NOT_SUPPORTED}) = LdapStrongAuthNotSupported
 toEnum (#{const LDAP_STRONG_AUTH_REQUIRED}) = LdapStrongAuthRequired
 toEnum (#{const LDAP_PARTIAL_RESULTS}) = LdapPartialResults
 toEnum (#{const LDAP_REFERRAL}) = LdapReferral
 toEnum (#{const LDAP_ADMINLIMIT_EXCEEDED}) = LdapAdminlimitExceeded
 toEnum (#{const LDAP_UNAVAILABLE_CRITICAL_EXTENSION}) = LdapUnavailableCriticalExtension
 toEnum (#{const LDAP_CONFIDENTIALITY_REQUIRED}) = LdapConfidentialityRequired
 toEnum (#{const LDAP_SASL_BIND_IN_PROGRESS}) = LdapSaslBindInProgress
 toEnum (#{const LDAP_NO_SUCH_ATTRIBUTE}) = LdapNoSuchAttribute
 toEnum (#{const LDAP_UNDEFINED_TYPE}) = LdapUndefinedType
 toEnum (#{const LDAP_INAPPROPRIATE_MATCHING}) = LdapInappropriateMatching
 toEnum (#{const LDAP_CONSTRAINT_VIOLATION}) = LdapConstraintViolation
 toEnum (#{const LDAP_TYPE_OR_VALUE_EXISTS}) = LdapTypeOrValueExists
 toEnum (#{const LDAP_INVALID_SYNTAX}) = LdapInvalidSyntax
 toEnum (#{const LDAP_NO_SUCH_OBJECT}) = LdapNoSuchObject
 toEnum (#{const LDAP_ALIAS_PROBLEM}) = LdapAliasProblem
 toEnum (#{const LDAP_INVALID_DN_SYNTAX}) = LdapInvalidDnSyntax
 toEnum (#{const LDAP_IS_LEAF}) = LdapIsLeaf
 toEnum (#{const LDAP_ALIAS_DEREF_PROBLEM}) = LdapAliasDerefProblem
 toEnum (#{const LDAP_X_PROXY_AUTHZ_FAILURE}) = LdapProxyAuthzFailure
 toEnum (#{const LDAP_INAPPROPRIATE_AUTH}) = LdapInappropriateAuth
 toEnum (#{const LDAP_INVALID_CREDENTIALS}) = LdapInvalidCredentials
 toEnum (#{const LDAP_INSUFFICIENT_ACCESS}) = LdapInsufficientAccess
 toEnum (#{const LDAP_BUSY}) = LdapBusy
 toEnum (#{const LDAP_UNAVAILABLE}) = LdapUnavailable
 toEnum (#{const LDAP_UNWILLING_TO_PERFORM}) = LdapUnwillingToPerform
 toEnum (#{const LDAP_LOOP_DETECT}) = LdapLoopDetect
 toEnum (#{const LDAP_NAMING_VIOLATION}) = LdapNamingViolation
 toEnum (#{const LDAP_OBJECT_CLASS_VIOLATION}) = LdapObjectClassViolation
 toEnum (#{const LDAP_NOT_ALLOWED_ON_NONLEAF}) = LdapNotAllowedOnNonleaf
 toEnum (#{const LDAP_NOT_ALLOWED_ON_RDN}) = LdapNotAllowedOnRdn
 toEnum (#{const LDAP_ALREADY_EXISTS}) = LdapAlreadyExists
 toEnum (#{const LDAP_NO_OBJECT_CLASS_MODS}) = LdapNoObjectClassMods
 toEnum (#{const LDAP_RESULTS_TOO_LARGE}) = LdapResultsTooLarge
 toEnum (#{const LDAP_AFFECTS_MULTIPLE_DSAS}) = LdapAffectsMultipleDsas
 toEnum (#{const LDAP_OTHER}) = LdapOther
 toEnum (#{const LDAP_SERVER_DOWN}) = LdapServerDown
 toEnum (#{const LDAP_LOCAL_ERROR}) = LdapLocalError
 toEnum (#{const LDAP_ENCODING_ERROR}) = LdapEncodingError
 toEnum (#{const LDAP_DECODING_ERROR}) = LdapDecodingError
 toEnum (#{const LDAP_TIMEOUT}) = LdapTimeout
 toEnum (#{const LDAP_AUTH_UNKNOWN}) = LdapAuthUnknown
 toEnum (#{const LDAP_FILTER_ERROR}) = LdapFilterError
 toEnum (#{const LDAP_USER_CANCELLED}) = LdapUserCancelled
 toEnum (#{const LDAP_PARAM_ERROR}) = LdapParamError
 toEnum (#{const LDAP_NO_MEMORY}) = LdapNoMemory
 toEnum (#{const LDAP_CONNECT_ERROR}) = LdapConnectError
 toEnum (#{const LDAP_NOT_SUPPORTED}) = LdapNotSupported
 toEnum (#{const LDAP_CONTROL_NOT_FOUND}) = LdapControlNotFound
 toEnum (#{const LDAP_NO_RESULTS_RETURNED}) = LdapNoResultsReturned
 toEnum (#{const LDAP_MORE_RESULTS_TO_RETURN}) = LdapMoreResultsToReturn
 toEnum (#{const LDAP_CLIENT_LOOP}) = LdapClientLoop
 toEnum (#{const LDAP_REFERRAL_LIMIT_EXCEEDED}) = LdapReferralLimitExceeded
 toEnum x = UnknownLDAPReturnCode x

 fromEnum LdapSuccess = (#{const LDAP_SUCCESS})
 fromEnum LdapOperationsError = (#{const LDAP_OPERATIONS_ERROR})
 fromEnum LdapProtocolError = (#{const LDAP_PROTOCOL_ERROR})
 fromEnum LdapTimelimitExceeded = (#{const LDAP_TIMELIMIT_EXCEEDED})
 fromEnum LdapSizelimitExceeded = (#{const LDAP_SIZELIMIT_EXCEEDED})
 fromEnum LdapCompareFalse = (#{const LDAP_COMPARE_FALSE})
 fromEnum LdapCompareTrue = (#{const LDAP_COMPARE_TRUE})
 fromEnum LdapAuthMethodNotSupported = (#{const LDAP_AUTH_METHOD_NOT_SUPPORTED})
 fromEnum LdapStrongAuthNotSupported = (#{const LDAP_STRONG_AUTH_NOT_SUPPORTED})
 fromEnum LdapStrongAuthRequired = (#{const LDAP_STRONG_AUTH_REQUIRED})
 fromEnum LdapPartialResults = (#{const LDAP_PARTIAL_RESULTS})
 fromEnum LdapReferral = (#{const LDAP_REFERRAL})
 fromEnum LdapAdminlimitExceeded = (#{const LDAP_ADMINLIMIT_EXCEEDED})
 fromEnum LdapUnavailableCriticalExtension = (#{const LDAP_UNAVAILABLE_CRITICAL_EXTENSION})
 fromEnum LdapConfidentialityRequired = (#{const LDAP_CONFIDENTIALITY_REQUIRED})
 fromEnum LdapSaslBindInProgress = (#{const LDAP_SASL_BIND_IN_PROGRESS})
 fromEnum LdapNoSuchAttribute = (#{const LDAP_NO_SUCH_ATTRIBUTE})
 fromEnum LdapUndefinedType = (#{const LDAP_UNDEFINED_TYPE})
 fromEnum LdapInappropriateMatching = (#{const LDAP_INAPPROPRIATE_MATCHING})
 fromEnum LdapConstraintViolation = (#{const LDAP_CONSTRAINT_VIOLATION})
 fromEnum LdapTypeOrValueExists = (#{const LDAP_TYPE_OR_VALUE_EXISTS})
 fromEnum LdapInvalidSyntax = (#{const LDAP_INVALID_SYNTAX})
 fromEnum LdapNoSuchObject = (#{const LDAP_NO_SUCH_OBJECT})
 fromEnum LdapAliasProblem = (#{const LDAP_ALIAS_PROBLEM})
 fromEnum LdapInvalidDnSyntax = (#{const LDAP_INVALID_DN_SYNTAX})
 fromEnum LdapIsLeaf = (#{const LDAP_IS_LEAF})
 fromEnum LdapAliasDerefProblem = (#{const LDAP_ALIAS_DEREF_PROBLEM})
 fromEnum LdapProxyAuthzFailure = (#{const LDAP_X_PROXY_AUTHZ_FAILURE})
 fromEnum LdapInappropriateAuth = (#{const LDAP_INAPPROPRIATE_AUTH})
 fromEnum LdapInvalidCredentials = (#{const LDAP_INVALID_CREDENTIALS})
 fromEnum LdapInsufficientAccess = (#{const LDAP_INSUFFICIENT_ACCESS})
 fromEnum LdapBusy = (#{const LDAP_BUSY})
 fromEnum LdapUnavailable = (#{const LDAP_UNAVAILABLE})
 fromEnum LdapUnwillingToPerform = (#{const LDAP_UNWILLING_TO_PERFORM})
 fromEnum LdapLoopDetect = (#{const LDAP_LOOP_DETECT})
 fromEnum LdapNamingViolation = (#{const LDAP_NAMING_VIOLATION})
 fromEnum LdapObjectClassViolation = (#{const LDAP_OBJECT_CLASS_VIOLATION})
 fromEnum LdapNotAllowedOnNonleaf = (#{const LDAP_NOT_ALLOWED_ON_NONLEAF})
 fromEnum LdapNotAllowedOnRdn = (#{const LDAP_NOT_ALLOWED_ON_RDN})
 fromEnum LdapAlreadyExists = (#{const LDAP_ALREADY_EXISTS})
 fromEnum LdapNoObjectClassMods = (#{const LDAP_NO_OBJECT_CLASS_MODS})
 fromEnum LdapResultsTooLarge = (#{const LDAP_RESULTS_TOO_LARGE})
 fromEnum LdapAffectsMultipleDsas = (#{const LDAP_AFFECTS_MULTIPLE_DSAS})
 fromEnum LdapOther = (#{const LDAP_OTHER})
 fromEnum LdapServerDown = (#{const LDAP_SERVER_DOWN})
 fromEnum LdapLocalError = (#{const LDAP_LOCAL_ERROR})
 fromEnum LdapEncodingError = (#{const LDAP_ENCODING_ERROR})
 fromEnum LdapDecodingError = (#{const LDAP_DECODING_ERROR})
 fromEnum LdapTimeout = (#{const LDAP_TIMEOUT})
 fromEnum LdapAuthUnknown = (#{const LDAP_AUTH_UNKNOWN})
 fromEnum LdapFilterError = (#{const LDAP_FILTER_ERROR})
 fromEnum LdapUserCancelled = (#{const LDAP_USER_CANCELLED})
 fromEnum LdapParamError = (#{const LDAP_PARAM_ERROR})
 fromEnum LdapNoMemory = (#{const LDAP_NO_MEMORY})
 fromEnum LdapConnectError = (#{const LDAP_CONNECT_ERROR})
 fromEnum LdapNotSupported = (#{const LDAP_NOT_SUPPORTED})
 fromEnum LdapControlNotFound = (#{const LDAP_CONTROL_NOT_FOUND})
 fromEnum LdapNoResultsReturned = (#{const LDAP_NO_RESULTS_RETURNED})
 fromEnum LdapMoreResultsToReturn = (#{const LDAP_MORE_RESULTS_TO_RETURN})
 fromEnum LdapClientLoop = (#{const LDAP_CLIENT_LOOP})
 fromEnum LdapReferralLimitExceeded = (#{const LDAP_REFERRAL_LIMIT_EXCEEDED})
 fromEnum (UnknownLDAPReturnCode x) = x

instance Ord LDAPReturnCode where
 compare x y = compare (fromEnum x) (fromEnum y)

instance Eq LDAPReturnCode where
 x == y = (fromEnum x) == (fromEnum y)


data LDAPOptionCode =
   LdapOptApiInfo
 | LdapOptDesc
 | LdapOptDeref
 | LdapOptSizelimit
 | LdapOptTimelimit
 | LdapOptReferrals
 | LdapOptRestart
 | LdapOptProtocolVersion
 | LdapOptServerControls
 | LdapOptClientControls
 | LdapOptApiFeatureInfo
 | LdapOptHostName
 | LdapOptErrorNumber
 | LdapOptErrorString
 | LdapOptMatchedDn
 | LdapOptSuccess
 | LdapOptError
 | UnknownLDAPOptionCode Int

 deriving (Show)

instance Enum LDAPOptionCode where
 toEnum (#{const LDAP_OPT_API_INFO}) = LdapOptApiInfo
 toEnum (#{const LDAP_OPT_DESC}) = LdapOptDesc
 toEnum (#{const LDAP_OPT_DEREF}) = LdapOptDeref
 toEnum (#{const LDAP_OPT_SIZELIMIT}) = LdapOptSizelimit
 toEnum (#{const LDAP_OPT_TIMELIMIT}) = LdapOptTimelimit
 toEnum (#{const LDAP_OPT_REFERRALS}) = LdapOptReferrals
 toEnum (#{const LDAP_OPT_RESTART}) = LdapOptRestart
 toEnum (#{const LDAP_OPT_PROTOCOL_VERSION}) = LdapOptProtocolVersion
 toEnum (#{const LDAP_OPT_SERVER_CONTROLS}) = LdapOptServerControls
 toEnum (#{const LDAP_OPT_CLIENT_CONTROLS}) = LdapOptClientControls
 toEnum (#{const LDAP_OPT_API_FEATURE_INFO}) = LdapOptApiFeatureInfo
 toEnum (#{const LDAP_OPT_HOST_NAME}) = LdapOptHostName
 toEnum (#{const LDAP_OPT_ERROR_NUMBER}) = LdapOptErrorNumber
 toEnum (#{const LDAP_OPT_ERROR_STRING}) = LdapOptErrorString
 toEnum (#{const LDAP_OPT_MATCHED_DN}) = LdapOptMatchedDn
 toEnum (#{const LDAP_OPT_SUCCESS}) = LdapOptSuccess
 toEnum (#{const LDAP_OPT_ERROR}) = LdapOptError
 toEnum x = UnknownLDAPOptionCode x

 fromEnum LdapOptApiInfo = (#{const LDAP_OPT_API_INFO})
 fromEnum LdapOptDesc = (#{const LDAP_OPT_DESC})
 fromEnum LdapOptDeref = (#{const LDAP_OPT_DEREF})
 fromEnum LdapOptSizelimit = (#{const LDAP_OPT_SIZELIMIT})
 fromEnum LdapOptTimelimit = (#{const LDAP_OPT_TIMELIMIT})
 fromEnum LdapOptReferrals = (#{const LDAP_OPT_REFERRALS})
 fromEnum LdapOptRestart = (#{const LDAP_OPT_RESTART})
 fromEnum LdapOptProtocolVersion = (#{const LDAP_OPT_PROTOCOL_VERSION})
 fromEnum LdapOptServerControls = (#{const LDAP_OPT_SERVER_CONTROLS})
 fromEnum LdapOptClientControls = (#{const LDAP_OPT_CLIENT_CONTROLS})
 fromEnum LdapOptApiFeatureInfo = (#{const LDAP_OPT_API_FEATURE_INFO})
 fromEnum LdapOptHostName = (#{const LDAP_OPT_HOST_NAME})
 fromEnum LdapOptErrorNumber = (#{const LDAP_OPT_ERROR_NUMBER})
 fromEnum LdapOptErrorString = (#{const LDAP_OPT_ERROR_STRING})
 fromEnum LdapOptMatchedDn = (#{const LDAP_OPT_MATCHED_DN})
 fromEnum LdapOptSuccess = (#{const LDAP_OPT_SUCCESS})
 fromEnum LdapOptError = (#{const LDAP_OPT_ERROR})
 fromEnum (UnknownLDAPOptionCode x) = x

instance Ord LDAPOptionCode where
 compare x y = compare (fromEnum x) (fromEnum y)

instance Eq LDAPOptionCode where
 x == y = (fromEnum x) == (fromEnum y)


data LDAPScope =
   LdapScopeDefault
 | LdapScopeBase
 | LdapScopeOnelevel
 | LdapScopeSubtree
 | UnknownLDAPScope Int

 deriving (Show)

instance Enum LDAPScope where
 toEnum (#{const LDAP_SCOPE_DEFAULT}) = LdapScopeDefault
 toEnum (#{const LDAP_SCOPE_BASE}) = LdapScopeBase
 toEnum (#{const LDAP_SCOPE_ONELEVEL}) = LdapScopeOnelevel
 toEnum (#{const LDAP_SCOPE_SUBTREE}) = LdapScopeSubtree
 toEnum x = UnknownLDAPScope x

 fromEnum LdapScopeDefault = (#{const LDAP_SCOPE_DEFAULT})
 fromEnum LdapScopeBase = (#{const LDAP_SCOPE_BASE})
 fromEnum LdapScopeOnelevel = (#{const LDAP_SCOPE_ONELEVEL})
 fromEnum LdapScopeSubtree = (#{const LDAP_SCOPE_SUBTREE})
 fromEnum (UnknownLDAPScope x) = x

instance Ord LDAPScope where
 compare x y = compare (fromEnum x) (fromEnum y)

instance Eq LDAPScope where
 x == y = (fromEnum x) == (fromEnum y)


data LDAPModOp =
   LdapModAdd
 | LdapModDelete
 | LdapModReplace
 | UnknownLDAPModOp Int

 deriving (Show)

instance Enum LDAPModOp where
 toEnum (#{const LDAP_MOD_ADD}) = LdapModAdd
 toEnum (#{const LDAP_MOD_DELETE}) = LdapModDelete
 toEnum (#{const LDAP_MOD_REPLACE}) = LdapModReplace
 toEnum x = UnknownLDAPModOp x

 fromEnum LdapModAdd = (#{const LDAP_MOD_ADD})
 fromEnum LdapModDelete = (#{const LDAP_MOD_DELETE})
 fromEnum LdapModReplace = (#{const LDAP_MOD_REPLACE})
 fromEnum (UnknownLDAPModOp x) = x

instance Ord LDAPModOp where
 compare x y = compare (fromEnum x) (fromEnum y)

instance Eq LDAPModOp where
 x == y = (fromEnum x) == (fromEnum y)