1
%% Generated by the Erlang ASN.1 BER-compiler version:1.4.5
2
%% Purpose: encoder and decoder to the types in mod ELDAPv3
5
-include("ELDAPv3.hrl").
6
-define('RT_BER',asn1rt_ber_bin).
7
-asn1_info([{vsn,'1.4.5'},
9
{options,[ber,report_errors,{cwd,[47,104,111,109,101,47,112,97,98,108,111,47,108,111,99,111,115,47,106,117,110,103,101,114,108,47,108,105,98,47,101,108,100,97,112,47,115,114,99]},{outdir,[47,104,111,109,101,47,112,97,98,108,111,47,108,111,99,111,115,47,106,117,110,103,101,114,108,47,108,105,98,47,101,108,100,97,112,47,115,114,99]},{i,[46]},{i,[47,104,111,109,101,47,112,97,98,108,111,47,108,111,99,111,115,47,106,117,110,103,101,114,108,47,108,105,98,47,101,108,100,97,112,47,115,114,99]}]}]).
11
-export([encoding_rule/0]).
18
'enc_RelativeLDAPDN'/2,
19
'enc_AttributeType'/2,
20
'enc_AttributeDescription'/2,
21
'enc_AttributeDescriptionList'/2,
22
'enc_AttributeValue'/2,
23
'enc_AttributeValueAssertion'/2,
24
'enc_AssertionValue'/2,
26
'enc_MatchingRuleId'/2,
33
'enc_AuthenticationChoice'/2,
34
'enc_SaslCredentials'/2,
36
'enc_UnbindRequest'/2,
37
'enc_SearchRequest'/2,
39
'enc_SubstringFilter'/2,
40
'enc_MatchingRuleAssertion'/2,
41
'enc_SearchResultEntry'/2,
42
'enc_PartialAttributeList'/2,
43
'enc_SearchResultReference'/2,
44
'enc_SearchResultDone'/2,
45
'enc_ModifyRequest'/2,
46
'enc_AttributeTypeAndValues'/2,
47
'enc_ModifyResponse'/2,
49
'enc_AttributeList'/2,
53
'enc_ModifyDNRequest'/2,
54
'enc_ModifyDNResponse'/2,
55
'enc_CompareRequest'/2,
56
'enc_CompareResponse'/2,
57
'enc_AbandonRequest'/2,
58
'enc_ExtendedRequest'/2,
59
'enc_ExtendedResponse'/2
68
'dec_RelativeLDAPDN'/2,
69
'dec_AttributeType'/2,
70
'dec_AttributeDescription'/2,
71
'dec_AttributeDescriptionList'/2,
72
'dec_AttributeValue'/2,
73
'dec_AttributeValueAssertion'/2,
74
'dec_AssertionValue'/2,
76
'dec_MatchingRuleId'/2,
83
'dec_AuthenticationChoice'/2,
84
'dec_SaslCredentials'/2,
86
'dec_UnbindRequest'/2,
87
'dec_SearchRequest'/2,
89
'dec_SubstringFilter'/2,
90
'dec_MatchingRuleAssertion'/2,
91
'dec_SearchResultEntry'/2,
92
'dec_PartialAttributeList'/2,
93
'dec_SearchResultReference'/2,
94
'dec_SearchResultDone'/2,
95
'dec_ModifyRequest'/2,
96
'dec_AttributeTypeAndValues'/2,
97
'dec_ModifyResponse'/2,
99
'dec_AttributeList'/2,
103
'dec_ModifyDNRequest'/2,
104
'dec_ModifyDNResponse'/2,
105
'dec_CompareRequest'/2,
106
'dec_CompareResponse'/2,
107
'dec_AbandonRequest'/2,
108
'dec_ExtendedRequest'/2,
109
'dec_ExtendedResponse'/2
118
'dec_RelativeLDAPDN'/3,
119
'dec_AttributeType'/3,
120
'dec_AttributeDescription'/3,
121
'dec_AttributeDescriptionList'/3,
122
'dec_AttributeValue'/3,
123
'dec_AttributeValueAssertion'/3,
124
'dec_AssertionValue'/3,
126
'dec_MatchingRuleId'/3,
133
'dec_AuthenticationChoice'/3,
134
'dec_SaslCredentials'/3,
135
'dec_BindResponse'/3,
136
'dec_UnbindRequest'/3,
137
'dec_SearchRequest'/3,
139
'dec_SubstringFilter'/3,
140
'dec_MatchingRuleAssertion'/3,
141
'dec_SearchResultEntry'/3,
142
'dec_PartialAttributeList'/3,
143
'dec_SearchResultReference'/3,
144
'dec_SearchResultDone'/3,
145
'dec_ModifyRequest'/3,
146
'dec_AttributeTypeAndValues'/3,
147
'dec_ModifyResponse'/3,
149
'dec_AttributeList'/3,
153
'dec_ModifyDNRequest'/3,
154
'dec_ModifyDNResponse'/3,
155
'dec_CompareRequest'/3,
156
'dec_CompareResponse'/3,
157
'dec_AbandonRequest'/3,
158
'dec_ExtendedRequest'/3,
159
'dec_ExtendedResponse'/3
169
-export([encode/2,decode/2,encode_disp/2,decode_disp/2]).
175
case catch encode_disp(Type,Data) of
176
{'EXIT',{error,Reason}} ->
179
{error,{asn1,Reason}};
181
{ok,wrap_encode(Bytes)};
183
{ok,wrap_encode(Bytes)}
187
case catch decode_disp(Type,wrap_decode(Data)) of
188
{'EXIT',{error,Reason}} ->
191
{error,{asn1,Reason}};
198
encode_disp('LDAPMessage',Data) -> 'enc_LDAPMessage'(Data,[]);
199
encode_disp('MessageID',Data) -> 'enc_MessageID'(Data,[]);
200
encode_disp('LDAPString',Data) -> 'enc_LDAPString'(Data,[]);
201
encode_disp('LDAPOID',Data) -> 'enc_LDAPOID'(Data,[]);
202
encode_disp('LDAPDN',Data) -> 'enc_LDAPDN'(Data,[]);
203
encode_disp('RelativeLDAPDN',Data) -> 'enc_RelativeLDAPDN'(Data,[]);
204
encode_disp('AttributeType',Data) -> 'enc_AttributeType'(Data,[]);
205
encode_disp('AttributeDescription',Data) -> 'enc_AttributeDescription'(Data,[]);
206
encode_disp('AttributeDescriptionList',Data) -> 'enc_AttributeDescriptionList'(Data,[]);
207
encode_disp('AttributeValue',Data) -> 'enc_AttributeValue'(Data,[]);
208
encode_disp('AttributeValueAssertion',Data) -> 'enc_AttributeValueAssertion'(Data,[]);
209
encode_disp('AssertionValue',Data) -> 'enc_AssertionValue'(Data,[]);
210
encode_disp('Attribute',Data) -> 'enc_Attribute'(Data,[]);
211
encode_disp('MatchingRuleId',Data) -> 'enc_MatchingRuleId'(Data,[]);
212
encode_disp('LDAPResult',Data) -> 'enc_LDAPResult'(Data,[]);
213
encode_disp('Referral',Data) -> 'enc_Referral'(Data,[]);
214
encode_disp('LDAPURL',Data) -> 'enc_LDAPURL'(Data,[]);
215
encode_disp('Controls',Data) -> 'enc_Controls'(Data,[]);
216
encode_disp('Control',Data) -> 'enc_Control'(Data,[]);
217
encode_disp('BindRequest',Data) -> 'enc_BindRequest'(Data,[]);
218
encode_disp('AuthenticationChoice',Data) -> 'enc_AuthenticationChoice'(Data,[]);
219
encode_disp('SaslCredentials',Data) -> 'enc_SaslCredentials'(Data,[]);
220
encode_disp('BindResponse',Data) -> 'enc_BindResponse'(Data,[]);
221
encode_disp('UnbindRequest',Data) -> 'enc_UnbindRequest'(Data,[]);
222
encode_disp('SearchRequest',Data) -> 'enc_SearchRequest'(Data,[]);
223
encode_disp('Filter',Data) -> 'enc_Filter'(Data,[]);
224
encode_disp('SubstringFilter',Data) -> 'enc_SubstringFilter'(Data,[]);
225
encode_disp('MatchingRuleAssertion',Data) -> 'enc_MatchingRuleAssertion'(Data,[]);
226
encode_disp('SearchResultEntry',Data) -> 'enc_SearchResultEntry'(Data,[]);
227
encode_disp('PartialAttributeList',Data) -> 'enc_PartialAttributeList'(Data,[]);
228
encode_disp('SearchResultReference',Data) -> 'enc_SearchResultReference'(Data,[]);
229
encode_disp('SearchResultDone',Data) -> 'enc_SearchResultDone'(Data,[]);
230
encode_disp('ModifyRequest',Data) -> 'enc_ModifyRequest'(Data,[]);
231
encode_disp('AttributeTypeAndValues',Data) -> 'enc_AttributeTypeAndValues'(Data,[]);
232
encode_disp('ModifyResponse',Data) -> 'enc_ModifyResponse'(Data,[]);
233
encode_disp('AddRequest',Data) -> 'enc_AddRequest'(Data,[]);
234
encode_disp('AttributeList',Data) -> 'enc_AttributeList'(Data,[]);
235
encode_disp('AddResponse',Data) -> 'enc_AddResponse'(Data,[]);
236
encode_disp('DelRequest',Data) -> 'enc_DelRequest'(Data,[]);
237
encode_disp('DelResponse',Data) -> 'enc_DelResponse'(Data,[]);
238
encode_disp('ModifyDNRequest',Data) -> 'enc_ModifyDNRequest'(Data,[]);
239
encode_disp('ModifyDNResponse',Data) -> 'enc_ModifyDNResponse'(Data,[]);
240
encode_disp('CompareRequest',Data) -> 'enc_CompareRequest'(Data,[]);
241
encode_disp('CompareResponse',Data) -> 'enc_CompareResponse'(Data,[]);
242
encode_disp('AbandonRequest',Data) -> 'enc_AbandonRequest'(Data,[]);
243
encode_disp('ExtendedRequest',Data) -> 'enc_ExtendedRequest'(Data,[]);
244
encode_disp('ExtendedResponse',Data) -> 'enc_ExtendedResponse'(Data,[]);
245
encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).
248
decode_disp('LDAPMessage',Data) -> 'dec_LDAPMessage'(Data,mandatory);
249
decode_disp('MessageID',Data) -> 'dec_MessageID'(Data,mandatory);
250
decode_disp('LDAPString',Data) -> 'dec_LDAPString'(Data,mandatory);
251
decode_disp('LDAPOID',Data) -> 'dec_LDAPOID'(Data,mandatory);
252
decode_disp('LDAPDN',Data) -> 'dec_LDAPDN'(Data,mandatory);
253
decode_disp('RelativeLDAPDN',Data) -> 'dec_RelativeLDAPDN'(Data,mandatory);
254
decode_disp('AttributeType',Data) -> 'dec_AttributeType'(Data,mandatory);
255
decode_disp('AttributeDescription',Data) -> 'dec_AttributeDescription'(Data,mandatory);
256
decode_disp('AttributeDescriptionList',Data) -> 'dec_AttributeDescriptionList'(Data,mandatory);
257
decode_disp('AttributeValue',Data) -> 'dec_AttributeValue'(Data,mandatory);
258
decode_disp('AttributeValueAssertion',Data) -> 'dec_AttributeValueAssertion'(Data,mandatory);
259
decode_disp('AssertionValue',Data) -> 'dec_AssertionValue'(Data,mandatory);
260
decode_disp('Attribute',Data) -> 'dec_Attribute'(Data,mandatory);
261
decode_disp('MatchingRuleId',Data) -> 'dec_MatchingRuleId'(Data,mandatory);
262
decode_disp('LDAPResult',Data) -> 'dec_LDAPResult'(Data,mandatory);
263
decode_disp('Referral',Data) -> 'dec_Referral'(Data,mandatory);
264
decode_disp('LDAPURL',Data) -> 'dec_LDAPURL'(Data,mandatory);
265
decode_disp('Controls',Data) -> 'dec_Controls'(Data,mandatory);
266
decode_disp('Control',Data) -> 'dec_Control'(Data,mandatory);
267
decode_disp('BindRequest',Data) -> 'dec_BindRequest'(Data,mandatory);
268
decode_disp('AuthenticationChoice',Data) -> 'dec_AuthenticationChoice'(Data,mandatory);
269
decode_disp('SaslCredentials',Data) -> 'dec_SaslCredentials'(Data,mandatory);
270
decode_disp('BindResponse',Data) -> 'dec_BindResponse'(Data,mandatory);
271
decode_disp('UnbindRequest',Data) -> 'dec_UnbindRequest'(Data,mandatory);
272
decode_disp('SearchRequest',Data) -> 'dec_SearchRequest'(Data,mandatory);
273
decode_disp('Filter',Data) -> 'dec_Filter'(Data,mandatory);
274
decode_disp('SubstringFilter',Data) -> 'dec_SubstringFilter'(Data,mandatory);
275
decode_disp('MatchingRuleAssertion',Data) -> 'dec_MatchingRuleAssertion'(Data,mandatory);
276
decode_disp('SearchResultEntry',Data) -> 'dec_SearchResultEntry'(Data,mandatory);
277
decode_disp('PartialAttributeList',Data) -> 'dec_PartialAttributeList'(Data,mandatory);
278
decode_disp('SearchResultReference',Data) -> 'dec_SearchResultReference'(Data,mandatory);
279
decode_disp('SearchResultDone',Data) -> 'dec_SearchResultDone'(Data,mandatory);
280
decode_disp('ModifyRequest',Data) -> 'dec_ModifyRequest'(Data,mandatory);
281
decode_disp('AttributeTypeAndValues',Data) -> 'dec_AttributeTypeAndValues'(Data,mandatory);
282
decode_disp('ModifyResponse',Data) -> 'dec_ModifyResponse'(Data,mandatory);
283
decode_disp('AddRequest',Data) -> 'dec_AddRequest'(Data,mandatory);
284
decode_disp('AttributeList',Data) -> 'dec_AttributeList'(Data,mandatory);
285
decode_disp('AddResponse',Data) -> 'dec_AddResponse'(Data,mandatory);
286
decode_disp('DelRequest',Data) -> 'dec_DelRequest'(Data,mandatory);
287
decode_disp('DelResponse',Data) -> 'dec_DelResponse'(Data,mandatory);
288
decode_disp('ModifyDNRequest',Data) -> 'dec_ModifyDNRequest'(Data,mandatory);
289
decode_disp('ModifyDNResponse',Data) -> 'dec_ModifyDNResponse'(Data,mandatory);
290
decode_disp('CompareRequest',Data) -> 'dec_CompareRequest'(Data,mandatory);
291
decode_disp('CompareResponse',Data) -> 'dec_CompareResponse'(Data,mandatory);
292
decode_disp('AbandonRequest',Data) -> 'dec_AbandonRequest'(Data,mandatory);
293
decode_disp('ExtendedRequest',Data) -> 'dec_ExtendedRequest'(Data,mandatory);
294
decode_disp('ExtendedResponse',Data) -> 'dec_ExtendedResponse'(Data,mandatory);
295
decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).
299
wrap_encode(Bytes) when list(Bytes) ->
300
binary_to_list(list_to_binary(Bytes));
301
wrap_encode(Bytes) when binary(Bytes) ->
302
binary_to_list(Bytes);
303
wrap_encode(Bytes) -> Bytes.
305
wrap_decode(Bytes) when list(Bytes) ->
306
list_to_binary(Bytes);
307
wrap_decode(Bytes) -> Bytes.
311
case ?MODULE:module_info() of
312
MI when is_list(MI) ->
313
case lists:keysearch(attributes,1,MI) of
314
{value,{_,Attributes}} when is_list(Attributes) ->
315
case lists:keysearch(asn1_info,1,Attributes) of
316
{value,{_,Info}} when is_list(Info) ->
327
%%================================
329
%%================================
330
'enc_LDAPMessage'(Val, TagIn) ->
332
%%-------------------------------------------------
333
%% attribute number 1 with type INTEGER
334
%%-------------------------------------------------
335
{EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,messageID), []),
337
%%-------------------------------------------------
338
%% attribute number 2 with type CHOICE
339
%%-------------------------------------------------
340
{EncBytes2,EncLen2} = 'enc_LDAPMessage_protocolOp'(?RT_BER:cindex(3,Val,protocolOp), []),
342
%%-------------------------------------------------
343
%% attribute number 3 External ELDAPv3:Controls OPTIONAL
344
%%-------------------------------------------------
345
{EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,controls) of
346
asn1_NOVALUE -> {<<>>,0};
348
'enc_Controls'(?RT_BER:cindex(4,Val,controls), [{tag,128,0,'IMPLICIT',32}])
351
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
352
LenSoFar = EncLen1 + EncLen2 + EncLen3,
353
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
357
%%================================
358
%% LDAPMessage_protocolOp
359
%%================================
361
'enc_LDAPMessage_protocolOp'({'LDAPMessage_protocolOp',Val}, TagIn) ->
362
'enc_LDAPMessage_protocolOp'(Val, TagIn);
364
'enc_LDAPMessage_protocolOp'(Val, TagIn) ->
365
{EncBytes,EncLen} = case element(1,Val) of
367
'enc_BindRequest'(element(2,Val), []);
369
'enc_BindResponse'(element(2,Val), []);
371
?RT_BER:encode_null(element(2,Val), [{tag,64,2,'IMPLICIT',32}]);
373
'enc_SearchRequest'(element(2,Val), []);
375
'enc_SearchResultEntry'(element(2,Val), []);
377
'enc_SearchResultDone'(element(2,Val), []);
379
'enc_SearchResultReference'(element(2,Val), []);
381
'enc_ModifyRequest'(element(2,Val), []);
383
'enc_ModifyResponse'(element(2,Val), []);
385
'enc_AddRequest'(element(2,Val), []);
387
'enc_AddResponse'(element(2,Val), []);
389
?RT_BER:encode_octet_string([], element(2,Val), [{tag,64,10,'IMPLICIT',32}]);
391
'enc_DelResponse'(element(2,Val), []);
393
'enc_ModifyDNRequest'(element(2,Val), []);
395
'enc_ModifyDNResponse'(element(2,Val), []);
397
'enc_CompareRequest'(element(2,Val), []);
399
'enc_CompareResponse'(element(2,Val), []);
401
?RT_BER:encode_integer([], element(2,Val), [{tag,64,16,'IMPLICIT',32}]);
403
'enc_ExtendedRequest'(element(2,Val), []);
405
'enc_ExtendedResponse'(element(2,Val), []);
407
exit({error,{asn1,{invalid_choice_type,Else}}})
410
?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
413
'dec_LDAPMessage_protocolOp'(Bytes, OptOrMand, TagIn) ->
414
{{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
415
IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
416
IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
420
<<1:2,_:1,0:5,_/binary>> ->
421
{Dec, Rest, RbCho} = 'dec_BindRequest'(Bytes1, mandatory, []),
422
{{bindRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
426
<<1:2,_:1,1:5,_/binary>> ->
427
{Dec, Rest, RbCho} = 'dec_BindResponse'(Bytes1, mandatory, []),
428
{{bindResponse, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
432
<<1:2,_:1,2:5,_/binary>> ->
433
{Dec, Rest, RbCho} = ?RT_BER:decode_null(Bytes1,[{tag,64,2,'IMPLICIT',32}], mandatory),
434
{{unbindRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
438
<<1:2,_:1,3:5,_/binary>> ->
439
{Dec, Rest, RbCho} = 'dec_SearchRequest'(Bytes1, mandatory, []),
440
{{searchRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
444
<<1:2,_:1,4:5,_/binary>> ->
445
{Dec, Rest, RbCho} = 'dec_SearchResultEntry'(Bytes1, mandatory, []),
446
{{searchResEntry, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
450
<<1:2,_:1,5:5,_/binary>> ->
451
{Dec, Rest, RbCho} = 'dec_SearchResultDone'(Bytes1, mandatory, []),
452
{{searchResDone, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
456
<<1:2,_:1,19:5,_/binary>> ->
457
{Dec, Rest, RbCho} = 'dec_SearchResultReference'(Bytes1, mandatory, []),
458
{{searchResRef, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
462
<<1:2,_:1,6:5,_/binary>> ->
463
{Dec, Rest, RbCho} = 'dec_ModifyRequest'(Bytes1, mandatory, []),
464
{{modifyRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
468
<<1:2,_:1,7:5,_/binary>> ->
469
{Dec, Rest, RbCho} = 'dec_ModifyResponse'(Bytes1, mandatory, []),
470
{{modifyResponse, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
474
<<1:2,_:1,8:5,_/binary>> ->
475
{Dec, Rest, RbCho} = 'dec_AddRequest'(Bytes1, mandatory, []),
476
{{addRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
480
<<1:2,_:1,9:5,_/binary>> ->
481
{Dec, Rest, RbCho} = 'dec_AddResponse'(Bytes1, mandatory, []),
482
{{addResponse, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
486
<<1:2,_:1,10:5,_/binary>> ->
487
{Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,64,10,'IMPLICIT',32}], no_length, mandatory),
488
{{delRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
492
<<1:2,_:1,11:5,_/binary>> ->
493
{Dec, Rest, RbCho} = 'dec_DelResponse'(Bytes1, mandatory, []),
494
{{delResponse, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
498
<<1:2,_:1,12:5,_/binary>> ->
499
{Dec, Rest, RbCho} = 'dec_ModifyDNRequest'(Bytes1, mandatory, []),
500
{{modDNRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
504
<<1:2,_:1,13:5,_/binary>> ->
505
{Dec, Rest, RbCho} = 'dec_ModifyDNResponse'(Bytes1, mandatory, []),
506
{{modDNResponse, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
510
<<1:2,_:1,14:5,_/binary>> ->
511
{Dec, Rest, RbCho} = 'dec_CompareRequest'(Bytes1, mandatory, []),
512
{{compareRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
516
<<1:2,_:1,15:5,_/binary>> ->
517
{Dec, Rest, RbCho} = 'dec_CompareResponse'(Bytes1, mandatory, []),
518
{{compareResponse, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
522
<<1:2,_:1,16:5,_/binary>> ->
523
{Dec, Rest, RbCho} = ?RT_BER:decode_integer(Bytes1,{0,2147483647},[{tag,64,16,'IMPLICIT',32}], mandatory),
524
{{abandonRequest, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
528
<<1:2,_:1,23:5,_/binary>> ->
529
{Dec, Rest, RbCho} = 'dec_ExtendedRequest'(Bytes1, mandatory, []),
530
{{extendedReq, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
534
<<1:2,_:1,24:5,_/binary>> ->
535
{Dec, Rest, RbCho} = 'dec_ExtendedResponse'(Bytes1, mandatory, []),
536
{{extendedResp, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
540
mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
541
_ ->exit({error,{asn1,{no_optional_tag,Else}}})
546
'dec_LDAPMessage'(Bytes, OptOrMand) ->
547
'dec_LDAPMessage'(Bytes, OptOrMand, []).
549
'dec_LDAPMessage'(Bytes, OptOrMand, TagIn) ->
550
%%-------------------------------------------------
551
%% decode tag and length
552
%%-------------------------------------------------
553
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
554
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
556
%%-------------------------------------------------
557
%% attribute number 1 with type INTEGER
558
%%-------------------------------------------------
559
{Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,{0,2147483647},[], mandatory),
561
%%-------------------------------------------------
562
%% attribute number 2 with type CHOICE
563
%%-------------------------------------------------
564
{Term2,Bytes4,Rb3} = 'dec_LDAPMessage_protocolOp'(Bytes3, mandatory, []),
566
%%-------------------------------------------------
567
%% attribute number 3 External ELDAPv3:Controls OPTIONAL
568
%%-------------------------------------------------
569
{Term3,Bytes5,Rb4} = case Bytes4 of
570
<<2:2,_:1,0:5,_/binary>> ->
571
'dec_Controls'(Bytes4, opt_or_default, [{tag,128,0,'IMPLICIT',32}]);
573
{ asn1_NOVALUE, Bytes4, 0 }
576
{Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext),
577
{{'LDAPMessage', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}.
580
%%================================
582
%%================================
584
'enc_MessageID'({'MessageID',Val}, TagIn) ->
585
'enc_MessageID'(Val, TagIn);
587
'enc_MessageID'(Val, TagIn) ->
588
?RT_BER:encode_integer([], Val, TagIn ++ []).
591
'dec_MessageID'(Bytes, OptOrMand) ->
592
'dec_MessageID'(Bytes, OptOrMand, []).
594
'dec_MessageID'(Bytes, OptOrMand, TagIn) ->
595
?RT_BER:decode_integer(Bytes,{0,2147483647},TagIn++[], OptOrMand).
599
%%================================
601
%%================================
603
'enc_LDAPString'({'LDAPString',Val}, TagIn) ->
604
'enc_LDAPString'(Val, TagIn);
606
'enc_LDAPString'(Val, TagIn) ->
607
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
610
'dec_LDAPString'(Bytes, OptOrMand) ->
611
'dec_LDAPString'(Bytes, OptOrMand, []).
613
'dec_LDAPString'(Bytes, OptOrMand, TagIn) ->
614
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
618
%%================================
620
%%================================
622
'enc_LDAPOID'({'LDAPOID',Val}, TagIn) ->
623
'enc_LDAPOID'(Val, TagIn);
625
'enc_LDAPOID'(Val, TagIn) ->
626
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
629
'dec_LDAPOID'(Bytes, OptOrMand) ->
630
'dec_LDAPOID'(Bytes, OptOrMand, []).
632
'dec_LDAPOID'(Bytes, OptOrMand, TagIn) ->
633
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
637
%%================================
639
%%================================
641
'enc_LDAPDN'({'LDAPDN',Val}, TagIn) ->
642
'enc_LDAPDN'(Val, TagIn);
644
'enc_LDAPDN'(Val, TagIn) ->
645
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
648
'dec_LDAPDN'(Bytes, OptOrMand) ->
649
'dec_LDAPDN'(Bytes, OptOrMand, []).
651
'dec_LDAPDN'(Bytes, OptOrMand, TagIn) ->
652
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
656
%%================================
658
%%================================
660
'enc_RelativeLDAPDN'({'RelativeLDAPDN',Val}, TagIn) ->
661
'enc_RelativeLDAPDN'(Val, TagIn);
663
'enc_RelativeLDAPDN'(Val, TagIn) ->
664
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
667
'dec_RelativeLDAPDN'(Bytes, OptOrMand) ->
668
'dec_RelativeLDAPDN'(Bytes, OptOrMand, []).
670
'dec_RelativeLDAPDN'(Bytes, OptOrMand, TagIn) ->
671
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
675
%%================================
677
%%================================
679
'enc_AttributeType'({'AttributeType',Val}, TagIn) ->
680
'enc_AttributeType'(Val, TagIn);
682
'enc_AttributeType'(Val, TagIn) ->
683
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
686
'dec_AttributeType'(Bytes, OptOrMand) ->
687
'dec_AttributeType'(Bytes, OptOrMand, []).
689
'dec_AttributeType'(Bytes, OptOrMand, TagIn) ->
690
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
694
%%================================
695
%% AttributeDescription
696
%%================================
698
'enc_AttributeDescription'({'AttributeDescription',Val}, TagIn) ->
699
'enc_AttributeDescription'(Val, TagIn);
701
'enc_AttributeDescription'(Val, TagIn) ->
702
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
705
'dec_AttributeDescription'(Bytes, OptOrMand) ->
706
'dec_AttributeDescription'(Bytes, OptOrMand, []).
708
'dec_AttributeDescription'(Bytes, OptOrMand, TagIn) ->
709
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
713
%%================================
714
%% AttributeDescriptionList
715
%%================================
717
'enc_AttributeDescriptionList'({'AttributeDescriptionList',Val}, TagIn) ->
718
'enc_AttributeDescriptionList'(Val, TagIn);
720
'enc_AttributeDescriptionList'(Val, TagIn) ->
721
{EncBytes,EncLen} = 'enc_AttributeDescriptionList_components'(Val,[],0),
722
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
724
'enc_AttributeDescriptionList_components'([], AccBytes, AccLen) ->
725
{lists:reverse(AccBytes),AccLen};
727
'enc_AttributeDescriptionList_components'([H|T],AccBytes, AccLen) ->
728
{EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, []),
729
'enc_AttributeDescriptionList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
733
'dec_AttributeDescriptionList'(Bytes, OptOrMand) ->
734
'dec_AttributeDescriptionList'(Bytes, OptOrMand, []).
736
'dec_AttributeDescriptionList'(Bytes, OptOrMand, TagIn) ->
737
%%-------------------------------------------------
738
%% decode tag and length
739
%%-------------------------------------------------
740
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
741
?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
742
?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)
748
%%================================
750
%%================================
752
'enc_AttributeValue'({'AttributeValue',Val}, TagIn) ->
753
'enc_AttributeValue'(Val, TagIn);
755
'enc_AttributeValue'(Val, TagIn) ->
756
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
759
'dec_AttributeValue'(Bytes, OptOrMand) ->
760
'dec_AttributeValue'(Bytes, OptOrMand, []).
762
'dec_AttributeValue'(Bytes, OptOrMand, TagIn) ->
763
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
767
%%================================
768
%% AttributeValueAssertion
769
%%================================
770
'enc_AttributeValueAssertion'(Val, TagIn) ->
772
%%-------------------------------------------------
773
%% attribute number 1 with type OCTET STRING
774
%%-------------------------------------------------
775
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,attributeDesc), []),
777
%%-------------------------------------------------
778
%% attribute number 2 with type OCTET STRING
779
%%-------------------------------------------------
780
{EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,assertionValue), []),
782
BytesSoFar = [EncBytes1, EncBytes2],
783
LenSoFar = EncLen1 + EncLen2,
784
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
787
'dec_AttributeValueAssertion'(Bytes, OptOrMand) ->
788
'dec_AttributeValueAssertion'(Bytes, OptOrMand, []).
790
'dec_AttributeValueAssertion'(Bytes, OptOrMand, TagIn) ->
791
%%-------------------------------------------------
792
%% decode tag and length
793
%%-------------------------------------------------
794
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
795
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
797
%%-------------------------------------------------
798
%% attribute number 1 with type OCTET STRING
799
%%-------------------------------------------------
800
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
802
%%-------------------------------------------------
803
%% attribute number 2 with type OCTET STRING
804
%%-------------------------------------------------
805
{Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[], no_length, mandatory),
807
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
808
{{'AttributeValueAssertion', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
811
%%================================
813
%%================================
815
'enc_AssertionValue'({'AssertionValue',Val}, TagIn) ->
816
'enc_AssertionValue'(Val, TagIn);
818
'enc_AssertionValue'(Val, TagIn) ->
819
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
822
'dec_AssertionValue'(Bytes, OptOrMand) ->
823
'dec_AssertionValue'(Bytes, OptOrMand, []).
825
'dec_AssertionValue'(Bytes, OptOrMand, TagIn) ->
826
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
830
%%================================
832
%%================================
833
'enc_Attribute'(Val, TagIn) ->
835
%%-------------------------------------------------
836
%% attribute number 1 with type OCTET STRING
837
%%-------------------------------------------------
838
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,type), []),
840
%%-------------------------------------------------
841
%% attribute number 2 with type SET OF
842
%%-------------------------------------------------
843
{EncBytes2,EncLen2} = 'enc_Attribute_vals'(?RT_BER:cindex(3,Val,vals), []),
845
BytesSoFar = [EncBytes1, EncBytes2],
846
LenSoFar = EncLen1 + EncLen2,
847
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
851
%%================================
853
%%================================
855
'enc_Attribute_vals'({'Attribute_vals',Val}, TagIn) ->
856
'enc_Attribute_vals'(Val, TagIn);
858
'enc_Attribute_vals'(Val, TagIn) ->
859
{EncBytes,EncLen} = 'enc_Attribute_vals_components'(Val,[],0),
860
?RT_BER:encode_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], EncBytes, EncLen).
862
'enc_Attribute_vals_components'([], AccBytes, AccLen) ->
863
{lists:reverse(AccBytes),AccLen};
865
'enc_Attribute_vals_components'([H|T],AccBytes, AccLen) ->
866
{EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, []),
867
'enc_Attribute_vals_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
869
'dec_Attribute_vals'(Bytes, OptOrMand, TagIn) ->
870
%%-------------------------------------------------
871
%% decode tag and length
872
%%-------------------------------------------------
873
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], Bytes, OptOrMand),
874
?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
875
?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)
881
'dec_Attribute'(Bytes, OptOrMand) ->
882
'dec_Attribute'(Bytes, OptOrMand, []).
884
'dec_Attribute'(Bytes, OptOrMand, TagIn) ->
885
%%-------------------------------------------------
886
%% decode tag and length
887
%%-------------------------------------------------
888
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
889
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
891
%%-------------------------------------------------
892
%% attribute number 1 with type OCTET STRING
893
%%-------------------------------------------------
894
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
896
%%-------------------------------------------------
897
%% attribute number 2 with type SET OF
898
%%-------------------------------------------------
899
{Term2,Bytes4,Rb3} = 'dec_Attribute_vals'(Bytes3, mandatory, []),
901
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
902
{{'Attribute', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
905
%%================================
907
%%================================
909
'enc_MatchingRuleId'({'MatchingRuleId',Val}, TagIn) ->
910
'enc_MatchingRuleId'(Val, TagIn);
912
'enc_MatchingRuleId'(Val, TagIn) ->
913
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
916
'dec_MatchingRuleId'(Bytes, OptOrMand) ->
917
'dec_MatchingRuleId'(Bytes, OptOrMand, []).
919
'dec_MatchingRuleId'(Bytes, OptOrMand, TagIn) ->
920
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
924
%%================================
926
%%================================
927
'enc_LDAPResult'(Val, TagIn) ->
929
%%-------------------------------------------------
930
%% attribute number 1 with type ENUMERATED
931
%%-------------------------------------------------
932
{EncBytes1,EncLen1} = case (case ?RT_BER:cindex(2,Val,resultCode) of {_,_}->element(2,?RT_BER:cindex(2,Val,resultCode));_->?RT_BER:cindex(2,Val,resultCode) end) of
933
success -> ?RT_BER:encode_enumerated(0,[]);
934
operationsError -> ?RT_BER:encode_enumerated(1,[]);
935
protocolError -> ?RT_BER:encode_enumerated(2,[]);
936
timeLimitExceeded -> ?RT_BER:encode_enumerated(3,[]);
937
sizeLimitExceeded -> ?RT_BER:encode_enumerated(4,[]);
938
compareFalse -> ?RT_BER:encode_enumerated(5,[]);
939
compareTrue -> ?RT_BER:encode_enumerated(6,[]);
940
authMethodNotSupported -> ?RT_BER:encode_enumerated(7,[]);
941
strongAuthRequired -> ?RT_BER:encode_enumerated(8,[]);
942
referral -> ?RT_BER:encode_enumerated(10,[]);
943
adminLimitExceeded -> ?RT_BER:encode_enumerated(11,[]);
944
unavailableCriticalExtension -> ?RT_BER:encode_enumerated(12,[]);
945
confidentialityRequired -> ?RT_BER:encode_enumerated(13,[]);
946
saslBindInProgress -> ?RT_BER:encode_enumerated(14,[]);
947
noSuchAttribute -> ?RT_BER:encode_enumerated(16,[]);
948
undefinedAttributeType -> ?RT_BER:encode_enumerated(17,[]);
949
inappropriateMatching -> ?RT_BER:encode_enumerated(18,[]);
950
constraintViolation -> ?RT_BER:encode_enumerated(19,[]);
951
attributeOrValueExists -> ?RT_BER:encode_enumerated(20,[]);
952
invalidAttributeSyntax -> ?RT_BER:encode_enumerated(21,[]);
953
noSuchObject -> ?RT_BER:encode_enumerated(32,[]);
954
aliasProblem -> ?RT_BER:encode_enumerated(33,[]);
955
invalidDNSyntax -> ?RT_BER:encode_enumerated(34,[]);
956
aliasDereferencingProblem -> ?RT_BER:encode_enumerated(36,[]);
957
inappropriateAuthentication -> ?RT_BER:encode_enumerated(48,[]);
958
invalidCredentials -> ?RT_BER:encode_enumerated(49,[]);
959
insufficientAccessRights -> ?RT_BER:encode_enumerated(50,[]);
960
busy -> ?RT_BER:encode_enumerated(51,[]);
961
unavailable -> ?RT_BER:encode_enumerated(52,[]);
962
unwillingToPerform -> ?RT_BER:encode_enumerated(53,[]);
963
loopDetect -> ?RT_BER:encode_enumerated(54,[]);
964
namingViolation -> ?RT_BER:encode_enumerated(64,[]);
965
objectClassViolation -> ?RT_BER:encode_enumerated(65,[]);
966
notAllowedOnNonLeaf -> ?RT_BER:encode_enumerated(66,[]);
967
notAllowedOnRDN -> ?RT_BER:encode_enumerated(67,[]);
968
entryAlreadyExists -> ?RT_BER:encode_enumerated(68,[]);
969
objectClassModsProhibited -> ?RT_BER:encode_enumerated(69,[]);
970
affectsMultipleDSAs -> ?RT_BER:encode_enumerated(71,[]);
971
other -> ?RT_BER:encode_enumerated(80,[]);
972
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
975
%%-------------------------------------------------
976
%% attribute number 2 with type OCTET STRING
977
%%-------------------------------------------------
978
{EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,matchedDN), []),
980
%%-------------------------------------------------
981
%% attribute number 3 with type OCTET STRING
982
%%-------------------------------------------------
983
{EncBytes3,EncLen3} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(4,Val,errorMessage), []),
985
%%-------------------------------------------------
986
%% attribute number 4 External ELDAPv3:Referral OPTIONAL
987
%%-------------------------------------------------
988
{EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,referral) of
989
asn1_NOVALUE -> {<<>>,0};
991
'enc_Referral'(?RT_BER:cindex(5,Val,referral), [{tag,128,3,'IMPLICIT',32}])
994
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
995
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
996
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
999
'dec_LDAPResult'(Bytes, OptOrMand) ->
1000
'dec_LDAPResult'(Bytes, OptOrMand, []).
1002
'dec_LDAPResult'(Bytes, OptOrMand, TagIn) ->
1003
%%-------------------------------------------------
1004
%% decode tag and length
1005
%%-------------------------------------------------
1006
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1007
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1009
%%-------------------------------------------------
1010
%% attribute number 1 with type ENUMERATED
1011
%%-------------------------------------------------
1012
{Term1,Bytes3,Rb2} = ?RT_BER:decode_enumerated(Bytes2,[],[{success,0},{operationsError,1},{protocolError,2},{timeLimitExceeded,3},{sizeLimitExceeded,4},{compareFalse,5},{compareTrue,6},{authMethodNotSupported,7},{strongAuthRequired,8},{referral,10},{adminLimitExceeded,11},{unavailableCriticalExtension,12},{confidentialityRequired,13},{saslBindInProgress,14},{noSuchAttribute,16},{undefinedAttributeType,17},{inappropriateMatching,18},{constraintViolation,19},{attributeOrValueExists,20},{invalidAttributeSyntax,21},{noSuchObject,32},{aliasProblem,33},{invalidDNSyntax,34},{aliasDereferencingProblem,36},{inappropriateAuthentication,48},{invalidCredentials,49},{insufficientAccessRights,50},{busy,51},{unavailable,52},{unwillingToPerform,53},{loopDetect,54},{namingViolation,64},{objectClassViolation,65},{notAllowedOnNonLeaf,66},{notAllowedOnRDN,67},{entryAlreadyExists,68},{objectClassModsProhibited,69},{affectsMultipleDSAs,71},{other,80}],[], mandatory),
1014
%%-------------------------------------------------
1015
%% attribute number 2 with type OCTET STRING
1016
%%-------------------------------------------------
1017
{Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[], no_length, mandatory),
1019
%%-------------------------------------------------
1020
%% attribute number 3 with type OCTET STRING
1021
%%-------------------------------------------------
1022
{Term3,Bytes5,Rb4} = ?RT_BER:decode_octet_string(Bytes4,[],[], no_length, mandatory),
1024
%%-------------------------------------------------
1025
%% attribute number 4 External ELDAPv3:Referral OPTIONAL
1026
%%-------------------------------------------------
1027
{Term4,Bytes6,Rb5} = case Bytes5 of
1028
<<2:2,_:1,3:5,_/binary>> ->
1029
'dec_Referral'(Bytes5, opt_or_default, [{tag,128,3,'IMPLICIT',32}]);
1031
{ asn1_NOVALUE, Bytes5, 0 }
1034
{Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext),
1035
{{'LDAPResult', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}.
1038
%%================================
1040
%%================================
1042
'enc_Referral'({'Referral',Val}, TagIn) ->
1043
'enc_Referral'(Val, TagIn);
1045
'enc_Referral'(Val, TagIn) ->
1046
{EncBytes,EncLen} = 'enc_Referral_components'(Val,[],0),
1047
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
1049
'enc_Referral_components'([], AccBytes, AccLen) ->
1050
{lists:reverse(AccBytes),AccLen};
1052
'enc_Referral_components'([H|T],AccBytes, AccLen) ->
1053
{EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, []),
1054
'enc_Referral_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
1058
'dec_Referral'(Bytes, OptOrMand) ->
1059
'dec_Referral'(Bytes, OptOrMand, []).
1061
'dec_Referral'(Bytes, OptOrMand, TagIn) ->
1062
%%-------------------------------------------------
1063
%% decode tag and length
1064
%%-------------------------------------------------
1065
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1066
?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
1067
?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)
1073
%%================================
1075
%%================================
1077
'enc_LDAPURL'({'LDAPURL',Val}, TagIn) ->
1078
'enc_LDAPURL'(Val, TagIn);
1080
'enc_LDAPURL'(Val, TagIn) ->
1081
?RT_BER:encode_octet_string([], Val, TagIn ++ []).
1084
'dec_LDAPURL'(Bytes, OptOrMand) ->
1085
'dec_LDAPURL'(Bytes, OptOrMand, []).
1087
'dec_LDAPURL'(Bytes, OptOrMand, TagIn) ->
1088
?RT_BER:decode_octet_string(Bytes,[],TagIn++[], no_length, OptOrMand).
1092
%%================================
1094
%%================================
1096
'enc_Controls'({'Controls',Val}, TagIn) ->
1097
'enc_Controls'(Val, TagIn);
1099
'enc_Controls'(Val, TagIn) ->
1100
{EncBytes,EncLen} = 'enc_Controls_components'(Val,[],0),
1101
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
1103
'enc_Controls_components'([], AccBytes, AccLen) ->
1104
{lists:reverse(AccBytes),AccLen};
1106
'enc_Controls_components'([H|T],AccBytes, AccLen) ->
1107
{EncBytes,EncLen} = 'enc_Control'(H, []),
1108
'enc_Controls_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
1112
'dec_Controls'(Bytes, OptOrMand) ->
1113
'dec_Controls'(Bytes, OptOrMand, []).
1115
'dec_Controls'(Bytes, OptOrMand, TagIn) ->
1116
%%-------------------------------------------------
1117
%% decode tag and length
1118
%%-------------------------------------------------
1119
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1120
?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_Control'/3, [], []).
1125
%%================================
1127
%%================================
1128
'enc_Control'(Val, TagIn) ->
1130
%%-------------------------------------------------
1131
%% attribute number 1 with type OCTET STRING
1132
%%-------------------------------------------------
1133
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,controlType), []),
1135
%%-------------------------------------------------
1136
%% attribute number 2 with type BOOLEAN DEFAULT = false
1137
%%-------------------------------------------------
1138
{EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,criticality) of
1139
asn1_DEFAULT -> {<<>>,0};
1142
?RT_BER:encode_boolean(?RT_BER:cindex(3,Val,criticality), [])
1145
%%-------------------------------------------------
1146
%% attribute number 3 with type OCTET STRING OPTIONAL
1147
%%-------------------------------------------------
1148
{EncBytes3,EncLen3} = case ?RT_BER:cindex(4,Val,controlValue) of
1149
asn1_NOVALUE -> {<<>>,0};
1151
?RT_BER:encode_octet_string([], ?RT_BER:cindex(4,Val,controlValue), [])
1154
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
1155
LenSoFar = EncLen1 + EncLen2 + EncLen3,
1156
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
1159
'dec_Control'(Bytes, OptOrMand) ->
1160
'dec_Control'(Bytes, OptOrMand, []).
1162
'dec_Control'(Bytes, OptOrMand, TagIn) ->
1163
%%-------------------------------------------------
1164
%% decode tag and length
1165
%%-------------------------------------------------
1166
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1167
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1169
%%-------------------------------------------------
1170
%% attribute number 1 with type OCTET STRING
1171
%%-------------------------------------------------
1172
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
1174
%%-------------------------------------------------
1175
%% attribute number 2 with type BOOLEAN DEFAULT = false
1176
%%-------------------------------------------------
1177
{Term2,Bytes4,Rb3} = case Bytes3 of
1178
<<0:2,_:1,1:5,_/binary>> ->
1179
?RT_BER:decode_boolean(Bytes3,[], mandatory);
1184
%%-------------------------------------------------
1185
%% attribute number 3 with type OCTET STRING OPTIONAL
1186
%%-------------------------------------------------
1187
{Term3,Bytes5,Rb4} = case Bytes4 of
1188
<<0:2,_:1,4:5,_/binary>> ->
1189
?RT_BER:decode_octet_string(Bytes4,[],[], no_length, mandatory);
1191
{ asn1_NOVALUE, Bytes4, 0 }
1194
{Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext),
1195
{{'Control', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}.
1198
%%================================
1200
%%================================
1201
'enc_BindRequest'(Val, TagIn) ->
1203
%%-------------------------------------------------
1204
%% attribute number 1 with type INTEGER
1205
%%-------------------------------------------------
1206
{EncBytes1,EncLen1} = ?RT_BER:encode_integer([], ?RT_BER:cindex(2,Val,version), []),
1208
%%-------------------------------------------------
1209
%% attribute number 2 with type OCTET STRING
1210
%%-------------------------------------------------
1211
{EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,name), []),
1213
%%-------------------------------------------------
1214
%% attribute number 3 External ELDAPv3:AuthenticationChoice
1215
%%-------------------------------------------------
1216
{EncBytes3,EncLen3} = 'enc_AuthenticationChoice'(?RT_BER:cindex(4,Val,authentication), []),
1218
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
1219
LenSoFar = EncLen1 + EncLen2 + EncLen3,
1220
?RT_BER:encode_tags(TagIn ++ [{tag,64,0,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
1223
'dec_BindRequest'(Bytes, OptOrMand) ->
1224
'dec_BindRequest'(Bytes, OptOrMand, []).
1226
'dec_BindRequest'(Bytes, OptOrMand, TagIn) ->
1227
%%-------------------------------------------------
1228
%% decode tag and length
1229
%%-------------------------------------------------
1230
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,0,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1231
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1233
%%-------------------------------------------------
1234
%% attribute number 1 with type INTEGER
1235
%%-------------------------------------------------
1236
{Term1,Bytes3,Rb2} = ?RT_BER:decode_integer(Bytes2,{1,127},[], mandatory),
1238
%%-------------------------------------------------
1239
%% attribute number 2 with type OCTET STRING
1240
%%-------------------------------------------------
1241
{Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[], no_length, mandatory),
1243
%%-------------------------------------------------
1244
%% attribute number 3 External ELDAPv3:AuthenticationChoice
1245
%%-------------------------------------------------
1246
{Term3,Bytes5,Rb4} = 'dec_AuthenticationChoice'(Bytes4, mandatory, []),
1248
{Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext),
1249
{{'BindRequest', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}.
1252
%%================================
1253
%% AuthenticationChoice
1254
%%================================
1256
'enc_AuthenticationChoice'({'AuthenticationChoice',Val}, TagIn) ->
1257
'enc_AuthenticationChoice'(Val, TagIn);
1259
'enc_AuthenticationChoice'(Val, TagIn) ->
1260
{EncBytes,EncLen} = case element(1,Val) of
1262
?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'IMPLICIT',32}]);
1264
'enc_SaslCredentials'(element(2,Val), [{tag,128,3,'IMPLICIT',32}]);
1266
exit({error,{asn1,{invalid_choice_type,Else}}})
1269
?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
1274
'dec_AuthenticationChoice'(Bytes, OptOrMand) ->
1275
'dec_AuthenticationChoice'(Bytes, OptOrMand, []).
1277
'dec_AuthenticationChoice'(Bytes, OptOrMand, TagIn) ->
1278
{{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
1279
IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
1280
IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
1284
<<2:2,_:1,0:5,_/binary>> ->
1285
{Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory),
1286
{{simple, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1290
<<2:2,_:1,3:5,_/binary>> ->
1291
{Dec, Rest, RbCho} = 'dec_SaslCredentials'(Bytes1, mandatory, [{tag,128,3,'IMPLICIT',32}]),
1292
{{sasl, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1296
mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
1297
_ ->exit({error,{asn1,{no_optional_tag,Else}}})
1302
%%================================
1304
%%================================
1305
'enc_SaslCredentials'(Val, TagIn) ->
1307
%%-------------------------------------------------
1308
%% attribute number 1 with type OCTET STRING
1309
%%-------------------------------------------------
1310
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,mechanism), []),
1312
%%-------------------------------------------------
1313
%% attribute number 2 with type OCTET STRING OPTIONAL
1314
%%-------------------------------------------------
1315
{EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,credentials) of
1316
asn1_NOVALUE -> {<<>>,0};
1318
?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,credentials), [])
1321
BytesSoFar = [EncBytes1, EncBytes2],
1322
LenSoFar = EncLen1 + EncLen2,
1323
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
1326
'dec_SaslCredentials'(Bytes, OptOrMand) ->
1327
'dec_SaslCredentials'(Bytes, OptOrMand, []).
1329
'dec_SaslCredentials'(Bytes, OptOrMand, TagIn) ->
1330
%%-------------------------------------------------
1331
%% decode tag and length
1332
%%-------------------------------------------------
1333
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1334
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1336
%%-------------------------------------------------
1337
%% attribute number 1 with type OCTET STRING
1338
%%-------------------------------------------------
1339
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
1341
%%-------------------------------------------------
1342
%% attribute number 2 with type OCTET STRING OPTIONAL
1343
%%-------------------------------------------------
1344
{Term2,Bytes4,Rb3} = case Bytes3 of
1345
<<0:2,_:1,4:5,_/binary>> ->
1346
?RT_BER:decode_octet_string(Bytes3,[],[], no_length, mandatory);
1348
{ asn1_NOVALUE, Bytes3, 0 }
1351
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
1352
{{'SaslCredentials', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
1355
%%================================
1357
%%================================
1358
'enc_BindResponse'(Val, TagIn) ->
1360
%%-------------------------------------------------
1361
%% attribute number 1 with type ENUMERATED
1362
%%-------------------------------------------------
1363
{EncBytes1,EncLen1} = case (case ?RT_BER:cindex(2,Val,resultCode) of {_,_}->element(2,?RT_BER:cindex(2,Val,resultCode));_->?RT_BER:cindex(2,Val,resultCode) end) of
1364
success -> ?RT_BER:encode_enumerated(0,[]);
1365
operationsError -> ?RT_BER:encode_enumerated(1,[]);
1366
protocolError -> ?RT_BER:encode_enumerated(2,[]);
1367
timeLimitExceeded -> ?RT_BER:encode_enumerated(3,[]);
1368
sizeLimitExceeded -> ?RT_BER:encode_enumerated(4,[]);
1369
compareFalse -> ?RT_BER:encode_enumerated(5,[]);
1370
compareTrue -> ?RT_BER:encode_enumerated(6,[]);
1371
authMethodNotSupported -> ?RT_BER:encode_enumerated(7,[]);
1372
strongAuthRequired -> ?RT_BER:encode_enumerated(8,[]);
1373
referral -> ?RT_BER:encode_enumerated(10,[]);
1374
adminLimitExceeded -> ?RT_BER:encode_enumerated(11,[]);
1375
unavailableCriticalExtension -> ?RT_BER:encode_enumerated(12,[]);
1376
confidentialityRequired -> ?RT_BER:encode_enumerated(13,[]);
1377
saslBindInProgress -> ?RT_BER:encode_enumerated(14,[]);
1378
noSuchAttribute -> ?RT_BER:encode_enumerated(16,[]);
1379
undefinedAttributeType -> ?RT_BER:encode_enumerated(17,[]);
1380
inappropriateMatching -> ?RT_BER:encode_enumerated(18,[]);
1381
constraintViolation -> ?RT_BER:encode_enumerated(19,[]);
1382
attributeOrValueExists -> ?RT_BER:encode_enumerated(20,[]);
1383
invalidAttributeSyntax -> ?RT_BER:encode_enumerated(21,[]);
1384
noSuchObject -> ?RT_BER:encode_enumerated(32,[]);
1385
aliasProblem -> ?RT_BER:encode_enumerated(33,[]);
1386
invalidDNSyntax -> ?RT_BER:encode_enumerated(34,[]);
1387
aliasDereferencingProblem -> ?RT_BER:encode_enumerated(36,[]);
1388
inappropriateAuthentication -> ?RT_BER:encode_enumerated(48,[]);
1389
invalidCredentials -> ?RT_BER:encode_enumerated(49,[]);
1390
insufficientAccessRights -> ?RT_BER:encode_enumerated(50,[]);
1391
busy -> ?RT_BER:encode_enumerated(51,[]);
1392
unavailable -> ?RT_BER:encode_enumerated(52,[]);
1393
unwillingToPerform -> ?RT_BER:encode_enumerated(53,[]);
1394
loopDetect -> ?RT_BER:encode_enumerated(54,[]);
1395
namingViolation -> ?RT_BER:encode_enumerated(64,[]);
1396
objectClassViolation -> ?RT_BER:encode_enumerated(65,[]);
1397
notAllowedOnNonLeaf -> ?RT_BER:encode_enumerated(66,[]);
1398
notAllowedOnRDN -> ?RT_BER:encode_enumerated(67,[]);
1399
entryAlreadyExists -> ?RT_BER:encode_enumerated(68,[]);
1400
objectClassModsProhibited -> ?RT_BER:encode_enumerated(69,[]);
1401
affectsMultipleDSAs -> ?RT_BER:encode_enumerated(71,[]);
1402
other -> ?RT_BER:encode_enumerated(80,[]);
1403
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
1406
%%-------------------------------------------------
1407
%% attribute number 2 with type OCTET STRING
1408
%%-------------------------------------------------
1409
{EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,matchedDN), []),
1411
%%-------------------------------------------------
1412
%% attribute number 3 with type OCTET STRING
1413
%%-------------------------------------------------
1414
{EncBytes3,EncLen3} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(4,Val,errorMessage), []),
1416
%%-------------------------------------------------
1417
%% attribute number 4 External ELDAPv3:Referral OPTIONAL
1418
%%-------------------------------------------------
1419
{EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,referral) of
1420
asn1_NOVALUE -> {<<>>,0};
1422
'enc_Referral'(?RT_BER:cindex(5,Val,referral), [{tag,128,3,'IMPLICIT',32}])
1425
%%-------------------------------------------------
1426
%% attribute number 5 with type OCTET STRING OPTIONAL
1427
%%-------------------------------------------------
1428
{EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,serverSaslCreds) of
1429
asn1_NOVALUE -> {<<>>,0};
1431
?RT_BER:encode_octet_string([], ?RT_BER:cindex(6,Val,serverSaslCreds), [{tag,128,7,'IMPLICIT',32}])
1434
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5],
1435
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5,
1436
?RT_BER:encode_tags(TagIn ++ [{tag,64,1,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
1439
'dec_BindResponse'(Bytes, OptOrMand) ->
1440
'dec_BindResponse'(Bytes, OptOrMand, []).
1442
'dec_BindResponse'(Bytes, OptOrMand, TagIn) ->
1443
%%-------------------------------------------------
1444
%% decode tag and length
1445
%%-------------------------------------------------
1446
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,1,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1447
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1449
%%-------------------------------------------------
1450
%% attribute number 1 with type ENUMERATED
1451
%%-------------------------------------------------
1452
{Term1,Bytes3,Rb2} = ?RT_BER:decode_enumerated(Bytes2,[],[{success,0},{operationsError,1},{protocolError,2},{timeLimitExceeded,3},{sizeLimitExceeded,4},{compareFalse,5},{compareTrue,6},{authMethodNotSupported,7},{strongAuthRequired,8},{referral,10},{adminLimitExceeded,11},{unavailableCriticalExtension,12},{confidentialityRequired,13},{saslBindInProgress,14},{noSuchAttribute,16},{undefinedAttributeType,17},{inappropriateMatching,18},{constraintViolation,19},{attributeOrValueExists,20},{invalidAttributeSyntax,21},{noSuchObject,32},{aliasProblem,33},{invalidDNSyntax,34},{aliasDereferencingProblem,36},{inappropriateAuthentication,48},{invalidCredentials,49},{insufficientAccessRights,50},{busy,51},{unavailable,52},{unwillingToPerform,53},{loopDetect,54},{namingViolation,64},{objectClassViolation,65},{notAllowedOnNonLeaf,66},{notAllowedOnRDN,67},{entryAlreadyExists,68},{objectClassModsProhibited,69},{affectsMultipleDSAs,71},{other,80}],[], mandatory),
1454
%%-------------------------------------------------
1455
%% attribute number 2 with type OCTET STRING
1456
%%-------------------------------------------------
1457
{Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[], no_length, mandatory),
1459
%%-------------------------------------------------
1460
%% attribute number 3 with type OCTET STRING
1461
%%-------------------------------------------------
1462
{Term3,Bytes5,Rb4} = ?RT_BER:decode_octet_string(Bytes4,[],[], no_length, mandatory),
1464
%%-------------------------------------------------
1465
%% attribute number 4 External ELDAPv3:Referral OPTIONAL
1466
%%-------------------------------------------------
1467
{Term4,Bytes6,Rb5} = case Bytes5 of
1468
<<2:2,_:1,3:5,_/binary>> ->
1469
'dec_Referral'(Bytes5, opt_or_default, [{tag,128,3,'IMPLICIT',32}]);
1471
{ asn1_NOVALUE, Bytes5, 0 }
1474
%%-------------------------------------------------
1475
%% attribute number 5 with type OCTET STRING OPTIONAL
1476
%%-------------------------------------------------
1477
{Term5,Bytes7,Rb6} = case Bytes6 of
1478
<<2:2,_:1,7:5,_/binary>> ->
1479
?RT_BER:decode_octet_string(Bytes6,[],[{tag,128,7,'IMPLICIT',32}], no_length, mandatory);
1481
{ asn1_NOVALUE, Bytes6, 0 }
1484
{Bytes8,Rb7} = ?RT_BER:restbytes2(RemBytes, Bytes7,noext),
1485
{{'BindResponse', Term1, Term2, Term3, Term4, Term5}, Bytes8, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7}.
1488
%%================================
1490
%%================================
1492
'enc_UnbindRequest'({'UnbindRequest',Val}, TagIn) ->
1493
'enc_UnbindRequest'(Val, TagIn);
1495
'enc_UnbindRequest'(Val, TagIn) ->
1496
?RT_BER:encode_null(Val, TagIn ++ [{tag,64,2,'IMPLICIT',32}]).
1499
'dec_UnbindRequest'(Bytes, OptOrMand) ->
1500
'dec_UnbindRequest'(Bytes, OptOrMand, []).
1502
'dec_UnbindRequest'(Bytes, OptOrMand, TagIn) ->
1503
?RT_BER:decode_null(Bytes,TagIn++[{tag,64,2,'IMPLICIT',32}], OptOrMand).
1507
%%================================
1509
%%================================
1510
'enc_SearchRequest'(Val, TagIn) ->
1512
%%-------------------------------------------------
1513
%% attribute number 1 with type OCTET STRING
1514
%%-------------------------------------------------
1515
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,baseObject), []),
1517
%%-------------------------------------------------
1518
%% attribute number 2 with type ENUMERATED
1519
%%-------------------------------------------------
1520
{EncBytes2,EncLen2} = case (case ?RT_BER:cindex(3,Val,scope) of {_,_}->element(2,?RT_BER:cindex(3,Val,scope));_->?RT_BER:cindex(3,Val,scope) end) of
1521
baseObject -> ?RT_BER:encode_enumerated(0,[]);
1522
singleLevel -> ?RT_BER:encode_enumerated(1,[]);
1523
wholeSubtree -> ?RT_BER:encode_enumerated(2,[]);
1524
Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}})
1527
%%-------------------------------------------------
1528
%% attribute number 3 with type ENUMERATED
1529
%%-------------------------------------------------
1530
{EncBytes3,EncLen3} = case (case ?RT_BER:cindex(4,Val,derefAliases) of {_,_}->element(2,?RT_BER:cindex(4,Val,derefAliases));_->?RT_BER:cindex(4,Val,derefAliases) end) of
1531
neverDerefAliases -> ?RT_BER:encode_enumerated(0,[]);
1532
derefInSearching -> ?RT_BER:encode_enumerated(1,[]);
1533
derefFindingBaseObj -> ?RT_BER:encode_enumerated(2,[]);
1534
derefAlways -> ?RT_BER:encode_enumerated(3,[]);
1535
Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}})
1538
%%-------------------------------------------------
1539
%% attribute number 4 with type INTEGER
1540
%%-------------------------------------------------
1541
{EncBytes4,EncLen4} = ?RT_BER:encode_integer([], ?RT_BER:cindex(5,Val,sizeLimit), []),
1543
%%-------------------------------------------------
1544
%% attribute number 5 with type INTEGER
1545
%%-------------------------------------------------
1546
{EncBytes5,EncLen5} = ?RT_BER:encode_integer([], ?RT_BER:cindex(6,Val,timeLimit), []),
1548
%%-------------------------------------------------
1549
%% attribute number 6 with type BOOLEAN
1550
%%-------------------------------------------------
1551
{EncBytes6,EncLen6} = ?RT_BER:encode_boolean(?RT_BER:cindex(7,Val,typesOnly), []),
1553
%%-------------------------------------------------
1554
%% attribute number 7 External ELDAPv3:Filter
1555
%%-------------------------------------------------
1556
{EncBytes7,EncLen7} = 'enc_Filter'(?RT_BER:cindex(8,Val,filter), []),
1558
%%-------------------------------------------------
1559
%% attribute number 8 External ELDAPv3:AttributeDescriptionList
1560
%%-------------------------------------------------
1561
{EncBytes8,EncLen8} = 'enc_AttributeDescriptionList'(?RT_BER:cindex(9,Val,attributes), []),
1563
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8],
1564
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8,
1565
?RT_BER:encode_tags(TagIn ++ [{tag,64,3,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
1568
'dec_SearchRequest'(Bytes, OptOrMand) ->
1569
'dec_SearchRequest'(Bytes, OptOrMand, []).
1571
'dec_SearchRequest'(Bytes, OptOrMand, TagIn) ->
1572
%%-------------------------------------------------
1573
%% decode tag and length
1574
%%-------------------------------------------------
1575
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,3,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1576
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1578
%%-------------------------------------------------
1579
%% attribute number 1 with type OCTET STRING
1580
%%-------------------------------------------------
1581
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
1583
%%-------------------------------------------------
1584
%% attribute number 2 with type ENUMERATED
1585
%%-------------------------------------------------
1586
{Term2,Bytes4,Rb3} = ?RT_BER:decode_enumerated(Bytes3,[],[{baseObject,0},{singleLevel,1},{wholeSubtree,2}],[], mandatory),
1588
%%-------------------------------------------------
1589
%% attribute number 3 with type ENUMERATED
1590
%%-------------------------------------------------
1591
{Term3,Bytes5,Rb4} = ?RT_BER:decode_enumerated(Bytes4,[],[{neverDerefAliases,0},{derefInSearching,1},{derefFindingBaseObj,2},{derefAlways,3}],[], mandatory),
1593
%%-------------------------------------------------
1594
%% attribute number 4 with type INTEGER
1595
%%-------------------------------------------------
1596
{Term4,Bytes6,Rb5} = ?RT_BER:decode_integer(Bytes5,{0,2147483647},[], mandatory),
1598
%%-------------------------------------------------
1599
%% attribute number 5 with type INTEGER
1600
%%-------------------------------------------------
1601
{Term5,Bytes7,Rb6} = ?RT_BER:decode_integer(Bytes6,{0,2147483647},[], mandatory),
1603
%%-------------------------------------------------
1604
%% attribute number 6 with type BOOLEAN
1605
%%-------------------------------------------------
1606
{Term6,Bytes8,Rb7} = ?RT_BER:decode_boolean(Bytes7,[], mandatory),
1608
%%-------------------------------------------------
1609
%% attribute number 7 External ELDAPv3:Filter
1610
%%-------------------------------------------------
1611
{Term7,Bytes9,Rb8} = 'dec_Filter'(Bytes8, mandatory, []),
1613
%%-------------------------------------------------
1614
%% attribute number 8 External ELDAPv3:AttributeDescriptionList
1615
%%-------------------------------------------------
1616
{Term8,Bytes10,Rb9} = 'dec_AttributeDescriptionList'(Bytes9, mandatory, []),
1618
{Bytes11,Rb10} = ?RT_BER:restbytes2(RemBytes, Bytes10,noext),
1619
{{'SearchRequest', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8}, Bytes11, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9+Rb10}.
1622
%%================================
1624
%%================================
1626
'enc_Filter'({'Filter',Val}, TagIn) ->
1627
'enc_Filter'(Val, TagIn);
1629
'enc_Filter'(Val, TagIn) ->
1630
{EncBytes,EncLen} = case element(1,Val) of
1632
'enc_Filter_and'(element(2,Val), [{tag,128,0,'IMPLICIT',32}]);
1634
'enc_Filter_or'(element(2,Val), [{tag,128,1,'IMPLICIT',32}]);
1636
'enc_Filter'(element(2,Val), [{tag,128,2,'EXPLICIT',32}]);
1638
'enc_AttributeValueAssertion'(element(2,Val), [{tag,128,3,'IMPLICIT',32}]);
1640
'enc_SubstringFilter'(element(2,Val), [{tag,128,4,'IMPLICIT',32}]);
1642
'enc_AttributeValueAssertion'(element(2,Val), [{tag,128,5,'IMPLICIT',32}]);
1644
'enc_AttributeValueAssertion'(element(2,Val), [{tag,128,6,'IMPLICIT',32}]);
1646
?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,7,'IMPLICIT',32}]);
1648
'enc_AttributeValueAssertion'(element(2,Val), [{tag,128,8,'IMPLICIT',32}]);
1650
'enc_MatchingRuleAssertion'(element(2,Val), [{tag,128,9,'IMPLICIT',32}]);
1652
exit({error,{asn1,{invalid_choice_type,Else}}})
1655
?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
1661
%%================================
1663
%%================================
1665
'enc_Filter_and'({'Filter_and',Val}, TagIn) ->
1666
'enc_Filter_and'(Val, TagIn);
1668
'enc_Filter_and'(Val, TagIn) ->
1669
{EncBytes,EncLen} = 'enc_Filter_and_components'(Val,[],0),
1670
?RT_BER:encode_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], EncBytes, EncLen).
1672
'enc_Filter_and_components'([], AccBytes, AccLen) ->
1673
{lists:reverse(AccBytes),AccLen};
1675
'enc_Filter_and_components'([H|T],AccBytes, AccLen) ->
1676
{EncBytes,EncLen} = 'enc_Filter'(H, []),
1677
'enc_Filter_and_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
1679
'dec_Filter_and'(Bytes, OptOrMand, TagIn) ->
1680
%%-------------------------------------------------
1681
%% decode tag and length
1682
%%-------------------------------------------------
1683
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], Bytes, OptOrMand),
1684
?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_Filter'/3, [], []).
1690
%%================================
1692
%%================================
1694
'enc_Filter_or'({'Filter_or',Val}, TagIn) ->
1695
'enc_Filter_or'(Val, TagIn);
1697
'enc_Filter_or'(Val, TagIn) ->
1698
{EncBytes,EncLen} = 'enc_Filter_or_components'(Val,[],0),
1699
?RT_BER:encode_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], EncBytes, EncLen).
1701
'enc_Filter_or_components'([], AccBytes, AccLen) ->
1702
{lists:reverse(AccBytes),AccLen};
1704
'enc_Filter_or_components'([H|T],AccBytes, AccLen) ->
1705
{EncBytes,EncLen} = 'enc_Filter'(H, []),
1706
'enc_Filter_or_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
1708
'dec_Filter_or'(Bytes, OptOrMand, TagIn) ->
1709
%%-------------------------------------------------
1710
%% decode tag and length
1711
%%-------------------------------------------------
1712
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], Bytes, OptOrMand),
1713
?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_Filter'/3, [], []).
1718
'dec_Filter'(Bytes, OptOrMand) ->
1719
'dec_Filter'(Bytes, OptOrMand, []).
1721
'dec_Filter'(Bytes, OptOrMand, TagIn) ->
1722
{{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
1723
IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
1724
IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
1728
<<2:2,_:1,0:5,_/binary>> ->
1729
{Dec, Rest, RbCho} = 'dec_Filter_and'(Bytes1, mandatory, [{tag,128,0,'IMPLICIT',32}]),
1730
{{'and', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1734
<<2:2,_:1,1:5,_/binary>> ->
1735
{Dec, Rest, RbCho} = 'dec_Filter_or'(Bytes1, mandatory, [{tag,128,1,'IMPLICIT',32}]),
1736
{{'or', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1740
<<2:2,_:1,2:5,_/binary>> ->
1741
{Dec, Rest, RbCho} = 'dec_Filter'(Bytes1, mandatory, [{tag,128,2,'EXPLICIT',32}]),
1742
{{'not', Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1746
<<2:2,_:1,3:5,_/binary>> ->
1747
{Dec, Rest, RbCho} = 'dec_AttributeValueAssertion'(Bytes1, mandatory, [{tag,128,3,'IMPLICIT',32}]),
1748
{{equalityMatch, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1752
<<2:2,_:1,4:5,_/binary>> ->
1753
{Dec, Rest, RbCho} = 'dec_SubstringFilter'(Bytes1, mandatory, [{tag,128,4,'IMPLICIT',32}]),
1754
{{substrings, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1758
<<2:2,_:1,5:5,_/binary>> ->
1759
{Dec, Rest, RbCho} = 'dec_AttributeValueAssertion'(Bytes1, mandatory, [{tag,128,5,'IMPLICIT',32}]),
1760
{{greaterOrEqual, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1764
<<2:2,_:1,6:5,_/binary>> ->
1765
{Dec, Rest, RbCho} = 'dec_AttributeValueAssertion'(Bytes1, mandatory, [{tag,128,6,'IMPLICIT',32}]),
1766
{{lessOrEqual, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1770
<<2:2,_:1,7:5,_/binary>> ->
1771
{Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,7,'IMPLICIT',32}], no_length, mandatory),
1772
{{present, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1776
<<2:2,_:1,8:5,_/binary>> ->
1777
{Dec, Rest, RbCho} = 'dec_AttributeValueAssertion'(Bytes1, mandatory, [{tag,128,8,'IMPLICIT',32}]),
1778
{{approxMatch, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1781
%% 'extensibleMatch'
1782
<<2:2,_:1,9:5,_/binary>> ->
1783
{Dec, Rest, RbCho} = 'dec_MatchingRuleAssertion'(Bytes1, mandatory, [{tag,128,9,'IMPLICIT',32}]),
1784
{{extensibleMatch, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1788
mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
1789
_ ->exit({error,{asn1,{no_optional_tag,Else}}})
1794
%%================================
1796
%%================================
1797
'enc_SubstringFilter'(Val, TagIn) ->
1799
%%-------------------------------------------------
1800
%% attribute number 1 with type OCTET STRING
1801
%%-------------------------------------------------
1802
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,type), []),
1804
%%-------------------------------------------------
1805
%% attribute number 2 with type SEQUENCE OF
1806
%%-------------------------------------------------
1807
{EncBytes2,EncLen2} = 'enc_SubstringFilter_substrings'(?RT_BER:cindex(3,Val,substrings), []),
1809
BytesSoFar = [EncBytes1, EncBytes2],
1810
LenSoFar = EncLen1 + EncLen2,
1811
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
1815
%%================================
1816
%% SubstringFilter_substrings
1817
%%================================
1819
'enc_SubstringFilter_substrings'({'SubstringFilter_substrings',Val}, TagIn) ->
1820
'enc_SubstringFilter_substrings'(Val, TagIn);
1822
'enc_SubstringFilter_substrings'(Val, TagIn) ->
1823
{EncBytes,EncLen} = 'enc_SubstringFilter_substrings_components'(Val,[],0),
1824
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
1826
'enc_SubstringFilter_substrings_components'([], AccBytes, AccLen) ->
1827
{lists:reverse(AccBytes),AccLen};
1829
'enc_SubstringFilter_substrings_components'([H|T],AccBytes, AccLen) ->
1830
{EncBytes,EncLen} = 'enc_SubstringFilter_substrings_SEQOF'(H, []),
1831
'enc_SubstringFilter_substrings_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
1836
%%================================
1837
%% SubstringFilter_substrings_SEQOF
1838
%%================================
1840
'enc_SubstringFilter_substrings_SEQOF'({'SubstringFilter_substrings_SEQOF',Val}, TagIn) ->
1841
'enc_SubstringFilter_substrings_SEQOF'(Val, TagIn);
1843
'enc_SubstringFilter_substrings_SEQOF'(Val, TagIn) ->
1844
{EncBytes,EncLen} = case element(1,Val) of
1846
?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,0,'IMPLICIT',32}]);
1848
?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,1,'IMPLICIT',32}]);
1850
?RT_BER:encode_octet_string([], element(2,Val), [{tag,128,2,'IMPLICIT',32}]);
1852
exit({error,{asn1,{invalid_choice_type,Else}}})
1855
?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).
1858
'dec_SubstringFilter_substrings_SEQOF'(Bytes, OptOrMand, TagIn) ->
1859
{{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
1860
IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
1861
IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
1865
<<2:2,_:1,0:5,_/binary>> ->
1866
{Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory),
1867
{{initial, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1871
<<2:2,_:1,1:5,_/binary>> ->
1872
{Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory),
1873
{{any, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1877
<<2:2,_:1,2:5,_/binary>> ->
1878
{Dec, Rest, RbCho} = ?RT_BER:decode_octet_string(Bytes1,[],[{tag,128,2,'IMPLICIT',32}], no_length, mandatory),
1879
{{final, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};
1883
mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
1884
_ ->exit({error,{asn1,{no_optional_tag,Else}}})
1887
'dec_SubstringFilter_substrings'(Bytes, OptOrMand, TagIn) ->
1888
%%-------------------------------------------------
1889
%% decode tag and length
1890
%%-------------------------------------------------
1891
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1892
?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_SubstringFilter_substrings_SEQOF'/3, [], []).
1897
'dec_SubstringFilter'(Bytes, OptOrMand) ->
1898
'dec_SubstringFilter'(Bytes, OptOrMand, []).
1900
'dec_SubstringFilter'(Bytes, OptOrMand, TagIn) ->
1901
%%-------------------------------------------------
1902
%% decode tag and length
1903
%%-------------------------------------------------
1904
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1905
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1907
%%-------------------------------------------------
1908
%% attribute number 1 with type OCTET STRING
1909
%%-------------------------------------------------
1910
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
1912
%%-------------------------------------------------
1913
%% attribute number 2 with type SEQUENCE OF
1914
%%-------------------------------------------------
1915
{Term2,Bytes4,Rb3} = 'dec_SubstringFilter_substrings'(Bytes3, mandatory, []),
1917
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
1918
{{'SubstringFilter', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
1921
%%================================
1922
%% MatchingRuleAssertion
1923
%%================================
1924
'enc_MatchingRuleAssertion'(Val, TagIn) ->
1926
%%-------------------------------------------------
1927
%% attribute number 1 with type OCTET STRING OPTIONAL
1928
%%-------------------------------------------------
1929
{EncBytes1,EncLen1} = case ?RT_BER:cindex(2,Val,matchingRule) of
1930
asn1_NOVALUE -> {<<>>,0};
1932
?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,matchingRule), [{tag,128,1,'IMPLICIT',32}])
1935
%%-------------------------------------------------
1936
%% attribute number 2 with type OCTET STRING OPTIONAL
1937
%%-------------------------------------------------
1938
{EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,type) of
1939
asn1_NOVALUE -> {<<>>,0};
1941
?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,type), [{tag,128,2,'IMPLICIT',32}])
1944
%%-------------------------------------------------
1945
%% attribute number 3 with type OCTET STRING
1946
%%-------------------------------------------------
1947
{EncBytes3,EncLen3} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(4,Val,matchValue), [{tag,128,3,'IMPLICIT',32}]),
1949
%%-------------------------------------------------
1950
%% attribute number 4 with type BOOLEAN DEFAULT = false
1951
%%-------------------------------------------------
1952
{EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,dnAttributes) of
1953
asn1_DEFAULT -> {<<>>,0};
1956
?RT_BER:encode_boolean(?RT_BER:cindex(5,Val,dnAttributes), [{tag,128,4,'IMPLICIT',32}])
1959
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
1960
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
1961
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
1964
'dec_MatchingRuleAssertion'(Bytes, OptOrMand) ->
1965
'dec_MatchingRuleAssertion'(Bytes, OptOrMand, []).
1967
'dec_MatchingRuleAssertion'(Bytes, OptOrMand, TagIn) ->
1968
%%-------------------------------------------------
1969
%% decode tag and length
1970
%%-------------------------------------------------
1971
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
1972
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
1974
%%-------------------------------------------------
1975
%% attribute number 1 with type OCTET STRING OPTIONAL
1976
%%-------------------------------------------------
1977
{Term1,Bytes3,Rb2} = case Bytes2 of
1978
<<2:2,_:1,1:5,_/binary>> ->
1979
?RT_BER:decode_octet_string(Bytes2,[],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory);
1981
{ asn1_NOVALUE, Bytes2, 0 }
1984
%%-------------------------------------------------
1985
%% attribute number 2 with type OCTET STRING OPTIONAL
1986
%%-------------------------------------------------
1987
{Term2,Bytes4,Rb3} = case Bytes3 of
1988
<<2:2,_:1,2:5,_/binary>> ->
1989
?RT_BER:decode_octet_string(Bytes3,[],[{tag,128,2,'IMPLICIT',32}], no_length, mandatory);
1991
{ asn1_NOVALUE, Bytes3, 0 }
1994
%%-------------------------------------------------
1995
%% attribute number 3 with type OCTET STRING
1996
%%-------------------------------------------------
1997
{Term3,Bytes5,Rb4} = ?RT_BER:decode_octet_string(Bytes4,[],[{tag,128,3,'IMPLICIT',32}], no_length, mandatory),
1999
%%-------------------------------------------------
2000
%% attribute number 4 with type BOOLEAN DEFAULT = false
2001
%%-------------------------------------------------
2002
{Term4,Bytes6,Rb5} = case Bytes5 of
2003
<<2:2,_:1,4:5,_/binary>> ->
2004
?RT_BER:decode_boolean(Bytes5,[{tag,128,4,'IMPLICIT',32}], mandatory);
2009
{Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext),
2010
{{'MatchingRuleAssertion', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}.
2013
%%================================
2014
%% SearchResultEntry
2015
%%================================
2016
'enc_SearchResultEntry'(Val, TagIn) ->
2018
%%-------------------------------------------------
2019
%% attribute number 1 with type OCTET STRING
2020
%%-------------------------------------------------
2021
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,objectName), []),
2023
%%-------------------------------------------------
2024
%% attribute number 2 External ELDAPv3:PartialAttributeList
2025
%%-------------------------------------------------
2026
{EncBytes2,EncLen2} = 'enc_PartialAttributeList'(?RT_BER:cindex(3,Val,attributes), []),
2028
BytesSoFar = [EncBytes1, EncBytes2],
2029
LenSoFar = EncLen1 + EncLen2,
2030
?RT_BER:encode_tags(TagIn ++ [{tag,64,4,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2033
'dec_SearchResultEntry'(Bytes, OptOrMand) ->
2034
'dec_SearchResultEntry'(Bytes, OptOrMand, []).
2036
'dec_SearchResultEntry'(Bytes, OptOrMand, TagIn) ->
2037
%%-------------------------------------------------
2038
%% decode tag and length
2039
%%-------------------------------------------------
2040
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,4,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2041
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2043
%%-------------------------------------------------
2044
%% attribute number 1 with type OCTET STRING
2045
%%-------------------------------------------------
2046
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2048
%%-------------------------------------------------
2049
%% attribute number 2 External ELDAPv3:PartialAttributeList
2050
%%-------------------------------------------------
2051
{Term2,Bytes4,Rb3} = 'dec_PartialAttributeList'(Bytes3, mandatory, []),
2053
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2054
{{'SearchResultEntry', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2057
%%================================
2058
%% PartialAttributeList
2059
%%================================
2061
'enc_PartialAttributeList'({'PartialAttributeList',Val}, TagIn) ->
2062
'enc_PartialAttributeList'(Val, TagIn);
2064
'enc_PartialAttributeList'(Val, TagIn) ->
2065
{EncBytes,EncLen} = 'enc_PartialAttributeList_components'(Val,[],0),
2066
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
2068
'enc_PartialAttributeList_components'([], AccBytes, AccLen) ->
2069
{lists:reverse(AccBytes),AccLen};
2071
'enc_PartialAttributeList_components'([H|T],AccBytes, AccLen) ->
2072
{EncBytes,EncLen} = 'enc_PartialAttributeList_SEQOF'(H, []),
2073
'enc_PartialAttributeList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
2078
%%================================
2079
%% PartialAttributeList_SEQOF
2080
%%================================
2081
'enc_PartialAttributeList_SEQOF'(Val, TagIn) ->
2083
%%-------------------------------------------------
2084
%% attribute number 1 with type OCTET STRING
2085
%%-------------------------------------------------
2086
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,type), []),
2088
%%-------------------------------------------------
2089
%% attribute number 2 with type SET OF
2090
%%-------------------------------------------------
2091
{EncBytes2,EncLen2} = 'enc_PartialAttributeList_SEQOF_vals'(?RT_BER:cindex(3,Val,vals), []),
2093
BytesSoFar = [EncBytes1, EncBytes2],
2094
LenSoFar = EncLen1 + EncLen2,
2095
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2099
%%================================
2100
%% PartialAttributeList_SEQOF_vals
2101
%%================================
2103
'enc_PartialAttributeList_SEQOF_vals'({'PartialAttributeList_SEQOF_vals',Val}, TagIn) ->
2104
'enc_PartialAttributeList_SEQOF_vals'(Val, TagIn);
2106
'enc_PartialAttributeList_SEQOF_vals'(Val, TagIn) ->
2107
{EncBytes,EncLen} = 'enc_PartialAttributeList_SEQOF_vals_components'(Val,[],0),
2108
?RT_BER:encode_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], EncBytes, EncLen).
2110
'enc_PartialAttributeList_SEQOF_vals_components'([], AccBytes, AccLen) ->
2111
{lists:reverse(AccBytes),AccLen};
2113
'enc_PartialAttributeList_SEQOF_vals_components'([H|T],AccBytes, AccLen) ->
2114
{EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, []),
2115
'enc_PartialAttributeList_SEQOF_vals_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
2117
'dec_PartialAttributeList_SEQOF_vals'(Bytes, OptOrMand, TagIn) ->
2118
%%-------------------------------------------------
2119
%% decode tag and length
2120
%%-------------------------------------------------
2121
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], Bytes, OptOrMand),
2122
?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
2123
?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)
2127
'dec_PartialAttributeList_SEQOF'(Bytes, OptOrMand, TagIn) ->
2128
%%-------------------------------------------------
2129
%% decode tag and length
2130
%%-------------------------------------------------
2131
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2132
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2134
%%-------------------------------------------------
2135
%% attribute number 1 with type OCTET STRING
2136
%%-------------------------------------------------
2137
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2139
%%-------------------------------------------------
2140
%% attribute number 2 with type SET OF
2141
%%-------------------------------------------------
2142
{Term2,Bytes4,Rb3} = 'dec_PartialAttributeList_SEQOF_vals'(Bytes3, mandatory, []),
2144
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2145
{{'PartialAttributeList_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2148
'dec_PartialAttributeList'(Bytes, OptOrMand) ->
2149
'dec_PartialAttributeList'(Bytes, OptOrMand, []).
2151
'dec_PartialAttributeList'(Bytes, OptOrMand, TagIn) ->
2152
%%-------------------------------------------------
2153
%% decode tag and length
2154
%%-------------------------------------------------
2155
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2156
?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_PartialAttributeList_SEQOF'/3, [], []).
2161
%%================================
2162
%% SearchResultReference
2163
%%================================
2165
'enc_SearchResultReference'({'SearchResultReference',Val}, TagIn) ->
2166
'enc_SearchResultReference'(Val, TagIn);
2168
'enc_SearchResultReference'(Val, TagIn) ->
2169
{EncBytes,EncLen} = 'enc_SearchResultReference_components'(Val,[],0),
2170
?RT_BER:encode_tags(TagIn ++ [{tag,64,19,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
2172
'enc_SearchResultReference_components'([], AccBytes, AccLen) ->
2173
{lists:reverse(AccBytes),AccLen};
2175
'enc_SearchResultReference_components'([H|T],AccBytes, AccLen) ->
2176
{EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, []),
2177
'enc_SearchResultReference_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
2181
'dec_SearchResultReference'(Bytes, OptOrMand) ->
2182
'dec_SearchResultReference'(Bytes, OptOrMand, []).
2184
'dec_SearchResultReference'(Bytes, OptOrMand, TagIn) ->
2185
%%-------------------------------------------------
2186
%% decode tag and length
2187
%%-------------------------------------------------
2188
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,19,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2189
?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
2190
?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)
2196
%%================================
2198
%%================================
2200
'enc_SearchResultDone'({'SearchResultDone',Val}, TagIn) ->
2201
'enc_SearchResultDone'(Val, TagIn);
2203
'enc_SearchResultDone'(Val, TagIn) ->
2204
'enc_LDAPResult'(Val, TagIn ++ [{tag,64,5,'IMPLICIT',32}]).
2207
'dec_SearchResultDone'(Bytes, OptOrMand) ->
2208
'dec_SearchResultDone'(Bytes, OptOrMand, []).
2210
'dec_SearchResultDone'(Bytes, OptOrMand, TagIn) ->
2211
'dec_LDAPResult'(Bytes, OptOrMand, TagIn++[{tag,64,5,'IMPLICIT',32}]).
2215
%%================================
2217
%%================================
2218
'enc_ModifyRequest'(Val, TagIn) ->
2220
%%-------------------------------------------------
2221
%% attribute number 1 with type OCTET STRING
2222
%%-------------------------------------------------
2223
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,object), []),
2225
%%-------------------------------------------------
2226
%% attribute number 2 with type SEQUENCE OF
2227
%%-------------------------------------------------
2228
{EncBytes2,EncLen2} = 'enc_ModifyRequest_modification'(?RT_BER:cindex(3,Val,modification), []),
2230
BytesSoFar = [EncBytes1, EncBytes2],
2231
LenSoFar = EncLen1 + EncLen2,
2232
?RT_BER:encode_tags(TagIn ++ [{tag,64,6,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2236
%%================================
2237
%% ModifyRequest_modification
2238
%%================================
2240
'enc_ModifyRequest_modification'({'ModifyRequest_modification',Val}, TagIn) ->
2241
'enc_ModifyRequest_modification'(Val, TagIn);
2243
'enc_ModifyRequest_modification'(Val, TagIn) ->
2244
{EncBytes,EncLen} = 'enc_ModifyRequest_modification_components'(Val,[],0),
2245
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
2247
'enc_ModifyRequest_modification_components'([], AccBytes, AccLen) ->
2248
{lists:reverse(AccBytes),AccLen};
2250
'enc_ModifyRequest_modification_components'([H|T],AccBytes, AccLen) ->
2251
{EncBytes,EncLen} = 'enc_ModifyRequest_modification_SEQOF'(H, []),
2252
'enc_ModifyRequest_modification_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
2257
%%================================
2258
%% ModifyRequest_modification_SEQOF
2259
%%================================
2260
'enc_ModifyRequest_modification_SEQOF'(Val, TagIn) ->
2262
%%-------------------------------------------------
2263
%% attribute number 1 with type ENUMERATED
2264
%%-------------------------------------------------
2265
{EncBytes1,EncLen1} = case (case ?RT_BER:cindex(2,Val,operation) of {_,_}->element(2,?RT_BER:cindex(2,Val,operation));_->?RT_BER:cindex(2,Val,operation) end) of
2266
add -> ?RT_BER:encode_enumerated(0,[]);
2267
delete -> ?RT_BER:encode_enumerated(1,[]);
2268
replace -> ?RT_BER:encode_enumerated(2,[]);
2269
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
2272
%%-------------------------------------------------
2273
%% attribute number 2 External ELDAPv3:AttributeTypeAndValues
2274
%%-------------------------------------------------
2275
{EncBytes2,EncLen2} = 'enc_AttributeTypeAndValues'(?RT_BER:cindex(3,Val,modification), []),
2277
BytesSoFar = [EncBytes1, EncBytes2],
2278
LenSoFar = EncLen1 + EncLen2,
2279
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2280
'dec_ModifyRequest_modification_SEQOF'(Bytes, OptOrMand, TagIn) ->
2281
%%-------------------------------------------------
2282
%% decode tag and length
2283
%%-------------------------------------------------
2284
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2285
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2287
%%-------------------------------------------------
2288
%% attribute number 1 with type ENUMERATED
2289
%%-------------------------------------------------
2290
{Term1,Bytes3,Rb2} = ?RT_BER:decode_enumerated(Bytes2,[],[{add,0},{delete,1},{replace,2}],[], mandatory),
2292
%%-------------------------------------------------
2293
%% attribute number 2 External ELDAPv3:AttributeTypeAndValues
2294
%%-------------------------------------------------
2295
{Term2,Bytes4,Rb3} = 'dec_AttributeTypeAndValues'(Bytes3, mandatory, []),
2297
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2298
{{'ModifyRequest_modification_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2299
'dec_ModifyRequest_modification'(Bytes, OptOrMand, TagIn) ->
2300
%%-------------------------------------------------
2301
%% decode tag and length
2302
%%-------------------------------------------------
2303
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2304
?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_ModifyRequest_modification_SEQOF'/3, [], []).
2309
'dec_ModifyRequest'(Bytes, OptOrMand) ->
2310
'dec_ModifyRequest'(Bytes, OptOrMand, []).
2312
'dec_ModifyRequest'(Bytes, OptOrMand, TagIn) ->
2313
%%-------------------------------------------------
2314
%% decode tag and length
2315
%%-------------------------------------------------
2316
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,6,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2317
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2319
%%-------------------------------------------------
2320
%% attribute number 1 with type OCTET STRING
2321
%%-------------------------------------------------
2322
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2324
%%-------------------------------------------------
2325
%% attribute number 2 with type SEQUENCE OF
2326
%%-------------------------------------------------
2327
{Term2,Bytes4,Rb3} = 'dec_ModifyRequest_modification'(Bytes3, mandatory, []),
2329
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2330
{{'ModifyRequest', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2333
%%================================
2334
%% AttributeTypeAndValues
2335
%%================================
2336
'enc_AttributeTypeAndValues'(Val, TagIn) ->
2338
%%-------------------------------------------------
2339
%% attribute number 1 with type OCTET STRING
2340
%%-------------------------------------------------
2341
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,type), []),
2343
%%-------------------------------------------------
2344
%% attribute number 2 with type SET OF
2345
%%-------------------------------------------------
2346
{EncBytes2,EncLen2} = 'enc_AttributeTypeAndValues_vals'(?RT_BER:cindex(3,Val,vals), []),
2348
BytesSoFar = [EncBytes1, EncBytes2],
2349
LenSoFar = EncLen1 + EncLen2,
2350
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2354
%%================================
2355
%% AttributeTypeAndValues_vals
2356
%%================================
2358
'enc_AttributeTypeAndValues_vals'({'AttributeTypeAndValues_vals',Val}, TagIn) ->
2359
'enc_AttributeTypeAndValues_vals'(Val, TagIn);
2361
'enc_AttributeTypeAndValues_vals'(Val, TagIn) ->
2362
{EncBytes,EncLen} = 'enc_AttributeTypeAndValues_vals_components'(Val,[],0),
2363
?RT_BER:encode_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], EncBytes, EncLen).
2365
'enc_AttributeTypeAndValues_vals_components'([], AccBytes, AccLen) ->
2366
{lists:reverse(AccBytes),AccLen};
2368
'enc_AttributeTypeAndValues_vals_components'([H|T],AccBytes, AccLen) ->
2369
{EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, []),
2370
'enc_AttributeTypeAndValues_vals_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
2372
'dec_AttributeTypeAndValues_vals'(Bytes, OptOrMand, TagIn) ->
2373
%%-------------------------------------------------
2374
%% decode tag and length
2375
%%-------------------------------------------------
2376
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], Bytes, OptOrMand),
2377
?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
2378
?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)
2384
'dec_AttributeTypeAndValues'(Bytes, OptOrMand) ->
2385
'dec_AttributeTypeAndValues'(Bytes, OptOrMand, []).
2387
'dec_AttributeTypeAndValues'(Bytes, OptOrMand, TagIn) ->
2388
%%-------------------------------------------------
2389
%% decode tag and length
2390
%%-------------------------------------------------
2391
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2392
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2394
%%-------------------------------------------------
2395
%% attribute number 1 with type OCTET STRING
2396
%%-------------------------------------------------
2397
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2399
%%-------------------------------------------------
2400
%% attribute number 2 with type SET OF
2401
%%-------------------------------------------------
2402
{Term2,Bytes4,Rb3} = 'dec_AttributeTypeAndValues_vals'(Bytes3, mandatory, []),
2404
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2405
{{'AttributeTypeAndValues', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2408
%%================================
2410
%%================================
2412
'enc_ModifyResponse'({'ModifyResponse',Val}, TagIn) ->
2413
'enc_ModifyResponse'(Val, TagIn);
2415
'enc_ModifyResponse'(Val, TagIn) ->
2416
'enc_LDAPResult'(Val, TagIn ++ [{tag,64,7,'IMPLICIT',32}]).
2419
'dec_ModifyResponse'(Bytes, OptOrMand) ->
2420
'dec_ModifyResponse'(Bytes, OptOrMand, []).
2422
'dec_ModifyResponse'(Bytes, OptOrMand, TagIn) ->
2423
'dec_LDAPResult'(Bytes, OptOrMand, TagIn++[{tag,64,7,'IMPLICIT',32}]).
2427
%%================================
2429
%%================================
2430
'enc_AddRequest'(Val, TagIn) ->
2432
%%-------------------------------------------------
2433
%% attribute number 1 with type OCTET STRING
2434
%%-------------------------------------------------
2435
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,entry), []),
2437
%%-------------------------------------------------
2438
%% attribute number 2 External ELDAPv3:AttributeList
2439
%%-------------------------------------------------
2440
{EncBytes2,EncLen2} = 'enc_AttributeList'(?RT_BER:cindex(3,Val,attributes), []),
2442
BytesSoFar = [EncBytes1, EncBytes2],
2443
LenSoFar = EncLen1 + EncLen2,
2444
?RT_BER:encode_tags(TagIn ++ [{tag,64,8,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2447
'dec_AddRequest'(Bytes, OptOrMand) ->
2448
'dec_AddRequest'(Bytes, OptOrMand, []).
2450
'dec_AddRequest'(Bytes, OptOrMand, TagIn) ->
2451
%%-------------------------------------------------
2452
%% decode tag and length
2453
%%-------------------------------------------------
2454
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,8,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2455
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2457
%%-------------------------------------------------
2458
%% attribute number 1 with type OCTET STRING
2459
%%-------------------------------------------------
2460
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2462
%%-------------------------------------------------
2463
%% attribute number 2 External ELDAPv3:AttributeList
2464
%%-------------------------------------------------
2465
{Term2,Bytes4,Rb3} = 'dec_AttributeList'(Bytes3, mandatory, []),
2467
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2468
{{'AddRequest', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2471
%%================================
2473
%%================================
2475
'enc_AttributeList'({'AttributeList',Val}, TagIn) ->
2476
'enc_AttributeList'(Val, TagIn);
2478
'enc_AttributeList'(Val, TagIn) ->
2479
{EncBytes,EncLen} = 'enc_AttributeList_components'(Val,[],0),
2480
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).
2482
'enc_AttributeList_components'([], AccBytes, AccLen) ->
2483
{lists:reverse(AccBytes),AccLen};
2485
'enc_AttributeList_components'([H|T],AccBytes, AccLen) ->
2486
{EncBytes,EncLen} = 'enc_AttributeList_SEQOF'(H, []),
2487
'enc_AttributeList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
2492
%%================================
2493
%% AttributeList_SEQOF
2494
%%================================
2495
'enc_AttributeList_SEQOF'(Val, TagIn) ->
2497
%%-------------------------------------------------
2498
%% attribute number 1 with type OCTET STRING
2499
%%-------------------------------------------------
2500
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,type), []),
2502
%%-------------------------------------------------
2503
%% attribute number 2 with type SET OF
2504
%%-------------------------------------------------
2505
{EncBytes2,EncLen2} = 'enc_AttributeList_SEQOF_vals'(?RT_BER:cindex(3,Val,vals), []),
2507
BytesSoFar = [EncBytes1, EncBytes2],
2508
LenSoFar = EncLen1 + EncLen2,
2509
?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2513
%%================================
2514
%% AttributeList_SEQOF_vals
2515
%%================================
2517
'enc_AttributeList_SEQOF_vals'({'AttributeList_SEQOF_vals',Val}, TagIn) ->
2518
'enc_AttributeList_SEQOF_vals'(Val, TagIn);
2520
'enc_AttributeList_SEQOF_vals'(Val, TagIn) ->
2521
{EncBytes,EncLen} = 'enc_AttributeList_SEQOF_vals_components'(Val,[],0),
2522
?RT_BER:encode_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], EncBytes, EncLen).
2524
'enc_AttributeList_SEQOF_vals_components'([], AccBytes, AccLen) ->
2525
{lists:reverse(AccBytes),AccLen};
2527
'enc_AttributeList_SEQOF_vals_components'([H|T],AccBytes, AccLen) ->
2528
{EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, []),
2529
'enc_AttributeList_SEQOF_vals_components'(T,[EncBytes|AccBytes], AccLen + EncLen).
2531
'dec_AttributeList_SEQOF_vals'(Bytes, OptOrMand, TagIn) ->
2532
%%-------------------------------------------------
2533
%% decode tag and length
2534
%%-------------------------------------------------
2535
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,17,'IMPLICIT',32}], Bytes, OptOrMand),
2536
?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
2537
?RT_BER:decode_octet_string(FBytes,[],[], no_length, mandatory)
2541
'dec_AttributeList_SEQOF'(Bytes, OptOrMand, TagIn) ->
2542
%%-------------------------------------------------
2543
%% decode tag and length
2544
%%-------------------------------------------------
2545
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2546
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2548
%%-------------------------------------------------
2549
%% attribute number 1 with type OCTET STRING
2550
%%-------------------------------------------------
2551
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2553
%%-------------------------------------------------
2554
%% attribute number 2 with type SET OF
2555
%%-------------------------------------------------
2556
{Term2,Bytes4,Rb3} = 'dec_AttributeList_SEQOF_vals'(Bytes3, mandatory, []),
2558
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2559
{{'AttributeList_SEQOF', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2562
'dec_AttributeList'(Bytes, OptOrMand) ->
2563
'dec_AttributeList'(Bytes, OptOrMand, []).
2565
'dec_AttributeList'(Bytes, OptOrMand, TagIn) ->
2566
%%-------------------------------------------------
2567
%% decode tag and length
2568
%%-------------------------------------------------
2569
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2570
?RT_BER:decode_components(Rb1, Len, Bytes1, fun 'dec_AttributeList_SEQOF'/3, [], []).
2575
%%================================
2577
%%================================
2579
'enc_AddResponse'({'AddResponse',Val}, TagIn) ->
2580
'enc_AddResponse'(Val, TagIn);
2582
'enc_AddResponse'(Val, TagIn) ->
2583
'enc_LDAPResult'(Val, TagIn ++ [{tag,64,9,'IMPLICIT',32}]).
2586
'dec_AddResponse'(Bytes, OptOrMand) ->
2587
'dec_AddResponse'(Bytes, OptOrMand, []).
2589
'dec_AddResponse'(Bytes, OptOrMand, TagIn) ->
2590
'dec_LDAPResult'(Bytes, OptOrMand, TagIn++[{tag,64,9,'IMPLICIT',32}]).
2594
%%================================
2596
%%================================
2598
'enc_DelRequest'({'DelRequest',Val}, TagIn) ->
2599
'enc_DelRequest'(Val, TagIn);
2601
'enc_DelRequest'(Val, TagIn) ->
2602
?RT_BER:encode_octet_string([], Val, TagIn ++ [{tag,64,10,'IMPLICIT',32}]).
2605
'dec_DelRequest'(Bytes, OptOrMand) ->
2606
'dec_DelRequest'(Bytes, OptOrMand, []).
2608
'dec_DelRequest'(Bytes, OptOrMand, TagIn) ->
2609
?RT_BER:decode_octet_string(Bytes,[],TagIn++[{tag,64,10,'IMPLICIT',32}], no_length, OptOrMand).
2613
%%================================
2615
%%================================
2617
'enc_DelResponse'({'DelResponse',Val}, TagIn) ->
2618
'enc_DelResponse'(Val, TagIn);
2620
'enc_DelResponse'(Val, TagIn) ->
2621
'enc_LDAPResult'(Val, TagIn ++ [{tag,64,11,'IMPLICIT',32}]).
2624
'dec_DelResponse'(Bytes, OptOrMand) ->
2625
'dec_DelResponse'(Bytes, OptOrMand, []).
2627
'dec_DelResponse'(Bytes, OptOrMand, TagIn) ->
2628
'dec_LDAPResult'(Bytes, OptOrMand, TagIn++[{tag,64,11,'IMPLICIT',32}]).
2632
%%================================
2634
%%================================
2635
'enc_ModifyDNRequest'(Val, TagIn) ->
2637
%%-------------------------------------------------
2638
%% attribute number 1 with type OCTET STRING
2639
%%-------------------------------------------------
2640
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,entry), []),
2642
%%-------------------------------------------------
2643
%% attribute number 2 with type OCTET STRING
2644
%%-------------------------------------------------
2645
{EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,newrdn), []),
2647
%%-------------------------------------------------
2648
%% attribute number 3 with type BOOLEAN
2649
%%-------------------------------------------------
2650
{EncBytes3,EncLen3} = ?RT_BER:encode_boolean(?RT_BER:cindex(4,Val,deleteoldrdn), []),
2652
%%-------------------------------------------------
2653
%% attribute number 4 with type OCTET STRING OPTIONAL
2654
%%-------------------------------------------------
2655
{EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,newSuperior) of
2656
asn1_NOVALUE -> {<<>>,0};
2658
?RT_BER:encode_octet_string([], ?RT_BER:cindex(5,Val,newSuperior), [{tag,128,0,'IMPLICIT',32}])
2661
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
2662
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
2663
?RT_BER:encode_tags(TagIn ++ [{tag,64,12,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2666
'dec_ModifyDNRequest'(Bytes, OptOrMand) ->
2667
'dec_ModifyDNRequest'(Bytes, OptOrMand, []).
2669
'dec_ModifyDNRequest'(Bytes, OptOrMand, TagIn) ->
2670
%%-------------------------------------------------
2671
%% decode tag and length
2672
%%-------------------------------------------------
2673
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,12,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2674
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2676
%%-------------------------------------------------
2677
%% attribute number 1 with type OCTET STRING
2678
%%-------------------------------------------------
2679
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2681
%%-------------------------------------------------
2682
%% attribute number 2 with type OCTET STRING
2683
%%-------------------------------------------------
2684
{Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[], no_length, mandatory),
2686
%%-------------------------------------------------
2687
%% attribute number 3 with type BOOLEAN
2688
%%-------------------------------------------------
2689
{Term3,Bytes5,Rb4} = ?RT_BER:decode_boolean(Bytes4,[], mandatory),
2691
%%-------------------------------------------------
2692
%% attribute number 4 with type OCTET STRING OPTIONAL
2693
%%-------------------------------------------------
2694
{Term4,Bytes6,Rb5} = case Bytes5 of
2695
<<2:2,_:1,0:5,_/binary>> ->
2696
?RT_BER:decode_octet_string(Bytes5,[],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory);
2698
{ asn1_NOVALUE, Bytes5, 0 }
2701
{Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext),
2702
{{'ModifyDNRequest', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}.
2705
%%================================
2707
%%================================
2709
'enc_ModifyDNResponse'({'ModifyDNResponse',Val}, TagIn) ->
2710
'enc_ModifyDNResponse'(Val, TagIn);
2712
'enc_ModifyDNResponse'(Val, TagIn) ->
2713
'enc_LDAPResult'(Val, TagIn ++ [{tag,64,13,'IMPLICIT',32}]).
2716
'dec_ModifyDNResponse'(Bytes, OptOrMand) ->
2717
'dec_ModifyDNResponse'(Bytes, OptOrMand, []).
2719
'dec_ModifyDNResponse'(Bytes, OptOrMand, TagIn) ->
2720
'dec_LDAPResult'(Bytes, OptOrMand, TagIn++[{tag,64,13,'IMPLICIT',32}]).
2724
%%================================
2726
%%================================
2727
'enc_CompareRequest'(Val, TagIn) ->
2729
%%-------------------------------------------------
2730
%% attribute number 1 with type OCTET STRING
2731
%%-------------------------------------------------
2732
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,entry), []),
2734
%%-------------------------------------------------
2735
%% attribute number 2 External ELDAPv3:AttributeValueAssertion
2736
%%-------------------------------------------------
2737
{EncBytes2,EncLen2} = 'enc_AttributeValueAssertion'(?RT_BER:cindex(3,Val,ava), []),
2739
BytesSoFar = [EncBytes1, EncBytes2],
2740
LenSoFar = EncLen1 + EncLen2,
2741
?RT_BER:encode_tags(TagIn ++ [{tag,64,14,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2744
'dec_CompareRequest'(Bytes, OptOrMand) ->
2745
'dec_CompareRequest'(Bytes, OptOrMand, []).
2747
'dec_CompareRequest'(Bytes, OptOrMand, TagIn) ->
2748
%%-------------------------------------------------
2749
%% decode tag and length
2750
%%-------------------------------------------------
2751
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,14,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2752
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2754
%%-------------------------------------------------
2755
%% attribute number 1 with type OCTET STRING
2756
%%-------------------------------------------------
2757
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[], no_length, mandatory),
2759
%%-------------------------------------------------
2760
%% attribute number 2 External ELDAPv3:AttributeValueAssertion
2761
%%-------------------------------------------------
2762
{Term2,Bytes4,Rb3} = 'dec_AttributeValueAssertion'(Bytes3, mandatory, []),
2764
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2765
{{'CompareRequest', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2768
%%================================
2770
%%================================
2772
'enc_CompareResponse'({'CompareResponse',Val}, TagIn) ->
2773
'enc_CompareResponse'(Val, TagIn);
2775
'enc_CompareResponse'(Val, TagIn) ->
2776
'enc_LDAPResult'(Val, TagIn ++ [{tag,64,15,'IMPLICIT',32}]).
2779
'dec_CompareResponse'(Bytes, OptOrMand) ->
2780
'dec_CompareResponse'(Bytes, OptOrMand, []).
2782
'dec_CompareResponse'(Bytes, OptOrMand, TagIn) ->
2783
'dec_LDAPResult'(Bytes, OptOrMand, TagIn++[{tag,64,15,'IMPLICIT',32}]).
2787
%%================================
2789
%%================================
2791
'enc_AbandonRequest'({'AbandonRequest',Val}, TagIn) ->
2792
'enc_AbandonRequest'(Val, TagIn);
2794
'enc_AbandonRequest'(Val, TagIn) ->
2795
?RT_BER:encode_integer([], Val, TagIn ++ [{tag,64,16,'IMPLICIT',32}]).
2798
'dec_AbandonRequest'(Bytes, OptOrMand) ->
2799
'dec_AbandonRequest'(Bytes, OptOrMand, []).
2801
'dec_AbandonRequest'(Bytes, OptOrMand, TagIn) ->
2802
?RT_BER:decode_integer(Bytes,{0,2147483647},TagIn++[{tag,64,16,'IMPLICIT',32}], OptOrMand).
2806
%%================================
2808
%%================================
2809
'enc_ExtendedRequest'(Val, TagIn) ->
2811
%%-------------------------------------------------
2812
%% attribute number 1 with type OCTET STRING
2813
%%-------------------------------------------------
2814
{EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(2,Val,requestName), [{tag,128,0,'IMPLICIT',32}]),
2816
%%-------------------------------------------------
2817
%% attribute number 2 with type OCTET STRING OPTIONAL
2818
%%-------------------------------------------------
2819
{EncBytes2,EncLen2} = case ?RT_BER:cindex(3,Val,requestValue) of
2820
asn1_NOVALUE -> {<<>>,0};
2822
?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,requestValue), [{tag,128,1,'IMPLICIT',32}])
2825
BytesSoFar = [EncBytes1, EncBytes2],
2826
LenSoFar = EncLen1 + EncLen2,
2827
?RT_BER:encode_tags(TagIn ++ [{tag,64,23,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2830
'dec_ExtendedRequest'(Bytes, OptOrMand) ->
2831
'dec_ExtendedRequest'(Bytes, OptOrMand, []).
2833
'dec_ExtendedRequest'(Bytes, OptOrMand, TagIn) ->
2834
%%-------------------------------------------------
2835
%% decode tag and length
2836
%%-------------------------------------------------
2837
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,23,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2838
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2840
%%-------------------------------------------------
2841
%% attribute number 1 with type OCTET STRING
2842
%%-------------------------------------------------
2843
{Term1,Bytes3,Rb2} = ?RT_BER:decode_octet_string(Bytes2,[],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory),
2845
%%-------------------------------------------------
2846
%% attribute number 2 with type OCTET STRING OPTIONAL
2847
%%-------------------------------------------------
2848
{Term2,Bytes4,Rb3} = case Bytes3 of
2849
<<2:2,_:1,1:5,_/binary>> ->
2850
?RT_BER:decode_octet_string(Bytes3,[],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory);
2852
{ asn1_NOVALUE, Bytes3, 0 }
2855
{Bytes5,Rb4} = ?RT_BER:restbytes2(RemBytes, Bytes4,noext),
2856
{{'ExtendedRequest', Term1, Term2}, Bytes5, Rb1+Rb2+Rb3+Rb4}.
2859
%%================================
2861
%%================================
2862
'enc_ExtendedResponse'(Val, TagIn) ->
2864
%%-------------------------------------------------
2865
%% attribute number 1 with type ENUMERATED
2866
%%-------------------------------------------------
2867
{EncBytes1,EncLen1} = case (case ?RT_BER:cindex(2,Val,resultCode) of {_,_}->element(2,?RT_BER:cindex(2,Val,resultCode));_->?RT_BER:cindex(2,Val,resultCode) end) of
2868
success -> ?RT_BER:encode_enumerated(0,[]);
2869
operationsError -> ?RT_BER:encode_enumerated(1,[]);
2870
protocolError -> ?RT_BER:encode_enumerated(2,[]);
2871
timeLimitExceeded -> ?RT_BER:encode_enumerated(3,[]);
2872
sizeLimitExceeded -> ?RT_BER:encode_enumerated(4,[]);
2873
compareFalse -> ?RT_BER:encode_enumerated(5,[]);
2874
compareTrue -> ?RT_BER:encode_enumerated(6,[]);
2875
authMethodNotSupported -> ?RT_BER:encode_enumerated(7,[]);
2876
strongAuthRequired -> ?RT_BER:encode_enumerated(8,[]);
2877
referral -> ?RT_BER:encode_enumerated(10,[]);
2878
adminLimitExceeded -> ?RT_BER:encode_enumerated(11,[]);
2879
unavailableCriticalExtension -> ?RT_BER:encode_enumerated(12,[]);
2880
confidentialityRequired -> ?RT_BER:encode_enumerated(13,[]);
2881
saslBindInProgress -> ?RT_BER:encode_enumerated(14,[]);
2882
noSuchAttribute -> ?RT_BER:encode_enumerated(16,[]);
2883
undefinedAttributeType -> ?RT_BER:encode_enumerated(17,[]);
2884
inappropriateMatching -> ?RT_BER:encode_enumerated(18,[]);
2885
constraintViolation -> ?RT_BER:encode_enumerated(19,[]);
2886
attributeOrValueExists -> ?RT_BER:encode_enumerated(20,[]);
2887
invalidAttributeSyntax -> ?RT_BER:encode_enumerated(21,[]);
2888
noSuchObject -> ?RT_BER:encode_enumerated(32,[]);
2889
aliasProblem -> ?RT_BER:encode_enumerated(33,[]);
2890
invalidDNSyntax -> ?RT_BER:encode_enumerated(34,[]);
2891
aliasDereferencingProblem -> ?RT_BER:encode_enumerated(36,[]);
2892
inappropriateAuthentication -> ?RT_BER:encode_enumerated(48,[]);
2893
invalidCredentials -> ?RT_BER:encode_enumerated(49,[]);
2894
insufficientAccessRights -> ?RT_BER:encode_enumerated(50,[]);
2895
busy -> ?RT_BER:encode_enumerated(51,[]);
2896
unavailable -> ?RT_BER:encode_enumerated(52,[]);
2897
unwillingToPerform -> ?RT_BER:encode_enumerated(53,[]);
2898
loopDetect -> ?RT_BER:encode_enumerated(54,[]);
2899
namingViolation -> ?RT_BER:encode_enumerated(64,[]);
2900
objectClassViolation -> ?RT_BER:encode_enumerated(65,[]);
2901
notAllowedOnNonLeaf -> ?RT_BER:encode_enumerated(66,[]);
2902
notAllowedOnRDN -> ?RT_BER:encode_enumerated(67,[]);
2903
entryAlreadyExists -> ?RT_BER:encode_enumerated(68,[]);
2904
objectClassModsProhibited -> ?RT_BER:encode_enumerated(69,[]);
2905
affectsMultipleDSAs -> ?RT_BER:encode_enumerated(71,[]);
2906
other -> ?RT_BER:encode_enumerated(80,[]);
2907
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
2910
%%-------------------------------------------------
2911
%% attribute number 2 with type OCTET STRING
2912
%%-------------------------------------------------
2913
{EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(3,Val,matchedDN), []),
2915
%%-------------------------------------------------
2916
%% attribute number 3 with type OCTET STRING
2917
%%-------------------------------------------------
2918
{EncBytes3,EncLen3} = ?RT_BER:encode_octet_string([], ?RT_BER:cindex(4,Val,errorMessage), []),
2920
%%-------------------------------------------------
2921
%% attribute number 4 External ELDAPv3:Referral OPTIONAL
2922
%%-------------------------------------------------
2923
{EncBytes4,EncLen4} = case ?RT_BER:cindex(5,Val,referral) of
2924
asn1_NOVALUE -> {<<>>,0};
2926
'enc_Referral'(?RT_BER:cindex(5,Val,referral), [{tag,128,3,'IMPLICIT',32}])
2929
%%-------------------------------------------------
2930
%% attribute number 5 with type OCTET STRING OPTIONAL
2931
%%-------------------------------------------------
2932
{EncBytes5,EncLen5} = case ?RT_BER:cindex(6,Val,responseName) of
2933
asn1_NOVALUE -> {<<>>,0};
2935
?RT_BER:encode_octet_string([], ?RT_BER:cindex(6,Val,responseName), [{tag,128,10,'IMPLICIT',32}])
2938
%%-------------------------------------------------
2939
%% attribute number 6 with type OCTET STRING OPTIONAL
2940
%%-------------------------------------------------
2941
{EncBytes6,EncLen6} = case ?RT_BER:cindex(7,Val,response) of
2942
asn1_NOVALUE -> {<<>>,0};
2944
?RT_BER:encode_octet_string([], ?RT_BER:cindex(7,Val,response), [{tag,128,11,'IMPLICIT',32}])
2947
BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6],
2948
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6,
2949
?RT_BER:encode_tags(TagIn ++ [{tag,64,24,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).
2952
'dec_ExtendedResponse'(Bytes, OptOrMand) ->
2953
'dec_ExtendedResponse'(Bytes, OptOrMand, []).
2955
'dec_ExtendedResponse'(Bytes, OptOrMand, TagIn) ->
2956
%%-------------------------------------------------
2957
%% decode tag and length
2958
%%-------------------------------------------------
2959
{{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,64,24,'IMPLICIT',32},{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand),
2960
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),
2962
%%-------------------------------------------------
2963
%% attribute number 1 with type ENUMERATED
2964
%%-------------------------------------------------
2965
{Term1,Bytes3,Rb2} = ?RT_BER:decode_enumerated(Bytes2,[],[{success,0},{operationsError,1},{protocolError,2},{timeLimitExceeded,3},{sizeLimitExceeded,4},{compareFalse,5},{compareTrue,6},{authMethodNotSupported,7},{strongAuthRequired,8},{referral,10},{adminLimitExceeded,11},{unavailableCriticalExtension,12},{confidentialityRequired,13},{saslBindInProgress,14},{noSuchAttribute,16},{undefinedAttributeType,17},{inappropriateMatching,18},{constraintViolation,19},{attributeOrValueExists,20},{invalidAttributeSyntax,21},{noSuchObject,32},{aliasProblem,33},{invalidDNSyntax,34},{aliasDereferencingProblem,36},{inappropriateAuthentication,48},{invalidCredentials,49},{insufficientAccessRights,50},{busy,51},{unavailable,52},{unwillingToPerform,53},{loopDetect,54},{namingViolation,64},{objectClassViolation,65},{notAllowedOnNonLeaf,66},{notAllowedOnRDN,67},{entryAlreadyExists,68},{objectClassModsProhibited,69},{affectsMultipleDSAs,71},{other,80}],[], mandatory),
2967
%%-------------------------------------------------
2968
%% attribute number 2 with type OCTET STRING
2969
%%-------------------------------------------------
2970
{Term2,Bytes4,Rb3} = ?RT_BER:decode_octet_string(Bytes3,[],[], no_length, mandatory),
2972
%%-------------------------------------------------
2973
%% attribute number 3 with type OCTET STRING
2974
%%-------------------------------------------------
2975
{Term3,Bytes5,Rb4} = ?RT_BER:decode_octet_string(Bytes4,[],[], no_length, mandatory),
2977
%%-------------------------------------------------
2978
%% attribute number 4 External ELDAPv3:Referral OPTIONAL
2979
%%-------------------------------------------------
2980
{Term4,Bytes6,Rb5} = case Bytes5 of
2981
<<2:2,_:1,3:5,_/binary>> ->
2982
'dec_Referral'(Bytes5, opt_or_default, [{tag,128,3,'IMPLICIT',32}]);
2984
{ asn1_NOVALUE, Bytes5, 0 }
2987
%%-------------------------------------------------
2988
%% attribute number 5 with type OCTET STRING OPTIONAL
2989
%%-------------------------------------------------
2990
{Term5,Bytes7,Rb6} = case Bytes6 of
2991
<<2:2,_:1,10:5,_/binary>> ->
2992
?RT_BER:decode_octet_string(Bytes6,[],[{tag,128,10,'IMPLICIT',32}], no_length, mandatory);
2994
{ asn1_NOVALUE, Bytes6, 0 }
2997
%%-------------------------------------------------
2998
%% attribute number 6 with type OCTET STRING OPTIONAL
2999
%%-------------------------------------------------
3000
{Term6,Bytes8,Rb7} = case Bytes7 of
3001
<<2:2,_:1,11:5,_/binary>> ->
3002
?RT_BER:decode_octet_string(Bytes7,[],[{tag,128,11,'IMPLICIT',32}], no_length, mandatory);
3004
{ asn1_NOVALUE, Bytes7, 0 }
3007
{Bytes9,Rb8} = ?RT_BER:restbytes2(RemBytes, Bytes8,noext),
3008
{{'ExtendedResponse', Term1, Term2, Term3, Term4, Term5, Term6}, Bytes9, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8}.